UNPKG

@umbraco/json-models-builders

Version:
50 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MediaPickerValueBuilder = void 0; class MediaPickerValueBuilder { parentBuilder; key; mediaKey; mediaTypeAlias; focalPoint; crops; constructor(parentBuilder) { this.parentBuilder = parentBuilder; } withKey(key) { this.key = key; return this; } withMediaKey(mediaKey) { this.mediaKey = mediaKey; return this; } withMediaTypeAlias(mediaTypeAlias) { this.mediaTypeAlias = mediaTypeAlias; return this; } withFocalPoint(focalPoint) { this.focalPoint = focalPoint; return this; } done() { return this.parentBuilder; } getValue() { let value = {}; if (this.key == null) { const crypto = require('crypto'); this.key = crypto.randomUUID(); } value.key = this.key; if (this.mediaKey !== undefined) { value.mediaKey = this.mediaKey; } value.mediaTypeAlias = this.mediaTypeAlias || ""; value.focalPoint = this.focalPoint || null; value.crops = this.crops || []; return value; } } exports.MediaPickerValueBuilder = MediaPickerValueBuilder; //# sourceMappingURL=mediaPickerValueBuilder.js.map