import type { ManifestComponentType, ManifestScope, ManifestComponent } from "../manifest-builder.js"; export type ComponentType = ManifestComponentType | 'CUSTOM_OBJECT_SETTINGS' | 'CUSTOM_OBJECT_SEARCH_CONFIG'; /** New definitions compose explicitly; legacy constructors still register through their original scopes. */ export declare const detachedManifestScope: ManifestScope; /** Shared by components whose backend writers require the custom API-name suffix. */ export declare function validateCustomApiName(apiName: string): void; /** Decorate only a newly created instance; the existing class and serializer stay unchanged. */ export declare function withApiName(definition: D, apiName: string, extra?: Record): D & { getApiName: () => string; toDict: () => { api_name: string; identity_format_version: 2; }; }; /** Identifying fields belong to the component's serialized metadata. */ export type MetadataConfig = { readonly type: Exclude; readonly api_name: string; } | { readonly type: 'CUSTOM_OBJECT_FIELD'; readonly custom_object_api_name: string; readonly field_api_name: string; } | { readonly type: 'CUSTOM_OBJECT_FIELD_SECTION'; readonly api_name: string; readonly model_name: string; } | { readonly type: 'CUSTOM_OBJECT_ACTION' | 'CUSTOM_OBJECT_LIST_VIEW' | 'CUSTOM_OBJECT_PAGE_LAYOUT'; readonly api_name: string; readonly object_rql_name: string; } | { readonly type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW' | 'CUSTOM_OBJECT_VALIDATION_RULE' | 'CUSTOM_FIELD_SECTION' | 'CUSTOM_FIELD_V2'; readonly api_name: string; readonly model_rql_name: string; } | { readonly type: 'CUSTOM_OBJECT_SETTINGS'; readonly object_rql_name: string; readonly setting_id: string; } | { readonly type: 'CUSTOM_OBJECT_SEARCH_CONFIG'; readonly model_rql_name: string; }; export interface BuildContext { bundle(entrypoint: URL): Promise; } export interface MetadataEntry { readonly config: W; /** Generated defaults yield to authored metadata with the same type, parent, and API name. */ readonly fallback?: boolean; readonly buildKey?: string; readonly build?: (context: BuildContext) => Promise; } export interface CompileContext { readonly definitions: readonly object[]; } type DefinitionFactory = (...args: never[]) => object; interface ComponentFactory { /** Wire kind used to register this adapter; does not register an API endpoint. */ readonly type: ComponentType; /** Creates the public definition. The wrapper registers the result without adding public properties. */ readonly define: F; /** * Receives the factory result and its original arguments. Return fixed references * or a callback that reads current dependencies when setters can change them. */ references?(definition: ReturnType, ...args: Parameters): readonly object[] | (() => readonly object[]); } /** Use a single-definition serializer normally; batch compilers handle schema expansion and merging. */ export type ComponentImplementation = ComponentFactory & ({ serialize(definition: ReturnType): W | MetadataEntry; compileBatch?: never; } | { serialize?: never; compileBatch(definitions: readonly ReturnType[], context: CompileContext): readonly (W | MetadataEntry)[]; } | (ReturnType extends ManifestComponent ? { serialize?: never; compileBatch?: never; } : never)); /** Keep public declarations compact without expanding generic factories into their field unions. */ export interface ComponentDefinition { readonly define: F; /** @internal Register a constructed value, preserving its concrete generic type. */ register(definition: D, ...args: unknown[]): D; } interface RegisteredComponent { readonly type: ComponentType; references(): readonly object[]; readonly implementation: { readonly batchKey: object; compileBatch(definitions: readonly object[], context: CompileContext): readonly (MetadataConfig | MetadataEntry)[]; }; } export declare function registeredComponent(definition: object): RegisteredComponent | undefined; /** Retains the exact factory signature, including its generic type parameters. */ export declare function defineComponent(implementation: ComponentImplementation): ComponentDefinition; /** Mirror backend identity and installation-map scopes, using wire fields rather than source IDs. */ export declare function entryKey({ config }: MetadataEntry): string; /** Shared source-build plumbing; each component supplies its own wire format. */ export declare function sourceEntry(metadata: W, source: URL | undefined, build: (config: W, content: string) => W): MetadataEntry; export {}; //# sourceMappingURL=component.d.ts.map