import type { JsonRpcNotification } from "@metamask/utils"; /** * A function for sending JSON-RPC notifications from an endowment. * Used by endowments that perform outbound operations (e.g., network `fetch`) * to signal request lifecycle events. */ export type NotifyFunction = (notification: Omit) => Promise; /** * Options passed to endowment factory functions. */ export type EndowmentFactoryOptions = { /** * A label identifying the source of endowment interactions, used as a * prefix in console output. For example, passing `"MyApp"` causes console * messages to be prefixed with `[MyApp]`. */ sourceLabel?: string; /** * A notification callback used by endowments that perform outbound * operations (e.g., network `fetch`). */ notify?: NotifyFunction; }; /** * The object returned by an endowment factory. Contains the endowment values * keyed by their global name (e.g., `setTimeout`, `Date`) and an optional * teardown function for lifecycle management. */ export type EndowmentFactoryResult = { /** * An optional function that performs cleanup when active resources (e.g., * pending timers or open network connections) should be released. Must not * render endowments unusable — only restore them to their initial state, * since they may be reused without reconstruction. */ teardownFunction?: () => Promise | void; [key: string]: unknown; }; /** * Describes an endowment factory module. Each module exposes the names of * the endowments it provides and a factory function that produces them. */ export type EndowmentFactory = { names: readonly string[]; factory: (options?: EndowmentFactoryOptions) => EndowmentFactoryResult; }; /** * Describes a simple global value that should be hardened and exposed as an * endowment without additional attenuation. */ export type CommonEndowmentSpecification = { endowment: unknown; name: string; bind?: boolean; }; /** * Creates a consolidated collection of common endowments. * This function will return factories for all common endowments including * the additionally attenuated. All hardened with SES. * * @returns An object with common endowments. */ declare const buildCommonEndowments: () => EndowmentFactory[]; export default buildCommonEndowments; //# sourceMappingURL=commonEndowmentFactory.d.mts.map