Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions src/resources/blueprints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function validateFileMounts(fileMounts?: { [key: string]: string } | null): Arra
const over = sizeBytes - FILE_MOUNT_MAX_SIZE_BYTES;
errors.push(
`file_mount '${mountPath}' is ${formatBytes(over)} over the limit (` +
`${formatBytes(sizeBytes)} / ${formatBytes(FILE_MOUNT_MAX_SIZE_BYTES)}). Use object_mounts instead.`,
`${formatBytes(sizeBytes)} / ${formatBytes(
FILE_MOUNT_MAX_SIZE_BYTES,
)}). Use object_mounts instead.`,
);
}
totalSizeBytes += sizeBytes;
Expand All @@ -66,7 +68,9 @@ function validateFileMounts(fileMounts?: { [key: string]: string } | null): Arra
const totalOver = totalSizeBytes - FILE_MOUNT_TOTAL_MAX_SIZE_BYTES;
errors.push(
`total file_mounts size is ${formatBytes(totalOver)} over the limit (` +
`${formatBytes(totalSizeBytes)} / ${formatBytes(FILE_MOUNT_TOTAL_MAX_SIZE_BYTES)}). Use object_mounts instead.`,
`${formatBytes(totalSizeBytes)} / ${formatBytes(
FILE_MOUNT_TOTAL_MAX_SIZE_BYTES,
)}). Use object_mounts instead.`,
);
}

Expand Down
13 changes: 1 addition & 12 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,18 +595,6 @@ export class StorageObjectOps {
}
}

// @deprecated Use {@link RunloopSDK} instead.
/**
* @deprecated Use {@link RunloopSDK} instead.
* @example
* ```typescript
* import { RunloopSDK } from '@runloop/api-client';
* const sdk = new RunloopSDK();
* const devbox = await sdk.devbox.create({ name: 'my-devbox' });
* ```
*/
export default Runloop;

export declare namespace RunloopSDK {
export {
RunloopSDK as Client,
Expand All @@ -620,6 +608,7 @@ export declare namespace RunloopSDK {
StorageObject as StorageObject,
};
}

// Export SDK classes from sdk/sdk.ts - these are separate from RunloopSDK to avoid circular dependencies
export {
Devbox,
Expand Down
13 changes: 8 additions & 5 deletions src/sdk/storage-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
ObjectDownloadURLView,
ObjectListParams,
} from '../resources/objects';
import { fetch } from '../_shims/index';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import * as tar from 'tar';
Expand Down Expand Up @@ -312,7 +313,7 @@ export class StorageObject {
try {
const response = await fetch(uploadUrl, {
method: 'PUT',
body: new Blob([text]),
body: text,
});

if (!response.ok) {
Expand Down Expand Up @@ -387,7 +388,7 @@ export class StorageObject {
try {
const response = await fetch(uploadUrl, {
method: 'PUT',
body: new Blob([buffer]),
body: buffer,
});

if (!response.ok) {
Expand Down Expand Up @@ -430,14 +431,16 @@ export class StorageObject {
let buffer;
try {
const tarStream = tar.create({ gzip: true, cwd: dirPath }, ['.']);
const chunks = [];
const chunks: Buffer[] = [];
for await (const chunk of tarStream) {
chunks.push(chunk);
}
buffer = Buffer.concat(chunks);
buffer = Buffer.concat(chunks as readonly Uint8Array[]);
} catch (error) {
throw new Error(
`Failed to create tarball from directory ${dirPath}: ${error instanceof Error ? error.message : 'Unknown error'}`,
`Failed to create tarball from directory ${dirPath}: ${
error instanceof Error ? error.message : 'Unknown error'
}`,
);
}

Expand Down
4 changes: 1 addition & 3 deletions src/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
}
} else {
throw new Error(
`Unexpected data type: ${typeof value}; constructor: ${
value?.constructor?.name
}; props: ${propsForError(value)}`,
`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/api-resources/agents.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Runloop from '@runloop/api-client';
import { Runloop } from '@runloop/api-client';
import { Response } from 'node-fetch';

const client = new Runloop({
Expand Down
4 changes: 2 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ describe('retries', () => {
let count = 0;
const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise<Response> => {
if (count++ === 0) {
return new Promise((resolve, reject) =>
signal?.addEventListener('abort', () => reject(new Error('timed out'))),
return new Promise(
(resolve, reject) => signal?.addEventListener('abort', () => reject(new Error('timed out'))),
);
}
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/streaming-reconnection.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReadableStream, ReadableStreamDefaultController } from 'stream/web';
import { APIError } from '../../src/error';
import { withStreamAutoReconnect } from '../../src/lib/streaming-reconnection';
import { Stream } from '../../src/streaming';
Expand Down Expand Up @@ -37,7 +38,7 @@ function createStreamFactory(
let lastDeliveredOffset = offset ?? 0;

const readable = new ReadableStream<Uint8Array>({
async pull(controller) {
async pull(controller: ReadableStreamDefaultController<Uint8Array>) {
const trigger = takeTrigger(lastDeliveredOffset);
if (trigger) {
controller.error(trigger.error ?? new Error('Synthetic failure'));
Expand Down Expand Up @@ -220,7 +221,7 @@ describe('withStreamAutoReconnect', () => {
creatorCalls += 1;
const abortController = new AbortController();
const readable = new ReadableStream<Uint8Array>({
pull(controller) {
pull(controller: ReadableStreamDefaultController<Uint8Array>) {
controller.error(error);
},
cancel() {
Expand Down
Loading
Loading