test public entry point exports

This commit is contained in:
Tasnim Kabir Sadik
2026-05-16 16:23:27 +06:00
parent 1f74d48576
commit b35df41f08
2 changed files with 105 additions and 62 deletions

View File

@ -1,90 +1,90 @@
export type { export type {
CapsuleCreateOptions, CapsuleCreateOptions,
CapsuleInfo, CapsuleInfo,
CapsuleMetrics, CapsuleMetrics,
CapsuleMetricsOptions, CapsuleMetricsOptions,
CapsuleResumeOptions, CapsuleResumeOptions,
WaitForReadyOptions, WaitForReadyOptions,
} from "./capsule.js"; } from "./capsule.js";
export { Capsule, Sandbox } from "./capsule.js"; export { Capsule, Sandbox } from "./capsule.js";
export type { export type {
FileUploadInput, FileUploadInput,
OperationJsonBody, OperationJsonBody,
OperationJsonResponse, OperationJsonResponse,
OperationQueryParams, OperationQueryParams,
OperationRequestOptions, OperationRequestOptions,
} from "./client.js"; } from "./client.js";
export { export {
AccountResource, AccountResource,
APIKeysResource, APIKeysResource,
AuthResource, AuthResource,
CapsulesResource, CapsulesResource,
ChannelsResource, ChannelsResource,
FilesResource, FilesResource,
HostsResource, HostsResource,
SnapshotsResource, SnapshotsResource,
TeamsResource, TeamsResource,
UsersResource, UsersResource,
WrennClient, WrennClient,
} from "./client.js"; } from "./client.js";
export type { export type {
ExecCellOptions, ExecCellOptions,
ExecCellResult, ExecCellResult,
} from "./code-interpreter/index.js"; } from "./code-interpreter/index.js";
export { CodeInterpreter, Notebook } from "./code-interpreter/index.js"; export { CodeInterpreter, Notebook } from "./code-interpreter/index.js";
export type { export type {
BackgroundCommandOptions, BackgroundCommandOptions,
BackgroundProcess, BackgroundProcess,
CommandOptions, CommandOptions,
CommandResult, CommandResult,
CommandStreamEvent, CommandStreamEvent,
CommandStreamOptions, CommandStreamOptions,
ProcessList, ProcessList,
} from "./commands.js"; } from "./commands.js";
export { CommandManager } from "./commands.js"; export { CommandManager } from "./commands.js";
export type { ClientConfig, ResolvedClientConfig } from "./config.js"; export type { ClientConfig, ResolvedClientConfig } from "./config.js";
export { export {
DEFAULT_BASE_URL, DEFAULT_BASE_URL,
ENV_API_KEY, ENV_API_KEY,
ENV_BASE_URL, ENV_BASE_URL,
ENV_HOST_TOKEN, ENV_HOST_TOKEN,
ENV_TOKEN, ENV_TOKEN,
resolveConfig, resolveConfig,
} from "./config.js"; } from "./config.js";
export { export {
AuthenticationError, AuthenticationError,
BadRequestError, BadRequestError,
ConflictError, ConflictError,
ForbiddenError, ForbiddenError,
HostHasCapsulesError, HostHasCapsulesError,
NotFoundError, NotFoundError,
PayloadTooLargeError, PayloadTooLargeError,
ServerError, ServerError,
TimeoutError, TimeoutError,
throwErrorFromResponse, throwErrorFromResponse,
WrennError, WrennError,
} from "./exceptions.js"; } from "./exceptions.js";
export type { export type {
FileContent, FileContent,
FileList, FileList,
ListFilesOptions, ListFilesOptions,
MakeDirectoryResult, MakeDirectoryResult,
} from "./files.js"; } from "./files.js";
export { FileManager } from "./files.js"; export { FileManager } from "./files.js";
export type { export type {
GitCheckoutOptions, GitCheckoutOptions,
GitCloneOptions, GitCloneOptions,
GitLogOptions, GitLogOptions,
GitOptions, GitOptions,
GitRemoteBranchOptions, GitRemoteBranchOptions,
} from "./git/index.js"; } from "./git/index.js";
export { Git } from "./git/index.js"; export { Git } from "./git/index.js";
export type { export type {
$defs, $defs,
components, components,
operations, operations,
paths, paths,
webhooks, webhooks,
} from "./models/generated.js"; } from "./models/generated.js";
export type { PtyEvent, PtyStartOptions } from "./pty.js"; export type { PtyEvent, PtyStartOptions } from "./pty.js";
export { PtyManager, PtySession } from "./pty.js"; export { PtyManager, PtySession } from "./pty.js";

43
tests/index.test.ts Normal file
View File

@ -0,0 +1,43 @@
import { describe, expect, it } from "vitest";
import type { components, operations, paths } from "../src/index.js";
import * as sdk from "../src/index.js";
type CapsuleSchema = components["schemas"]["Capsule"];
type GetCapsuleOperation = operations["getCapsule"];
type CapsulePath = paths["/v1/capsules/{id}"];
function acceptsGeneratedTypes(
_capsule: CapsuleSchema,
_operation: GetCapsuleOperation,
_path: CapsulePath,
): void {}
describe("public entry point", () => {
it("exports the supported runtime API from the package root", () => {
expect(sdk.Capsule).toBeTypeOf("function");
expect(sdk.Sandbox).toBe(sdk.Capsule);
expect(sdk.WrennClient).toBeTypeOf("function");
expect(sdk.CodeInterpreter).toBeTypeOf("function");
expect(sdk.Notebook).toBeTypeOf("function");
expect(sdk.CommandManager).toBeTypeOf("function");
expect(sdk.FileManager).toBeTypeOf("function");
expect(sdk.Git).toBeTypeOf("function");
expect(sdk.PtyManager).toBeTypeOf("function");
expect(sdk.PtySession).toBeTypeOf("function");
expect(sdk.WrennError).toBeTypeOf("function");
expect(sdk.NotFoundError).toBeTypeOf("function");
});
it("keeps internal shared helpers out of the public runtime API", () => {
expect("HttpClient" in sdk).toBe(false);
expect("WsConnection" in sdk).toBe(false);
});
it("exposes generated OpenAPI types from the package root", () => {
acceptsGeneratedTypes(
{} as CapsuleSchema,
{} as GetCapsuleOperation,
{} as CapsulePath,
);
});
});