import type { InterfaceType, Property } from '@jsii/spec'; /** * Something that has jsii properties. */ export interface HasProperties { /** * The list of properties of the thing. */ readonly properties?: Property[]; } /** * Something that has a fully-qualified-name. */ export interface HasFullyQualifiedName { /** * The fully-qualified-name of the thing. */ readonly fqn: string; } /** * Something that has a fully-qualified-name. */ export interface HasStructSpec { /** * Get the current spec of the builder. */ readonly spec: InterfaceType; } export interface IStructBuilder { /** * Add properties. * * In the same call, the first defined properties take priority. * However later calls will overwrite existing properties. */ add(...props: Property[]): IStructBuilder; /** * Mix the properties of these sources into the struct. * * In the same call, the first defined sources and properties take priority. * However later calls will overwrite existing properties. */ mixin(...sources: HasProperties[]): IStructBuilder; /** * Replaces an existing property with a new spec. */ replace(name: string, replacement: Property): IStructBuilder; /** * Calls a defined callback function on each property, and replaces the property with the returned property. * * @param callbackfn — A function that accepts a property spec as an argument. The map method calls the callbackfn function one time for each property. */ map(callbackfn: (prop: Property) => Property): IStructBuilder; /** * Update an existing property. */ update(name: string, update: Partial): IStructBuilder; /** * Calls a defined callback function on each property, and merges the property with the returned property partial. * * @param callbackfn — A function that accepts a property spec as an argument. The map method calls the callbackfn function one time for each property. */ updateEvery(callbackfn: (prop: Property) => Partial): IStructBuilder; /** * Update all existing properties. */ updateAll(update: Partial): IStructBuilder; /** * Rename a property. * * If another property with the new name exists, it will be overridden. */ rename(from: string, to: string): IStructBuilder; /** * Mark all properties as optional. */ allOptional(): IStructBuilder; /** * Keep only the properties that meet the condition specified in the callback function. */ filter(predicate: (prop: Property) => boolean): IStructBuilder; /** * Only keep these properties. */ only(...keep: string[]): IStructBuilder; /** * Omit these properties. */ omit(...remove: string[]): IStructBuilder; /** * Remove all deprecated properties. */ withoutDeprecated(): IStructBuilder; } /** * Build a jsii struct */ export declare class Struct implements IStructBuilder, HasProperties, HasFullyQualifiedName, HasStructSpec { /** * Create a builder from an jsii spec */ static fromSpec(spec: InterfaceType): Struct; /** * Create a builder from a jsii FQN * * @param fqn The jsii fqn of the source spec. * @param mergeParents Merge parent interfaces into the spec. Defaults to `true`. */ static fromFqn(fqn: string, mergeParents?: boolean): Struct; /** * Create an empty builder * * Note that the behavior of `builder.spec` is undefined when using this method. */ static empty(fqn?: string): Struct; private _base; private _properties; private constructor(); add(...props: Property[]): this; mixin(...sources: HasProperties[]): this; replace(name: string, replacement: Property): this; map(callbackfn: (prop: Property) => Property): this; update(name: string, update: Partial): this; updateEvery(callbackfn: (prop: Property) => Partial): this; updateAll(update: Partial): this; rename(from: string, to: string): this; allOptional(): this; filter(predicate: (prop: Property) => boolean): this; only(...keep: string[]): this; omit(...remove: string[]): this; withoutDeprecated(): this; /** * Get the current state of the builder */ get spec(): InterfaceType; /** * Get the current properties of the builder */ get properties(): Property[]; /** * Get the FQN for the builder */ get fqn(): string; }