@onehat/data 1.4.4 → 1.4.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/OneHatData.js CHANGED
@@ -282,12 +282,15 @@ export class OneHatData extends EventEmitter {
282
282
  if (this.isDestroyed) {
283
283
  throw new Error('this.createRepositories is no longer valid. OneHatData has been destroyed.');
284
284
  }
285
- let promises = [];
286
- _.each(schemas, (schema) => {
287
- promises.push( this.createRepository({ schema, }, bound) );
288
- });
289
-
290
- await Promise.all(promises);
285
+ const schemasArray = _.map(schemas, (schema) => schema);
286
+ let i, schema, repository;
287
+ for (i = 0; i < schemasArray.length; i++) {
288
+ schema = schemasArray[i];
289
+ repository = await this.createRepository({ schema, }, bound);
290
+ if (!repository) {
291
+ throw new Error('Repository could not be created');
292
+ }
293
+ }
291
294
  return this;
292
295
  }
293
296