@composio/core
Version:

29 lines (27 loc) • 1.07 kB
JavaScript
//#region src/models/Files.workerd.ts
const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (e.g., `node:crypto`, `node:fs`) that are not available in this environment. Please use a Node.js runtime for file operations.";
/**
* Creates a Proxy that throws a user-friendly error when any method is accessed.
* This ensures that users get a clear error message when attempting to use
* file operations in unsupported environments.
*/
const createUnsupportedFilesProxy = () => {
return new Proxy({}, { get(_target, prop) {
if (prop === Symbol.toStringTag) return "Files";
if (prop === "constructor") return Files;
return () => {
throw new Error(UNSUPPORTED_MESSAGE);
};
} });
};
/**
* Files class for Cloudflare Workers / Edge runtimes.
* All methods throw an error indicating that file operations are not supported.
*/
var Files = class {
constructor(_client) {
return createUnsupportedFilesProxy();
}
};
//#endregion
exports.Files = Files;