// Copyright (c) Cratis. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. import { EventMigrationPropertyBuilder } from './EventMigrationPropertyBuilder.js'; import { IEventMigrationBuilder } from './IEventMigrationBuilder.js'; /** * Represents an implementation of {@link IEventMigrationBuilder}. */ export class EventMigrationBuilder implements IEventMigrationBuilder { private readonly _propertyBuilders: EventMigrationPropertyBuilder[] = []; /** @inheritdoc */ properties(properties: (builder: EventMigrationPropertyBuilder) => void): void { const builder = new EventMigrationPropertyBuilder(); properties(builder); this._propertyBuilders.push(builder); } /** * Convert the builder to an object representation. * @returns The migration object representation. */ toObject(): Record { const result: Record = {}; for (const builder of this._propertyBuilders) { Object.assign(result, builder.properties); } return result; } }