@researchdatabox/sails-hook-redbox-storage-mongo 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -671,6 +671,7 @@ var Services;
671
671
  updateDatastream(oid, record, newMetadata, fileRoot, fileIdsAdded) {
672
672
  return FormsService.getFormByName(record.metaMetadata.form, true)
673
673
  .pipe((0, rxjs_2.mergeMap)(form => {
674
+ form = form !== null && form !== void 0 ? form : { attachmentFields: [] };
674
675
  const typedForm = form;
675
676
  const reqs = [];
676
677
  record.metaMetadata.attachmentFields = typedForm.attachmentFields;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@researchdatabox/sails-hook-redbox-storage-mongo",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "A MongoDB storage plugin for ReDBox.",
5
5
  "main": "index.js",
6
6
  "sails": {
@@ -742,6 +742,9 @@ export module Services {
742
742
  return FormsService.getFormByName(record.metaMetadata.form, true)
743
743
  .pipe(
744
744
  mergeMap(form => {
745
+ // For any generated, view-only forms, the form may be null, add a coalescence to avoid breaking
746
+ // the attachment update process.
747
+ form = form ?? { attachmentFields: [] };
745
748
  const typedForm = form as { attachmentFields: string[] };
746
749
  const reqs = [];
747
750
  record.metaMetadata.attachmentFields = typedForm.attachmentFields;