@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
104 lines • 4.51 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);
};
import { JsonDiscriminatorProperty, JsonElementType, JsonObject, JsonProperty } from "ta-json";
import DataType from "./data-type";
import { MemberCondition } from "./member-condition";
import { MemberDefinitionType } from "./member-definition-type";
let MemberDefinition = class MemberDefinition {
get isConditional() {
return !!this.conditions.length;
}
constructor(name, type) {
this.allowUpdates = true;
this.labels = {};
this.helpText = {};
this.conditions = [];
this.name = name;
this.type = type;
}
static isPropertyDefinition(definition) {
return definition.definitionType === MemberDefinitionType.Property;
}
static isStringPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.String;
}
static isIntegerPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.Integer;
}
static isLongPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.Long;
}
static isDecimalPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.Decimal;
}
static isBooleanPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.Boolean;
}
static isDateTimePropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.DateTime;
}
static isDateTimeOffsetPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.DateTimeOffset;
}
static isJsonPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === DataType.Json;
}
static isRelationDefinition(definition) {
return definition.definitionType === MemberDefinitionType.Relation;
}
};
__decorate([
JsonProperty("type"),
__metadata("design:type", String)
], MemberDefinition.prototype, "type", void 0);
__decorate([
JsonProperty("name"),
__metadata("design:type", String)
], MemberDefinition.prototype, "name", void 0);
__decorate([
JsonProperty("allow_updates"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "allowUpdates", void 0);
__decorate([
JsonProperty("is_system_owned"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "isSystemOwned", void 0);
__decorate([
JsonProperty("is_secured"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "isSecured", void 0);
__decorate([
JsonProperty("labels"),
__metadata("design:type", Object)
], MemberDefinition.prototype, "labels", void 0);
__decorate([
JsonProperty("helptext"),
__metadata("design:type", Object)
], MemberDefinition.prototype, "helpText", void 0);
__decorate([
JsonProperty("conditions"),
JsonElementType(MemberCondition),
__metadata("design:type", Array)
], MemberDefinition.prototype, "conditions", void 0);
__decorate([
JsonProperty("can_trigger_conditional_members"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "canTriggerConditionalMembers", void 0);
__decorate([
JsonProperty("can_write"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "canWrite", void 0);
MemberDefinition = __decorate([
JsonObject(),
JsonDiscriminatorProperty("type"),
__metadata("design:paramtypes", [String, String])
], MemberDefinition);
export { MemberDefinition };
//# sourceMappingURL=member-definition.js.map