@autofleet/sadot 0.5.4-beta.22 → 0.5.4-beta.23
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
3
7
|
const attributeCache = new Map();
|
|
4
8
|
const mapAttributeToInstance = (scopeAttributes, instance) => scopeAttributes.map((attr) => instance[attr]);
|
|
5
9
|
const buildAttributesByInstance = (instance, scopeAttributes) => {
|
|
@@ -9,10 +13,12 @@ const buildAttributesByInstance = (instance, scopeAttributes) => {
|
|
|
9
13
|
return mapAttributeToInstance(scopeAttributes, instance);
|
|
10
14
|
};
|
|
11
15
|
const getScopeAttributes = async (instance, scopeAttributes, scopeAttributeReplacer) => {
|
|
16
|
+
logger_1.default.info('Getting scope attributes', { instance, scopeAttributes });
|
|
12
17
|
const attributes = buildAttributesByInstance(instance, scopeAttributes);
|
|
13
18
|
const attributeCacheKey = attributes.join();
|
|
14
19
|
const cachedAttributes = attributeCache.get(attributeCacheKey);
|
|
15
20
|
if (cachedAttributes) {
|
|
21
|
+
logger_1.default.info('Using cached attributes', { cachedAttributes });
|
|
16
22
|
return cachedAttributes;
|
|
17
23
|
}
|
|
18
24
|
const attributeResult = (scopeAttributeReplacer
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ModelOptions } from '../types';
|
|
2
|
+
import logger from './logger';
|
|
2
3
|
|
|
3
4
|
const attributeCache = new Map<string, string[]>();
|
|
4
5
|
|
|
@@ -14,10 +15,12 @@ const buildAttributesByInstance = (instance: any, scopeAttributes: string[]) =>
|
|
|
14
15
|
|
|
15
16
|
const getScopeAttributes = async (instance: any, scopeAttributes: string[],
|
|
16
17
|
scopeAttributeReplacer?: ModelOptions['scopeAttributeReplacer']): Promise<string[]> => {
|
|
18
|
+
logger.info('Getting scope attributes', { instance, scopeAttributes });
|
|
17
19
|
const attributes = buildAttributesByInstance(instance, scopeAttributes);
|
|
18
20
|
const attributeCacheKey = attributes.join();
|
|
19
21
|
const cachedAttributes = attributeCache.get(attributeCacheKey);
|
|
20
22
|
if (cachedAttributes) {
|
|
23
|
+
logger.info('Using cached attributes', { cachedAttributes });
|
|
21
24
|
return cachedAttributes;
|
|
22
25
|
}
|
|
23
26
|
const attributeResult = (scopeAttributeReplacer
|