@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
65 lines • 2.61 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 PropertyLoadOption_1;
import { JSON, JsonElementType, JsonObject, JsonProperty } from "ta-json";
import Guard from "../../guard";
import { LoadOption } from "./load-options";
let PropertyLoadOption = PropertyLoadOption_1 = class PropertyLoadOption {
constructor(param) {
this.loadOption = 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.stringNotNullOrEmpty(param);
this.loadOption = LoadOption.Custom;
this.properties = [param];
}
else if (param instanceof Array) {
Guard.arrayNotEmpty(param);
this.loadOption = LoadOption.Custom;
this.properties = [...param];
}
else {
this.loadOption = param;
}
}
deepClone() {
return JSON.deserialize(JSON.serialize(this), PropertyLoadOption_1);
}
};
/**
* Load no properties.
*/
PropertyLoadOption.None = new PropertyLoadOption_1(LoadOption.None);
/**
* Load all properties.
*/
PropertyLoadOption.All = new PropertyLoadOption_1(LoadOption.All);
__decorate([
JsonProperty("load_option"),
__metadata("design:type", Number)
], PropertyLoadOption.prototype, "loadOption", void 0);
__decorate([
JsonProperty("properties"),
JsonElementType(String),
__metadata("design:type", Array)
], PropertyLoadOption.prototype, "properties", void 0);
PropertyLoadOption = PropertyLoadOption_1 = __decorate([
JsonObject(),
__metadata("design:paramtypes", [Object])
], PropertyLoadOption);
export { PropertyLoadOption };
//# sourceMappingURL=property-load-option.js.map