@enonic/mock-xp
Version:
Mock Enonic XP API JavaScript Library
57 lines (56 loc) • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LibContent = void 0;
var Project_1 = require("../implementation/Project");
var LibContent = (function () {
function LibContent(_a) {
var server = _a.server;
this.server = server;
}
LibContent.prototype._connect = function () {
var repoId = this.server.context.repository;
if (!repoId) {
throw new Error('mock-xp: LibContent._connect: No repository set in context!');
}
var branchId = this.server.context.branch;
if (!branchId) {
throw new Error('mock-xp: LibContent._connect: No branch set in context!');
}
return this.server.contentConnect({
branchId: branchId,
projectId: Project_1.Project.projectNameFromRepoId(repoId),
});
};
LibContent.prototype.create = function (params) {
return this._connect().create(params);
};
LibContent.prototype.createMedia = function (params) {
return this._connect().createMedia(params);
};
LibContent.prototype.delete = function (params) {
return this._connect().delete(params);
};
LibContent.prototype.exists = function (params) {
return this._connect().exists(params);
};
LibContent.prototype.get = function (params) {
return this._connect().get(params);
};
LibContent.prototype.getAttachmentStream = function (params) {
return this._connect().getAttachmentStream(params);
};
LibContent.prototype.modify = function (params) {
return this._connect().modify(params);
};
LibContent.prototype.move = function (params) {
return this._connect().move(params);
};
LibContent.prototype.publish = function (params) {
return this._connect().publish(params);
};
LibContent.prototype.query = function (params) {
return this._connect().query(params);
};
return LibContent;
}());
exports.LibContent = LibContent;