Skip to content

Allow different recipes to be called via the INK component

Alf Eaton requested to merge ink-backend-recipe-parameter into master

The existing INK components (frontend and backend) were built to handle conversion of DOCX files to HTML; this change allows any INK recipe to be called in the same way.

  • Adds a "recipe" parameter (fixes #54)
  • Adds an "outputFile" parameter (so the backend knows which file to download at the end of the process)
  • Refactor to improve promise handling

The changes to the backend component are backwards-compatible (tested in Editoria) - finding the recipe id works as follows:

  1. Read the "recipe" parameter.
  2. If there's a matching key (e.g. 'editoria-typescript') in config['pubsweet-component-ink-backend']['recipes'] use that value as the recipe ID. This is the ideal situation, where the app configuration maps keys used in the frontend to recipe IDs in the configured INK instance.
  3. If there's no key, use "Editoria Typescript" as the default (for backwards compatibility). Fetch the list of recipes from the INK API and find the recipe with title that matches this key (this is how it used to work, but is inefficient as it has to fetch and filter that list for every conversion).
Edited by Alf Eaton

Merge request reports