@ricsam/isolate-types 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,9 +13,9 @@
13
13
  /**
14
14
  * Type definitions for @ricsam/isolate-core globals.
15
15
  *
16
- * Includes: ReadableStream, WritableStream, TransformStream, Blob, File, URL, URLSearchParams, DOMException
16
+ * Includes: ReadableStream, WritableStream, TransformStream, Blob, File, URL, URLSearchParams, DOMException, DOMParser, DOM constructors
17
17
  */
18
- export declare const CORE_TYPES = "/**\n * Global Type Definitions for @ricsam/isolate-core\n *\n * These types define the globals injected by setupCore() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n *\n * @example\n * // In your tsconfig.isolate.json\n * {\n * \"compilerOptions\": {\n * \"lib\": [\"ESNext\", \"DOM\"]\n * }\n * }\n *\n * // Then reference this file or use ts-morph for code strings\n */\n\nexport {};\n\ndeclare global {\n // ============================================\n // Web Streams API\n // ============================================\n\n /**\n * A readable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream\n */\n const ReadableStream: typeof globalThis.ReadableStream;\n\n /**\n * A writable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStream\n */\n const WritableStream: typeof globalThis.WritableStream;\n\n /**\n * A transform stream that can be used to pipe data through a transformer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TransformStream\n */\n const TransformStream: typeof globalThis.TransformStream;\n\n /**\n * Default reader for ReadableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader\n */\n const ReadableStreamDefaultReader: typeof globalThis.ReadableStreamDefaultReader;\n\n /**\n * Default writer for WritableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter\n */\n const WritableStreamDefaultWriter: typeof globalThis.WritableStreamDefaultWriter;\n\n // ============================================\n // Blob and File APIs\n // ============================================\n\n /**\n * A file-like object of immutable, raw data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob\n */\n const Blob: typeof globalThis.Blob;\n\n /**\n * A file object representing a file.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/File\n */\n const File: typeof globalThis.File;\n\n // ============================================\n // URL APIs\n // ============================================\n\n /**\n * Interface for URL manipulation.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URL\n */\n const URL: typeof globalThis.URL;\n\n /**\n * Utility for working with URL query strings.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n */\n const URLSearchParams: typeof globalThis.URLSearchParams;\n\n // ============================================\n // Error Handling\n // ============================================\n\n /**\n * Exception type for DOM operations.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n */\n const DOMException: typeof globalThis.DOMException;\n}\n";
18
+ export declare const CORE_TYPES = "/**\n * Global Type Definitions for @ricsam/isolate-core\n *\n * These types define the globals injected by setupCore() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n *\n * @example\n * // In your tsconfig.isolate.json\n * {\n * \"compilerOptions\": {\n * \"lib\": [\"ESNext\", \"DOM\"]\n * }\n * }\n *\n * // Then reference this file or use ts-morph for code strings\n */\n\nexport {};\n\ndeclare global {\n // ============================================\n // Web Streams API\n // ============================================\n\n /**\n * A readable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream\n */\n const ReadableStream: typeof globalThis.ReadableStream;\n\n /**\n * A writable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStream\n */\n const WritableStream: typeof globalThis.WritableStream;\n\n /**\n * A transform stream that can be used to pipe data through a transformer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TransformStream\n */\n const TransformStream: typeof globalThis.TransformStream;\n\n /**\n * Default reader for ReadableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader\n */\n const ReadableStreamDefaultReader: typeof globalThis.ReadableStreamDefaultReader;\n\n /**\n * Default writer for WritableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter\n */\n const WritableStreamDefaultWriter: typeof globalThis.WritableStreamDefaultWriter;\n\n // ============================================\n // Blob and File APIs\n // ============================================\n\n /**\n * A file-like object of immutable, raw data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob\n */\n const Blob: typeof globalThis.Blob;\n\n /**\n * A file object representing a file.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/File\n */\n const File: typeof globalThis.File;\n\n // ============================================\n // URL APIs\n // ============================================\n\n /**\n * Interface for URL manipulation.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URL\n */\n const URL: typeof globalThis.URL;\n\n /**\n * Utility for working with URL query strings.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n */\n const URLSearchParams: typeof globalThis.URLSearchParams;\n\n // ============================================\n // DOM Parsing and Constructors\n // ============================================\n\n /**\n * Parses HTML/XML strings into Document objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n */\n const DOMParser: typeof globalThis.DOMParser;\n\n /**\n * Base DOM node constructor.\n */\n const Node: typeof globalThis.Node;\n\n /**\n * DOM document constructor.\n */\n const Document: typeof globalThis.Document;\n\n /**\n * DOM document fragment constructor.\n */\n const DocumentFragment: typeof globalThis.DocumentFragment;\n\n /**\n * DOM document type constructor.\n */\n const DocumentType: typeof globalThis.DocumentType;\n\n /**\n * DOM element constructor.\n */\n const Element: typeof globalThis.Element;\n\n /**\n * DOM attribute constructor.\n */\n const Attr: typeof globalThis.Attr;\n\n /**\n * DOM text node constructor.\n */\n const Text: typeof globalThis.Text;\n\n /**\n * DOM comment node constructor.\n */\n const Comment: typeof globalThis.Comment;\n\n /**\n * DOM event constructor.\n */\n const Event: typeof globalThis.Event;\n\n /**\n * Base event target constructor.\n */\n const EventTarget: typeof globalThis.EventTarget;\n\n /**\n * Custom event constructor.\n */\n const CustomEvent: typeof globalThis.CustomEvent;\n\n // ============================================\n // Error Handling\n // ============================================\n\n /**\n * Exception type for DOM operations.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n */\n const DOMException: typeof globalThis.DOMException;\n}\n";
19
19
  /**
20
20
  * Type definitions for @ricsam/isolate-fetch globals.
21
21
  *
@@ -77,7 +77,7 @@ export declare const PLAYWRIGHT_TYPES = "\n/**\n * Locator represents an element
77
77
  * Map of package names to their type definitions.
78
78
  */
79
79
  export declare const TYPE_DEFINITIONS: {
80
- readonly core: "/**\n * Global Type Definitions for @ricsam/isolate-core\n *\n * These types define the globals injected by setupCore() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n *\n * @example\n * // In your tsconfig.isolate.json\n * {\n * \"compilerOptions\": {\n * \"lib\": [\"ESNext\", \"DOM\"]\n * }\n * }\n *\n * // Then reference this file or use ts-morph for code strings\n */\n\nexport {};\n\ndeclare global {\n // ============================================\n // Web Streams API\n // ============================================\n\n /**\n * A readable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream\n */\n const ReadableStream: typeof globalThis.ReadableStream;\n\n /**\n * A writable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStream\n */\n const WritableStream: typeof globalThis.WritableStream;\n\n /**\n * A transform stream that can be used to pipe data through a transformer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TransformStream\n */\n const TransformStream: typeof globalThis.TransformStream;\n\n /**\n * Default reader for ReadableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader\n */\n const ReadableStreamDefaultReader: typeof globalThis.ReadableStreamDefaultReader;\n\n /**\n * Default writer for WritableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter\n */\n const WritableStreamDefaultWriter: typeof globalThis.WritableStreamDefaultWriter;\n\n // ============================================\n // Blob and File APIs\n // ============================================\n\n /**\n * A file-like object of immutable, raw data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob\n */\n const Blob: typeof globalThis.Blob;\n\n /**\n * A file object representing a file.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/File\n */\n const File: typeof globalThis.File;\n\n // ============================================\n // URL APIs\n // ============================================\n\n /**\n * Interface for URL manipulation.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URL\n */\n const URL: typeof globalThis.URL;\n\n /**\n * Utility for working with URL query strings.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n */\n const URLSearchParams: typeof globalThis.URLSearchParams;\n\n // ============================================\n // Error Handling\n // ============================================\n\n /**\n * Exception type for DOM operations.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n */\n const DOMException: typeof globalThis.DOMException;\n}\n";
80
+ readonly core: "/**\n * Global Type Definitions for @ricsam/isolate-core\n *\n * These types define the globals injected by setupCore() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n *\n * @example\n * // In your tsconfig.isolate.json\n * {\n * \"compilerOptions\": {\n * \"lib\": [\"ESNext\", \"DOM\"]\n * }\n * }\n *\n * // Then reference this file or use ts-morph for code strings\n */\n\nexport {};\n\ndeclare global {\n // ============================================\n // Web Streams API\n // ============================================\n\n /**\n * A readable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream\n */\n const ReadableStream: typeof globalThis.ReadableStream;\n\n /**\n * A writable stream of data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStream\n */\n const WritableStream: typeof globalThis.WritableStream;\n\n /**\n * A transform stream that can be used to pipe data through a transformer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TransformStream\n */\n const TransformStream: typeof globalThis.TransformStream;\n\n /**\n * Default reader for ReadableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader\n */\n const ReadableStreamDefaultReader: typeof globalThis.ReadableStreamDefaultReader;\n\n /**\n * Default writer for WritableStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter\n */\n const WritableStreamDefaultWriter: typeof globalThis.WritableStreamDefaultWriter;\n\n // ============================================\n // Blob and File APIs\n // ============================================\n\n /**\n * A file-like object of immutable, raw data.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob\n */\n const Blob: typeof globalThis.Blob;\n\n /**\n * A file object representing a file.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/File\n */\n const File: typeof globalThis.File;\n\n // ============================================\n // URL APIs\n // ============================================\n\n /**\n * Interface for URL manipulation.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URL\n */\n const URL: typeof globalThis.URL;\n\n /**\n * Utility for working with URL query strings.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams\n */\n const URLSearchParams: typeof globalThis.URLSearchParams;\n\n // ============================================\n // DOM Parsing and Constructors\n // ============================================\n\n /**\n * Parses HTML/XML strings into Document objects.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n */\n const DOMParser: typeof globalThis.DOMParser;\n\n /**\n * Base DOM node constructor.\n */\n const Node: typeof globalThis.Node;\n\n /**\n * DOM document constructor.\n */\n const Document: typeof globalThis.Document;\n\n /**\n * DOM document fragment constructor.\n */\n const DocumentFragment: typeof globalThis.DocumentFragment;\n\n /**\n * DOM document type constructor.\n */\n const DocumentType: typeof globalThis.DocumentType;\n\n /**\n * DOM element constructor.\n */\n const Element: typeof globalThis.Element;\n\n /**\n * DOM attribute constructor.\n */\n const Attr: typeof globalThis.Attr;\n\n /**\n * DOM text node constructor.\n */\n const Text: typeof globalThis.Text;\n\n /**\n * DOM comment node constructor.\n */\n const Comment: typeof globalThis.Comment;\n\n /**\n * DOM event constructor.\n */\n const Event: typeof globalThis.Event;\n\n /**\n * Base event target constructor.\n */\n const EventTarget: typeof globalThis.EventTarget;\n\n /**\n * Custom event constructor.\n */\n const CustomEvent: typeof globalThis.CustomEvent;\n\n // ============================================\n // Error Handling\n // ============================================\n\n /**\n * Exception type for DOM operations.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n */\n const DOMException: typeof globalThis.DOMException;\n}\n";
81
81
  readonly console: "/**\n * Global Type Definitions for @ricsam/isolate-console\n *\n * These types define the globals injected by setupConsole() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n */\n\nexport {};\n\ndeclare global {\n /**\n * Console interface for logging and debugging.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Console\n */\n interface Console {\n /**\n * Log a message to the console.\n * @param data - Values to log\n */\n log(...data: unknown[]): void;\n\n /**\n * Log a warning message.\n * @param data - Values to log\n */\n warn(...data: unknown[]): void;\n\n /**\n * Log an error message.\n * @param data - Values to log\n */\n error(...data: unknown[]): void;\n\n /**\n * Log a debug message.\n * @param data - Values to log\n */\n debug(...data: unknown[]): void;\n\n /**\n * Log an info message.\n * @param data - Values to log\n */\n info(...data: unknown[]): void;\n\n /**\n * Log a stack trace.\n * @param data - Values to log with the trace\n */\n trace(...data: unknown[]): void;\n\n /**\n * Display an object in a formatted way.\n * @param item - Object to display\n * @param options - Display options\n */\n dir(item: unknown, options?: object): void;\n\n /**\n * Display tabular data.\n * @param tabularData - Data to display as a table\n * @param properties - Optional array of property names to include\n */\n table(tabularData: unknown, properties?: string[]): void;\n\n /**\n * Start a timer.\n * @param label - Timer label (default: \"default\")\n */\n time(label?: string): void;\n\n /**\n * End a timer and log the elapsed time.\n * @param label - Timer label (default: \"default\")\n */\n timeEnd(label?: string): void;\n\n /**\n * Log the elapsed time of a timer without ending it.\n * @param label - Timer label (default: \"default\")\n * @param data - Additional values to log\n */\n timeLog(label?: string, ...data: unknown[]): void;\n\n /**\n * Log an error if the assertion is false.\n * @param condition - Condition to test\n * @param data - Values to log if assertion fails\n */\n assert(condition?: boolean, ...data: unknown[]): void;\n\n /**\n * Increment and log a counter.\n * @param label - Counter label (default: \"default\")\n */\n count(label?: string): void;\n\n /**\n * Reset a counter.\n * @param label - Counter label (default: \"default\")\n */\n countReset(label?: string): void;\n\n /**\n * Clear the console.\n */\n clear(): void;\n\n /**\n * Start an inline group.\n * @param data - Group label\n */\n group(...data: unknown[]): void;\n\n /**\n * Start a collapsed inline group.\n * @param data - Group label\n */\n groupCollapsed(...data: unknown[]): void;\n\n /**\n * End the current inline group.\n */\n groupEnd(): void;\n }\n\n /**\n * Console object for logging and debugging.\n */\n const console: Console;\n}\n";
82
82
  readonly crypto: "/**\n * Global Type Definitions for @ricsam/isolate-crypto\n *\n * These types define the globals injected by setupCrypto() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n *\n * @example\n * // Generate random bytes\n * const arr = new Uint8Array(16);\n * crypto.getRandomValues(arr);\n *\n * // Generate UUID\n * const uuid = crypto.randomUUID();\n *\n * // Use SubtleCrypto\n * const key = await crypto.subtle.generateKey(\n * { name: \"AES-GCM\", length: 256 },\n * true,\n * [\"encrypt\", \"decrypt\"]\n * );\n */\n\nexport {};\n\ndeclare global {\n /**\n * CryptoKey represents a cryptographic key.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey\n */\n interface CryptoKey {\n /**\n * The type of key: \"public\", \"private\", or \"secret\".\n */\n readonly type: \"public\" | \"private\" | \"secret\";\n\n /**\n * Whether the key can be exported.\n */\n readonly extractable: boolean;\n\n /**\n * The algorithm used by this key.\n */\n readonly algorithm: KeyAlgorithm;\n\n /**\n * The usages allowed for this key.\n */\n readonly usages: ReadonlyArray<KeyUsage>;\n }\n\n /**\n * CryptoKey constructor (keys cannot be constructed directly).\n */\n const CryptoKey: {\n prototype: CryptoKey;\n };\n\n /**\n * SubtleCrypto interface for cryptographic operations.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto\n */\n interface SubtleCrypto {\n /**\n * Generate a digest (hash) of the given data.\n *\n * @param algorithm - Hash algorithm (e.g., \"SHA-256\", \"SHA-384\", \"SHA-512\")\n * @param data - Data to hash\n * @returns Promise resolving to the hash as ArrayBuffer\n */\n digest(\n algorithm: AlgorithmIdentifier,\n data: BufferSource\n ): Promise<ArrayBuffer>;\n\n /**\n * Generate a new cryptographic key or key pair.\n *\n * @param algorithm - Key generation algorithm\n * @param extractable - Whether the key can be exported\n * @param keyUsages - Allowed key usages\n * @returns Promise resolving to a CryptoKey or CryptoKeyPair\n */\n generateKey(\n algorithm: RsaHashedKeyGenParams | EcKeyGenParams | AesKeyGenParams | HmacKeyGenParams,\n extractable: boolean,\n keyUsages: KeyUsage[]\n ): Promise<CryptoKey | CryptoKeyPair>;\n\n /**\n * Sign data using a private key.\n *\n * @param algorithm - Signing algorithm\n * @param key - Private key to sign with\n * @param data - Data to sign\n * @returns Promise resolving to the signature as ArrayBuffer\n */\n sign(\n algorithm: AlgorithmIdentifier,\n key: CryptoKey,\n data: BufferSource\n ): Promise<ArrayBuffer>;\n\n /**\n * Verify a signature.\n *\n * @param algorithm - Signing algorithm\n * @param key - Public key to verify with\n * @param signature - Signature to verify\n * @param data - Data that was signed\n * @returns Promise resolving to true if valid, false otherwise\n */\n verify(\n algorithm: AlgorithmIdentifier,\n key: CryptoKey,\n signature: BufferSource,\n data: BufferSource\n ): Promise<boolean>;\n\n /**\n * Encrypt data.\n *\n * @param algorithm - Encryption algorithm\n * @param key - Encryption key\n * @param data - Data to encrypt\n * @returns Promise resolving to encrypted data as ArrayBuffer\n */\n encrypt(\n algorithm: AlgorithmIdentifier,\n key: CryptoKey,\n data: BufferSource\n ): Promise<ArrayBuffer>;\n\n /**\n * Decrypt data.\n *\n * @param algorithm - Decryption algorithm\n * @param key - Decryption key\n * @param data - Data to decrypt\n * @returns Promise resolving to decrypted data as ArrayBuffer\n */\n decrypt(\n algorithm: AlgorithmIdentifier,\n key: CryptoKey,\n data: BufferSource\n ): Promise<ArrayBuffer>;\n\n /**\n * Import a key from external data.\n *\n * @param format - Key format (\"raw\", \"pkcs8\", \"spki\", \"jwk\")\n * @param keyData - Key data\n * @param algorithm - Key algorithm\n * @param extractable - Whether the key can be exported\n * @param keyUsages - Allowed key usages\n * @returns Promise resolving to a CryptoKey\n */\n importKey(\n format: \"raw\" | \"pkcs8\" | \"spki\" | \"jwk\",\n keyData: BufferSource | JsonWebKey,\n algorithm: AlgorithmIdentifier,\n extractable: boolean,\n keyUsages: KeyUsage[]\n ): Promise<CryptoKey>;\n\n /**\n * Export a key.\n *\n * @param format - Export format (\"raw\", \"pkcs8\", \"spki\", \"jwk\")\n * @param key - Key to export\n * @returns Promise resolving to ArrayBuffer or JsonWebKey\n */\n exportKey(\n format: \"raw\" | \"pkcs8\" | \"spki\" | \"jwk\",\n key: CryptoKey\n ): Promise<ArrayBuffer | JsonWebKey>;\n\n /**\n * Derive bits from a key.\n *\n * @param algorithm - Derivation algorithm\n * @param baseKey - Base key for derivation\n * @param length - Number of bits to derive\n * @returns Promise resolving to derived bits as ArrayBuffer\n */\n deriveBits(\n algorithm: AlgorithmIdentifier,\n baseKey: CryptoKey,\n length: number\n ): Promise<ArrayBuffer>;\n\n /**\n * Derive a new key from a base key.\n *\n * @param algorithm - Derivation algorithm\n * @param baseKey - Base key for derivation\n * @param derivedKeyType - Type of key to derive\n * @param extractable - Whether the derived key can be exported\n * @param keyUsages - Allowed usages for derived key\n * @returns Promise resolving to a CryptoKey\n */\n deriveKey(\n algorithm: AlgorithmIdentifier,\n baseKey: CryptoKey,\n derivedKeyType: AlgorithmIdentifier,\n extractable: boolean,\n keyUsages: KeyUsage[]\n ): Promise<CryptoKey>;\n\n /**\n * Wrap a key for secure export.\n *\n * @param format - Key format\n * @param key - Key to wrap\n * @param wrappingKey - Key to wrap with\n * @param wrapAlgorithm - Wrapping algorithm\n * @returns Promise resolving to wrapped key as ArrayBuffer\n */\n wrapKey(\n format: \"raw\" | \"pkcs8\" | \"spki\" | \"jwk\",\n key: CryptoKey,\n wrappingKey: CryptoKey,\n wrapAlgorithm: AlgorithmIdentifier\n ): Promise<ArrayBuffer>;\n\n /**\n * Unwrap a wrapped key.\n *\n * @param format - Key format\n * @param wrappedKey - Wrapped key data\n * @param unwrappingKey - Key to unwrap with\n * @param unwrapAlgorithm - Unwrapping algorithm\n * @param unwrappedKeyAlgorithm - Algorithm for the unwrapped key\n * @param extractable - Whether the unwrapped key can be exported\n * @param keyUsages - Allowed usages for unwrapped key\n * @returns Promise resolving to a CryptoKey\n */\n unwrapKey(\n format: \"raw\" | \"pkcs8\" | \"spki\" | \"jwk\",\n wrappedKey: BufferSource,\n unwrappingKey: CryptoKey,\n unwrapAlgorithm: AlgorithmIdentifier,\n unwrappedKeyAlgorithm: AlgorithmIdentifier,\n extractable: boolean,\n keyUsages: KeyUsage[]\n ): Promise<CryptoKey>;\n }\n\n /**\n * Crypto interface providing cryptographic functionality.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto\n */\n interface Crypto {\n /**\n * SubtleCrypto interface for cryptographic operations.\n */\n readonly subtle: SubtleCrypto;\n\n /**\n * Fill a TypedArray with cryptographically random values.\n *\n * @param array - TypedArray to fill (max 65536 bytes)\n * @returns The same array, filled with random values\n *\n * @example\n * const arr = new Uint8Array(16);\n * crypto.getRandomValues(arr);\n */\n getRandomValues<T extends ArrayBufferView | null>(array: T): T;\n\n /**\n * Generate a random UUID v4.\n *\n * @returns A random UUID string\n *\n * @example\n * const uuid = crypto.randomUUID();\n * // \"550e8400-e29b-41d4-a716-446655440000\"\n */\n randomUUID(): string;\n }\n\n /**\n * Crypto object providing cryptographic functionality.\n */\n const crypto: Crypto;\n}\n";
83
83
  readonly encoding: "/**\n * Global Type Definitions for @ricsam/isolate-encoding\n *\n * These types define the globals injected by setupEncoding() into an isolated-vm context.\n * Use these types to typecheck user code that will run inside the V8 isolate.\n */\n\nexport {};\n\ndeclare global {\n /**\n * Decodes a Base64-encoded string.\n *\n * @param encodedData - The Base64 string to decode\n * @returns The decoded string\n * @throws DOMException if the input is not valid Base64\n *\n * @example\n * atob(\"SGVsbG8=\"); // \"Hello\"\n */\n function atob(encodedData: string): string;\n\n /**\n * Encodes a string to Base64.\n *\n * @param stringToEncode - The string to encode (must contain only Latin1 characters)\n * @returns The Base64 encoded string\n * @throws DOMException if the string contains characters outside Latin1 range (0-255)\n *\n * @example\n * btoa(\"Hello\"); // \"SGVsbG8=\"\n */\n function btoa(stringToEncode: string): string;\n\n // ============================================\n // Buffer\n // ============================================\n\n /**\n * Buffer encoding types supported by the isolate Buffer implementation.\n */\n type BufferEncoding = \"utf8\" | \"utf-8\" | \"base64\" | \"hex\";\n\n /**\n * Buffer class for working with binary data.\n * Extends Uint8Array for compatibility.\n * @see https://nodejs.org/api/buffer.html\n */\n interface Buffer extends Uint8Array {\n /**\n * Convert the buffer to a string.\n *\n * @param encoding - The encoding to use (default: \"utf8\")\n * @returns The string representation\n *\n * @example\n * const buf = Buffer.from(\"hello\");\n * buf.toString(); // \"hello\"\n * buf.toString(\"hex\"); // \"68656c6c6f\"\n * buf.toString(\"base64\"); // \"aGVsbG8=\"\n */\n toString(encoding?: BufferEncoding): string;\n\n /**\n * Returns a new Buffer that references the same memory as the original,\n * but offset and cropped by the start and end indices.\n *\n * @param start - Start index (default: 0)\n * @param end - End index (default: buffer.length)\n * @returns A new Buffer instance\n *\n * @example\n * const buf = Buffer.from(\"hello\");\n * buf.slice(1, 4).toString(); // \"ell\"\n */\n slice(start?: number, end?: number): Buffer;\n\n /**\n * Returns a new Buffer that references the same memory as the original,\n * but offset and cropped by the start and end indices.\n *\n * @param start - Start index (default: 0)\n * @param end - End index (default: buffer.length)\n * @returns A new Buffer instance\n */\n subarray(start?: number, end?: number): Buffer;\n }\n\n /**\n * Buffer constructor interface.\n */\n interface BufferConstructor {\n /**\n * Creates a new Buffer from a string, array, ArrayBuffer, or another Buffer.\n *\n * @param value - The value to create a buffer from\n * @param encodingOrOffset - Encoding for strings, or byte offset for ArrayBuffer\n * @param length - Length for ArrayBuffer (when offset is provided)\n * @returns A new Buffer instance\n *\n * @example\n * Buffer.from(\"hello\"); // UTF-8 encoded\n * Buffer.from(\"aGVsbG8=\", \"base64\"); // base64 decoded\n * Buffer.from(\"68656c6c6f\", \"hex\"); // hex decoded\n * Buffer.from([104, 101, 108, 108, 111]); // from array\n */\n from(value: string, encoding?: BufferEncoding): Buffer;\n from(value: ArrayBuffer, byteOffset?: number, length?: number): Buffer;\n from(value: Uint8Array | ReadonlyArray<number>): Buffer;\n from(value: Iterable<number>): Buffer;\n\n /**\n * Allocates a new Buffer of the specified size, filled with zeros or the specified fill value.\n *\n * @param size - The size of the buffer in bytes\n * @param fill - Value to fill the buffer with (default: 0)\n * @param encoding - Encoding for string fill values\n * @returns A new Buffer instance\n *\n * @example\n * Buffer.alloc(5); // <Buffer 00 00 00 00 00>\n * Buffer.alloc(5, 1); // <Buffer 01 01 01 01 01>\n * Buffer.alloc(5, \"ab\"); // <Buffer 61 62 61 62 61>\n */\n alloc(size: number, fill?: number | string | Buffer, encoding?: BufferEncoding): Buffer;\n\n /**\n * Allocates a new Buffer of the specified size without initializing the memory.\n * The contents are unknown and may contain sensitive data.\n *\n * @param size - The size of the buffer in bytes\n * @returns A new Buffer instance\n */\n allocUnsafe(size: number): Buffer;\n\n /**\n * Concatenates a list of Buffers.\n *\n * @param list - Array of Buffer instances to concatenate\n * @param totalLength - Total length of the buffers (optional)\n * @returns A new Buffer instance\n *\n * @example\n * const buf1 = Buffer.from(\"hel\");\n * const buf2 = Buffer.from(\"lo\");\n * Buffer.concat([buf1, buf2]).toString(); // \"hello\"\n */\n concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;\n\n /**\n * Returns true if the given object is a Buffer.\n *\n * @param obj - Object to test\n * @returns true if obj is a Buffer\n *\n * @example\n * Buffer.isBuffer(Buffer.from(\"test\")); // true\n * Buffer.isBuffer(new Uint8Array(5)); // false\n */\n isBuffer(obj: unknown): obj is Buffer;\n\n /**\n * Returns the byte length of a string when encoded.\n *\n * @param string - The string to measure\n * @param encoding - The encoding (default: \"utf8\")\n * @returns The byte length\n *\n * @example\n * Buffer.byteLength(\"hello\"); // 5\n * Buffer.byteLength(\"aGVsbG8=\", \"base64\"); // 5 (decoded length)\n */\n byteLength(string: string, encoding?: BufferEncoding): number;\n byteLength(buffer: ArrayBufferView | ArrayBuffer): number;\n\n /**\n * Returns true if the encoding is a valid buffer encoding.\n *\n * @param encoding - The encoding to check\n * @returns true if the encoding is supported\n */\n isEncoding(encoding: string): encoding is BufferEncoding;\n\n readonly prototype: Buffer;\n }\n\n /**\n * Buffer class for working with binary data.\n * @see https://nodejs.org/api/buffer.html\n */\n const Buffer: BufferConstructor;\n}\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/isolate-types",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "exports": {