@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
110 lines • 5.13 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 };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberDefinition = void 0;
const ta_json_1 = require("ta-json");
const data_type_1 = __importDefault(require("./data-type"));
const member_condition_1 = require("./member-condition");
const member_definition_type_1 = require("./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 === member_definition_type_1.MemberDefinitionType.Property;
}
static isStringPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.String;
}
static isIntegerPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.Integer;
}
static isLongPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.Long;
}
static isDecimalPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.Decimal;
}
static isBooleanPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.Boolean;
}
static isDateTimePropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.DateTime;
}
static isDateTimeOffsetPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.DateTimeOffset;
}
static isJsonPropertyDefinition(definition) {
return this.isPropertyDefinition(definition) && definition.dataType === data_type_1.default.Json;
}
static isRelationDefinition(definition) {
return definition.definitionType === member_definition_type_1.MemberDefinitionType.Relation;
}
};
exports.MemberDefinition = MemberDefinition;
__decorate([
(0, ta_json_1.JsonProperty)("type"),
__metadata("design:type", String)
], MemberDefinition.prototype, "type", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("name"),
__metadata("design:type", String)
], MemberDefinition.prototype, "name", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("allow_updates"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "allowUpdates", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("is_system_owned"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "isSystemOwned", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("is_secured"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "isSecured", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("labels"),
__metadata("design:type", Object)
], MemberDefinition.prototype, "labels", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("helptext"),
__metadata("design:type", Object)
], MemberDefinition.prototype, "helpText", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("conditions"),
(0, ta_json_1.JsonElementType)(member_condition_1.MemberCondition),
__metadata("design:type", Array)
], MemberDefinition.prototype, "conditions", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("can_trigger_conditional_members"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "canTriggerConditionalMembers", void 0);
__decorate([
(0, ta_json_1.JsonProperty)("can_write"),
__metadata("design:type", Boolean)
], MemberDefinition.prototype, "canWrite", void 0);
exports.MemberDefinition = MemberDefinition = __decorate([
(0, ta_json_1.JsonObject)(),
(0, ta_json_1.JsonDiscriminatorProperty)("type"),
__metadata("design:paramtypes", [String, String])
], MemberDefinition);
//# sourceMappingURL=member-definition.js.map