@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
71 lines • 3.07 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var PropertyLoadOption_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyLoadOption = void 0;
const ta_json_1 = require("ta-json");
const guard_1 = __importDefault(require("../../guard"));
const load_options_1 = require("./load-options");
let PropertyLoadOption = PropertyLoadOption_1 = class PropertyLoadOption {
constructor(param) {
this.loadOption = load_options_1.LoadOption.None;
this.properties = [];
if (param == null) {
return;
}
else if (param instanceof PropertyLoadOption_1) {
this.loadOption = param.loadOption;
this.properties = [...param.properties];
}
else if (typeof param === "string") {
guard_1.default.stringNotNullOrEmpty(param);
this.loadOption = load_options_1.LoadOption.Custom;
this.properties = [param];
}
else if (param instanceof Array) {
guard_1.default.arrayNotEmpty(param);
this.loadOption = load_options_1.LoadOption.Custom;
this.properties = [...param];
}
else {
this.loadOption = param;
}
}
deepClone() {
return ta_json_1.JSON.deserialize(ta_json_1.JSON.serialize(this), PropertyLoadOption_1);
}
};
exports.PropertyLoadOption = PropertyLoadOption;
/**
* Load no properties.
*/
PropertyLoadOption.None = new PropertyLoadOption_1(load_options_1.LoadOption.None);
/**
* Load all properties.
*/
PropertyLoadOption.All = new PropertyLoadOption_1(load_options_1.LoadOption.All);
__decorate([
(0, ta_json_1.JsonProperty)("load_option"),
__metadata("design:type", Number)
], PropertyLoadOption.prototype, "loadOption", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("properties"),
(0, ta_json_1.JsonElementType)(String),
__metadata("design:type", Array)
], PropertyLoadOption.prototype, "properties", void 0);
exports.PropertyLoadOption = PropertyLoadOption = PropertyLoadOption_1 = __decorate([
(0, ta_json_1.JsonObject)(),
__metadata("design:paramtypes", [Object])
], PropertyLoadOption);
//# sourceMappingURL=property-load-option.js.map