UNPKG

@sitecore/sc-contenthub-webclient-sdk

Version:

Sitecore Content Hub WebClient SDK.

64 lines 3.29 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { DEFINITIONS } from "../../constants"; import { FinalLifeCycleStatusMapper } from "../../mappers/final-life-cycle-status-mapper"; import { Entity } from "../base/entity"; import { CultureLoadOption } from "../querying/culture-load-option"; import { EntityLoadConfiguration } from "../querying/entity-load-configuration"; import { PropertyLoadOption } from "../querying/property-load-option"; import { RelationLoadOption } from "../querying/relation-load-option"; export class Asset extends Entity { get title() { return this.getPropertyValue(DEFINITIONS["Asset"].title); } set title(value) { this.setPropertyValue(DEFINITIONS["Asset"].title, value); } get fileName() { return this.getPropertyValue(DEFINITIONS["Asset"].fileName); } set fileName(value) { this.setPropertyValue(DEFINITIONS["Asset"].fileName, value); } getDescription(culture) { return this.getPropertyValue(DEFINITIONS["Asset"].description, culture); } setDescription(culture, description) { return this.setPropertyValue(DEFINITIONS["Asset"].description, description, culture); } getFinalLifeCycleStatusAsync() { return __awaiter(this, void 0, void 0, function* () { const relation = this.getRelation(DEFINITIONS["Asset"].finalLifeCycleStatusToAsset); if (relation == null || relation.parent == null) { return null; } const loadConfiguration = new EntityLoadConfiguration(CultureLoadOption.None, new PropertyLoadOption(DEFINITIONS["FinalLifeCycleStatus"].statusValue), RelationLoadOption.None); const parent = yield this._client.entities.getAsync(relation.parent, loadConfiguration); if (parent == null) { return null; } const statusString = parent.getPropertyValue(DEFINITIONS["FinalLifeCycleStatus"].statusValue); const status = FinalLifeCycleStatusMapper.fromString(statusString); return status; }); } loadTypedMembersAsync() { return __awaiter(this, void 0, void 0, function* () { const propertyLoadOption = new PropertyLoadOption([ DEFINITIONS["Asset"].title, DEFINITIONS["Asset"].fileName, DEFINITIONS["Asset"].description, ]); const relationLoadOption = new RelationLoadOption([DEFINITIONS["Asset"].finalLifeCycleStatusToAsset]); yield this.loadMembersAsync(propertyLoadOption, relationLoadOption); }); } } //# sourceMappingURL=asset.js.map