UNPKG

@botonic/plugin-contentful

Version:

## What Does This Plugin Do?

22 lines 875 B
import { __awaiter, __rest } from "tslib"; import * as cms from '../../cms'; import { ContentDelivery } from '../content-delivery'; export class CustomDelivery extends ContentDelivery { constructor(delivery, resumeErrors) { super(cms.CustomContentType.CUSTOM, delivery, resumeErrors); } custom(id, context) { return __awaiter(this, void 0, void 0, function* () { const entry = yield this.getEntry(id, context); return this.fromEntry(entry, context); }); } fromEntry(customEntry, _context) { return new cms.Custom(customEntry.sys.id, customEntry.fields.name, this.getCustomFields(customEntry.fields)); } getCustomFields(entryFields) { const { name } = entryFields, fields = __rest(entryFields, ["name"]); return fields ? fields : {}; } } //# sourceMappingURL=custom.js.map