UNPKG

@botonic/plugin-contentful

Version:

## What Does This Plugin Do?

26 lines 1.08 kB
import { __awaiter } from "tslib"; import * as cms from '../../cms'; import { ContentType } from '../../cms'; import { addCustomFields } from '../delivery-utils'; import { DeliveryWithReference } from './reference'; export class DocumentDelivery extends DeliveryWithReference { constructor(delivery, resumeErrors) { super(ContentType.DOCUMENT, delivery, resumeErrors); } document(id, context) { return __awaiter(this, void 0, void 0, function* () { const entry = yield this.getEntry(id, context); return this.fromEntry(entry, context); }); } fromEntry(entry, context) { return __awaiter(this, void 0, void 0, function* () { const referenceDelivery = { delivery: this.reference, context, }; return addCustomFields(new cms.Document(yield this.getReference().commonFields(entry, context), this.urlFromAssetRequired(entry.fields.document)), entry.fields, referenceDelivery, ['document']); }); } } //# sourceMappingURL=document.js.map