UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

30 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentDelivery = void 0; const tslib_1 = require("tslib"); const cms = tslib_1.__importStar(require("../../cms")); const cms_1 = require("../../cms"); const delivery_utils_1 = require("../delivery-utils"); const reference_1 = require("./reference"); class DocumentDelivery extends reference_1.DeliveryWithReference { constructor(delivery, resumeErrors) { super(cms_1.ContentType.DOCUMENT, delivery, resumeErrors); } document(id, context) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const entry = yield this.getEntry(id, context); return this.fromEntry(entry, context); }); } fromEntry(entry, context) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const referenceDelivery = { delivery: this.reference, context, }; return (0, delivery_utils_1.addCustomFields)(new cms.Document(yield this.getReference().commonFields(entry, context), this.urlFromAssetRequired(entry.fields.document)), entry.fields, referenceDelivery, ['document']); }); } } exports.DocumentDelivery = DocumentDelivery; //# sourceMappingURL=document.js.map