@becomes/cms
Version:
Simple CMS for building APIs.
45 lines • 1.95 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntryServiceCache = void 0;
var cache_1 = require("../util/cache");
var EntryServiceCache = (function (_super) {
__extends(EntryServiceCache, _super);
function EntryServiceCache() {
return _super !== null && _super.apply(this, arguments) || this;
}
EntryServiceCache.prototype.findByTemplateIdAndEntrySlug = function (templateId, entrySlug) {
var result = this.cache.find(function (entry) {
return entry.templateId === templateId &&
entry.content.find(function (content) {
return content.props.find(function (prop) {
return prop.value.heading &&
prop.value.heading.slug === entrySlug;
});
});
});
return result ? result : null;
};
EntryServiceCache.prototype.findAllByTemplateId = function (templateId) {
var result = this.cache.filter(function (entry) { return entry.templateId === templateId; });
return result ? result : null;
};
EntryServiceCache.prototype.count = function () {
return this.cache.length;
};
return EntryServiceCache;
}(cache_1.Cache));
exports.EntryServiceCache = EntryServiceCache;
//# sourceMappingURL=entry.service.cache.js.map