@onehat/data 1.22.6 → 1.22.7
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 +1 -1
- package/src/OneHatData.js +7 -5
package/package.json
CHANGED
package/src/OneHatData.js
CHANGED
|
@@ -56,10 +56,10 @@ export class OneHatData extends EventEmitter {
|
|
|
56
56
|
this.repositories = {};
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* @member {Object}
|
|
59
|
+
* @member {Object} uniqueRepositoryIdsMap - Object map of all unique Repositories, with signature of { mapName: id }
|
|
60
60
|
* @private
|
|
61
61
|
*/
|
|
62
|
-
this.
|
|
62
|
+
this.uniqueRepositoryIdsMap = {};
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @member {boolean} isDestroyed - Whether this object has been destroyed
|
|
@@ -495,8 +495,8 @@ export class OneHatData extends EventEmitter {
|
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Gets or creates a unique repository with the supplied schemaName and name
|
|
498
|
-
* @param {string} schemaName - Name of Schema
|
|
499
498
|
* @param {string} mapName - Name of unique repository (will be internally mapped to an id)
|
|
499
|
+
* @param {string} schemaName - Name of Schema
|
|
500
500
|
* @return {Repository} repository
|
|
501
501
|
*/
|
|
502
502
|
getOrCreateUniqueRepository = async (mapName, schemaName) => {
|
|
@@ -505,7 +505,7 @@ export class OneHatData extends EventEmitter {
|
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
// Try to get it
|
|
508
|
-
|
|
508
|
+
let id = this.uniqueRepositoryIdsMap[mapName];
|
|
509
509
|
if (id) {
|
|
510
510
|
return this.getRepositoryById(id);
|
|
511
511
|
}
|
|
@@ -517,8 +517,10 @@ export class OneHatData extends EventEmitter {
|
|
|
517
517
|
}
|
|
518
518
|
|
|
519
519
|
const repository = await this.createRepository(schemaName);
|
|
520
|
-
|
|
520
|
+
id = repository.id;
|
|
521
|
+
repository.name += '-' + id;
|
|
521
522
|
repository.isUnique = true;
|
|
523
|
+
this.uniqueRepositoryIdsMap[mapName] = repository.id;
|
|
522
524
|
return repository;
|
|
523
525
|
}
|
|
524
526
|
|