import { z } from "zod"; import { ReadableStream } from "stream/web"; import { ExtensionType } from "@directus/types"; //#region src/modules/account/schemas/registry-account-response.d.ts declare const RegistryAccountResponse: z.ZodObject<{ data: z.ZodObject<{ id: z.ZodString; username: z.ZodString; verified: z.ZodBoolean; github_username: z.ZodNullable; github_avatar_url: z.ZodNullable; github_name: z.ZodNullable; github_company: z.ZodNullable; github_blog: z.ZodNullable; github_location: z.ZodNullable; github_bio: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; type RegistryAccountResponse = z.infer; //#endregion //#region src/modules/account/types/account-options.d.ts interface AccountOptions { registry?: string; } //#endregion //#region src/modules/account/account.d.ts /** * Retrieves account information from the extensions registry. * * This function fetches detailed account data for a specified user or organization * from the Directus extensions registry. It validates API version compatibility * and returns structured account information including profile details, published * extensions, and other relevant metadata. * * @param id - The unique identifier of the account to retrieve (username or organization name) * @param options - Optional configuration for the request * @param options.registry - Custom registry URL to use instead of the default registry * @returns Promise that resolves to validated account data from the registry * * @throws {Error} When API version compatibility check fails * @throws {Error} When the account ID is not found in the registry * @throws {Error} When network request fails or registry is unreachable * @throws {Error} When response data fails validation against the expected schema * * @example * ```typescript * // Get account information using default registry * const accountData = await account('directus'); * console.log(accountData.name); // Account name * console.log(accountData.extensions); // Published extensions * * // Get account information from custom registry * const customAccountData = await account('my-org', { * registry: 'https://custom-registry.example.com' * }); * * // Handle errors * try { * const accountData = await account('non-existent-user'); * } catch (error) { * console.error('Failed to fetch account:', error.message); * } * ``` */ declare const account: (id: string, options?: AccountOptions) => Promise; //#endregion //#region src/modules/describe/schemas/registry-describe-response.d.ts declare const RegistryDescribeResponse: z.ZodObject<{ data: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodUnion; total_downloads: z.ZodNumber; downloads: z.ZodUnion>]>; verified: z.ZodBoolean; readme: z.ZodUnion; type: z.ZodEnum<{ interface: "interface"; display: "display"; layout: "layout"; module: "module"; panel: "panel"; theme: "theme"; hook: "hook"; endpoint: "endpoint"; operation: "operation"; bundle: "bundle"; }>; license: z.ZodNullable; versions: z.ZodArray; host_version: z.ZodString; publish_date: z.ZodString; unpacked_size: z.ZodNumber; file_count: z.ZodNumber; url_bugs: z.ZodUnion; url_homepage: z.ZodUnion; url_repository: z.ZodUnion; license: z.ZodNullable; publisher: z.ZodObject<{ id: z.ZodString; username: z.ZodString; verified: z.ZodBoolean; github_name: z.ZodNullable; github_avatar_url: z.ZodNullable; }, z.core.$strip>; bundled: z.ZodArray>; maintainers: z.ZodNullable; github_avatar_url: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>>>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>; type RegistryDescribeResponse = z.infer; //#endregion //#region src/modules/describe/types/describe-options.d.ts interface DescribeOptions { registry?: string; } //#endregion //#region src/modules/describe/describe.d.ts declare const describe: (id: string, options?: DescribeOptions) => Promise; //#endregion //#region src/modules/download/types/download-options.d.ts interface DownloadOptions { registry?: string; } //#endregion //#region src/modules/download/download.d.ts /** * Downloads an extension version from the registry as a stream. * * This function retrieves the binary content of a specific extension version * from the Directus extensions registry. It validates API version compatibility * and returns a ReadableStream that can be used to process the downloaded content, * such as saving to disk or streaming to a client. * * @param versionId - The unique identifier of the extension version to download * @param requireSandbox - Whether to enable sandbox mode for the download (defaults to false) * @param options - Optional configuration for the download request * @param options.registry - Custom registry URL to use instead of the default registry * @returns Promise that resolves to a ReadableStream containing the extension's binary content * * @throws {Error} When API version compatibility check fails * @throws {Error} When the version ID is not found in the registry * @throws {Error} When network request fails or registry is unreachable * @throws {Error} When the response status indicates an error (4xx, 5xx) * * @example * ```typescript * // Download extension from default registry * const stream = await download('my-extension-v1.0.0'); * * // Save to file system * import { createWriteStream } from 'fs'; * import { pipeline } from 'stream/promises'; * * const fileStream = createWriteStream('./extension.zip'); * await pipeline(Readable.fromWeb(stream), fileStream); * * // Download with sandbox mode enabled * const sandboxStream = await download('my-extension-v1.0.0', true); * * // Download from custom registry * const customStream = await download('my-extension-v1.0.0', false, { * registry: 'https://custom-registry.example.com' * }); * * // Download with both sandbox and custom registry * const customSandboxStream = await download('my-extension-v1.0.0', true, { * registry: 'https://custom-registry.example.com' * }); * * // Handle errors * try { * const stream = await download('non-existent-version'); * } catch (error) { * console.error('Download failed:', error.message); * } * ``` */ declare const download: (versionId: string, requireSandbox?: boolean, options?: DownloadOptions) => Promise | null>; //#endregion //#region src/modules/list/schemas/registry-list-response.d.ts declare const RegistryListResponse: z.ZodObject<{ meta: z.ZodObject<{ filter_count: z.ZodNumber; }, z.core.$strip>; data: z.ZodArray; total_downloads: z.ZodNumber; verified: z.ZodBoolean; type: z.ZodEnum<{ interface: "interface"; display: "display"; layout: "layout"; module: "module"; panel: "panel"; theme: "theme"; hook: "hook"; endpoint: "endpoint"; operation: "operation"; bundle: "bundle"; }>; last_updated: z.ZodString; host_version: z.ZodString; sandbox: z.ZodBoolean; license: z.ZodNullable; publisher: z.ZodObject<{ username: z.ZodString; verified: z.ZodBoolean; github_name: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>>; }, z.core.$strip>; type RegistryListResponse = z.infer; //#endregion //#region src/modules/list/types/list-options.d.ts interface ListOptions { registry?: string; } //#endregion //#region src/modules/list/types/list-query.d.ts interface ListQuery { type?: ExtensionType; search?: string; limit?: number; offset?: number; by?: string; sort?: 'popular' | 'recent' | 'downloads'; sandbox?: boolean; } //#endregion //#region src/modules/list/list.d.ts declare const list: (query: ListQuery, options?: ListOptions) => Promise; //#endregion export { type AccountOptions, type DescribeOptions, type DownloadOptions, type ListOptions, type ListQuery, type RegistryAccountResponse, type RegistryDescribeResponse, type RegistryListResponse, account, describe, download, list };