mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-15 01:35:37 +00:00
* Add resilient PDF thumbnails to GUI uploads * Keep GUI image thumbnails working with SDKs lacking the callback context The desktop loads puter.js from js.puter.com by default, and the SDK there predates the thumbnail callback context, so passing the PDF generator made every image upload lose its thumbnail until the SDK deploys. Fall back to the SDK's bundled image generator whenever the running SDK passes no usable context, and cover both paths in the unit and browser tests. * Ignore preparation failures that land after an upload is cancelled Cancelling during preparation already rejects the upload and fires the abort callback. If the step that was in flight then fails, such as a dropped directory that cannot be read, the error callback also fired and the GUI showed an upload error for an upload the user had just cancelled. Skip error reporting once preparation has been aborted. * Give each PDF thumbnail worker four seconds The per-PDF budget covers downloading PDF.js as well as rendering, and the first PDF of a session on a slower connection ran out of time before its assets had even loaded. Four seconds fits that first load on ordinary connections while staying under the five-second batch cap, so one stuck PDF still leaves the rest of the batch a chance.
274 lines
7.0 KiB
TypeScript
274 lines
7.0 KiB
TypeScript
// The published type surface of puter.js.
|
|
//
|
|
// This is the only hand-written declaration file in the package: it names what
|
|
// the SDK exports and nothing more. Every type it re-exports is generated from
|
|
// the JSDoc in `src/` by `npm run build:types` — edit the JSDoc, not `types/`.
|
|
|
|
import type { Puter } from './types/index.js';
|
|
|
|
export type { Puter };
|
|
export { puter, default } from './types/index.js';
|
|
|
|
declare global {
|
|
interface Window {
|
|
puter: Puter;
|
|
}
|
|
}
|
|
|
|
// -- Shared --
|
|
export type {
|
|
APILoggingConfig,
|
|
ListPage,
|
|
ListPaginationOptions,
|
|
ListStreamOptions,
|
|
PaginatedResult,
|
|
PaginationOptions,
|
|
PuterEnvironment,
|
|
RequestCallbacks,
|
|
ToolSchema,
|
|
} from './types/lib/types.js';
|
|
export type { default as APICallLogger } from './types/lib/APICallLogger.js';
|
|
|
|
// -- puter.ai --
|
|
export type {
|
|
AIMessageContent,
|
|
ChatMessage,
|
|
ChatOptions,
|
|
ChatResponse,
|
|
ChatResponseChunk,
|
|
ImageContent,
|
|
Img2TxtOptions,
|
|
ListTTSEnginesOptions,
|
|
ListTTSVoicesOptions,
|
|
Speech2SpeechOptions,
|
|
Speech2TxtOptions,
|
|
Speech2TxtResult,
|
|
Speech2TxtWord,
|
|
StreamingChatOptions,
|
|
TextFormatSpeech2TxtOptions,
|
|
Tool,
|
|
ToolCall,
|
|
TTSEngine,
|
|
TTSVoice,
|
|
Txt2ImgOptions,
|
|
Txt2SpeechOptions,
|
|
Txt2VidOptions,
|
|
} from './types/modules/ai/types.js';
|
|
export type { Txt2Speech } from './types/modules/ai/index.js';
|
|
|
|
// -- puter.apps --
|
|
export type {
|
|
App,
|
|
AppListOptions,
|
|
AppUser,
|
|
CheckAppNameResult,
|
|
CreateAppOptions,
|
|
CreateAppResult,
|
|
GetUsersOptions,
|
|
UpdateAppAttributes,
|
|
} from './types/modules/apps/types.js';
|
|
|
|
// -- puter.auth --
|
|
export type {
|
|
AllowanceInfo,
|
|
APIUsage,
|
|
AppUsage,
|
|
DetailedAppUsage,
|
|
MonthlyUsage,
|
|
SignInResult,
|
|
User,
|
|
} from './types/modules/Auth.js';
|
|
|
|
// -- puter.debug --
|
|
export type { Debug } from './types/modules/Debug.js';
|
|
|
|
// -- puter.drivers --
|
|
export type { Driver } from './types/modules/Drivers.js';
|
|
|
|
// -- puter.email --
|
|
export type {
|
|
EmailAttachment,
|
|
EmailSendOptions,
|
|
EmailSendResult,
|
|
} from './types/modules/Email.js';
|
|
|
|
// -- puter.events --
|
|
export type {
|
|
DestroyedEventsWorker,
|
|
EventAnchor,
|
|
EventDelivery,
|
|
EventFetchOptions,
|
|
EventFetchPage,
|
|
EventGapMarker,
|
|
EventHandler,
|
|
EventsWorkerPage,
|
|
EventsWorkerSummary,
|
|
EventsWorkersListOptions,
|
|
HandlerOptions,
|
|
HandlerPublication,
|
|
HandlerSummary,
|
|
OnLocalOptions,
|
|
OnPersistentOptions,
|
|
PersistentSubscription,
|
|
PublishedHandler,
|
|
PuterEvent,
|
|
PuterKvEvent,
|
|
PuterNotifEvent,
|
|
} from './types/modules/events/types.js';
|
|
export type { EventSubscription } from './types/modules/events/lib/subscription.js';
|
|
export type { EventHandlers } from './types/modules/events/lib/handlers.js';
|
|
export type { EventsWorkers } from './types/modules/events/lib/workers.js';
|
|
|
|
// -- puter.fs --
|
|
export type {
|
|
CopyOptions,
|
|
DeleteOptions,
|
|
FSItemRead,
|
|
FSItemWithShares,
|
|
GetSharesOptions,
|
|
ListSharedByMeOptions,
|
|
ListSharedOptions,
|
|
MkdirOptions,
|
|
MoveOptions,
|
|
ReadOptions,
|
|
ReaddirOptions,
|
|
RenameOptions,
|
|
Share,
|
|
ShareMode,
|
|
ShareOptions,
|
|
SharePage,
|
|
ShareRecipient,
|
|
SignResult,
|
|
SpaceInfo,
|
|
StatOptions,
|
|
UnshareOptions,
|
|
UploadBatchError,
|
|
UploadItems,
|
|
UploadOperationResult,
|
|
UploadOptions,
|
|
ThumbnailGenerator,
|
|
ThumbnailGeneratorContext,
|
|
WriteOptions,
|
|
} from './types/modules/FileSystem/types.js';
|
|
export type {
|
|
FileSignatureInfo,
|
|
FSItem,
|
|
InternalFSProperties,
|
|
} from './types/modules/FSItem.js';
|
|
|
|
// -- puter.hosting --
|
|
export type { Subdomain } from './types/modules/hosting/types.js';
|
|
|
|
// -- puter.kv --
|
|
export type {
|
|
KVAddPath,
|
|
KVIncrementPath,
|
|
KVListOptions,
|
|
KVListPage,
|
|
KVListPaginationOptions,
|
|
KVListStreamOptions,
|
|
KVOptConfig,
|
|
KVPair,
|
|
KVScalar,
|
|
KVSetBatch,
|
|
KVSetItem,
|
|
KVSetObject,
|
|
KVUpdateObject,
|
|
KVUpdatePath,
|
|
KVValue,
|
|
} from './types/modules/kv/types.js';
|
|
|
|
// -- puter.net --
|
|
export type { Networking, SocketEvent } from './types/modules/networking/types.js';
|
|
export type { PSocket } from './types/modules/networking/PSocket.js';
|
|
export type { PTLSSocket } from './types/modules/networking/PTLS.js';
|
|
|
|
// -- puter.os --
|
|
|
|
// -- puter.peer --
|
|
export type {
|
|
PuterPeerConnection,
|
|
PuterPeerDescription,
|
|
PuterPeerIceCandidate,
|
|
PuterPeerMessage,
|
|
PuterPeerOptions,
|
|
PuterPeerServer,
|
|
PuterPeerUser,
|
|
} from './types/modules/Peer.js';
|
|
|
|
// -- puter.perms --
|
|
export type {
|
|
AppDataClass,
|
|
AppDataFsScope,
|
|
AppDataKvScope,
|
|
AppDataScopePair,
|
|
AppDataScopes,
|
|
AppDataStore,
|
|
PermsAccess,
|
|
PermsAccessRequest,
|
|
PermsAppDataRequest,
|
|
PermsAppRootDirRequest,
|
|
PermsBatchEntry,
|
|
PermsFolderName,
|
|
PermsFolderRequest,
|
|
PermsPermissionRequest,
|
|
PermsRequestDetails,
|
|
PermsResource,
|
|
} from './types/modules/perms/types.js';
|
|
|
|
// -- puter.ui --
|
|
export type { AppConnection } from './types/modules/UI.js';
|
|
export type {
|
|
AlertButton,
|
|
AlertOptions,
|
|
AppConnectionCloseEvent,
|
|
CancelAwarePromise,
|
|
ColorPickerOptions,
|
|
ConnectionEvent,
|
|
ContextMenuItem,
|
|
ContextMenuOptions,
|
|
DirectoryPickerOptions,
|
|
FilePickerOptions,
|
|
FontPickerOptions,
|
|
LaunchAppOptions,
|
|
LaunchAppResult,
|
|
MenuItem,
|
|
MenubarOptions,
|
|
NotificationOptions,
|
|
PromptOptions,
|
|
ThemeData,
|
|
WindowHandle,
|
|
WindowIdentifier,
|
|
WindowOptions,
|
|
} from './types/modules/UI.js';
|
|
|
|
// -- puter.util --
|
|
export type { default as Util, UtilRPC } from './types/modules/Util.js';
|
|
|
|
// -- puter.workers --
|
|
export type {
|
|
WorkerDeployment,
|
|
WorkerInfo,
|
|
} from './types/modules/Workers.js';
|
|
|
|
// -- Module instance types --
|
|
//
|
|
// Each `puter.<module>` handle. Named here rather than re-exported, because the
|
|
// generated modules export a constructor value plus its constructor type, and
|
|
// what a consumer annotates with is the instance.
|
|
|
|
export type AI = InstanceType<import('./types/modules/ai/index.js').AIConstructor>;
|
|
export type Apps = InstanceType<import('./types/modules/apps/index.js').AppsConstructor>;
|
|
export type Auth = InstanceType<import('./types/modules/Auth.js').AuthConstructor>;
|
|
export type Drivers = InstanceType<import('./types/modules/Drivers.js').DriversConstructor>;
|
|
export type Email = InstanceType<import('./types/modules/Email.js').EmailConstructor>;
|
|
export type Events = InstanceType<import('./types/modules/events/index.js').EventsConstructor>;
|
|
export type FS = InstanceType<import('./types/modules/FileSystem/index.js').FSConstructor>;
|
|
export type Hosting = InstanceType<import('./types/modules/hosting/index.js').HostingConstructor>;
|
|
export type KV = InstanceType<import('./types/modules/kv/index.js').KVConstructor>;
|
|
export type OS = InstanceType<import('./types/modules/os/index.js').OSConstructor>;
|
|
export type Peer = InstanceType<import('./types/modules/Peer.js').PeerConstructor>;
|
|
export type Perms = InstanceType<import('./types/modules/perms/index.js').PermsConstructor>;
|
|
export type UI = InstanceType<import('./types/modules/UI.js').UIConstructor>;
|
|
export type WorkersHandler = InstanceType<import('./types/modules/Workers.js').WorkersConstructor>;
|