@netlify/content-engine
Version:
29 lines • 1.48 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.addRemoteFileInterfaceFields = addRemoteFileInterfaceFields;
exports.getOrCreateRemoteFileInterface = getOrCreateRemoteFileInterface;
const redux_1 = require("redux");
const redux_2 = require("../../redux");
const actions_1 = require("../../redux/actions");
const polyfill_remote_file_1 = require("../../plugin-utils/polyfill-remote-file");
function addRemoteFileInterfaceFields(schemaComposer, typeComposer) {
const remoteFileInterfaceType = getOrCreateRemoteFileInterface(schemaComposer);
typeComposer.addFields(remoteFileInterfaceType.getFields());
}
function getOrCreateRemoteFileInterface(schemaComposer) {
const enums = (0, polyfill_remote_file_1.getRemoteFileEnums)(schemaComposer.createEnumTC.bind(schemaComposer));
schemaComposer.getOrCreateOTC(`RemoteFileResize`, (tc) => {
tc.addFields({
width: `Int`,
height: `Int`,
src: `String`,
});
});
return schemaComposer.getOrCreateIFTC(`RemoteFile`, (tc) => {
tc.setDescription(`Remote Interface`);
const boundActions = (0, redux_1.bindActionCreators)(actions_1.actions, redux_2.store.dispatch);
// @ts-ignore - types are messed up by schema composer maybe new version helps here
tc.addFields((0, polyfill_remote_file_1.getRemoteFileFields)(enums, boundActions, redux_2.store));
});
}
//# sourceMappingURL=remote-file-interface.js.map
;