Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
db5089c
* update envd spec & generate for js-sdk
0div Apr 1, 2025
aeed7eb
Merge branch 'main' into recursive-files-list-in-the-sdk-e2b-1902_2
0div Apr 3, 2025
8e9ea77
* create Docker image with all the pinned deps needed to codegen
0div Apr 4, 2025
66d213a
Merge branch 'main' into make-codegen-deterministic-for-sdks-e2b-1969
0div Apr 4, 2025
181cd51
:wMerge branch 'main' of https://github.com/e2b-dev/E2B into recursiv…
0div Apr 4, 2025
7f3bff9
Merge branch 'make-codegen-deterministic-for-sdks-e2b-1969' into recu…
0div Apr 4, 2025
6355298
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 14, 2025
5bc4622
add depth param to file list in python-sdk sync and async and update …
0div Apr 14, 2025
14347a3
updated codegen
0div Apr 14, 2025
fe3a2f6
remove dev test file
0div Apr 14, 2025
f57fdeb
update js-sdk tests to loop and test -1 depth
0div Apr 14, 2025
427822c
update python-sdk tests to loop and assert throw for depth out of range
0div Apr 14, 2025
4c2c99f
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 16, 2025
d9349f6
extend FilesystemOpts to include optional depth
0div Apr 16, 2025
13612cb
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 17, 2025
8796734
js-sdk: make depth seperate param; better error message; update tests
0div Apr 17, 2025
d489712
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 18, 2025
c588a36
extend FilesystemListOpts
mishushakov Apr 21, 2025
c6230c1
Merge branch 'main' into recursive-files-list-in-the-sdk-e2b-1902_2
0div Apr 21, 2025
7fbccd5
split files list test (js)
mishushakov Apr 21, 2025
b831a64
split files.list tests (py)
mishushakov Apr 21, 2025
0a7ae10
rm next test
0div Apr 21, 2025
838d694
python-sdk: return InvalidArgument for negative depth and update tests
0div Apr 21, 2025
2cfc52e
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 28, 2025
9e0e769
add full paths in python-sdk list tests
0div Apr 28, 2025
c984a46
update depthp param validation and tests in js-sdk
0div Apr 28, 2025
765e054
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div Apr 29, 2025
ea21f65
add missing argument error and tests
0div Apr 30, 2025
0495b8a
[boyscouting] remove unintented api_ref dir in root folder
0div Apr 30, 2025
24a2af4
Merge branch 'main' of https://github.com/e2b-dev/E2B into recursive-…
0div May 1, 2025
bedb5d6
distinguish between path and name and fix js-sdk tests
0div May 1, 2025
71d0a3f
remove logs from test
0div May 1, 2025
e2aed07
add type, name and path assertiosn in python-sdk tests
0div May 1, 2025
c70317d
fix js-sdk test 502 from cleanup function
0div May 1, 2025
d7f859c
Merge branch 'main' into recursive-files-list-in-the-sdk-e2b-1902_2
0div May 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed api_ref/sandbox_sync.mdx
Empty file.
7 changes: 6 additions & 1 deletion packages/js-sdk/src/envd/filesystem/filesystem_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file filesystem/filesystem.proto.
*/
export const file_filesystem_filesystem: GenFile = /*@__PURE__*/
fileDesc("ChtmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0ucHJvdG8SCmZpbGVzeXN0ZW0iMgoLTW92ZVJlcXVlc3QSDgoGc291cmNlGAEgASgJEhMKC2Rlc3RpbmF0aW9uGAIgASgJIjQKDE1vdmVSZXNwb25zZRIkCgVlbnRyeRgBIAEoCzIVLmZpbGVzeXN0ZW0uRW50cnlJbmZvIh4KDk1ha2VEaXJSZXF1ZXN0EgwKBHBhdGgYASABKAkiNwoPTWFrZURpclJlc3BvbnNlEiQKBWVudHJ5GAEgASgLMhUuZmlsZXN5c3RlbS5FbnRyeUluZm8iHQoNUmVtb3ZlUmV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iQuZmlsZXN5c3RlbS5HZXRXYXRjaGVyRXZlbnRzUmVzcG9uc2USVAoNUmVtb3ZlV2F0Y2hlchIgLmZpbGVzeXN0ZW0uUmVtb3ZlV2F0Y2hlclJlcXVlc3QaIS5maWxlc3lzdGVtLlJlbW92ZVdhdGNoZXJSZXNwb25zZUJpCg5jb20uZmlsZXN5c3RlbUIPRmlsZXN5c3RlbVByb3RvUAGiAgNGWFiqAgpGaWxlc3lzdGVtygIKRmlsZXN5c3RlbeICFkZpbGVzeXN0ZW1cR1BCTWV0YWRhdGHqAgpGaWxlc3lzdGVtYgZwcm90bzM");

/**
* @generated from message filesystem.MoveRequest
Expand Down Expand Up @@ -184,6 +184,11 @@ export type ListDirRequest = Message<"filesystem.ListDirRequest"> & {
* @generated from field: string path = 1;
*/
path: string;

/**
* @generated from field: uint32 depth = 2;
*/
depth: number;
};

/**
Expand Down
20 changes: 17 additions & 3 deletions packages/js-sdk/src/sandbox/filesystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { FilesystemEvent, WatchHandle } from './watchHandle'

import { compareVersions } from 'compare-versions'
import { TemplateError } from '../../errors'
import { InvalidArgumentError, TemplateError } from '../../errors'
import { ENVD_VERSION_RECURSIVE_WATCH } from '../../envd/versions'

/**
Expand Down Expand Up @@ -87,6 +87,13 @@ export interface FilesystemRequestOpts
user?: Username
}

export interface FilesystemListOpts extends FilesystemRequestOpts {
/**
* Depth of the directory to list.
*/
depth?: number
}

/**
* Options for watching a directory.
*/
Expand Down Expand Up @@ -339,10 +346,17 @@ export class Filesystem {
*
* @returns list of entries in the sandbox filesystem directory.
*/
async list(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo[]> {
async list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo[]> {
if (typeof opts?.depth === 'number' && opts.depth < 1) {
throw new InvalidArgumentError('depth should be at least one')
}

try {
const res = await this.rpc.listDir(
{ path },
{
path,
depth: opts?.depth ?? 1,
Comment thread
0div marked this conversation as resolved.
},
{
headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
Expand Down
126 changes: 112 additions & 14 deletions packages/js-sdk/tests/sandbox/files/list.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,121 @@
import { assert } from 'vitest'
import { assert, onTestFinished } from 'vitest'

import { sandboxTest } from '../../setup.js'
import { sandboxTest, wait } from '../../setup.js'

const parentDirName = 'test_directory'

sandboxTest('list directory', async ({ sandbox }) => {
const dirName = 'test_directory4'
const homeDirName = '/home/user'
await sandbox.files.makeDir(parentDirName)
await sandbox.files.makeDir(`${parentDirName}/subdir1`)
await sandbox.files.makeDir(`${parentDirName}/subdir2`)
await sandbox.files.makeDir(`${parentDirName}/subdir1/subdir1_1`)
await sandbox.files.makeDir(`${parentDirName}/subdir1/subdir1_2`)
await sandbox.files.makeDir(`${parentDirName}/subdir2/subdir2_1`)
await sandbox.files.makeDir(`${parentDirName}/subdir2/subdir2_2`)
Comment thread
0div marked this conversation as resolved.
await sandbox.files.write(`${parentDirName}/file1.txt`, 'Hello, world!')

await sandbox.files.makeDir(dirName)
const testCases = [
{
test_name: 'default depth (1)',
depth: undefined,
expectedLen: 3,
expectedFileNames: ['file1.txt', 'subdir1', 'subdir2'],
expectedFileTypes: ['file', 'dir', 'dir'],
expectedFilePaths: [
`${homeDirName}/${parentDirName}/file1.txt`,
`${homeDirName}/${parentDirName}/subdir1`,
`${homeDirName}/${parentDirName}/subdir2`,
],
},
{
test_name: 'explicit depth 1',
depth: 1,
expectedLen: 3,
expectedFileNames: ['file1.txt', 'subdir1', 'subdir2'],
expectedFileTypes: ['file', 'dir', 'dir'],
expectedFilePaths: [
`${homeDirName}/${parentDirName}/file1.txt`,
`${homeDirName}/${parentDirName}/subdir1`,
`${homeDirName}/${parentDirName}/subdir2`,
],
},
{
test_name: 'explicit depth 2',
depth: 2,
expectedLen: 7,
expectedFileTypes: ['file', 'dir', 'dir', 'dir', 'dir', 'dir', 'dir'],
expectedFileNames: [
'file1.txt',
'subdir1',
'subdir1_1',
'subdir1_2',
'subdir2',
'subdir2_1',
'subdir2_2',
],
expectedFilePaths: [
`${homeDirName}/${parentDirName}/file1.txt`,
`${homeDirName}/${parentDirName}/subdir1`,
`${homeDirName}/${parentDirName}/subdir1/subdir1_1`,
`${homeDirName}/${parentDirName}/subdir1/subdir1_2`,
`${homeDirName}/${parentDirName}/subdir2`,
`${homeDirName}/${parentDirName}/subdir2/subdir2_1`,
`${homeDirName}/${parentDirName}/subdir2/subdir2_2`,
],
},
{
test_name: 'explicit depth 3 (should be the same as depth 2)',
depth: 3,
expectedLen: 7,
expectedFileTypes: ['file', 'dir', 'dir', 'dir', 'dir', 'dir', 'dir'],
expectedFileNames: [
'file1.txt',
'subdir1',
'subdir1_1',
'subdir1_2',
'subdir2',
'subdir2_1',
'subdir2_2',
],
expectedFilePaths: [
`${homeDirName}/${parentDirName}/file1.txt`,
`${homeDirName}/${parentDirName}/subdir1`,
`${homeDirName}/${parentDirName}/subdir1/subdir1_1`,
`${homeDirName}/${parentDirName}/subdir1/subdir1_2`,
`${homeDirName}/${parentDirName}/subdir2`,
`${homeDirName}/${parentDirName}/subdir2/subdir2_1`,
`${homeDirName}/${parentDirName}/subdir2/subdir2_2`,
],
},
]

const files = await sandbox.files.list(dirName)
assert.equal(files.length, 0)
for (const testCase of testCases) {
const files = await sandbox.files.list(
parentDirName,
testCase.depth !== undefined ? { depth: testCase.depth } : undefined
)
assert.equal(files.length, testCase.expectedLen)

await sandbox.files.write('test_directory4/test_file', 'test')
for (let i = 0; i < testCase.expectedFilePaths.length; i++) {
assert.equal(files[i].type, testCase.expectedFileTypes[i])
assert.equal(files[i].name, testCase.expectedFileNames[i])
assert.equal(files[i].path, testCase.expectedFilePaths[i])
}
}
})

const files1 = await sandbox.files.list(dirName)
assert.equal(files1.length, 1)
assert.equal(files1[0].name, 'test_file')
assert.equal(files1[0].type, 'file')
assert.equal(files1[0].path, `/home/user/${dirName}/test_file`)
sandboxTest('list directory with invalid depth', async ({ sandbox }) => {
await sandbox.files.makeDir(parentDirName)

const exists = await sandbox.files.exists(dirName)
assert.isTrue(exists)
try {
await sandbox.files.list(parentDirName, { depth: -1 })
assert.fail('Expected error but none was thrown')
} catch (err) {
const expectedErrorMessage = 'depth should be at least one'
assert.ok(
err.message.includes(expectedErrorMessage),
`expected error message to include "${expectedErrorMessage}"`
)
}
})
Loading