crossfile_context_retrievalwref
dict
prompt
stringlengths
676
22k
right_context
stringlengths
0
29.4k
metadata
dict
crossfile_context_retrieval
dict
groundtruth
stringlengths
6
470
{ "list": [ { "filename": "src/apiDebug.ts", "retrieved_chunk": " response: Response;\n};\nexport const apiDebug = ({\n init,\n options,\n durationTime,\n getBody,\n response,\n}: ApiDebug) => {\n if (process.env.DEBUG !== 'true') {", "score": 16.352674382866905 }, { "filena...
import { RequestInfo, RequestInit, Response } from 'node-fetch'; import { cloneResponse } from './cloneResponse'; import { timeSpan } from './timeSpan'; import { apiDebug }from './apiDebug'; import { apiReport } from './apiReport'; import { getRequestMock, saveRequestMock } from './apiCache'; const fetch = (url: URL ...
init, options, getBody, response, json, text, }); const { responseCopy } = await cloneResponse(response, text); return responseCopy; }); };
{ "context_start_lineno": 0, "file": "src/apiWithLog.ts", "groundtruth_start_lineno": 70, "repository": "entria-apiWithLog-be8c368", "right_context_start_lineno": 71, "task_id": "project_cc_typescript/17" }
{ "list": [ { "filename": "src/apiDebug.ts", "retrieved_chunk": " return;\n }\n // eslint-disable-next-line\n const { agent, headers, ...optionsWithoutAgent } = options;\n const cleanHeaders = Object.keys(headers || {}).reduce((acc, key) => {\n if (!headers || ignoredHeaders.includes(key)) {...
await apiReport({
{ "list": [ { "filename": "src/apiCache.ts", "retrieved_chunk": " try {\n json = JSON.parse(text);\n } catch (err) {}\n if (json) {\n return {\n json,\n };\n }\n return {\n text,", "score": 10.078164173943478 }...
import { RequestInfo, RequestInit, Response } from 'node-fetch'; import { cloneResponse } from './cloneResponse'; import { timeSpan } from './timeSpan'; import { apiDebug }from './apiDebug'; import { apiReport } from './apiReport'; import { getRequestMock, saveRequestMock } from './apiCache'; const fetch = (url: URL ...
apiDebug({ init, options, durationTime, getBody, response, }); await apiReport({ init, options, getBody, response, json, text, }); const { responseCopy } = await cloneResponse(response, text); return responseCopy; }); };
{ "context_start_lineno": 0, "file": "src/apiWithLog.ts", "groundtruth_start_lineno": 60, "repository": "entria-apiWithLog-be8c368", "right_context_start_lineno": 61, "task_id": "project_cc_typescript/25" }
{ "list": [ { "filename": "src/apiReport.ts", "retrieved_chunk": "export const apiReport = async ({\n init,\n options,\n getBody,\n response,\n json,\n text,\n}: ApiReport) => {\n const canReport =\n typeof options?.shouldReport === 'boolean' ? options.shouldReport : true;", "score": 1...
await saveRequestMock(init, options, text, response);
{ "list": [ { "filename": "src/apiCache.ts", "retrieved_chunk": "export const saveRequestMock = async (\n init: RequestInfo,\n options: RequestInit,\n text: string,\n response: Response,\n) => {\n if (process.env.WRITE_MOCK !== 'true') {\n return;\n }\n // only save ok requests 200", "...
import { RequestInfo, RequestInit, Response } from 'node-fetch'; import { cloneResponse } from './cloneResponse'; import { timeSpan } from './timeSpan'; import { apiDebug }from './apiDebug'; import { apiReport } from './apiReport'; import { getRequestMock, saveRequestMock } from './apiCache'; const fetch = (url: URL ...
apiDebug({ init, options, durationTime, getBody, response, }); await apiReport({ init, options, getBody, response, json, text, }); const { responseCopy } = await cloneResponse(response, text); return responseCopy; }); };
{ "context_start_lineno": 0, "file": "src/apiWithLog.ts", "groundtruth_start_lineno": 60, "repository": "entria-apiWithLog-be8c368", "right_context_start_lineno": 61, "task_id": "project_cc_typescript/16" }
{ "list": [ { "filename": "src/apiCache.ts", "retrieved_chunk": " };\n };\n // eslint-disable-next-line\n debugConsole({\n init,\n options: optionsWithoutAgent,\n ...getBody(),\n ok: response.ok,\n status: response.status,\n curl,", ...
saveRequestMock(init, options, text, response);
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e...
import { HTTP_METHODS } from './constants' import * as subject from './api' import * as z from 'zod' import { HTTPMethod } from './types' import { kebabToCamel } from './transforms' const reqMock = vi.fn() function successfulFetch(response: string | Record<string, unknown>) { return async (input: URL | RequestInfo, ...
expect( typeof service[method.toLocaleLowerCase() as Lowercase<HTTPMethod>], ).toBe('function') } }) it('should return an API with enhancedFetch', async () => { vi.spyOn(global, 'fetch').mockImplementationOnce( successfulFetch({ foo: 'bar' }), ) const service = subject.ma...
{ "context_start_lineno": 0, "file": "src/api.test.ts", "groundtruth_start_lineno": 329, "repository": "gustavoguichard-make-service-e5a7bea", "right_context_start_lineno": 330, "task_id": "project_cc_typescript/114" }
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": ") {\n const fetcher = makeFetcher(baseURL, baseHeaders)\n function appliedService(method: HTTPMethod) {\n return async <T extends string>(\n path: T,\n requestInit: ServiceRequestInit<T> = {},\n ) => fetcher(path, { ...reque...
for (const method of HTTP_METHODS) {
{ "list": [ { "filename": "src/utils/prepare-code.ts", "retrieved_chunk": "import { ImportGroups } from '../types'\nexport const prepareCode = (importGroups: ImportGroups) => {\n let result = ''\n for (const importData of importGroups.libraries) {\n result += `${importData.raw}\\n`\n }\n result...
import config from '../config' import { ImportData, ImportGroups, LibraryRule } from '../types' const getImportDepth = (path: string) => { return path.split('/').length } const asc = (a, b) => { const depthA = getImportDepth(a.path) const depthB = getImportDepth(b.path) if (depthA !== depthB) { return de...
return { libraries: sortLibraries(inputGroups.libraries), aliases: sortAliases(inputGroups.aliases), relatives: sortRelatives(inputGroups.relatives), directRelatives: sortRelatives(inputGroups.directRelatives), } }
{ "context_start_lineno": 0, "file": "src/utils/sort-import-groups.ts", "groundtruth_start_lineno": 120, "repository": "crmapache-prettier-plugin-sort-react-imports-a237c21", "right_context_start_lineno": 121, "task_id": "project_cc_typescript/32" }
{ "list": [ { "filename": "src/utils/split-imports-to-groups.ts", "retrieved_chunk": " }\n }\n return {\n libraries,\n aliases,\n relatives,\n directRelatives,\n }\n}", "score": 22.0318146366964 }, { "filename": "src/utils/prepare-code.ts", "retrieved_chunk"...
export const sortImportGroups = (inputGroups: ImportGroups) => {
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": "}\n/**\n *\n * @param url a string or URL to be fetched\n * @param requestInit the requestInit to be passed to the fetch request. It is the same as the `RequestInit` type, but it also accepts a JSON-like `body` and an object-like `query` para...
import { typeOf } from './internals' import { JSONValue, PathParams, SearchParams } from './types' /** * @param url a string or URL to which the query parameters will be added * @param searchParams the query parameters * @returns the url with the query parameters added with the same type as the url */ function add...
// TODO: use the URL Pattern API as soon as it has better browser support if (!params) return url as T let urlString = String(url) Object.entries(params).forEach(([key, value]) => { urlString = urlString.replace(new RegExp(`:${key}($|\/)`), `${value}$1`) }) return (url instanceof URL ? new URL(urlStri...
{ "context_start_lineno": 0, "file": "src/primitives.ts", "groundtruth_start_lineno": 94, "repository": "gustavoguichard-make-service-e5a7bea", "right_context_start_lineno": 96, "task_id": "project_cc_typescript/123" }
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": " * const users = await response.json(userSchema);\n * // ^? User[]\n * const untyped = await response.json();\n * // ^? unknown\n */\nasync function enhancedFetch<T extends string | URL>(\n url: T,\n requestInit?: EnhancedRequestInit<...
params: PathParams<T>, ): T {
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e...
import { HTTP_METHODS } from './constants' import * as subject from './api' import * as z from 'zod' import { HTTPMethod } from './types' import { kebabToCamel } from './transforms' const reqMock = vi.fn() function successfulFetch(response: string | Record<string, unknown>) { return async (input: URL | RequestInfo, ...
}) it('should return an API with enhancedFetch', async () => { vi.spyOn(global, 'fetch').mockImplementationOnce( successfulFetch({ foo: 'bar' }), ) const service = subject.makeService('https://example.com/api') const result = await service .post('/users') .then((r) => r.json(z.ob...
{ "context_start_lineno": 0, "file": "src/api.test.ts", "groundtruth_start_lineno": 331, "repository": "gustavoguichard-make-service-e5a7bea", "right_context_start_lineno": 334, "task_id": "project_cc_typescript/115" }
{ "list": [ { "filename": "src/api.ts", "retrieved_chunk": " ReturnType<typeof appliedService>\n >\n for (const method of HTTP_METHODS) {\n const lowerMethod = method.toLowerCase() as Lowercase<HTTPMethod>\n service[lowerMethod] = appliedService(method)\n }\n return service\n}\nexport { e...
as Lowercase<HTTPMethod>], ).toBe('function') }
{ "list": [ { "filename": "src/utils/prepare-code.ts", "retrieved_chunk": " result += '\\n'\n for (const importData of importGroups.relatives) {\n result += `${importData.raw}\\n`\n }\n if (importGroups.directRelatives.length > 0) {\n result += '\\n'\n for (const importData of importGroup...
import config from '../config' import { ImportData, ImportGroups, LibraryRule } from '../types' const getImportDepth = (path: string) => { return path.split('/').length } const asc = (a, b) => { const depthA = getImportDepth(a.path) const depthB = getImportDepth(b.path) if (depthA !== depthB) { return de...
const importElementsString = searchResult[0].replace(/[{}\s]/gm, '') const importElements = importElementsString .split(',') .filter((importElement) => importElement) importElements.sort(function (a, b) { if (a.length === b.length) { return a.localeCompare(b) ...
{ "context_start_lineno": 0, "file": "src/utils/sort-import-groups.ts", "groundtruth_start_lineno": 91, "repository": "crmapache-prettier-plugin-sort-react-imports-a237c21", "right_context_start_lineno": 94, "task_id": "project_cc_typescript/40" }
{ "list": [ { "filename": "src/utils/prepare-code.ts", "retrieved_chunk": " result += '\\n'\n for (const importData of importGroups.relatives) {\n result += `${importData.raw}\\n`\n }\n if (importGroups.directRelatives.length > 0) {\n result += '\\n'\n for (const importData of importGroup...
= importData.raw.match(/\{[\s\S]+?}/gm) if (searchResult) {
{ "list": [ { "filename": "src/webgpu/helpers.ts", "retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n...
import { Vec2, Vec3, vec2 } from 'wgpu-matrix'; import { Camera } from './camera'; import { createBuffer } from './helpers'; import { WebGPUBindGroup } from './webgpubindgroup'; import { WebGPUBindGroupLayout } from './webgpubindgrouplayout'; import { WebGPURenderContext } from './webgpucontext'; import { WebGPUPipelin...
const bindGroupLayout = new WebGPUBindGroupLayout(); bindGroupLayout.create({ device: this.context.device, entries: [ { binding: 0, visibility: GPUShaderStage.FRAGMENT, buffer: { type: 'uniform', }, }, ], }); this.u...
{ "context_start_lineno": 0, "file": "src/webgpu/webgpurenderer.ts", "groundtruth_start_lineno": 129, "repository": "hsimpson-webgpu-fractals-41455fe", "right_context_start_lineno": 134, "task_id": "project_cc_typescript/79" }
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke...
uniformParamsBuffer = createBuffer( this.getUniformParamsArray(), GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, this.context.device, );
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " this.cameraPosition[2] = this.cameraPosition[2] + event.deltaY * 0.01;\n };\n private onMouseMove = (event: MouseEvent) => {\n // const currentPos: Vec2 = [event.clientX, event.clientY];\n // if (event.buttons === 1) {\n...
import { Vec2, Vec3, vec2 } from 'wgpu-matrix'; import { Camera } from './camera'; import { createBuffer } from './helpers'; import { WebGPUBindGroup } from './webgpubindgroup'; import { WebGPUBindGroupLayout } from './webgpubindgrouplayout'; import { WebGPURenderContext } from './webgpucontext'; import { WebGPUPipelin...
passEncoder.setBindGroup(0, this.uniformParamsGroup.bindGroup); passEncoder.draw(3, 1, 0, 0); // only 1 triangle passEncoder.end(); this.context.queue.submit([commandEncoder.finish()]); } // private computePass(deltaTime: number) { // const commandEncoder = this.context.device.createCommandEn...
{ "context_start_lineno": 0, "file": "src/webgpu/webgpurenderer.ts", "groundtruth_start_lineno": 237, "repository": "hsimpson-webgpu-fractals-41455fe", "right_context_start_lineno": 238, "task_id": "project_cc_typescript/94" }
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke...
passEncoder.setPipeline(this.renderPipeline.pipeline);
{ "list": [ { "filename": "src/webgpu/webgpurenderpipeline.ts", "retrieved_chunk": "export class WebGPURenderPipeline {\n private renderPipeline: GPURenderPipeline;\n public get pipeline() {\n return this.renderPipeline;\n }\n public async create(options: WebGPURenderPipelineOptions) {\n thi...
import { Vec2, Vec3, vec2 } from 'wgpu-matrix'; import { Camera } from './camera'; import { createBuffer } from './helpers'; import { WebGPUBindGroup } from './webgpubindgroup'; import { WebGPUBindGroupLayout } from './webgpubindgrouplayout'; import { WebGPURenderContext } from './webgpucontext'; import { WebGPUPipelin...
passEncoder.draw(3, 1, 0, 0); // only 1 triangle passEncoder.end(); this.context.queue.submit([commandEncoder.finish()]); } // private computePass(deltaTime: number) { // const commandEncoder = this.context.device.createCommandEncoder(); // const passEncoder = commandEncoder.beginComputePass(...
{ "context_start_lineno": 0, "file": "src/webgpu/webgpurenderer.ts", "groundtruth_start_lineno": 238, "repository": "hsimpson-webgpu-fractals-41455fe", "right_context_start_lineno": 239, "task_id": "project_cc_typescript/95" }
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke...
passEncoder.setBindGroup(0, this.uniformParamsGroup.bindGroup);
{ "list": [ { "filename": "src/webgpu/helpers.ts", "retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n...
import { Vec2, Vec3, vec2 } from 'wgpu-matrix'; import { Camera } from './camera'; import { createBuffer } from './helpers'; import { WebGPUBindGroup } from './webgpubindgroup'; import { WebGPUBindGroupLayout } from './webgpubindgrouplayout'; import { WebGPURenderContext } from './webgpucontext'; import { WebGPUPipelin...
bindGroupLayout.create({ device: this.context.device, entries: [ { binding: 0, visibility: GPUShaderStage.FRAGMENT, buffer: { type: 'uniform', }, }, ], }); this.uniformParamsGroup = new WebGPUBindGroup(); this.unifor...
{ "context_start_lineno": 0, "file": "src/webgpu/webgpurenderer.ts", "groundtruth_start_lineno": 135, "repository": "hsimpson-webgpu-fractals-41455fe", "right_context_start_lineno": 136, "task_id": "project_cc_typescript/80" }
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke...
const bindGroupLayout = new WebGPUBindGroupLayout();
{ "list": [ { "filename": "src/webgpu/helpers.ts", "retrieved_chunk": "export function supportsWebGPU(): boolean {\n if (navigator.gpu) {\n return true;\n }\n return false;\n}\nexport function createBuffer(array: ArrayBuffer, usage: GPUBufferUsageFlags, device: GPUDevice): GPUBuffer {\n try {\n...
import { Vec2, Vec3, vec2 } from 'wgpu-matrix'; import { Camera } from './camera'; import { createBuffer } from './helpers'; import { WebGPUBindGroup } from './webgpubindgroup'; import { WebGPUBindGroupLayout } from './webgpubindgrouplayout'; import { WebGPURenderContext } from './webgpucontext'; import { WebGPUPipelin...
const bindGroupLayout = new WebGPUBindGroupLayout(); bindGroupLayout.create({ device: this.context.device, entries: [ { binding: 0, visibility: GPUShaderStage.FRAGMENT, buffer: { type: 'uniform', }, }, ], }); this.u...
{ "context_start_lineno": 0, "file": "src/webgpu/webgpurenderer.ts", "groundtruth_start_lineno": 129, "repository": "hsimpson-webgpu-fractals-41455fe", "right_context_start_lineno": 134, "task_id": "project_cc_typescript/88" }
{ "list": [ { "filename": "src/webgpu/camera.ts", "retrieved_chunk": " // this.currentMousePosition = currentPos;\n };\n private onKeyDown = (event: KeyboardEvent) => {\n const movementSpeed = 0.25;\n let x = this.cameraPosition[0];\n let y = this.cameraPosition[1];\n switch (event.ke...
.uniformParamsBuffer = createBuffer( this.getUniformParamsArray(), GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, this.context.device, );
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s...
import { AchoClient } from '.'; import { ClientOptions } from './types'; import { App } from './app'; import { SERVER_ADDRESS, SOCKET_NAMESPACE } from './constants'; import { Socket, Manager } from 'socket.io-client'; import { joinAppBuilderRoom, leaveAppBuilderRoom } from './utils/sockets/appRoom'; export class AppVe...
return 'left'; } public async disconnect() { if (!this.socket) { throw new Error('AppVersion not initialized'); } this.socket.disconnect(); return 'closed'; } }
{ "context_start_lineno": 0, "file": "src/version.ts", "groundtruth_start_lineno": 76, "repository": "acho-dev-acho-js-7eafc31", "right_context_start_lineno": 77, "task_id": "project_cc_typescript/4" }
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s...
leaveAppBuilderRoom(this.socket, { app_version_id: this.verId, is_editing: true });
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "import { SOCKET_EVENT_NAME } from '../../constants/socket';\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_ve...
import { AchoClient } from '.'; import { ClientOptions } from './types'; import { App } from './app'; import { SERVER_ADDRESS, SOCKET_NAMESPACE } from './constants'; import { Socket, Manager } from 'socket.io-client'; import { joinAppBuilderRoom, leaveAppBuilderRoom } from './utils/sockets/appRoom'; export class AppVe...
return 'joined'; } public async leave() { if (!this.socket) { throw new Error('AppVersion not initialized'); } await leaveAppBuilderRoom(this.socket, { app_version_id: this.verId, is_editing: true }); return 'left'; } public async disconnect() { if (!this.socket) { throw new...
{ "context_start_lineno": 0, "file": "src/version.ts", "groundtruth_start_lineno": 69, "repository": "acho-dev-acho-js-7eafc31", "right_context_start_lineno": 70, "task_id": "project_cc_typescript/3" }
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s...
joinAppBuilderRoom(this.socket, { app_version_id: this.verId, is_editing: true });
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "import { SOCKET_EVENT_NAME } from '../../constants/socket';\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_ve...
import { AchoClient } from '.'; import { ClientOptions } from './types'; import { App } from './app'; import { SERVER_ADDRESS, SOCKET_NAMESPACE } from './constants'; import { Socket, Manager } from 'socket.io-client'; import { joinAppBuilderRoom, leaveAppBuilderRoom } from './utils/sockets/appRoom'; export class AppVe...
await new Promise((resolve, reject) => { socket .on('connect_error', (err) => { console.log('connect_error', err); reject(err); }) .on('connect_timeout', (err) => { console.log('connect_timeout', err); reject(err); }) .on('reconn...
{ "context_start_lineno": 0, "file": "src/version.ts", "groundtruth_start_lineno": 38, "repository": "acho-dev-acho-js-7eafc31", "right_context_start_lineno": 39, "task_id": "project_cc_typescript/2" }
{ "list": [ { "filename": "src/resource.ts", "retrieved_chunk": " readableObjectMode: true,\n transform(chunk: Buffer, encoding: string, callback: TransformCallback) {\n try {\n // console.log('fragment', fragment);\n // console.log('chunk', chunk.toString());\n ...
socket(SOCKET_NAMESPACE);
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s...
import { AchoClient } from '.'; import { ClientOptions } from './types'; import { App } from './app'; import { SERVER_ADDRESS, SOCKET_NAMESPACE } from './constants'; import { Socket, Manager } from 'socket.io-client'; import { joinAppBuilderRoom, leaveAppBuilderRoom } from './utils/sockets/appRoom'; export class AppVe...
return 'left'; } public async disconnect() { if (!this.socket) { throw new Error('AppVersion not initialized'); } this.socket.disconnect(); return 'closed'; } }
{ "context_start_lineno": 0, "file": "src/version.ts", "groundtruth_start_lineno": 76, "repository": "acho-dev-acho-js-7eafc31", "right_context_start_lineno": 77, "task_id": "project_cc_typescript/9" }
{ "list": [ { "filename": "src/utils/sockets/appRoom.ts", "retrieved_chunk": "}\n/**\n *\n * @param {*} socket - The socket instance\n * @param {Object} params - the params for the socket event\n * @param {String} params.app_version_id - app_version_id\n */\nexport async function leaveAppBuilderRoom(s...
await leaveAppBuilderRoom(this.socket, { app_version_id: this.verId, is_editing: true });
{ "list": [ { "filename": "src/bot.ts", "retrieved_chunk": " });\n });\n CLIENT.on('interactionCreate', async (interaction) => {\n if (!interaction.isChatInputCommand()) return;\n for (const command of COMMANDS) {\n if (interaction.commandName === command.command....
import { SlashCommandBuilder } from 'discord.js'; import { judge } from '../judge'; import { locale } from '../locales'; import { Command } from '../types/Command'; import { SpecialWeapon, SubWeapon, WeaponType } from '../types/Weapon'; export const JudgeCommand: Command = { command: new SlashCommandBuilder() ...
const special = interaction.options.get(locale('text-command-judge-name-3'))?.value as SpecialWeapon | undefined; const weapon = judge( type ? [type] : [], sub ? [sub] : [], special ? [s...
{ "context_start_lineno": 0, "file": "src/commands/JudgeCommand.ts", "groundtruth_start_lineno": 219, "repository": "rarula-WeaponJudgeKun-4fd6fe9", "right_context_start_lineno": 220, "task_id": "project_cc_typescript/74" }
{ "list": [ { "filename": "src/bot.ts", "retrieved_chunk": " CLIENT.login(BOT_TOKEN);\n}\nasync function registerCommands(): Promise<void> {\n const commands = COMMANDS.map((command) => {\n return command.command;\n });\n const rest = new REST({ version: '10' }).setToken(BOT_TOKEN);...
'text-command-judge-name-2'))?.value as SubWeapon | undefined;
{ "list": [ { "filename": "src/bot.ts", "retrieved_chunk": " });\n });\n CLIENT.on('interactionCreate', async (interaction) => {\n if (!interaction.isChatInputCommand()) return;\n for (const command of COMMANDS) {\n if (interaction.commandName === command.command....
import { SlashCommandBuilder } from 'discord.js'; import { judge } from '../judge'; import { locale } from '../locales'; import { Command } from '../types/Command'; import { SpecialWeapon, SubWeapon, WeaponType } from '../types/Weapon'; export const JudgeCommand: Command = { command: new SlashCommandBuilder() ...
const sub = interaction.options.get(locale('text-command-judge-name-2'))?.value as SubWeapon | undefined; const special = interaction.options.get(locale('text-command-judge-name-3'))?.value as SpecialWeapon | undefined; const weapon = judge( type ? [type] ...
{ "context_start_lineno": 0, "file": "src/commands/JudgeCommand.ts", "groundtruth_start_lineno": 218, "repository": "rarula-WeaponJudgeKun-4fd6fe9", "right_context_start_lineno": 219, "task_id": "project_cc_typescript/73" }
{ "list": [ { "filename": "src/bot.ts", "retrieved_chunk": " CLIENT.login(BOT_TOKEN);\n}\nasync function registerCommands(): Promise<void> {\n const commands = COMMANDS.map((command) => {\n return command.command;\n });\n const rest = new REST({ version: '10' }).setToken(BOT_TOKEN);...
type = interaction.options.get(locale('text-command-judge-name-1'))?.value as WeaponType | undefined;
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " try {\n // Проверка токена JWT\n payload = this.jwtService.verify(confirmAuthDto.token);\n } catch (error) {\n if (error instanceof TokenExpiredError) {\n throw new ...
import { Injectable, ConflictException, NotFoundException, BadRequestException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { Users, UsersDocument } from './models'; import { CreateUsersDto, UpdateUsersDto, DeleteUsersDto, IdUsersDto } from './dto'; ...
try { await this.usersModel.findByIdAndDelete(deleteUsersDto.id).orFail(); return { status: 'Deleted' }; } catch (error) { if (error.name === 'DocumentNotFoundError') { throw new NotFoundException('User not found'); } throw new...
{ "context_start_lineno": 0, "file": "src/users/users.service.ts", "groundtruth_start_lineno": 47, "repository": "Rewive-CRM.back-end-425b594", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/108" }
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " // Поиск пользователя по идентификатору из токена\n const user = await this.AuthModel.findById(payload.id);\n if (!user) {\n throw new NotFoundException('User not found');\n }\n // ...
remove(deleteUsersDto: DeleteUsersDto): Promise<{ status: string }> {
{ "list": [ { "filename": "src/bot.ts", "retrieved_chunk": " });\n });\n CLIENT.on('interactionCreate', async (interaction) => {\n if (!interaction.isChatInputCommand()) return;\n for (const command of COMMANDS) {\n if (interaction.commandName === command.command....
import { SlashCommandBuilder } from 'discord.js'; import { judge } from '../judge'; import { locale } from '../locales'; import { Command } from '../types/Command'; import { SpecialWeapon, SubWeapon, WeaponType } from '../types/Weapon'; export const JudgeCommand: Command = { command: new SlashCommandBuilder() ...
const sub = interaction.options.get(locale('text-command-judge-name-2'))?.value as SubWeapon | undefined; const special = interaction.options.get(locale('text-command-judge-name-3'))?.value as SpecialWeapon | undefined; const weapon = judge( type ? [type] ...
{ "context_start_lineno": 0, "file": "src/commands/JudgeCommand.ts", "groundtruth_start_lineno": 218, "repository": "rarula-WeaponJudgeKun-4fd6fe9", "right_context_start_lineno": 219, "task_id": "project_cc_typescript/64" }
{ "list": [ { "filename": "src/types/Weapon.ts", "retrieved_chunk": " | 'triple-inkstrike'\n | 'trizooka'\n | 'ultra-stamp'\n | 'wave-breaker'\n | 'zipcaster';", "score": 19.573049293215355 }, { "filename": "src/bot.ts", "retrieved_chunk": " CLIENT.login(BOT...
const type = interaction.options.get(locale('text-command-judge-name-1'))?.value as WeaponType | undefined;
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " try {\n // Проверка токена JWT\n payload = this.jwtService.verify(confirmAuthDto.token);\n } catch (error) {\n if (error instanceof TokenExpiredError) {\n throw new ...
import { Injectable, ConflictException, NotFoundException, BadRequestException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { Users, UsersDocument } from './models'; import { CreateUsersDto, UpdateUsersDto, DeleteUsersDto, IdUsersDto } from './dto'; ...
try { await this.usersModel.findByIdAndDelete(deleteUsersDto.id).orFail(); return { status: 'Deleted' }; } catch (error) { if (error.name === 'DocumentNotFoundError') { throw new NotFoundException('User not found'); } throw new...
{ "context_start_lineno": 0, "file": "src/users/users.service.ts", "groundtruth_start_lineno": 47, "repository": "Rewive-CRM.back-end-425b594", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/102" }
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " // Поиск пользователя по идентификатору из токена\n const user = await this.AuthModel.findById(payload.id);\n if (!user) {\n throw new NotFoundException('User not found');\n }\n // ...
: DeleteUsersDto): Promise<{ status: string }> {
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " // Поиск пользователя по идентификатору из токена\n const user = await this.AuthModel.findById(payload.id);\n if (!user) {\n throw new NotFoundException('User not found');\n }\n // ...
import { Injectable, ConflictException, NotFoundException, BadRequestException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { Users, UsersDocument } from './models'; import { CreateUsersDto, UpdateUsersDto, DeleteUsersDto, IdUsersDto } from './dto'; ...
try { await this.usersModel.findByIdAndDelete(deleteUsersDto.id).orFail(); return { status: 'Deleted' }; } catch (error) { if (error.name === 'DocumentNotFoundError') { throw new NotFoundException('User not found'); } throw new...
{ "context_start_lineno": 0, "file": "src/users/users.service.ts", "groundtruth_start_lineno": 47, "repository": "Rewive-CRM.back-end-425b594", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/101" }
{ "list": [ { "filename": "src/auth/auth.service.ts", "retrieved_chunk": " // Поиск пользователя по идентификатору из токена\n const user = await this.AuthModel.findById(payload.id);\n if (!user) {\n throw new NotFoundException('User not found');\n }\n // ...
async remove(deleteUsersDto: DeleteUsersDto): Promise<{ status: string }> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
return await this._databaseExecutor.executeQueryRequest(async (request: Request) => { // Remove square bracket notation if any, and split into schema and name. const schemaAndName = storedProcedureName.replace(/\[|\]/g, '').split('.'); const result = await request.query<StoredProcedureSchema>( ...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 46, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/152" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
logger: ILogger, ): Promise<IResult<StoredProcedureSchema>> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
return await this._databaseExecutor.executeQueryRequest(async (request: Request) => { // Remove square bracket notation if any, and split into schema and name. const schemaAndName = storedProcedureName.replace(/\[|\]/g, '').split('.'); const result = await request.query<StoredProcedureSchema>( ...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 47, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/154" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " ): Promise<IResolverProcedureResult<T>> {\n let startTime = performance.now();\n let schema = (await this._storedProcedureCacheManager.tryGetFromCache(storedProcedureName)) as\n | IResult...
): Promise<IResult<StoredProcedureSchema>> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import type { Request } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { DevConsoleLogger, logExecutionBegin, logExecutionEnd, logSafely } from '../logging'; import { DatabaseExecutor } from '../executor'; import { ConnectionManager } from '../utils'; import { StoredProcedureManager, Store...
const startTime = performance.now(); const logger = this._queryLogger; logExecutionBegin(logger, `Stored Procedure Query ${storedProcedureName} with inputs`, input); const result = await this._databaseExecutor.executeQueryRequest( async (request: Request): Promise<IResolverProcedureResult<T>> =...
{ "context_start_lineno": 0, "file": "src/lib/datasource/mssql-datasource.ts", "groundtruth_start_lineno": 81, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 84, "task_id": "project_cc_typescript/139" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
: InputParameters, info?: GraphQLResolveInfo, ): Promise<IResolverProcedureResult<T>> {
{ "list": [ { "filename": "src/lib/utils/connection-manager.ts", "retrieved_chunk": " }\n return ConnectionManager._globalMutationPool;\n }\n private createConnectionPool(config: MSSQLConfig): ConnectionPool {\n return isConfigString(config) ? new ConnectionPool(config) : new ConnectionPool...
import type { Request } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { DevConsoleLogger, logExecutionBegin, logExecutionEnd, logSafely } from '../logging'; import { DatabaseExecutor } from '../executor'; import { ConnectionManager } from '../utils'; import { StoredProcedureManager, Store...
} }
{ "context_start_lineno": 0, "file": "src/lib/datasource/mssql-datasource.ts", "groundtruth_start_lineno": 150, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 152, "task_id": "project_cc_typescript/142" }
{ "list": [ { "filename": "src/lib/types/i-mssql-options.ts", "retrieved_chunk": "import type { MSSQLConfig, ILogger } from '.';\n/**\n * The options for configuring the MSSQLDataSource.\n * @property {MSSQLConfig} config - The configuration for the MSSQL connection\n * @property {Logger} [logger] - O...
: new DevConsoleLogger(), };
{ "list": [ { "filename": "src/lib/logging/logging-utils.ts", "retrieved_chunk": " // Cyan\n `\\u001b[${ansiCode}Starting execution of ${fnName}: ${JSON.stringify(\n fnInput,\n replacer,\n 0,\n )}\\u001b[0m`,\n );\n};\n/**\n * Logs the end of a function execution including ela...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
} const preparedRequest = this.addParametersToRequest(parameters, request); return preparedRequest; } /** * Maps the keys of an object based on the provided mapping. * @template T - The type of the original object. * @param {T} obj - The object whose keys need to be mapped. * @param {Rec...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 205, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 208, "task_id": "project_cc_typescript/146" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " storedProcedureName,\n input,\n request,\n logger,\n info,\n ),\n logger,\n );\n logExecutionEnd(logger, `Stored Procedure Mutation ${storedProcedureN...
.map((param) => JSON.stringify(param, replacer, 0)) .join(', ')}.`, );
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
: { resultSetFields: {}, outputFields: {} }; const resultSets = result.recordsets.map((recordset: IRecordSet<Record<string, unknown>>) => { return recordset.map((record: Record<string, unknown>) => this.mapKeysWithMapping(record, resultSetFields), ); }); const output = this.ma...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 249, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 251, "task_id": "project_cc_typescript/149" }
{ "list": [ { "filename": "src/lib/types/i-resolver-procedure-result.ts", "retrieved_chunk": "/**\n * Represents a GraphQL resolver stored procedure result.\n * The format of the result is: a single resultSet property, followed by\n * any additional output properties that were returned by the stored p...
: getFieldNamesExcludingNode(info, 'resultSets'), }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " * @template T - This type parameter represents the type of the value returned by the resolver procedure.\n * @param {string} storedProcedureName - The name of the stored procedure to execute.\n * @param {Sto...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
const { resultSetFields, outputFields } = info !== undefined ? { resultSetFields: getNodeSelectionSetNames(info, 'resultSets'), outputFields: getFieldNamesExcludingNode(info, 'resultSets'), } : { resultSetFields: {}, outputFields: {} }; const resultSets ...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 244, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 245, "task_id": "project_cc_typescript/147" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " storedProcedureName: string,\n input: InputParameters,\n info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._mutatio...
: IResolverProcedureResult<T> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "retrieved_chunk": " const parameterSchemaMap: Map<string, StoredProcedureParameter> =\n schemaResult.recordsets[0].reduce(\n (parameterMap: Map<string, StoredProcedureParameter>, item: StoredProc...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
type, length, precision, scale, }) as DriverType, value: undefined, ...rest, }); } // Populate our input values into the request parameters. const inputParameters = input as Record<string, unknown>; for (const inputParameterKey in i...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 125, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 126, "task_id": "project_cc_typescript/145" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "retrieved_chunk": " throw new Error(\n `Could not parse stored procedure definition for stored procedure ${storedProcedureName}.`,\n );\n }\n const commentStrippedStoredProcedureDefinitio...
type: mapDbTypeToDriverType({
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " * @template T - This type parameter represents the type of the value returned by the resolver procedure.\n * @param {string} storedProcedureName - The name of the stored procedure to execute.\n * @param {Sto...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
const parameterSchemaMap: Map<string, StoredProcedureParameter> = schemaResult.recordsets[0].reduce( (parameterMap: Map<string, StoredProcedureParameter>, item: StoredProcedureParameter) => { parameterMap.set(item.name, item); return parameterMap; }, new Map<string...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 89, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 91, "task_id": "project_cc_typescript/156" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
schemaResult: IResult<StoredProcedureSchema>, ): IterableIterator<StoredProcedureParameter> {
{ "list": [ { "filename": "src/lib/types/i-resolver-procedure-result.ts", "retrieved_chunk": "/**\n * Represents a GraphQL resolver stored procedure result.\n * The format of the result is: a single resultSet property, followed by\n * any additional output properties that were returned by the stored p...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
: { resultSetFields: {}, outputFields: {} }; const resultSets = result.recordsets.map((recordset: IRecordSet<Record<string, unknown>>) => { return recordset.map((record: Record<string, unknown>) => this.mapKeysWithMapping(record, resultSetFields), ); }); const output = this.ma...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 248, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 251, "task_id": "project_cc_typescript/148" }
{ "list": [ { "filename": "src/lib/types/i-resolver-procedure-result.ts", "retrieved_chunk": "/**\n * Represents a GraphQL resolver stored procedure result.\n * The format of the result is: a single resultSet property, followed by\n * any additional output properties that were returned by the stored p...
resultSetFields: getNodeSelectionSetNames(info, 'resultSets'), outputFields: getFieldNamesExcludingNode(info, 'resultSets'), }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import type { Request } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { DevConsoleLogger, logExecutionBegin, logExecutionEnd, logSafely } from '../logging'; import { DatabaseExecutor } from '../executor'; import { ConnectionManager } from '../utils'; import { StoredProcedureManager, Store...
const startTime = performance.now(); const logger = this._queryLogger; logExecutionBegin(logger, `Stored Procedure Query ${storedProcedureName} with inputs`, input); const result = await this._databaseExecutor.executeQueryRequest( async (request: Request): Promise<IResolverProcedureResult<T>> =...
{ "context_start_lineno": 0, "file": "src/lib/datasource/mssql-datasource.ts", "groundtruth_start_lineno": 81, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 84, "task_id": "project_cc_typescript/138" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
InputParameters, info?: GraphQLResolveInfo, ): Promise<IResolverProcedureResult<T>> {
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " * @template T - This type parameter represents the type of the value returned by the resolver procedure.\n * @param {string} storedProcedureName - The name of the stored procedure to execute.\n * @param {Sto...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
const parameterSchemaMap: Map<string, StoredProcedureParameter> = schemaResult.recordsets[0].reduce( (parameterMap: Map<string, StoredProcedureParameter>, item: StoredProcedureParameter) => { parameterMap.set(item.name, item); return parameterMap; }, new Map<string...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 90, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 91, "task_id": "project_cc_typescript/157" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
): IterableIterator<StoredProcedureParameter> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
return await this._databaseExecutor.executeQueryRequest(async (request: Request) => { // Remove square bracket notation if any, and split into schema and name. const schemaAndName = storedProcedureName.replace(/\[|\]/g, '').split('.'); const result = await request.query<StoredProcedureSchema>( ...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 46, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/153" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
: ILogger, ): Promise<IResult<StoredProcedureSchema>> {
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " * @template T - This type parameter represents the type of the value returned by the resolver procedure.\n * @param {string} storedProcedureName - The name of the stored procedure to execute.\n * @param {Sto...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
const parameterSchemaMap: Map<string, StoredProcedureParameter> = schemaResult.recordsets[0].reduce( (parameterMap: Map<string, StoredProcedureParameter>, item: StoredProcedureParameter) => { parameterMap.set(item.name, item); return parameterMap; }, new Map<string...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 90, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 91, "task_id": "project_cc_typescript/158" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
IterableIterator<StoredProcedureParameter> {
{ "list": [ { "filename": "src/lib/types/i-stored-procedure-parameter.ts", "retrieved_chunk": " */\nexport interface StoredProcedureParameter {\n name: string;\n type: string;\n mode: ParameterMode;\n defaultValue?: unknown;\n length?: number;\n precision?: number;\n scale?: number;\n}", ...
import { type ISqlTypeFactory, type ISqlTypeFactoryWithLength, type ISqlTypeFactoryWithNoParams, type ISqlTypeFactoryWithPrecisionScale, type ISqlTypeFactoryWithScale, type ISqlTypeFactoryWithTvpType, type ISqlTypeWithLength, type ISqlTypeWithNoParams, type ISqlTypeWithPrecisionScale, type ISqlTypeW...
const types: IndexableTypes = TYPES; const property = findPropertyCaseInsensitive(types, type); if (property !== null) { const typeFactory = types[property as TypesKey]; if (isSqlTypeFactoryWithNoParams(typeFactory)) { return typeFactory(); } else if (isSqlTypeFactoryWithLength(typeFactory)) { ...
{ "context_start_lineno": 0, "file": "src/lib/utils/type-map.ts", "groundtruth_start_lineno": 90, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 91, "task_id": "project_cc_typescript/162" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " scale,\n }) as DriverType,\n value: undefined,\n ...rest,\n });\n }\n // Populate our input values into the request parameters.\n const inputParameters = i...
: Pick<StoredProcedureParameter, 'type' | 'length' | 'precision' | 'scale'>): ISqlTypeFactory => {
{ "list": [ { "filename": "src/lib/utils/type-map.ts", "retrieved_chunk": " return key;\n }\n }\n return null;\n};\nexport const mapDbTypeToDriverType = ({\n type,\n length,\n precision,\n scale,", "score": 28.17205688642332 }, { "filename": "src/lib/stored-procedure/...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
type, length, precision, scale, }) as DriverType, value: undefined, ...rest, }); } // Populate our input values into the request parameters. const inputParameters = input as Record<string, unknown>; for (const inputParameterKey in i...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 125, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 126, "task_id": "project_cc_typescript/173" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "retrieved_chunk": " throw new Error(\n `Could not parse stored procedure definition for stored procedure ${storedProcedureName}.`,\n );\n }\n const commentStrippedStoredProcedureDefinitio...
: mapDbTypeToDriverType({
{ "list": [ { "filename": "src/parser/1-source-to-cst/index.ts", "retrieved_chunk": " name: ConcreteTextNode;\n} & ConcreteBasicNode<ConcreteNodeTypes.AttributeEmpty>;\nexport type CST = ConcreteNode[];\nexport type TemplateMapping = {\n type: ConcreteNodeTypes;\n locStart: (node: Node[]) => number...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
for (let i = 0; i < cst.length; i += 1) { const node = cst[i]; const prevNode = cst[i - 1]; // Add whitespaces and linebreaks that went missing after parsing. We don't need to do this // if the node is an attribute since whitespaces between attributes is not important to preserve. // In fact it...
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 119, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 120, "task_id": "project_cc_typescript/55" }
{ "list": [ { "filename": "src/parser/1-source-to-cst/index.ts", "retrieved_chunk": "export type TopLevelFunctionMapping = (...nodes: Node[]) => any;\nexport type Mapping = {\n [k: string]: number | TemplateMapping | TopLevelFunctionMapping;\n};\nfunction locStart(nodes: Node[]) {\n return nodes[0]....
astBuilder = new ASTBuilder(cst[0].source);
{ "list": [ { "filename": "src/parser/errors.ts", "retrieved_chunk": "}\nexport class CSTParsingError extends LoggableError {\n constructor(matchResult: ohm.MatchResult) {\n super({ result: matchResult.message ?? '' });\n this.name = 'CSTParsingError';\n }\n}\nexport class UnknownConcreteNodeT...
import { Node } from 'ohm-js'; import { toAST } from 'ohm-js/extras'; import { CSTParsingError } from '../errors'; import grammar from '../grammar'; export enum ConcreteNodeTypes { TextNode = 'TextNode', LiquidDropNode = 'LiquidDropNode', ElementOpeningTag = 'ElementOpeningTag', ElementClosingTag = 'ElementC...
} const textNode = { type: ConcreteNodeTypes.TextNode, locStart, locEnd, value: function (this: Node) { return this.sourceString; }, source, }; const mapping: Mapping = { Node: 0, TextNode: textNode, liquidDropNode: { type: ConcreteNodeTypes.LiquidDropNode, ...
{ "context_start_lineno": 0, "file": "src/parser/1-source-to-cst/index.ts", "groundtruth_start_lineno": 108, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 109, "task_id": "project_cc_typescript/53" }
{ "list": [ { "filename": "src/parser/2-cst-to-ast/index.ts", "retrieved_chunk": " }\n return astBuilder.finish();\n}\nexport default function sourceToAST(source: string): LiquidXNode[] {\n const cst = sourceToCST(source);\n const ast = cstToAST(cst);\n return ast;\n}", "score": 26.54677398...
throw new CSTParsingError(matchResult);
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " case NodeTypes.ElementNode: {\n output += renderElement(node, { withSource, isChildOfElementNode });\n break;\n }\n case NodeTypes.AttributeDoubleQuoted:\n case NodeTypes.AttributeSingleQuoted:\n ...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
break; } case ConcreteNodeTypes.ElementSelfClosingTag: { astBuilder.open(toElementNode(node)); astBuilder.close(node, NodeTypes.ElementNode); break; } case ConcreteNodeTypes.AttributeDoubleQuoted: case ConcreteNodeTypes.AttributeSingleQuoted: case...
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 164, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 165, "task_id": "project_cc_typescript/58" }
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " value = JSON.stringify(renderText(node.value));\n } else {\n value = renderLiquidDrop(node.value);\n }\n output += `${name}: ${value}`;\n break;\n }\n case NodeTypes.Attribut...
astBuilder.close(node, NodeTypes.ElementNode);
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " storedProcedureName: string,\n input: InputParameters,\n info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._mutatio...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
} else { logSafely( logger, 'info', // Green `\x1b[32mCache hit occurred while retrieving the cached schema for ${storedProcedureName}\x1b[0m`, ); } logPerformance(logger, 'getStoredProcedureParameterSchema', startTime); startTime = performance.now(); co...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 69, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 70, "task_id": "project_cc_typescript/172" }
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " storedProcedureName,\n input,\n request,\n logger,\n info,\n ),\n logger,\n );\n logExecutionEnd(logger, `Stored Procedure Mutation ${storedProcedureN...
this._storedProcedureCacheManager.addToCache(storedProcedureName, schema);
{ "list": [ { "filename": "src/parser/1-source-to-cst/index.ts", "retrieved_chunk": " name: ConcreteTextNode;\n} & ConcreteBasicNode<ConcreteNodeTypes.AttributeEmpty>;\nexport type CST = ConcreteNode[];\nexport type TemplateMapping = {\n type: ConcreteNodeTypes;\n locStart: (node: Node[]) => number...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
for (let i = 0; i < cst.length; i += 1) { const node = cst[i]; const prevNode = cst[i - 1]; // Add whitespaces and linebreaks that went missing after parsing. We don't need to do this // if the node is an attribute since whitespaces between attributes is not important to preserve. // In fact it...
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 119, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 120, "task_id": "project_cc_typescript/50" }
{ "list": [ { "filename": "src/parser/1-source-to-cst/index.ts", "retrieved_chunk": "export type TopLevelFunctionMapping = (...nodes: Node[]) => any;\nexport type Mapping = {\n [k: string]: number | TemplateMapping | TopLevelFunctionMapping;\n};\nfunction locStart(nodes: Node[]) {\n return nodes[0]....
ASTBuilder(cst[0].source);
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " private addParametersToRequest(\n parameters: Map<string, PreparedStoredProcedureParameter>,\n request: Request,\n ): Request {\n const preparedRequest = request;\n for (const parameter...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
} } return parameterSchemaMap.values(); } }
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 138, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 139, "task_id": "project_cc_typescript/159" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " const modeEnum = mode;\n if (modeEnum === ParameterMode.IN) {\n preparedRequest.input(name, type, value);\n } else if (modeEnum === ParameterMode.INOUT) {\n preparedReque...
defaultValue = convertSqlValueToJsValue(defaultValue, type);
{ "list": [ { "filename": "src/parser/2-cst-to-ast/index.ts", "retrieved_chunk": " }\n return astBuilder.finish();\n}\nexport default function sourceToAST(source: string): LiquidXNode[] {\n const cst = sourceToCST(source);\n const ast = cstToAST(cst);\n return ast;\n}", "score": 26.54677398...
import { Node } from 'ohm-js'; import { toAST } from 'ohm-js/extras'; import { CSTParsingError } from '../errors'; import grammar from '../grammar'; export enum ConcreteNodeTypes { TextNode = 'TextNode', LiquidDropNode = 'LiquidDropNode', ElementOpeningTag = 'ElementOpeningTag', ElementClosingTag = 'ElementC...
if (matchResult.failed()) { throw new CSTParsingError(matchResult); } const textNode = { type: ConcreteNodeTypes.TextNode, locStart, locEnd, value: function (this: Node) { return this.sourceString; }, source, }; const mapping: Mapping = { Node: 0, TextNode: textN...
{ "context_start_lineno": 0, "file": "src/parser/1-source-to-cst/index.ts", "groundtruth_start_lineno": 105, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 106, "task_id": "project_cc_typescript/46" }
{ "list": [ { "filename": "src/parser/2-cst-to-ast/index.ts", "retrieved_chunk": " }\n return astBuilder.finish();\n}\nexport default function sourceToAST(source: string): LiquidXNode[] {\n const cst = sourceToCST(source);\n const ast = cstToAST(cst);\n return ast;\n}", "score": 26.62814765...
matchResult = grammar.match(source);
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " case NodeTypes.ElementNode: {\n output += renderElement(node, { withSource, isChildOfElementNode });\n break;\n }\n case NodeTypes.AttributeDoubleQuoted:\n case NodeTypes.AttributeSingleQuoted:\n ...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
break; } case ConcreteNodeTypes.ElementClosingTag: { astBuilder.close(node, NodeTypes.ElementNode); break; } case ConcreteNodeTypes.ElementSelfClosingTag: { astBuilder.open(toElementNode(node)); astBuilder.close(node, NodeTypes.ElementNode); ...
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 158, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 159, "task_id": "project_cc_typescript/57" }
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " value = JSON.stringify(renderText(node.value));\n } else {\n value = renderLiquidDrop(node.value);\n }\n output += `${name}: ${value}`;\n break;\n }\n case NodeTypes.Attribut...
open(toElementNode(node));
{ "list": [ { "filename": "src/parser/errors.ts", "retrieved_chunk": "}\nexport class CSTParsingError extends LoggableError {\n constructor(matchResult: ohm.MatchResult) {\n super({ result: matchResult.message ?? '' });\n this.name = 'CSTParsingError';\n }\n}\nexport class UnknownConcreteNodeT...
import { Node } from 'ohm-js'; import { toAST } from 'ohm-js/extras'; import { CSTParsingError } from '../errors'; import grammar from '../grammar'; export enum ConcreteNodeTypes { TextNode = 'TextNode', LiquidDropNode = 'LiquidDropNode', ElementOpeningTag = 'ElementOpeningTag', ElementClosingTag = 'ElementC...
} const textNode = { type: ConcreteNodeTypes.TextNode, locStart, locEnd, value: function (this: Node) { return this.sourceString; }, source, }; const mapping: Mapping = { Node: 0, TextNode: textNode, liquidDropNode: { type: ConcreteNodeTypes.LiquidDropNode, ...
{ "context_start_lineno": 0, "file": "src/parser/1-source-to-cst/index.ts", "groundtruth_start_lineno": 108, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 109, "task_id": "project_cc_typescript/47" }
{ "list": [ { "filename": "src/parser/2-cst-to-ast/index.ts", "retrieved_chunk": " }\n return astBuilder.finish();\n}\nexport default function sourceToAST(source: string): LiquidXNode[] {\n const cst = sourceToCST(source);\n const ast = cstToAST(cst);\n return ast;\n}", "score": 26.54677398...
new CSTParsingError(matchResult);
{ "list": [ { "filename": "src/parser/2-cst-to-ast/ast-builder.ts", "retrieved_chunk": " }\n close(\n node: ConcreteElementClosingTagNode | ConcreteElementSelfClosingTagNode,\n nodeType: NodeTypes.ElementNode,\n ) {\n if (!this.parent || this.parent.name !== node.name || this.parent.type !...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
} export default function sourceToAST(source: string): LiquidXNode[] { const cst = sourceToCST(source); const ast = cstToAST(cst); return ast; }
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 221, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 222, "task_id": "project_cc_typescript/59" }
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " return output;\n}\nexport default function render(source: string, { withSource = false } = {}) {\n const ast = sourceToAST(source);\n const ouput = renderAST(ast, { withSource });\n return ouput;\n}", "score": 18.6886795...
return astBuilder.finish();
{ "list": [ { "filename": "src/lib/types/stored-procedure-schema.ts", "retrieved_chunk": "import type { StoredProcedureParameter } from '.';\n/**\n * Represents the result of a stored procedure execution.\n */\nexport type StoredProcedureSchema = [\n StoredProcedureParameter,\n {\n storedProcedur...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
return parameterMap; }, new Map<string, StoredProcedureParameter>(), ); const storedProcedureDefinition = schemaResult.recordsets[1][0].storedProcedureDefinition; if (storedProcedureDefinition == null) { throw new Error( `Could not parse stored procedure definitio...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 94, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 95, "task_id": "project_cc_typescript/179" }
{ "list": [ { "filename": "src/lib/types/stored-procedure-schema.ts", "retrieved_chunk": "import type { StoredProcedureParameter } from '.';\n/**\n * Represents the result of a stored procedure execution.\n */\nexport type StoredProcedureSchema = [\n StoredProcedureParameter,\n {\n storedProcedur...
parameterMap.set(item.name, item);
{ "list": [ { "filename": "src/parser/2-cst-to-ast/__tests__/element-node.test.ts", "retrieved_chunk": " expectOutput(input).toHaveProperty('0.children.0.children.0.type', NodeTypes.TextNode);\n});\nit('should throw an error if corresponding closing tag is missing', () => {\n const input = '<Box>';\...
import sourceToCST, { ConcreteAttributeNode, ConcreteElementOpeningTagNode, ConcreteElementSelfClosingTagNode, ConcreteLiquidDropNode, ConcreteNode, ConcreteNodeTypes, ConcreteTextNode, } from '../1-source-to-cst'; import { UnknownConcreteNodeTypeError } from '../errors'; import ASTBuilder from './ast-bui...
type: ConcreteNodeTypes.TextNode, locStart: prevNode.locEnd, locEnd: node.locStart, source: node.source, value: prevNode.source.slice(prevNode.locEnd, node.locStart), }), ); } } switch (node.type) { case ConcreteNodeType...
{ "context_start_lineno": 0, "file": "src/parser/2-cst-to-ast/index.ts", "groundtruth_start_lineno": 133, "repository": "unshopable-liquidx-a101873", "right_context_start_lineno": 135, "task_id": "project_cc_typescript/56" }
{ "list": [ { "filename": "src/renderer/index.ts", "retrieved_chunk": " case NodeTypes.ElementNode: {\n output += renderElement(node, { withSource, isChildOfElementNode });\n break;\n }\n case NodeTypes.AttributeDoubleQuoted:\n case NodeTypes.AttributeSingleQuoted:\n ...
push( toTextNode({
{ "list": [ { "filename": "src/lib/datasource/mssql-datasource.ts", "retrieved_chunk": " info?: GraphQLResolveInfo,\n ): Promise<IResolverProcedureResult<T>> {\n const startTime = performance.now();\n const logger = this._queryLogger;\n logExecutionBegin(logger, `Stored Procedure Query ${...
import { camelCase } from 'lodash'; import { type Request, type IProcedureResult, type IResult, type IRecordSet } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { type DriverType, type PreparedStoredProcedureParameter, ParameterMode, type StoredProcedureSchema, type StoredProcedurePa...
: { resultSetFields: {}, outputFields: {} }; const resultSets = result.recordsets.map((recordset: IRecordSet<Record<string, unknown>>) => { return recordset.map((record: Record<string, unknown>) => this.mapKeysWithMapping(record, resultSetFields), ); }); const output = this.ma...
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-manager.ts", "groundtruth_start_lineno": 248, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 251, "task_id": "project_cc_typescript/175" }
{ "list": [ { "filename": "src/lib/types/i-resolver-procedure-result.ts", "retrieved_chunk": "/**\n * Represents a GraphQL resolver stored procedure result.\n * The format of the result is: a single resultSet property, followed by\n * any additional output properties that were returned by the stored p...
getNodeSelectionSetNames(info, 'resultSets'), outputFields: getFieldNamesExcludingNode(info, 'resultSets'), }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
import type { Request } from 'mssql'; import { type GraphQLResolveInfo } from 'graphql'; import { DevConsoleLogger, logExecutionBegin, logExecutionEnd, logSafely } from '../logging'; import { DatabaseExecutor } from '../executor'; import { ConnectionManager } from '../utils'; import { StoredProcedureManager, Store...
const startTime = performance.now(); const logger = this._queryLogger; logExecutionBegin(logger, `Stored Procedure Query ${storedProcedureName} with inputs`, input); const result = await this._databaseExecutor.executeQueryRequest( async (request: Request): Promise<IResolverProcedureResult<T>> =...
{ "context_start_lineno": 0, "file": "src/lib/datasource/mssql-datasource.ts", "groundtruth_start_lineno": 81, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 84, "task_id": "project_cc_typescript/166" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " * procedure results to the correct schema field names.\n * @param {ILogger} logger - The logger to use for logging.\n * @returns A Promise that resolves to the result of the stored procedure ex...
input: InputParameters, info?: GraphQLResolveInfo, ): Promise<IResolverProcedureResult<T>> {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " private addParametersToRequest(\n parameters: Map<string, PreparedStoredProcedureParameter>,\n request: Request,\n ): Request {\n const preparedRequest = request;\n for (const parameter...
import { type IResult, type Request } from 'mssql'; import type { StoredProcedureParameter, StoredProcedureSchema, ILogger } from '../types'; import { type DatabaseExecutor } from '../executor'; import { convertSqlValueToJsValue } from '../utils'; /** * A manager for stored procedure metadata. * Handles the retriev...
} } return parameterSchemaMap.values(); } }
{ "context_start_lineno": 0, "file": "src/lib/stored-procedure/stored-procedure-metadata-manager.ts", "groundtruth_start_lineno": 138, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 139, "task_id": "project_cc_typescript/182" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " const modeEnum = mode;\n if (modeEnum === ParameterMode.IN) {\n preparedRequest.input(name, type, value);\n } else if (modeEnum === ParameterMode.INOUT) {\n preparedReque...
.defaultValue = convertSqlValueToJsValue(defaultValue, type);
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " getCommands,\n async execute(commandName: string, args: string[], output: NodeJS.WriteStream) {\n const command = commands.find((cmd) => cmd.name === commandName || cmd.aliases.includes(commandName));\n if (command) {\n ...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
const config = getConfig(); const context = await getRelevantContext(contextVectorStore, question, config.numContextDocumentsToRetrieve); const history = await getRelevantContext(memoryVectorStore, question, config.numMemoryDocumentsToRetrieve); try { response = await chain.call({ input: ...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 82, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 83, "task_id": "project_cc_typescript/195" }
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " return commandHandler;\n}\nexport default createCommandHandler;", "score": 42.61334512403259 }, { "filename": "src/commands/helpCommand.ts", "retrieved_chunk": " output.write(chalk.blue('\\nAvailable comm...
const question = sanitizeInput(userInput);
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " getCommands,\n async execute(commandName: string, args: string[], output: NodeJS.WriteStream) {\n const command = commands.find((cmd) => cmd.name === commandName || cmd.aliases.includes(commandName));\n if (command) {\n ...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
const contextVectorStore = await getContextVectorStore(); const question = sanitizeInput(userInput); const config = getConfig(); const context = await getRelevantContext(contextVectorStore, question, config.numContextDocumentsToRetrieve); const history = await getRelevantContext(memoryVectorStore, ...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 80, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 81, "task_id": "project_cc_typescript/193" }
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " return commandHandler;\n}\nexport default createCommandHandler;", "score": 39.68696705501367 }, { "filename": "src/lib/vectorStoreUtils.ts", "retrieved_chunk": " const documents = await vectorStore.similarity...
const memoryVectorStore = await getMemoryVectorStore();
{ "list": [ { "filename": "src/commands/setContextConfigCommand.ts", "retrieved_chunk": " if (!args || args.length !== 1) {\n output.write(chalk.red('Invalid number of arguments. Usage: /context-config `number of documents`\\n'));\n return;\n }\n const numContextDocumentsToRetrieve ...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
const history = await getRelevantContext(memoryVectorStore, question, config.numMemoryDocumentsToRetrieve); try { response = await chain.call({ input: question, context, history, immediate_history: config.useWindowMemory ? windowMemory : '', }); if (response) {...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 84, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 85, "task_id": "project_cc_typescript/197" }
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " return commandHandler;\n}\nexport default createCommandHandler;", "score": 28.95783898202127 }, { "filename": "src/commands/setContextConfigCommand.ts", "retrieved_chunk": "export default setContextConfigComma...
await getRelevantContext(contextVectorStore, question, config.numContextDocumentsToRetrieve);
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": " documents: Array<{ content: string; metadataType: string }>\n): Promise<void> {\n const formattedDocuments = documents.map(\n (doc) => new Document({ pageContent: doc.content, metadata: { type: doc.metadataType } })\n );\...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
} } catch (error) { if (error instanceof Error && error.message.includes('Cancel:')) { // TODO: Handle cancel } else if (error instanceof Error) { output.write(chalk.red(error.message)); } else { output.write(chalk.red(error)); } } } output.write('\n');...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 98, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 99, "task_id": "project_cc_typescript/199" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nasync function deleteMemoryDirectory() {\n try {\n const files = await fs.readdir(memoryDirectory);\n const deletePromises = files.map((file) => fs.unlink(path.join(memoryDirectory, file)));\n await Promise.all(dele...
logChat(chatLogDirectory, question, response.response);
{ "list": [ { "filename": "src/lib/contextManager.ts", "retrieved_chunk": " const dbDirectory = getConfig().currentVectorStoreDatabasePath;\n try {\n vectorStore = await HNSWLib.load(dbDirectory, new OpenAIEmbeddings({ maxConcurrency: 5 }));\n } catch {\n spinner = ora({\n ...defaultOraO...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
const chain = new LLMChain({ prompt: chatPrompt, memory: windowMemory, llm, }); // eslint-disable-next-line no-constant-condition while (true) { output.write(chalk.green('\nStart chatting or type /help for a list of commands\n')); const userInput = await rl.question('> '); let response; if (userInput.s...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 63, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 64, "task_id": "project_cc_typescript/192" }
{ "list": [ { "filename": "src/lib/contextManager.ts", "retrieved_chunk": " const documents = await Promise.all(filesToAdd.map((filePath) => loadAndSplitFile(filePath)));\n const flattenedDocuments = documents.reduce((acc, val) => acc.concat(val), []);\n vectorStore = await HNSWLib.fromDocume...
const windowMemory = getBufferWindowMemory();
{ "list": [ { "filename": "src/lib/types/i-stored-procedure-parameter.ts", "retrieved_chunk": " */\nexport interface StoredProcedureParameter {\n name: string;\n type: string;\n mode: ParameterMode;\n defaultValue?: unknown;\n length?: number;\n precision?: number;\n scale?: number;\n}", ...
import { type ISqlTypeFactory, type ISqlTypeFactoryWithLength, type ISqlTypeFactoryWithNoParams, type ISqlTypeFactoryWithPrecisionScale, type ISqlTypeFactoryWithScale, type ISqlTypeFactoryWithTvpType, type ISqlTypeWithLength, type ISqlTypeWithNoParams, type ISqlTypeWithPrecisionScale, type ISqlTypeW...
const types: IndexableTypes = TYPES; const property = findPropertyCaseInsensitive(types, type); if (property !== null) { const typeFactory = types[property as TypesKey]; if (isSqlTypeFactoryWithNoParams(typeFactory)) { return typeFactory(); } else if (isSqlTypeFactoryWithLength(typeFactory)) { ...
{ "context_start_lineno": 0, "file": "src/lib/utils/type-map.ts", "groundtruth_start_lineno": 90, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 91, "task_id": "project_cc_typescript/184" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " scale,\n }) as DriverType,\n value: undefined,\n ...rest,\n });\n }\n // Populate our input values into the request parameters.\n const inputParameters = i...
}: Pick<StoredProcedureParameter, 'type' | 'length' | 'precision' | 'scale'>): ISqlTypeFactory => {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ]);\n }\n }\n }\n private pushAnalyzedType(\n kind: AnalyzedType['kind'],\n range: [pos: number, end: number]\n ) {\n const [pos, end] = range;\n const text = this.sourceFile.text.sl...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 19, end: 35 }, text: '<number, string>', kind: TYPE_KIND.FUNCTION_CALL_GENERIC }, { range: { pos: 40, end: 62 }, text: '<number, string, null>', kind: TYPE_KIND.FUNCTION_CALL_GENERIC }, { range: { end: 93, pos: 73 }, text: '<PersistListener<...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 520, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 523, "task_id": "project_cc_typescript/243" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " }\n });\n });\n const sortedToRemoveIndexs = Array.from(indexsToRemove).sort((a, b) => b - a);\n sortedToRemoveIndexs.forEach(index => this.analyzedTypes.splice(index, 1));\n }\n...
kind: TYPE_KIND.FUNCTION_CALL_GENERIC }, {
{ "list": [ { "filename": "src/lib/types/i-stored-procedure-parameter.ts", "retrieved_chunk": "import type { ParameterMode } from '.';\n/**\n * Represents a subset of used metadata for an MSSQL stored procedure parameter.\n * @property {string} name - The name of the parameter. Begins with @.\n * @pro...
import { type ISqlTypeFactory, type ISqlTypeFactoryWithLength, type ISqlTypeFactoryWithNoParams, type ISqlTypeFactoryWithPrecisionScale, type ISqlTypeFactoryWithScale, type ISqlTypeFactoryWithTvpType, type ISqlTypeWithLength, type ISqlTypeWithNoParams, type ISqlTypeWithPrecisionScale, type ISqlTypeW...
} else if (isSqlTypeFactoryWithScale(typeFactory)) { return (typeFactory as ISqlTypeFactoryWithScale)(scale); } else if (isSqlTypeFactoryWithPrecisionScale(typeFactory)) { return (typeFactory as ISqlTypeFactoryWithPrecisionScale)(precision, scale); } else if (isSqlTypeFactoryWithTvpType(typeFac...
{ "context_start_lineno": 0, "file": "src/lib/utils/type-map.ts", "groundtruth_start_lineno": 98, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 99, "task_id": "project_cc_typescript/186" }
{ "list": [ { "filename": "src/lib/types/i-stored-procedure-parameter.ts", "retrieved_chunk": " */\nexport interface StoredProcedureParameter {\n name: string;\n type: string;\n mode: ParameterMode;\n defaultValue?: unknown;\n length?: number;\n precision?: number;\n scale?: number;\n}", ...
typeFactory as ISqlTypeFactoryWithLength)(length === -1 ? MAX : length);
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ]);\n }\n }\n }\n private pushAnalyzedType(\n kind: AnalyzedType['kind'],\n range: [pos: number, end: number]\n ) {\n const [pos, end] = range;\n const text = this.sourceFile.text.sl...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 18, end: 58 }, text: 'type A111 = {\n a: number;\n} | 123 & {}', kind: TYPE_KIND.TYPE_ALIAS } ]); }); it('variable type definition', () => { const analyzer = new TypeAnalyzer(` const a = 1; declare const b: number, c: string; const d: number, e: string; const eee: null | stri...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 257, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 260, "task_id": "project_cc_typescript/237" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " this.analyzedTypes.push({ kind, range: { pos, end }, text });\n }\n}", "score": 19.819816438972378 }, { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ...
TYPE_KIND.TYPE_ALIAS }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ]);\n }\n }\n }\n private pushAnalyzedType(\n kind: AnalyzedType['kind'],\n range: [pos: number, end: number]\n ) {\n const [pos, end] = range;\n const text = this.sourceFile.text.sl...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 42, end: 68 }, text: ' satisfies number | string', kind: TYPE_KIND.SATISFIES_OPERATOR }, { range: { pos: 81, end: 114 }, text: ' satisfies number | string | null', kind: TYPE_KIND.SATISFIES_OPERATOR }, { range: { pos: 147, end: 161 }, text: ...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 426, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 429, "task_id": "project_cc_typescript/241" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " this.analyzedTypes.push({ kind, range: { pos, end }, text });\n }\n}", "score": 16.603920674868508 }, { "filename": "src/core/helpers/type-analyzer/constants.ts", "retrieved_chunk": ...
TYPE_KIND.SATISFIES_OPERATOR }, {
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " for (const spParameter of storedProcedureParameters) {\n const { name, type, length, precision, scale, ...rest } = spParameter;\n const parameterName = name.slice(1);\n // Let's use...
import { type ISqlTypeFactory, type ISqlTypeFactoryWithLength, type ISqlTypeFactoryWithNoParams, type ISqlTypeFactoryWithPrecisionScale, type ISqlTypeFactoryWithScale, type ISqlTypeFactoryWithTvpType, type ISqlTypeWithLength, type ISqlTypeWithNoParams, type ISqlTypeWithPrecisionScale, type ISqlTypeW...
if (property !== null) { const typeFactory = types[property as TypesKey]; if (isSqlTypeFactoryWithNoParams(typeFactory)) { return typeFactory(); } else if (isSqlTypeFactoryWithLength(typeFactory)) { return (typeFactory as ISqlTypeFactoryWithLength)(length === -1 ? MAX : length); } else if...
{ "context_start_lineno": 0, "file": "src/lib/utils/type-map.ts", "groundtruth_start_lineno": 92, "repository": "Falven-mssql-data-source-bca6621", "right_context_start_lineno": 93, "task_id": "project_cc_typescript/185" }
{ "list": [ { "filename": "src/lib/stored-procedure/stored-procedure-manager.ts", "retrieved_chunk": " scale,\n }) as DriverType,\n value: undefined,\n ...rest,\n });\n }\n // Populate our input values into the request parameters.\n const inputParameters = i...
const property = findPropertyCaseInsensitive(types, type);
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " this.analyzedTypes.push({ kind, range: { pos, end }, text });\n }\n}", "score": 14.79500541829947 }, { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 58, end: 76 }, text: ': asserts b is bbb', kind: TYPE_KIND.FUNCTION_TYPE_PREDICATE }, { range: { pos: 111, end: 129 }, text: ': asserts d is ddd', kind: TYPE_KIND.FUNCTION_TYPE_PREDICATE }, { range: { pos: 157, end: 175 }, ...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 191, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 194, "task_id": "project_cc_typescript/235" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/constants.ts", "retrieved_chunk": " * declare module d {}\n * declare namespace e {}\n * declare enum f {}\n * declare global {}\n * declare module 'g' {}\n * ```\n * ⏭️ 👆 All statements that begin with `declare`\n */\n DECLA...
TYPE_KIND.FUNCTION_TYPE_PREDICATE }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " }\n }\n const children = parent.getChildren(this.sourceFile);\n const index = children.findIndex(\n child => child.pos === curChild.pos && child.end === curChild.end\n );\n ...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 57, end: 87 }, text: '<B extends 222, C extends 222>', kind: TYPE_KIND.FUNCTION_GENERIC_DEFINITION }, { range: { pos: 115, end: 145 }, text: '<B extends 333, C extends 333>', kind: TYPE_KIND.FUNCTION_GENERIC_DEFINITION }, { r...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 45, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 48, "task_id": "project_cc_typescript/232" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " child => child.pos === parent.typeParameters!.pos\n );\n const endIndex = children.findIndex(\n child => child.end === parent.typeParameters!.end\n );\n // <\n ...
kind: TYPE_KIND.FUNCTION_GENERIC_DEFINITION }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " this.analyzedTypes.push({ kind, range: { pos, end }, text });\n }\n}", "score": 14.79500541829947 }, { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 17, end: 81 }, text: 'interface A111 {\n a: number;\n b: string;\n c: {\n e: 1\n }\n}', kind: TYPE_KIND.INTERFACE } ]); }); it('type alias', () => { const analyzer = new TypeAnalyzer(` type t = number; type A111 = { a: number; } | 123 & {}`); analyzer.analyze(); ...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 234, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 237, "task_id": "project_cc_typescript/236" }
{ "list": [ { "filename": "src/core/editor-context.ts", "retrieved_chunk": " foldedTypeRanges: FoldingRange[];\n}\nexport class EditorContext {\n private static _instance: EditorContext;\n /** instance */\n public static get i(): EditorContext {\n if (!EditorContext._instance) {\n throw ne...
kind: TYPE_KIND.INTERFACE }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ]);\n }\n }\n }\n private pushAnalyzedType(\n kind: AnalyzedType['kind'],\n range: [pos: number, end: number]\n ) {\n const [pos, end] = range;\n const text = this.sourceFile.text.sl...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 68, end: 76 }, text: ': string', kind: TYPE_KIND.VARIABLE_TYPE_DEFINITION }, { range: { pos: 87, end: 102 }, text: ': null | string', kind: TYPE_KIND.VARIABLE_TYPE_DEFINITION }, { range: { pos: 115, end: 124 }, text: '!: string', kind:...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 288, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 291, "task_id": "project_cc_typescript/239" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " this.analyzedTypes.push({ kind, range: { pos, end }, text });\n }\n}", "score": 31.84720769921471 }, { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ...
TYPE_KIND.VARIABLE_TYPE_DEFINITION }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/constants.ts", "retrieved_chunk": " * const user = { ... } satisfies UserModel;\n * ```\n * ⏭️ ` satisfies UserModel`\n */\n SATISFIES_OPERATOR = 'satisfies-operator',\n /**\n * ```ts\n * declare const a: number;\n * declare fu...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 57, end: 65 }, text: ': number', kind: TYPE_KIND.VARIABLE_TYPE_DEFINITION }, { range: { pos: 68, end: 76 }, text: ': string', kind: TYPE_KIND.VARIABLE_TYPE_DEFINITION }, { range: { pos: 87, end: 102 }, text: ': null | string', kind: TY...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 283, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 286, "task_id": "project_cc_typescript/238" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/constants.ts", "retrieved_chunk": " * declare module d {}\n * declare namespace e {}\n * declare enum f {}\n * declare global {}\n * declare module 'g' {}\n * ```\n * ⏭️ 👆 All statements that begin with `declare`\n */\n DECLA...
TYPE_KIND.DECLARE_STATEMENT }, {
{ "list": [ { "filename": "src/core/helpers/type-analyzer/index.ts", "retrieved_chunk": " ]);\n }\n }\n }\n private pushAnalyzedType(\n kind: AnalyzedType['kind'],\n range: [pos: number, end: number]\n ) {\n const [pos, end] = range;\n const text = this.sourceFile.text.sl...
import { describe, expect, it } from 'vitest'; import { TypeAnalyzer } from '.'; import { TYPE_KIND } from './constants'; describe('function', () => { it('overloading', () => { const analyzer = new TypeAnalyzer(` const t = 1 function a<B extends 222>(): void; function b<A>(o: A): string; `); analyzer.analyz...
range: { pos: 31, end: 48 }, text: '<number | string>', kind: TYPE_KIND.ANGLE_BRACKETS_ASSERTION }, { range: { pos: 61, end: 85 }, text: '<number | string | null>', kind: TYPE_KIND.ANGLE_BRACKETS_ASSERTION } ]); }); it('call expression', () => { const analyzer = new...
{ "context_start_lineno": 0, "file": "src/core/helpers/type-analyzer/index.test.ts", "groundtruth_start_lineno": 491, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 494, "task_id": "project_cc_typescript/242" }
{ "list": [ { "filename": "src/core/helpers/type-analyzer/constants.ts", "retrieved_chunk": " * declare module d {}\n * declare namespace e {}\n * declare enum f {}\n * declare global {}\n * declare module 'g' {}\n * ```\n * ⏭️ 👆 All statements that begin with `declare`\n */\n DECLA...
kind: TYPE_KIND.ANGLE_BRACKETS_ASSERTION }, {
{ "list": [ { "filename": "src/core/global-state.ts", "retrieved_chunk": " public static init(vscodeContext: vscode.ExtensionContext) {\n GlobalState._instance = new GlobalState(vscodeContext);\n }\n private constructor(private readonly vscodeContext: vscode.ExtensionContext) {}\n get isHiddenM...
import type { ReadonlyDeep } from 'type-fest'; import vscode from 'vscode'; import fs from 'fs-extra'; import { log } from './log'; import { TYPE_KIND } from './helpers/type-analyzer/constants'; interface ExtensionConfig { /** @default true */ enabled: boolean; /** @default `{$ExtensionRootPath}/res/type-icon.p...
`); } registerWatchCallback(fn: Function) { this.watchCallbacks.push(fn); } private verify() { if (!fs.existsSync(this.config.typeIconPath)) { vscode.window.showErrorMessage( '[ts-type-hidden configuration]: \n`typeIconPath` is not a valid path' ); this.config.typeIconPath =...
{ "context_start_lineno": 0, "file": "src/core/config.ts", "groundtruth_start_lineno": 50, "repository": "xlboy-ts-type-hidden-a749a29", "right_context_start_lineno": 52, "task_id": "project_cc_typescript/231" }
{ "list": [ { "filename": "src/core/editor-context.ts", "retrieved_chunk": " Config.i.registerWatchCallback(this.decoration.refreshIcon);\n if (GlobalState.i.isHiddenMode) this.hideType(true);\n }\n hideType(needToFold = false) {\n const activeEditorWindow = vscode.window.activeTextEditor;\...
log.appendLine(`Config updated: ${JSON.stringify(this.config, null, 2)}
{ "list": [ { "filename": "src/lib/vectorStoreUtils.ts", "retrieved_chunk": "import { HNSWLib } from 'langchain/vectorstores/hnswlib';\n/**\n * Retrieves relevant context for the given question by performing a similarity search on the provided vector store.\n * @param {HNSWLib} vectorStore - HNSWLib i...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const dbDirectory = getConfig().currentVectorStoreDatabasePath; try { vectorStore = await HNSWLib.load(dbDirectory, new OpenAIEmbeddings({ maxConcurrency: 5 })); } catch { spinner = ora({ ...defaultOraOptions, text: chalk.blue(`Creating new Context Vector Store in the ${dbDirectory} directory...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 83, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 84, "task_id": "project_cc_typescript/200" }
{ "list": [ { "filename": "src/lib/vectorStoreUtils.ts", "retrieved_chunk": " * @returns The function `getRelevantContext` is returning a Promise that resolves to a string. The\n * string is the concatenation of the `pageContent` property of the top `numDocuments` documents\n * returned by a similarit...
await createDirectory(getConfig().currentVectorStoreDatabasePath);
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "const memoryDirectory = path.join(projectRootDir, process.env.MEMORY_VECTOR_STORE_DIR || 'memory');\nlet memoryVectorStore: HNSWLib;\ntry {\n memoryVectorStore = await HNSWLib.load(memoryDirectory, new OpenAIEmbeddings());\n} c...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const documents = await Promise.all(filesToAdd.map((filePath) => loadAndSplitFile(filePath))); const flattenedDocuments = documents.reduce((acc, val) => acc.concat(val), []); vectorStore = await HNSWLib.fromDocuments(flattenedDocuments, new OpenAIEmbeddings({ maxConcurrency: 5 })); await vectorStore.sa...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 93, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 94, "task_id": "project_cc_typescript/202" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nconst bufferWindowMemory = new BufferWindowMemory({\n returnMessages: false,\n memoryKey: 'immediate_history',\n inputKey: 'input',\n k: 2,\n});\nconst memoryWrapper = {\n vectorStoreInstance: memoryVectorStore,\n};", ...
const filesToAdd = await getDirectoryFiles(docsDirectory);
{ "list": [ { "filename": "src/lib/crawler.ts", "retrieved_chunk": "import * as cheerio from 'cheerio';\nimport Crawler, { CrawlerRequestResponse } from 'crawler';\nimport { stderr } from 'node:process';\nimport resolveURL from '../utils/resolveURL.js';\n// import TurndownService from 'turndown';\n// ...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const pages = (await crawler.start()) as Page[]; documents = await Promise.all( pages.map((row) => { const splitter = new RecursiveCharacterTextSplitter(); const webDocs = splitter.splitDocuments([ new Document({ pageContent: row.text, }), ]); ...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 241, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 242, "task_id": "project_cc_typescript/206" }
{ "list": [ { "filename": "src/lib/crawler.ts", "retrieved_chunk": " title: string;\n}\n/* The WebCrawler class is a TypeScript implementation of a web crawler that can extract text from web\npages and follow links to crawl more pages. */\nclass WebCrawler {\n pages: Page[];\n limit: number;\n url...
new WebCrawler([URL], progressCallback, selector, maxPages, numberOfCharactersRequired);
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "const memoryDirectory = path.join(projectRootDir, process.env.MEMORY_VECTOR_STORE_DIR || 'memory');\nlet memoryVectorStore: HNSWLib;\ntry {\n memoryVectorStore = await HNSWLib.load(memoryDirectory, new OpenAIEmbeddings());\n} c...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const flattenedDocuments = documents.reduce((acc, val) => acc.concat(val), []); vectorStore = await HNSWLib.fromDocuments(flattenedDocuments, new OpenAIEmbeddings({ maxConcurrency: 5 })); await vectorStore.save(dbDirectory); spinner.succeed(); } return vectorStore; } const contextVectorStore = awa...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 94, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 95, "task_id": "project_cc_typescript/203" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nconst bufferWindowMemory = new BufferWindowMemory({\n returnMessages: false,\n memoryKey: 'immediate_history',\n inputKey: 'input',\n k: 2,\n});\nconst memoryWrapper = {\n vectorStoreInstance: memoryVectorStore,\n};", ...
const documents = await Promise.all(filesToAdd.map((filePath) => loadAndSplitFile(filePath)));
{ "list": [ { "filename": "src/lib/vectorStoreUtils.ts", "retrieved_chunk": "import { HNSWLib } from 'langchain/vectorstores/hnswlib';\n/**\n * Retrieves relevant context for the given question by performing a similarity search on the provided vector store.\n * @param {HNSWLib} vectorStore - HNSWLib i...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const dbDirectory = getConfig().currentVectorStoreDatabasePath; try { vectorStore = await HNSWLib.load(dbDirectory, new OpenAIEmbeddings({ maxConcurrency: 5 })); } catch { spinner = ora({ ...defaultOraOptions, text: chalk.blue(`Creating new Context Vector Store in the ${dbDirectory} directory...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 83, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 84, "task_id": "project_cc_typescript/201" }
{ "list": [ { "filename": "src/lib/vectorStoreUtils.ts", "retrieved_chunk": " * @returns The function `getRelevantContext` is returning a Promise that resolves to a string. The\n * string is the concatenation of the `pageContent` property of the top `numDocuments` documents\n * returned by a similarit...
getConfig().currentVectorStoreDatabasePath);
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "const memoryDirectory = path.join(projectRootDir, process.env.MEMORY_VECTOR_STORE_DIR || 'memory');\nlet memoryVectorStore: HNSWLib;\ntry {\n memoryVectorStore = await HNSWLib.load(memoryDirectory, new OpenAIEmbeddings());\n} c...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
vectorStore = await HNSWLib.fromDocuments(flattenedDocuments, new OpenAIEmbeddings({ maxConcurrency: 5 })); await vectorStore.save(dbDirectory); spinner.succeed(); } return vectorStore; } const contextVectorStore = await loadOrCreateVectorStore(); const contextWrapper = { contextInstance: contextVe...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 95, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 96, "task_id": "project_cc_typescript/204" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nconst bufferWindowMemory = new BufferWindowMemory({\n returnMessages: false,\n memoryKey: 'immediate_history',\n inputKey: 'input',\n k: 2,\n});\nconst memoryWrapper = {\n vectorStoreInstance: memoryVectorStore,\n};", ...
const flattenedDocuments = documents.reduce((acc, val) => acc.concat(val), []);
{ "list": [ { "filename": "src/commands/addURLCommand.ts", "retrieved_chunk": " To avoid this, you can try to target a specific selector such as \\`.main\\``,\n async (args, output) => {\n if (!args || args.length > 4) {\n output.write(\n chalk.red(\n 'Invalid number of arg...
import * as cheerio from 'cheerio'; import Crawler, { CrawlerRequestResponse } from 'crawler'; import { stderr } from 'node:process'; import resolveURL from '../utils/resolveURL.js'; // import TurndownService from 'turndown'; // const turndownService = new TurndownService(); type ProgressCallback = (linksFound: numb...
// crawl more if (url && this.urls.some((u) => url.includes(u))) { this.crawler.queue(url); this.count += 1; } return true; // Continue iterating when the limit is not reached }); done(); }; start = async () => { this.pages = []; return new Promise((resolve...
{ "context_start_lineno": 0, "file": "src/lib/crawler.ts", "groundtruth_start_lineno": 95, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 96, "task_id": "project_cc_typescript/209" }
{ "list": [ { "filename": "src/commands/addURLCommand.ts", "retrieved_chunk": " const url = args[0];\n const selector = args[1];\n const maxLinks = parseInt(args[2], 10) || 20;\n const minChars = parseInt(args[3], 10) || 200;\n await addURL(url, selector, maxLinks, minChars);\n }\n);\n...
url = href && resolveURL(uri, href);
{ "list": [ { "filename": "src/commands/setContextConfigCommand.ts", "retrieved_chunk": " if (!args || args.length !== 1) {\n output.write(chalk.red('Invalid number of arguments. Usage: /context-config `number of documents`\\n'));\n return;\n }\n const numContextDocumentsToRetrieve ...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
const history = await getRelevantContext(memoryVectorStore, question, config.numMemoryDocumentsToRetrieve); try { response = await chain.call({ input: question, context, history, immediate_history: config.useWindowMemory ? windowMemory : '', }); if (response) {...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 84, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 85, "task_id": "project_cc_typescript/216" }
{ "list": [ { "filename": "src/commands.ts", "retrieved_chunk": " return commandHandler;\n}\nexport default createCommandHandler;", "score": 29.590925921345477 }, { "filename": "src/commands/addURLCommand.ts", "retrieved_chunk": " const url = args[0];\n const selector ...
const context = await getRelevantContext(contextVectorStore, question, config.numContextDocumentsToRetrieve);
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": " documents: Array<{ content: string; metadataType: string }>\n): Promise<void> {\n const formattedDocuments = documents.map(\n (doc) => new Document({ pageContent: doc.content, metadata: { type: doc.metadataType } })\n );\...
/* eslint-disable no-await-in-loop */ import dotenv from 'dotenv'; import { OpenAIChat } from 'langchain/llms/openai'; // eslint-disable-next-line import/no-unresolved import * as readline from 'node:readline/promises'; import path from 'path'; import fs from 'fs'; /* This line of code is importing the `stdin` and `std...
} } catch (error) { if (error instanceof Error && error.message.includes('Cancel:')) { // TODO: Handle cancel } else if (error instanceof Error) { output.write(chalk.red(error.message)); } else { output.write(chalk.red(error)); } } } output.write('\n');...
{ "context_start_lineno": 0, "file": "src/index.ts", "groundtruth_start_lineno": 98, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 99, "task_id": "project_cc_typescript/218" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nasync function deleteMemoryDirectory() {\n try {\n const files = await fs.readdir(memoryDirectory);\n const deletePromises = files.map((file) => fs.unlink(path.join(memoryDirectory, file)));\n await Promise.all(dele...
await logChat(chatLogDirectory, question, response.response);
{ "list": [ { "filename": "src/utils/getDirectoryFiles.ts", "retrieved_chunk": "import path from 'path';\nimport fs from 'node:fs/promises';\nexport default async function getDirectoryFiles(directoryPath: string): Promise<string[]> {\n const fileNames = await fs.readdir(directoryPath);\n const fileP...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
vectorStore = await HNSWLib.fromDocuments(flattenedDocuments, new OpenAIEmbeddings({ maxConcurrency: 5 })); await vectorStore.save(dbDirectory); spinner.succeed(); } return vectorStore; } const contextVectorStore = await loadOrCreateVectorStore(); const contextWrapper = { contextInstance: contextVe...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 95, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 96, "task_id": "project_cc_typescript/223" }
{ "list": [ { "filename": "src/lib/memoryManager.ts", "retrieved_chunk": "}\nconst bufferWindowMemory = new BufferWindowMemory({\n returnMessages: false,\n memoryKey: 'immediate_history',\n inputKey: 'input',\n k: 2,\n});\nconst memoryWrapper = {\n vectorStoreInstance: memoryVectorStore,\n};", ...
(acc, val) => acc.concat(val), []);
{ "list": [ { "filename": "src/getPlatformInfo.ts", "retrieved_chunk": " const { start, end, type, row } = item\n const color = HIGHTLIGHT_COLOR.platform[row as Platform]\n if (type === 'prefix') {\n platformInfos.push({\n start,\n end,\n type,\n })\n }\n ...
import { COMMENT_PRE, commentPreReg } from '../constants' import { parsePlatform } from './parsePlatform' export function parseComment(code: string) { if (code.trim().length === 0) return const commentResults = [...code.matchAll(commentPreReg)] if (commentResults.length === 0) return const commentAST...
const platformStart = self.indexOf(element) + index const platformEnd = platformStart + element.length commentAST.push({ start: platformStart, end: platformEnd, type: 'platform', row: element, }) }) } else { const start = self....
{ "context_start_lineno": 0, "file": "src/parseComment/index.ts", "groundtruth_start_lineno": 51, "repository": "uni-helper-uni-highlight-vscode-f9002ae", "right_context_start_lineno": 52, "task_id": "project_cc_typescript/347" }
{ "list": [ { "filename": "src/getPlatformInfo.ts", "retrieved_chunk": " platformInfos.push({\n start,\n end,\n type,\n color,\n })\n }\n else if (type === 'platform' && !color) {\n platformInfos.push({\n start,", "score": 11.10249193032912...
(element) => {
{ "list": [ { "filename": "src/lib/crawler.ts", "retrieved_chunk": "import * as cheerio from 'cheerio';\nimport Crawler, { CrawlerRequestResponse } from 'crawler';\nimport { stderr } from 'node:process';\nimport resolveURL from '../utils/resolveURL.js';\n// import TurndownService from 'turndown';\n// ...
import chalk from 'chalk'; import { stdout as output } from 'node:process'; import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; import { HNSWLib } from 'langchain/vectorstores/hnswlib'; import { JSONLoader } from 'langchain/document_loaders/fs/json'; import { TextLoader } from 'langchain/document_loaders/fs...
const pages = (await crawler.start()) as Page[]; documents = await Promise.all( pages.map((row) => { const splitter = new RecursiveCharacterTextSplitter(); const webDocs = splitter.splitDocuments([ new Document({ pageContent: row.text, }), ]); ...
{ "context_start_lineno": 0, "file": "src/lib/contextManager.ts", "groundtruth_start_lineno": 241, "repository": "gmickel-memorybot-bad0302", "right_context_start_lineno": 242, "task_id": "project_cc_typescript/225" }
{ "list": [ { "filename": "src/lib/crawler.ts", "retrieved_chunk": " title: string;\n}\n/* The WebCrawler class is a TypeScript implementation of a web crawler that can extract text from web\npages and follow links to crawl more pages. */\nclass WebCrawler {\n pages: Page[];\n limit: number;\n url...
const crawler = new WebCrawler([URL], progressCallback, selector, maxPages, numberOfCharactersRequired);
{ "list": [ { "filename": "src/server/deployer.ts", "retrieved_chunk": "export const deployPlugin = async (serverDir: string, pluginFile: string) => {\n const pluginDir = path.join(serverDir, \"plugins\")\n await io.mkdirP(pluginDir)\n await io.cp(pluginFile, pluginDir)\n}\nconst initScenamat...
import {isNoScenamatica} from "../utils.js" import {deployPlugin} from "./deployer.js" import {kill, onDataReceived} from "./client"; import type {ChildProcess} from "node:child_process"; import {spawn} from "node:child_process"; import type {Writable} from "node:stream"; import * as fs from "node:fs"; import path from...
const removeScenamatica = async (serverDir: string) => { info("Removing Scenamatica from server...") const pluginDir = path.join(serverDir, "plugins") const files = await fs.promises.readdir(pluginDir) for (const file of files) { if (file.includes("Scenamatica") && file.endsWith(".jar")) { ...
{ "context_start_lineno": 0, "file": "src/server/controller.ts", "groundtruth_start_lineno": 94, "repository": "TeamKun-scenamatica-action-6f66283", "right_context_start_lineno": 97, "task_id": "project_cc_typescript/360" }
{ "list": [ { "filename": "src/main.ts", "retrieved_chunk": "const initPRMode = (pullRequest: {number: number}, token: string) => {\n info(`Running in Pull Request mode for PR #${pullRequest.number}`)\n const prInfo: PullRequestInfo = {\n number: pullRequest.number,\n octokit: getO...
onDataReceived(data.toString("utf8")) }) }
{ "list": [ { "filename": "src/server/client.ts", "retrieved_chunk": " incomingBuffer = messages.slice(1).join(\"\\n\") || undefined\n if (!await processPacket(messages[0]))\n info(messages[0])\n }\n}\nexport const kill = () => {\n alive = false\n}\nconst processPacket =...
import {isNoScenamatica} from "../utils.js" import {deployPlugin} from "./deployer.js" import {kill, onDataReceived} from "./client"; import type {ChildProcess} from "node:child_process"; import {spawn} from "node:child_process"; import type {Writable} from "node:stream"; import * as fs from "node:fs"; import path from...
info("Tests succeeded") code = 0 } else { setFailed("Tests failed") code = 1 } process.exit(code) }
{ "context_start_lineno": 0, "file": "src/server/controller.ts", "groundtruth_start_lineno": 118, "repository": "TeamKun-scenamatica-action-6f66283", "right_context_start_lineno": 123, "task_id": "project_cc_typescript/377" }
{ "list": [ { "filename": "src/server/deployer.ts", "retrieved_chunk": " },\n reporting?: { // v0.6.1 から。\n raw: boolean\n }\n }\n if (compare(scenamaticaVersion, \"0.7.0\", \">=\")) {\n configData[\"reporting\"]![\"raw\"] = true\n } else {\n con...
printFooter() let code: number if (succeed) {
{ "list": [ { "filename": "src/server/client.ts", "retrieved_chunk": " incomingBuffer = messages.slice(1).join(\"\\n\") || undefined\n if (!await processPacket(messages[0]))\n info(messages[0])\n }\n}\nexport const kill = () => {\n alive = false\n}\nconst processPacket =...
import {isNoScenamatica} from "../utils.js" import {deployPlugin} from "./deployer.js" import {kill, onDataReceived} from "./client"; import type {ChildProcess} from "node:child_process"; import {spawn} from "node:child_process"; import type {Writable} from "node:stream"; import * as fs from "node:fs"; import path from...
info("Tests succeeded") code = 0 } else { setFailed("Tests failed") code = 1 } process.exit(code) }
{ "context_start_lineno": 0, "file": "src/server/controller.ts", "groundtruth_start_lineno": 118, "repository": "TeamKun-scenamatica-action-6f66283", "right_context_start_lineno": 123, "task_id": "project_cc_typescript/361" }
{ "list": [ { "filename": "src/main.ts", "retrieved_chunk": "const initPRMode = (pullRequest: {number: number}, token: string) => {\n info(`Running in Pull Request mode for PR #${pullRequest.number}`)\n const prInfo: PullRequestInfo = {\n number: pullRequest.number,\n octokit: getO...
await printFooter() let code: number if (succeed) {
{ "list": [ { "filename": "src/outputs/pull-request/appender.ts", "retrieved_chunk": "}\nexport const reportSessionEnd = (packet: PacketSessionEnd) => {\n const {results, finishedAt, startedAt} = packet\n appendHeaderIfNotPrinted()\n outMessage += `${getTestSummary(results, startedAt, finishe...
import {extractTestResults, getArguments} from "../utils"; import type {PacketTestEnd} from "../packets"; import {getEmojiForCause} from "../logging"; const MESSAGES_PASSED = [ ":tada: Congrats! All tests passed! :star2:", ":raised_hands: High-five! You nailed all the tests! :tada::tada:", ":confetti_ball:...
const elapsed = (finishedAt - startedAt) / 1000 const { total, passed, failures, skipped, cancelled } = extractTestResults(results) return joinLine( getSummaryHeader(total, elapsed, passed, failures, skipped, cancelled), "<hr />", wrap(...
{ "context_start_lineno": 0, "file": "src/outputs/messages.ts", "groundtruth_start_lineno": 81, "repository": "TeamKun-scenamatica-action-6f66283", "right_context_start_lineno": 82, "task_id": "project_cc_typescript/351" }
{ "list": [ { "filename": "src/server/client.ts", "retrieved_chunk": " return false\n }\n let packet\n try {\n packet = parsePacket(msg)\n } catch {\n return false\n }\n if (!packet) {\n return false", "score": 13.529874149692994 }, { "...
export const getTestSummary = (results: PacketTestEnd[], startedAt: number, finishedAt: number) => {
{ "list": [ { "filename": "src/pages/_navbar.tsx", "retrieved_chunk": " >\n fal-serverless\n </a>\n </span>\n </div>\n <div className=\"flex\">\n <a\n href=\"https://github.com/fal-ai/edit-anything-app\"\n target=...
import { DocumentDuplicateIcon as CopyIcon, InformationCircleIcon as InfoIcon, } from "@heroicons/react/24/outline"; import va from "@vercel/analytics"; import { PropsWithChildren, useCallback, useEffect, useMemo, useState, } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlight...
<span className="ms-3"> {" "} Sign in with Github to get a token{" "} </span> </a> </div> </div> </div> </div> <div> <div className="tabs w-full text-lg"> ...
{ "context_start_lineno": 0, "file": "src/components/ModelCard.tsx", "groundtruth_start_lineno": 118, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 119, "task_id": "project_cc_typescript/284" }
{ "list": [ { "filename": "src/pages/_navbar.tsx", "retrieved_chunk": " >\n <GitHubIcon />\n </a>\n </div>\n </div>\n </div>\n );\n}", "score": 32.001329020765546 }, { "filename": "src/pages/_footer.tsx", "retrieved_chunk": " ...
GitHubIcon />{" "}
{ "list": [ { "filename": "src/components/MaskPicker.tsx", "retrieved_chunk": " value={dilation}\n onChange={(e) => setDilation(parseInt(e.target.value))} // @ts-nocheck\n className=\"input placeholder-gray-400 dark:placeholder-gray-600 w-full\"\n disabled={isLoadin...
import NextImage from "next/image"; import Card from "./Card"; import EmptyMessage from "./EmptyMessage"; interface StableDiffusionButtonGroupProps { setActiveTab: (tab: string) => void; activeTab: string; } export const StableDiffusionOptionsButtonGroup = ( props: StableDiffusionButtonGroupProps ) => { const...
<div className="grid grid-cols-1 gap-4 mt-4 md:mt-6 lg:p-12 mx-auto"> {replacedImageUrls.map((url, index) => ( <NextImage key={index} src={url} alt={`Generated Image ${index + 1}`} width={0} ...
{ "context_start_lineno": 0, "file": "src/components/StableDiffusion.tsx", "groundtruth_start_lineno": 114, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 117, "task_id": "project_cc_typescript/286" }
{ "list": [ { "filename": "src/components/MaskPicker.tsx", "retrieved_chunk": " </div>\n )}\n {displayMasks.length > 0 && (\n <>\n {props.selectedModel.id === \"sam\" && (\n <span className=\"font-light mb-0 inline-block opacity-70\">\n <strong>...
<EmptyMessage message="Nothing to see just yet" /> </div> )}
{ "list": [ { "filename": "src/pages/index.tsx", "retrieved_chunk": " <ImageSelector\n onImageSelect={handleImageSelected}\n disabled={isLoading}\n />\n )}\n {selectedImage && (\n <>\n ...
import { ImageFile } from "@/data/image"; import { Model } from "@/data/modelMetadata"; import { PropsWithChildren } from "react"; import Card from "./Card"; import EmptyMessage from "./EmptyMessage"; import ImageMask from "./ImageMask"; export interface MaskPickerProps { displayMasks: string[]; masks: string[]; ...
alt={`Mask ${index}`} mask={mask} selected={selectedMask === mask} onClick={handleMaskSelected} /> ))} </div> <button className="btn btn-primary max-sm:btn-wide mb-4 md:mb-0" disabled={...
{ "context_start_lineno": 0, "file": "src/components/MaskPicker.tsx", "groundtruth_start_lineno": 75, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 77, "task_id": "project_cc_typescript/283" }
{ "list": [ { "filename": "src/pages/index.tsx", "retrieved_chunk": " <strong>Hint:</strong> click on the image to set the\n mask reference point\n </span>\n )}\n <button\n cla...
ImageMask key={index}
{ "list": [ { "filename": "src/components/ModelPicker.tsx", "retrieved_chunk": " <span className=\"label-text\">Select a model</span>\n </label>\n <select\n className=\"select select-bordered max-w-xs\"\n onChange={handleOnModelSelect}\n value={selectedModel.id}\n...
import { DocumentDuplicateIcon as CopyIcon, InformationCircleIcon as InfoIcon, } from "@heroicons/react/24/outline"; import va from "@vercel/analytics"; import { PropsWithChildren, useCallback, useEffect, useMemo, useState, } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlight...
} }, [activeTab, model]); return ( <dialog className={modalClassName.join(" ")}> <div className="modal-box max-w-full w-2/4"> <div className="prose w-full max-w-full"> <h3>{model.name}</h3> <div className="my-10"> <div className="form-control"> <...
{ "context_start_lineno": 0, "file": "src/components/ModelCard.tsx", "groundtruth_start_lineno": 65, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 66, "task_id": "project_cc_typescript/293" }
{ "list": [ { "filename": "src/pages/_navbar.tsx", "retrieved_chunk": " <span className=\"whitespace-nowrap dark:text-white font-light\">\n edit\n <span className=\"text-secondary font-normal\">anything</span>\n </span>\n </a>\n <span c...
return model.curlCode;
{ "list": [ { "filename": "src/pages/_navbar.tsx", "retrieved_chunk": " >\n fal-serverless\n </a>\n </span>\n </div>\n <div className=\"flex\">\n <a\n href=\"https://github.com/fal-ai/edit-anything-app\"\n target=...
import { DocumentDuplicateIcon as CopyIcon, InformationCircleIcon as InfoIcon, } from "@heroicons/react/24/outline"; import va from "@vercel/analytics"; import { PropsWithChildren, useCallback, useEffect, useMemo, useState, } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlight...
<span className="ms-3"> {" "} Sign in with Github to get a token{" "} </span> </a> </div> </div> </div> </div> <div> <div className="tabs w-full text-lg"> ...
{ "context_start_lineno": 0, "file": "src/components/ModelCard.tsx", "groundtruth_start_lineno": 118, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 119, "task_id": "project_cc_typescript/295" }
{ "list": [ { "filename": "src/pages/_navbar.tsx", "retrieved_chunk": " >\n <GitHubIcon />\n </a>\n </div>\n </div>\n </div>\n );\n}", "score": 32.001329020765546 }, { "filename": "src/pages/_footer.tsx", "retrieved_chunk": " ...
<GitHubIcon />{" "}
{ "list": [ { "filename": "src/components/StableDiffusion.tsx", "retrieved_chunk": "import NextImage from \"next/image\";\nimport Card from \"./Card\";\nimport EmptyMessage from \"./EmptyMessage\";\ninterface StableDiffusionButtonGroupProps {\n setActiveTab: (tab: string) => void;\n activeTab: strin...
import { DocumentDuplicateIcon as CopyIcon, InformationCircleIcon as InfoIcon, } from "@heroicons/react/24/outline"; import va from "@vercel/analytics"; import { PropsWithChildren, useCallback, useEffect, useMemo, useState, } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlight...
case "js": return model.jsCode; case "curl": return model.curlCode; } }, [activeTab, model]); return ( <dialog className={modalClassName.join(" ")}> <div className="modal-box max-w-full w-2/4"> <div className="prose w-full max-w-full"> <h3>{model.name}</...
{ "context_start_lineno": 0, "file": "src/components/ModelCard.tsx", "groundtruth_start_lineno": 61, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 62, "task_id": "project_cc_typescript/291" }
{ "list": [ { "filename": "src/components/StableDiffusion.tsx", "retrieved_chunk": " const { setActiveTab, activeTab } = props;\n const tabClass = (tabName: string) =>\n props.activeTab === tabName ? \"btn-primary\" : \"\";\n return (\n <div className=\"max-md:px-2 flex container mx-auto pt-8...
return model.pythonCode;
{ "list": [ { "filename": "src/components/Card.tsx", "retrieved_chunk": "import { PropsWithChildren } from \"react\";\nexport interface CardProps {\n classNames?: string;\n title?: string;\n}\nexport default function Card(props: PropsWithChildren<CardProps>) {\n return (\n <div\n className=...
import { DocumentDuplicateIcon as CopyIcon, InformationCircleIcon as InfoIcon, } from "@heroicons/react/24/outline"; import va from "@vercel/analytics"; import { PropsWithChildren, useCallback, useEffect, useMemo, useState, } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlight...
}, [model.apiEndpoint]); const selectOnClick = useCallback( (event: React.MouseEvent<HTMLInputElement>) => { event.currentTarget.select(); }, [] ); const isTabSelected = useCallback( (tab: Tabs) => { return activeTab === tab ? "tab-active" : ""; }, [activeTab] ); const...
{ "context_start_lineno": 0, "file": "src/components/ModelCard.tsx", "groundtruth_start_lineno": 42, "repository": "fal-ai-edit-anything-app-4e32d65", "right_context_start_lineno": 43, "task_id": "project_cc_typescript/290" }
{ "list": [ { "filename": "src/components/Card.tsx", "retrieved_chunk": " }`}\n >\n <div className=\"card-body p-4 md:p-8\">\n {props.title && (\n <h3 className=\"card-title text-sm md:text-lg font-light uppercase opacity-60 mt-0\">\n {props.title}\n </...
navigator.clipboard.writeText(model.apiEndpoint);
{ "list": [ { "filename": "src/server/db.ts", "retrieved_chunk": "import { PrismaClient } from \"@prisma/client\";\nimport { env } from \"~/env.mjs\";\nconst globalForPrisma = globalThis as unknown as {\n prisma: PrismaClient | undefined;\n};\nexport const prisma =\n globalForPrisma.prisma ??\n new...
import { type GetServerSidePropsContext } from "next"; import { getServerSession, type NextAuthOptions, type DefaultSession, } from "next-auth"; import GoogleProvider from "next-auth/providers/google"; import EmailProvider from "next-auth/providers/email"; import { PrismaAdapter } from "@next-auth/prisma-adapter"...
clientId: env.GOOGLE_CLIENT_ID, clientSecret: env.GOOGLE_CLIENT_SECRET, }), /** * ...add more providers here. * * Most other providers require a bit more work than the Discord provider. For example, the * GitHub provider requires you to add the `refresh_token_expires_in` field t...
{ "context_start_lineno": 0, "file": "src/server/auth.ts", "groundtruth_start_lineno": 59, "repository": "hackathon-ufrt-gptnotes-e185e8c", "right_context_start_lineno": 62, "task_id": "project_cc_typescript/277" }
{ "list": [ { "filename": "src/pages/api/trpc/[trpc].ts", "retrieved_chunk": " ? ({ path, error }) => {\n console.error(\n `❌ tRPC failed on ${path ?? \"<no-path>\"}: ${error.message}`\n );\n }\n : undefined,\n});", "score": 19.563728094040833 },...
from: env.EMAIL_FROM }), GoogleProvider({
{ "list": [ { "filename": "src/heterogeneous/heterogeneous-union-validator.ts", "retrieved_chunk": " }\n return Value.Check(this.schema.anyOf[indexOrError], value);\n }\n /** @inheritdoc */\n override errors(value: Readonly<unknown>): Iterable<ValueError> {\n const indexOrError = this.find...
import { TObject, TUnion } from '@sinclair/typebox'; import { Value, ValueError } from '@sinclair/typebox/value'; import { TypeCompiler } from '@sinclair/typebox/compiler'; import { AbstractTypedUnionValidator } from './abstract-typed-union-validator'; import { createErrorsIterable, createUnionTypeError, createU...
} protected override assertReturningSchema( value: Readonly<unknown>, overallError?: string ): TObject { const indexOrError = this.compiledFindSchemaMemberIndexOrError(value); if (typeof indexOrError !== 'number') { throwInvalidAssert(overallError, indexOrError); } const memberSche...
{ "context_start_lineno": 0, "file": "src/abstract/abstract-compiling-typed-union-validator.ts", "groundtruth_start_lineno": 43, "repository": "jtlapp-typebox-validators-0a2721a", "right_context_start_lineno": 45, "task_id": "project_cc_typescript/299" }
{ "list": [ { "filename": "src/heterogeneous/heterogeneous-union-validator.ts", "retrieved_chunk": " return createErrorsIterable(Value.Errors(schema, value));\n }\n override assertReturningSchema(\n value: Readonly<unknown>,\n overallError?: string\n ): TObject {\n const indexOrError = ...
Value.Errors(this.schema.anyOf[indexOrError], value) );
{ "list": [ { "filename": "src/pages/index.tsx", "retrieved_chunk": " </h1>\n {sessionData &&\n <div className=\"flex h-full w-full flex-col gap-5 md:h-128 md:flex-row-reverse\">\n <TodoBox />\n <SelectPageWrapper />\n </div>\n ...
import { TextInput } from "~/components/basic/TextInput"; import { useEffect, useRef, useState } from "react"; import { api } from "~/utils/api"; import { toast } from "react-toastify"; import { Message } from "~/components/chat/Message"; export function ChatBox() { const [message, setMessage] = useState(""); con...
<div className="h-0 w-0" ref={messagesEndRef} /> </div> <form className="flex w-full" onSubmit={onSubmit}> <TextInput placeholder="Message" value={message} setValue={setMessage} /> <button className="h-8 w-20" type="submit">Send</button> </form> </div> ); }
{ "context_start_lineno": 0, "file": "src/components/chat/ChatBox.tsx", "groundtruth_start_lineno": 78, "repository": "hackathon-ufrt-gptnotes-e185e8c", "right_context_start_lineno": 80, "task_id": "project_cc_typescript/261" }
{ "list": [ { "filename": "src/pages/index.tsx", "retrieved_chunk": " </div>\n </main>\n </>\n );\n};\nexport default Home;\nconst AuthShowcase: React.FC = () => {\n const { data: sessionData } = useSession();\n return (\n <div className=\"flex flex-col items-center justify-center...
Message message={message} key={index} /> ))}
{ "list": [ { "filename": "src/server/api/routers/character.ts", "retrieved_chunk": " .mutation(({ input, ctx }) => {\n return ctx.prisma.user.update({\n where: {\n id: ctx.session.user.id,\n },\n data: {\n activeCharacterId: input.id,\n },\n ...
import { type GetServerSidePropsContext } from "next"; import { getServerSession, type NextAuthOptions, type DefaultSession, } from "next-auth"; import GoogleProvider from "next-auth/providers/google"; import EmailProvider from "next-auth/providers/email"; import { PrismaAdapter } from "@next-auth/prisma-adapter"...
server: { host: env.EMAIL_SERVER_HOST, port: env.EMAIL_SERVER_PORT, auth: { user: env.EMAIL_SERVER_USER, pass: env.EMAIL_SERVER_PASSWORD } }, from: env.EMAIL_FROM }), GoogleProvider({ clientId: env.GOOGLE_CLIENT_ID, clientSecret:...
{ "context_start_lineno": 0, "file": "src/server/auth.ts", "groundtruth_start_lineno": 48, "repository": "hackathon-ufrt-gptnotes-e185e8c", "right_context_start_lineno": 51, "task_id": "project_cc_typescript/257" }
{ "list": [ { "filename": "src/server/api/routers/message.ts", "retrieved_chunk": " where: {\n authorId: ctx.session.user.id,\n },\n });\n }),\n});", "score": 20.540409674433835 }, { "filename": "src/server/api/trpc.ts", "retrieved_chunk": " * If you want...
adapter: PrismaAdapter(prisma), providers: [ EmailProvider({
{ "list": [ { "filename": "src/pages/api/trpc/[trpc].ts", "retrieved_chunk": "import { createNextApiHandler } from \"@trpc/server/adapters/next\";\nimport { env } from \"~/env.mjs\";\nimport { createTRPCContext } from \"~/server/api/trpc\";\nimport { appRouter } from \"~/server/api/root\";\n// export ...
import { type GetServerSidePropsContext } from "next"; import { getServerSession, type NextAuthOptions, type DefaultSession, } from "next-auth"; import GoogleProvider from "next-auth/providers/google"; import EmailProvider from "next-auth/providers/email"; import { PrismaAdapter } from "@next-auth/prisma-adapter"...
user: env.EMAIL_SERVER_USER, pass: env.EMAIL_SERVER_PASSWORD } }, from: env.EMAIL_FROM }), GoogleProvider({ clientId: env.GOOGLE_CLIENT_ID, clientSecret: env.GOOGLE_CLIENT_SECRET, }), /** * ...add more providers here. * * Most other pro...
{ "context_start_lineno": 0, "file": "src/server/auth.ts", "groundtruth_start_lineno": 52, "repository": "hackathon-ufrt-gptnotes-e185e8c", "right_context_start_lineno": 55, "task_id": "project_cc_typescript/258" }
{ "list": [ { "filename": "src/server/api/routers/character.ts", "retrieved_chunk": " .mutation(({ input, ctx }) => {\n return ctx.prisma.user.update({\n where: {\n id: ctx.session.user.id,\n },\n data: {\n activeCharacterId: input.id,\n },\n ...
host: env.EMAIL_SERVER_HOST, port: env.EMAIL_SERVER_PORT, auth: {