/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ClusterModel } from "@matter/model"; import { BitSchema, TypeFromPartialBitSchema } from "../schema/BitmapSchema.js"; import { TlvSchema } from "../tlv/TlvSchema.js"; import { Attribute, Command, Event } from "./RetiredElements.js"; /** * Types and utilities for the deprecated ClusterType factory. * * @deprecated Remove when ClusterType compat layer is dropped. */ export declare namespace RetiredClusterType { /** * Convert a legacy options bag (TLV schemas, AccessLevel enums, boolean flags) into a {@link ClusterModel}. */ export function ModelForOptions(options: Options): ClusterModel; /** * Input to the retired ClusterType factory. * * @deprecated */ export type Options = { id: number; name: string; revision: number; features?: F; supportedFeatures?: TypeFromPartialBitSchema; unknown?: boolean; attributes?: Record>; commands?: Record>; events?: Record>; }; /** * @deprecated Provided for compatibility with external consumers. */ export type AttributeValues = T extends { Typing: { Attributes: infer A; }; } ? A : {}; /** * @deprecated Provided for compatibility with external consumers. */ export type CommandsOf = T extends { Typing: { Commands: infer C; }; } ? C : {}; /** * Extract {@link ClusterTyping} from an {@link Options} bag. * * Derives value types directly from the TLV schemas in the options without the component-merging machinery. */ export type TypingOfOptions = { Attributes: AttrValuesOf; Commands: CmdValuesOf; Events: EventValuesOf; Features: FeatureNamesOf; SupportedFeatures: T["supportedFeatures"] extends {} ? T["supportedFeatures"] : {}; Components: [ { flags: {}; attributes: AttrInterfaceOf; events: EventInterfaceOf; } ]; }; type AttrValueOf = A extends { schema: TlvSchema; } ? T : never; type AttrValuesOf = { [K in keyof R]: AttrValueOf; }; type EventValuesOf = { [K in keyof R]: AttrValueOf; }; type CmdFnOf = C extends { requestSchema: TlvSchema; responseSchema: TlvSchema; } ? Req extends void ? () => Resp : (request: Req) => Resp : () => void; type CmdValuesOf = { [K in keyof R]: CmdFnOf; }; type FeatureNamesOf = Capitalize; /** * Attribute keys that are mandatory (not optional). */ type MandatoryAttrKeys = { [K in keyof R & string]: R[K] extends { optional: true; } ? never : K; }[keyof R & string]; /** * Attribute keys that are optional. */ type OptionalAttrKeys = { [K in keyof R & string]: R[K] extends { optional: true; } ? K : never; }[keyof R & string]; /** * Build a per-component attribute interface from legacy attributes. * * Mandatory attributes are required; optional attributes use `?`. */ type AttrInterfaceOf = { [K in MandatoryAttrKeys]: AttrValueOf; } & { [K in OptionalAttrKeys]?: AttrValueOf; }; /** * Build a per-component event interface from legacy events. * * Mandatory events are required; optional events use `?`. */ type EventInterfaceOf = { [K in MandatoryAttrKeys]: AttrValueOf; } & { [K in OptionalAttrKeys]?: AttrValueOf; }; export {}; } //# sourceMappingURL=RetiredClusterType.d.ts.map