1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.EntitiesMetadataStorage = void 0;
|
4 | class EntitiesMetadataStorage {
|
5 | static addEntitiesByConnection(connection, entities) {
|
6 | const connectionToken = typeof connection === 'string' ? connection : connection.name;
|
7 | if (!connectionToken) {
|
8 | return;
|
9 | }
|
10 | let collection = this.storage.get(connectionToken);
|
11 | if (!collection) {
|
12 | collection = [];
|
13 | this.storage.set(connectionToken, collection);
|
14 | }
|
15 | entities.forEach((entity) => {
|
16 | if (collection.includes(entity)) {
|
17 | return;
|
18 | }
|
19 | collection.push(entity);
|
20 | });
|
21 | }
|
22 | static getEntitiesByConnection(connection) {
|
23 | const connectionToken = typeof connection === 'string' ? connection : connection.name;
|
24 | if (!connectionToken) {
|
25 | return [];
|
26 | }
|
27 | return this.storage.get(connectionToken) || [];
|
28 | }
|
29 | }
|
30 | exports.EntitiesMetadataStorage = EntitiesMetadataStorage;
|
31 | EntitiesMetadataStorage.storage = new Map();
|