@umbraco/json-models-builders
Version:
Builders and models for Umbraco Sites
36 lines • 941 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataTypeBuilder = void 0;
const BuilderUtils_1 = require("../../helpers/BuilderUtils");
class DataTypeBuilder {
id;
parentId;
name;
editorAlias;
editorUiAlias;
withName(name) {
this.name = name;
return this;
}
withId(id) {
this.id = id;
return this;
}
withParentId(parentId) {
this.parentId = parentId;
return this;
}
build() {
this.id = (0, BuilderUtils_1.ensureIdExists)(this.id);
return {
editorAlias: this.editorAlias,
editorUiAlias: this.editorUiAlias,
id: this.id,
name: this.name,
parent: this.parentId ? { id: this.parentId } : null,
values: this.getValues()
};
}
}
exports.DataTypeBuilder = DataTypeBuilder;
//# sourceMappingURL=dataTypeBuilder.js.map