Dataset Viewer (First 5GB)
Auto-converted to Parquet
prefix
string
suffix
string
middle
string
formatted_text
string
file_path
string
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr
exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, );
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr<|fim_suffix|> exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, );
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to ente
ease Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
r your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Rel
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to ente<|fim_suffix|>ease Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>r your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Rel
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary',
const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); }
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', <|fim_suffix|> const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|> type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); }
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhance
nse', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
ments', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API respo
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhance<|fim_suffix|>nse', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>ments', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API respo
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead
}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead<|fim_suffix|>}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, },
`./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
{ name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath =
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, <|fim_suffix|>`./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>{ name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath =
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an atte
.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
mpt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an atte<|fim_suffix|>.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>mpt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (exis
othing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
tsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If n
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (exis<|fim_suffix|>othing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>tsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If n
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) {
'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error(
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-release-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) {<|fim_suffix|> 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|> return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error(
bin/release-note-generator.ts
import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-releas
ng-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type}
e-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcomi
<|fim_prefix|>import { exec } from 'node:child_process'; import { existsSync, writeFile } from 'node:fs'; import { exit } from 'node:process'; import prompts from 'prompts'; async function run() { const username = await execAsync( // eslint-disable-next-line rulesdir/typography "gh api user --jq '.login'", 'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.', ); const activePr = await getActivePr(username); if (activePr) { console.log( `Found potentially matching PR ${activePr.number}: ${activePr.title}`, ); } const prNumber = activePr?.number ?? (await getNextPrNumber()); const result = await prompts([ { name: 'githubUsername', message: 'Comma-separated GitHub username(s)', type: 'text', initial: username, }, { name: 'pullRequestNumber', message: 'PR Number', type: 'number', initial: prNumber, }, { name: 'releaseNoteType', message: 'Release Note Type', type: 'select', choices: [ { title: '✨ Features', value: 'Features' }, { title: '👍 Enhancements', value: 'Enhancements' }, { title: '🐛 Bugfix', value: 'Bugfix' }, { title: '⚙️ Maintenance', value: 'Maintenance' }, ], }, { name: 'oneLineSummary', message: 'Brief Summary', type: 'text', initial: activePr?.title, }, ]); if ( !result.githubUsername || !result.oneLineSummary || !result.releaseNoteType ) { console.log('All questions must be answered. Exiting'); exit(1); } const fileContents = getFileContents( result.releaseNoteType, result.githubUsername, result.oneLineSummary, ); const filepath = `./upcoming-releas<|fim_suffix|>ng-release-notes/${prNumber}.md`, ); } }); } // makes an attempt to find an existing open PR from <username>:<branch> async function getActivePr( username: string, ): Promise<{ number: number; title: string } | undefined> { if (!username) { return undefined; } const branchName = await execAsync('git rev-parse --abbrev-ref HEAD'); if (!branchName) { return undefined; } const forkHead = `${username}:${branchName}`; return getPrNumberFromHead(forkHead); } async function getPrNumberFromHead( head: string, ): Promise<{ number: number; title: string } | undefined> { try { // head is a weird query parameter in this API call. If nothing matches, it // will return as if the head query parameter doesn't exist. To get around // this, we make the page size 2 and only return the number if the length. const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/pulls?state=open&per_page=2&head=' + head, ); if (!resp.ok) { console.warn('error fetching from github pulls api:', resp.status); return undefined; } const ghResponse = await resp.json(); if (ghResponse?.length === 1) { return ghResponse[0]; } else { return undefined; } } catch (e) { console.warn('error fetching from github pulls api:', e); } } async function getNextPrNumber(): Promise<number> { try { const resp = await fetch( 'https://api.github.com/repos/actualbudget/actual/issues?state=all&per_page=1', ); if (!resp.ok) { throw new Error(`API responded with status: ${resp.status}`); } const ghResponse = await resp.json(); const latestPrNumber = ghResponse?.[0]?.number; if (!latestPrNumber) { console.error( 'Could not find latest issue number in GitHub API response', ghResponse, ); exit(1); } return latestPrNumber + 1; } catch (error) { console.error('Failed to fetch next PR number:', error); exit(1); } } function getFileContents(type: string, username: string, summary: string) { return `--- category: ${type} <|fim_middle|>e-notes/${prNumber}.md`; if (existsSync(filepath)) { const { confirm } = await prompts({ name: 'confirm', type: 'confirm', message: `This will overwrite the existing release note ${filepath} Are you sure?`, }); if (!confirm) { console.log('Exiting'); exit(1); } } writeFile(filepath, fileContents, err => { if (err) { console.error('Failed to write release note file:', err); exit(1); } else { console.log( `Release note generated successfully: ./upcomi
bin/release-note-generator.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetc
alApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
h').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actu
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetc<|fim_suffix|>alApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>h').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actu
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globa
rt async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
lThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } expo
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globa<|fim_suffix|>rt async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>lThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } expo
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; e
return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
xport * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => {
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; e<|fim_suffix|> return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>xport * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => {
packages/api/index.ts
import t
}; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
ype { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>;
<|fim_prefix|>import t<|fim_suffix|> }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>ype { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>;
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (ac
etch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
tualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: f
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (ac<|fim_suffix|>etch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>tualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: f
packages/api/index.ts
import type { RequestInfo as FetchIn
as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
fo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), )
<|fim_prefix|>import type { RequestInfo as FetchIn<|fim_suffix|> as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>fo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), )
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as
function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as <|fim_suffix|> function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions impor
rsion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
t * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVe
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions impor<|fim_suffix|>rsion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>t * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVe
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then((
await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
{ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) {
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then((<|fim_suffix|>await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>{ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.lib; } export async function shutdown() { if (actualApp) {
packages/api/index.ts
import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit
lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } }
), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.
<|fim_prefix|>import type { RequestInfo as FetchInfo, RequestInit as FetchInit, } from 'node-fetch'; // loot-core types import type { InitConfig } from 'loot-core/server/main'; // @ts-ignore: bundle not available until we build it // eslint-disable-next-line import/extensions import * as bundle from './app/bundle.api.js'; import * as injected from './injected'; import { validateNodeVersion } from './validateNodeVersion'; let actualApp: null | typeof bundle.lib; export const internal = bundle.lib; export * from './methods'; export * as utils from './utils'; export async function init(config: InitConfig = {}) { if (actualApp) { return; } validateNodeVersion(); if (!globalThis.fetch) { globalThis.fetch = (url: URL | RequestInfo, init?: RequestInit) => { return import('node-fetch').then(({ default: fetch }) => fetch(url as unknown as FetchInfo, init as unknown as FetchInit<|fim_suffix|>lib; } export async function shutdown() { if (actualApp) { await actualApp.send('sync'); await actualApp.send('close-budget'); actualApp = null; } } <|fim_middle|>), ) as unknown as Promise<Response>; }; } await bundle.init(config); actualApp = bundle.lib; injected.override(bundle.lib.send); return bundle.
packages/api/index.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export func
} export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
tion deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields });
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export func<|fim_suffix|>} export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>tion deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields });
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) {
port function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } ex
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { <|fim_suffix|>port function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|> return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } ex
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month
nsferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, tra
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month<|fim_suffix|>nsferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, tra
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportT
alBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
ransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initi
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportT<|fim_suffix|>alBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>ransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initi
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId,
function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId,<|fim_suffix|> function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|> startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password?
on deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
} = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export functi
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? <|fim_suffix|>on deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>} = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export functi
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as
accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', {
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as <|fim_suffix|>accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create', { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', {
packages/api/methods.ts
// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create
{ group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t
', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create',
<|fim_prefix|>// @ts-strict-ignore import type { Handlers } from 'loot-core/types/handlers'; import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction'; import * as injected from './injected'; export { q } from './app/query'; function send<K extends keyof Handlers, T extends Handlers[K]>( name: K, args?: Parameters<T>[0], ): Promise<Awaited<ReturnType<T>>> { return injected.send(name, args); } export async function runImport(name, func) { await send('api/start-import', { budgetName: name }); try { await func(); } catch (e) { await send('api/abort-import'); throw e; } await send('api/finish-import'); } export async function loadBudget(budgetId) { return send('api/load-budget', { id: budgetId }); } export async function downloadBudget(syncId, { password }: { password? } = {}) { return send('api/download-budget', { syncId, password }); } export async function getBudgets() { return send('api/get-budgets'); } export async function sync() { return send('api/sync'); } export async function runBankSync(args?: { accountId: string }) { return send('api/bank-sync', args); } export async function batchBudgetUpdates(func) { await send('api/batch-budget-start'); try { await func(); } finally { await send('api/batch-budget-end'); } } /** * @deprecated Please use `aqlQuery` instead. * This function will be removed in a future release. */ export function runQuery(query) { return send('api/query', { query: query.serialize() }); } export function aqlQuery(query) { return send('api/query', { query: query.serialize() }); } export function getBudgetMonths() { return send('api/budget-months'); } export function getBudgetMonth(month) { return send('api/budget-month', { month }); } export function setBudgetAmount(month, categoryId, value) { return send('api/budget-set-amount', { month, categoryId, amount: value }); } export function setBudgetCarryover(month, categoryId, flag) { return send('api/budget-set-carryover', { month, categoryId, flag }); } export function addTransactions( accountId, transactions, { learnCategories = false, runTransfers = false } = {}, ) { return send('api/transactions-add', { accountId, transactions, learnCategories, runTransfers, }); } export interface ImportTransactionsOpts { defaultCleared?: boolean; } export function importTransactions( accountId: string, transactions: ImportTransactionEntity[], opts: ImportTransactionsOpts = { defaultCleared: true, }, ) { return send('api/transactions-import', { accountId, transactions, opts, }); } export function getTransactions(accountId, startDate, endDate) { return send('api/transactions-get', { accountId, startDate, endDate }); } export function updateTransaction(id, fields) { return send('api/transaction-update', { id, fields }); } export function deleteTransaction(id) { return send('api/transaction-delete', { id }); } export function getAccounts() { return send('api/accounts-get'); } export function createAccount(account, initialBalance?) { return send('api/account-create<|fim_suffix|> { group }); } export function updateCategoryGroup(id, fields) { return send('api/category-group-update', { id, fields }); } export function deleteCategoryGroup(id, transferCategoryId?) { return send('api/category-group-delete', { id, transferCategoryId }); } export function getCategories() { return send('api/categories-get', { grouped: false }); } export function createCategory(category) { return send('api/category-create', { category }); } export function updateCategory(id, fields) { return send('api/category-update', { id, fields }); } export function deleteCategory(id, t<|fim_middle|>', { account, initialBalance }); } export function updateAccount(id, fields) { return send('api/account-update', { id, fields }); } export function closeAccount(id, transferAccountId?, transferCategoryId?) { return send('api/account-close', { id, transferAccountId, transferCategoryId, }); } export function reopenAccount(id) { return send('api/account-reopen', { id }); } export function deleteAccount(id) { return send('api/account-delete', { id }); } export function getAccountBalance(id, cutoff?) { return send('api/account-balance', { id, cutoff }); } export function getCategoryGroups() { return send('api/category-groups-get'); } export function createCategoryGroup(group) { return send('api/category-group-create',
packages/api/methods.ts
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
10