/** * Types required for policy enforcement. * * @module */ /* eslint-disable no-use-before-define */ import type { LiteralUnion, SomeObject } from './typescript.js'; export type PackageNamingKit = { /** true if location is the entry compartment */ isEntry?: boolean | undefined; name?: LiteralUnion<'', string>; path: Array; }; export type Attenuator< GlobalParams extends [any, ...any[]] = [any, ...any[]], ModuleParams extends [any, ...any[]] = [any, ...any[]], > = { attenuateGlobals?: GlobalAttenuatorFn | undefined; attenuateModule?: | ModuleAttenuatorFn | undefined; }; export type GlobalAttenuatorFn< Params extends [any, ...any[]] = [any, ...any[]], > = ( params: Params, originalObject: Record, globalThis: Record, ) => void; export type ModuleAttenuatorFn< Params extends [any, ...any[]] = [any, ...any[]], T = SomeObject, U = T, > = (params: Params, ns: T) => U; export type DeferredAttenuatorsProvider = { import: (attenuatorSpecifier: string | null) => Promise; }; /** * A fieldname of `PackagePolicy`; used with `policyLookupHelper()` */ export type PolicyEnforcementField = 'builtins' | 'globals' | 'packages';