Support Metadata in GridFSAdapter (#6660)

* Support Metadata in GridFSAdapter

* Useful for testing in the JS SDK
* Adds new endpoint to be used with `Parse.File.getData`
* Allows file adapters to return tags as well as future data.

* fix tests

* Make getMetadata optional

* Revert "fix tests"

This reverts commit 7706da13c688027483974e854b5b24321fb070cd.

* improve coverage
This commit is contained in:
Diamond Lewis
2020-05-08 15:32:20 -05:00
committed by GitHub
parent c32ff20f4f
commit 370215a39b
6 changed files with 162 additions and 50 deletions

View File

@@ -45,6 +45,13 @@ export class FilesController extends AdaptableController {
return this.adapter.deleteFile(filename);
}
getMetadata(filename) {
if (typeof this.adapter.getMetadata === 'function') {
return this.adapter.getMetadata(filename);
}
return Promise.resolve({});
}
/**
* Find file references in REST-format object and adds the url key
* with the current mount point and app id.
@@ -52,7 +59,7 @@ export class FilesController extends AdaptableController {
*/
expandFilesInObject(config, object) {
if (object instanceof Array) {
object.map(obj => this.expandFilesInObject(config, obj));
object.map((obj) => this.expandFilesInObject(config, obj));
return;
}
if (typeof object !== 'object') {