/provider/getFrom

The getFrom provider module allows XYZ modules to get resources either from configured sources.

Cloudfront resources get cached for 60seconds to prevent excessive requests for the same resource.

Requires

  • module:../sign/file
  • module:../utils/logger
  • module:./cloudfront
  • module:./file

Methods

(async, inner) Cloudfront(ref) → {Promise.<(String|JSON|Error)>}

The method will extract a cloudfront URL from the ref param string.

The fetch request will be created from the cloudfront provider module with the cloudfront url.

The fetch request will be stored in a cache Map object for requests from the cacheTemplates workspace module.

Parameters:
NameTypeDescription
refstring

Cloudfront resource reference.

Returns:

The fetch is resolved into either a string or JSON depending on the url ending.

Type: 
Promise.<(String|JSON|Error)>

(async, inner) XYZ(ref) → {Promise.<(String|JSON|Error)>}

The method splits the reference string into a params object for the XYZ file signer.

Parameters:
NameTypeDescription
refstring

Reference for the XYZ signer.

Returns:

The fetch is resolved into either a string or JSON depending on the url ending.

Type: 
Promise.<(String|JSON|Error)>