@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
22 lines • 875 B
JavaScript
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