Skip to content

Commit 4c3eab1

Browse files
authored
Export parquetDataSource (#377)
* Move parquet-squirreling integration to src/lib/parquet * Convert parquet integration to TypeScript * Update dependencies
1 parent a17fc41 commit 4c3eab1

File tree

14 files changed

+271
-235
lines changed

14 files changed

+271
-235
lines changed

.claude/commands/update-deps.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Update all npm dependencies to their latest versions.
2+
3+
## Steps
4+
5+
1. Run `npm outdated` to see what's behind.
6+
2. Update `package.json` with the latest versions, **pinned** (no `^` or `~`).
7+
3. Run `npm install` to update the lockfile.
8+
4. Run `npx tsc`, `npm run lint`, and tests `npm test`.
9+
5. If anything fails:
10+
- For **major version bumps**, research the changelog on GitHub (check the repo's CHANGELOG.md, releases page, or migration guide) to understand breaking changes.
11+
- Apply the necessary code fixes based on what you find.
12+
- Re-run tsc, lint, and tests until green.
13+
6. Summarize what was updated and any breaking changes you resolved.

bin/chat.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function sendToServer(chatInput) {
121121
async function sendMessages(messages) {
122122
/** @type {ChatInput} */
123123
const chatInput = {
124-
model: 'gpt-5',
124+
model: 'gpt-5.4',
125125
instructions,
126126
messages,
127127
reasoning: {
@@ -161,8 +161,6 @@ async function sendMessages(messages) {
161161
const { toolCall, tool } = toolResult
162162
const { call_id } = toolCall
163163
try {
164-
const output = await toolResult.result
165-
166164
// Construct function call message
167165
const args = JSON.parse(toolCall.arguments)
168166
const entries = Object.entries(args)
@@ -175,6 +173,8 @@ async function sendMessages(messages) {
175173
func += `(${pairs.join(', ')})`
176174
}
177175
write(colors.tool, `${tool.emoji} ${func}`, colors.normal, '\n')
176+
177+
const output = await toolResult.result
178178
incoming.push({ type: 'function_call_output', output, call_id })
179179
} catch (error) {
180180
const message = error instanceof Error ? error.message : String(error)

bin/tools/parquetFilter.js

Lines changed: 0 additions & 175 deletions
This file was deleted.

bin/tools/parquetSql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { asyncBufferFromFile, asyncBufferFromUrl, parquetMetadataAsync } from 'hyparquet'
22
import { compressors } from 'hyparquet-compressors'
33
import { collect, executeSql } from 'squirreling'
4-
import { parquetDataSource } from './parquetDataSource.js'
4+
import { parquetDataSource } from '../../src/index.js'
55
import { markdownTable } from './markdownTable.js'
66

77
const maxRows = 100

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,36 @@
5555
"watch:url": "NODE_ENV=development nodemon bin/cli.js https://hyperparam.blob.core.windows.net/hyperparam/starcoderdata-js-00000-of-00065.parquet"
5656
},
5757
"dependencies": {
58-
"hightable": "0.26.3",
58+
"hightable": "0.26.4",
5959
"hyparquet": "1.25.1",
6060
"hyparquet-compressors": "1.1.1",
6161
"icebird": "0.3.1",
62-
"squirreling": "0.9.4"
62+
"squirreling": "0.10.3"
6363
},
6464
"devDependencies": {
65-
"@storybook/react-vite": "10.2.13",
65+
"@storybook/react-vite": "10.2.19",
6666
"@testing-library/react": "16.3.2",
67-
"@types/node": "25.3.3",
67+
"@types/node": "25.5.0",
6868
"@types/react": "19.2.14",
6969
"@types/react-dom": "19.2.3",
7070
"@vitejs/plugin-react": "5.1.4",
71-
"@vitest/coverage-v8": "4.0.18",
71+
"@vitest/coverage-v8": "4.1.0",
7272
"eslint": "9.39.2",
7373
"eslint-plugin-react": "7.37.5",
7474
"eslint-plugin-react-hooks": "7.0.1",
7575
"eslint-plugin-react-refresh": "0.5.2",
76-
"eslint-plugin-storybook": "10.2.13",
76+
"eslint-plugin-storybook": "10.2.19",
7777
"globals": "17.4.0",
78-
"jsdom": "28.1.0",
78+
"jsdom": "29.0.0",
7979
"nodemon": "3.1.14",
8080
"npm-run-all": "4.1.5",
8181
"react": "19.2.4",
8282
"react-dom": "19.2.4",
83-
"storybook": "10.2.13",
83+
"storybook": "10.2.19",
8484
"typescript": "5.9.3",
85-
"typescript-eslint": "8.56.1",
85+
"typescript-eslint": "8.57.0",
8686
"vite": "7.3.1",
87-
"vitest": "4.0.18"
87+
"vitest": "4.1.0"
8888
},
8989
"peerDependencies": {
9090
"react": "^18.3.1 || ^19",

src/components/Folder/Folder.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { render, waitFor } from '@testing-library/react'
22
import { userEvent } from '@testing-library/user-event'
33
import { strict as assert } from 'assert'
44
import { act } from 'react'
5-
import { beforeEach, describe, expect, it, test, vi } from 'vitest'
5+
import { describe, expect, it, test, vi } from 'vitest'
66
import { Config, ConfigProvider } from '../../hooks/useConfig.js'
77
import { DirSource, FileMetadata, HyperparamFileMetadata, getHyperparamSource } from '../../lib/sources/index.js'
88
import Folder from './Folder.js'
@@ -20,12 +20,9 @@ const config: Config = {
2020
}
2121

2222
globalThis.fetch = vi.fn()
23+
globalThis.console.error = vi.fn()
2324

2425
describe('Folder Component', () => {
25-
beforeEach(() => {
26-
vi.clearAllMocks()
27-
})
28-
2926
test.for([
3027
'',
3128
'subfolder/',
@@ -85,6 +82,7 @@ describe('Folder Component', () => {
8582
await findByText('Error: ' + errorMessage)
8683
expect(queryByText('file1.txt')).toBeNull()
8784
expect(queryByText('folder1/')).toBeNull()
85+
expect(console.error).toHaveBeenCalledWith(new Error(errorMessage))
8886
})
8987

9088
it('filters files based on search query', async () => {

src/components/JsonView/JsonView.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('JsonView Component', () => {
3434
} as Response)
3535

3636
const { findAllByRole, findByText } = render(
37-
<JsonView source={source} setError={console.error} />
37+
<JsonView source={source} setError={vi.fn()} />
3838
)
3939

4040
expect(fetch).toHaveBeenCalledWith('testKey0', undefined)

src/components/Layout/Layout.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { render } from '@testing-library/react'
2-
import { describe, expect, it } from 'vitest'
2+
import { describe, expect, it, vi } from 'vitest'
33
import Layout from './Layout.js'
44

5+
globalThis.console.error = vi.fn()
6+
57
describe('Layout Component', () => {
68
it('renders children', () => {
79
const { getByText } = render(<Layout>Test Content</Layout>)
@@ -23,5 +25,6 @@ describe('Layout Component', () => {
2325
const testError = new Error('Test Error')
2426
const { getByText } = render(<Layout error={testError}>Test Content</Layout>)
2527
getByText('Error: Test Error')
28+
expect(console.error).toHaveBeenCalledWith(testError)
2629
})
2730
})

src/components/MarkdownView/MarkdownView.test.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import { render } from '@testing-library/react'
22
import { strict as assert } from 'assert'
3-
import { beforeEach, describe, expect, it, vi } from 'vitest'
3+
import { describe, expect, it, vi } from 'vitest'
44
import { getHyperparamSource } from '../../lib/sources/index.js'
55
import MarkdownView from './MarkdownView.js'
66

77
globalThis.fetch = vi.fn()
88

99
describe('MarkdownView Component', () => {
10-
beforeEach(() => {
11-
vi.clearAllMocks()
12-
// unnecessary for now because it has only one test, but safer for future tests
13-
})
14-
1510
it('renders markdown correctly', async () => {
1611
const text = '# Markdown\n\nThis is a test of the markdown viewer.'
1712
vi.mocked(fetch).mockResolvedValueOnce({
@@ -23,7 +18,7 @@ describe('MarkdownView Component', () => {
2318
assert(source?.kind === 'file')
2419

2520
const { findByText } = render(
26-
<MarkdownView source={source} setError={console.error} />
21+
<MarkdownView source={source} setError={vi.fn()} />
2722
)
2823

2924
expect(fetch).toHaveBeenCalled()

src/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export * from './sources/index.js'
33
export { parseCsv } from './csv.js'
44
export { csvDataFrame, jsonLinesDataFrame, parquetDataFrame, tableProvider } from './tableProvider.js'
55
export { asyncBufferFrom, cn, contentTypes, formatFileSize, getFileDate, getFileDateShort, imageTypes, parseFileSize } from './utils.js'
6+
export { parquetDataSource } from './parquet/parquetDataSource.js'
67
export { parquetQueryWorker, parquetReadObjectsWorker, parquetReadWorker } from './workers/parquetWorkerClient.js'
78
export type { AsyncBufferFrom } from './workers/types.js'

0 commit comments

Comments
 (0)