@adtrackify/at-service-common 3.1.9 → 3.1.10
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/dist/cjs/services/cache/product-cache-service.d.ts +4 -0
- package/dist/cjs/services/cache/product-cache-service.js +6 -1
- package/dist/cjs/services/cache/product-cache-service.js.map +1 -1
- package/dist/esm/services/cache/product-cache-service.d.ts +4 -0
- package/dist/esm/services/cache/product-cache-service.js +7 -2
- package/dist/esm/services/cache/product-cache-service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { InternalProduct } from '../shopify/types/product';
|
|
2
|
+
export interface ProductCache {
|
|
3
|
+
productCompressed: string;
|
|
4
|
+
expiresAt: number;
|
|
5
|
+
}
|
|
2
6
|
export declare class ProductCacheService {
|
|
3
7
|
private genericCacheService;
|
|
4
8
|
constructor(cacheLambdaFunctionArn: string);
|
|
@@ -14,7 +14,12 @@ class ProductCacheService {
|
|
|
14
14
|
};
|
|
15
15
|
getProductFromCache = async (pixelId, productId) => {
|
|
16
16
|
const cacheKey = this.getCacheKey(pixelId, productId);
|
|
17
|
-
|
|
17
|
+
const cachedData = await this.genericCacheService.getCachedData(cacheKey);
|
|
18
|
+
if (cachedData) {
|
|
19
|
+
const product = (0, libs_1.decompressJSON)(cachedData.productCompressed);
|
|
20
|
+
return product;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
18
23
|
};
|
|
19
24
|
putProductInCache = async (pixelId, productId, product, ttlInDays) => {
|
|
20
25
|
const cacheKey = this.getCacheKey(pixelId, productId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-cache-service.js","sourceRoot":"","sources":["../../../../src/services/cache/product-cache-service.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,oEAA+D;AAE/D,
|
|
1
|
+
{"version":3,"file":"product-cache-service.js","sourceRoot":"","sources":["../../../../src/services/cache/product-cache-service.ts"],"names":[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,EAAE,CAAC,CAAC;IAC3F,CAAC,CAAA;IACM,sBAAsB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAiB,EAAE,EAAE;QAC3E,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACtD,MAAM,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC,CAAA;CACF;AA5BD,kDA4BC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { InternalProduct } from '../shopify/types/product';
|
|
2
|
+
export interface ProductCache {
|
|
3
|
+
productCompressed: string;
|
|
4
|
+
expiresAt: number;
|
|
5
|
+
}
|
|
2
6
|
export declare class ProductCacheService {
|
|
3
7
|
private genericCacheService;
|
|
4
8
|
constructor(cacheLambdaFunctionArn: string);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
2
|
import { GenericCacheService } from '../generic-cache-service';
|
|
3
|
-
import { compressJSON } from '../../libs';
|
|
3
|
+
import { compressJSON, decompressJSON } from '../../libs';
|
|
4
4
|
export class ProductCacheService {
|
|
5
5
|
genericCacheService;
|
|
6
6
|
constructor(cacheLambdaFunctionArn) {
|
|
@@ -11,7 +11,12 @@ export class ProductCacheService {
|
|
|
11
11
|
};
|
|
12
12
|
getProductFromCache = async (pixelId, productId) => {
|
|
13
13
|
const cacheKey = this.getCacheKey(pixelId, productId);
|
|
14
|
-
|
|
14
|
+
const cachedData = await this.genericCacheService.getCachedData(cacheKey);
|
|
15
|
+
if (cachedData) {
|
|
16
|
+
const product = decompressJSON(cachedData.productCompressed);
|
|
17
|
+
return product;
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
15
20
|
};
|
|
16
21
|
putProductInCache = async (pixelId, productId, product, ttlInDays) => {
|
|
17
22
|
const cacheKey = this.getCacheKey(pixelId, productId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-cache-service.js","sourceRoot":"","sources":["../../../../src/services/cache/product-cache-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"product-cache-service.js","sourceRoot":"","sources":["../../../../src/services/cache/product-cache-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM1D,MAAM,OAAO,mBAAmB;IACtB,mBAAmB,CAAsB;IACjD,YAAY,sBAA8B;QACxC,IAAI,CAAC,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;IAC7E,CAAC;IACM,WAAW,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAE,EAAE;QAC1D,OAAO,oBAAoB,OAAO,IAAI,SAAS,EAAE,CAAC;IACpD,CAAC,CAAA;IACM,mBAAmB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAiB,EAAwC,EAAE;QAC9G,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAe,QAAQ,CAAC,CAAC;QACxF,IAAI,UAAU,EAAE;YACd,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;YAC7D,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAA;IACM,iBAAiB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAiB,EAAE,OAAwB,EAAE,SAAkB,EAA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