/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.
- Source
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.
| Name | Type | Description |
|---|---|---|
ref | string | Cloudfront resource reference. |
- Source
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.
| Name | Type | Description |
|---|---|---|
ref | string | Reference for the XYZ signer. |
- Source
The fetch is resolved into either a string or JSON depending on the url ending.
- Type:
- Promise.<(String|JSON|Error)>