template-archive icon indicating copy to clipboard operation
template-archive copied to clipboard

Support for Custom Resources

Open dselman opened this issue 5 years ago • 1 comments

It would be useful for template developers to be able to include custom resources within their templates. This would also allow vendors to create tools to add vendor-specific metadata to templates.

Describe the solution you'd like

  1. If a template on disk contains a folder resources the files inside should be included within the template archive.
  2. A template created from an archive should make the resources available via API (see below)

API Changes

Add the method:

class Template {
   /**
     * @param {string} filePath - the path to the file
     * @returns {string}  the custom resource
     */
   getResource( filePath )
}
const text = template.getResource(filePath);

Questions

  1. Do we want to limit the type of files. E.g. only JSON/MD/TXT?
  2. Do we want to limit the maximum size?
  3. Do we want to make the files available somehow to Ergo?

dselman avatar Oct 21 '20 16:10 dselman

I think this would be extremely useful!

We have examples of contracts that include attachments. These attachments are commonly static PDFs, DOCX or images. For example, utility bills included in real estate sale contracts.

However, sometimes the attachments are signed agreements which are represented as a Accord templates in their own right. For example, real-estate sale authorities in the State of Victoria sometimes include a separate, signed declaration from Consumer Affairs.

At the moment we are attaching "child" contracts and documents as URL parameters within the "parent" Accord contract. This, obviously, has challenges.

This being the case, it would be great to support a wider range of file types (or not limit the file types) and allow a fairly generous file size.

Maybe, this could be the first step on the path towards a document format for Accord contract instances? #Issue 562

martinhalford avatar Oct 22 '20 03:10 martinhalford