@adtrackify/at-service-common 3.0.39 → 3.0.41

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.
@@ -2,3 +2,5 @@ export * from './destinations-service.js';
2
2
  export * from './log-events-db-service.js';
3
3
  export * from './purchased-contacts-db-service.js';
4
4
  export * from './tracking-events-db-service.js';
5
+ export * from './shopify-products-cache-db-service.js';
6
+ export * from './shopify-app-installs-db-service.js';
@@ -18,4 +18,6 @@ __exportStar(require("./destinations-service.js"), exports);
18
18
  __exportStar(require("./log-events-db-service.js"), exports);
19
19
  __exportStar(require("./purchased-contacts-db-service.js"), exports);
20
20
  __exportStar(require("./tracking-events-db-service.js"), exports);
21
+ __exportStar(require("./shopify-products-cache-db-service.js"), exports);
22
+ __exportStar(require("./shopify-app-installs-db-service.js"), exports);
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/db/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C;AAC3C,qEAAmD;AACnD,kEAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/db/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C;AAC3C,qEAAmD;AACnD,kEAAgD;AAChD,yEAAuD;AACvD,uEAAqD"}
@@ -0,0 +1,7 @@
1
+ import { ShopifyAppInstall } from '@adtrackify/at-tracking-event-types';
2
+ export declare class ShopifyAppInstallsDbService {
3
+ TABLE_NAME: string;
4
+ constructor(tableName: string);
5
+ getShopifyAppInstallByShop: (indexName: string, shop: string) => Promise<ShopifyAppInstall | null>;
6
+ getShopifyAppInstallByPixelId: (indexName: string, pixelId: string) => Promise<ShopifyAppInstall | null>;
7
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShopifyAppInstallsDbService = void 0;
4
+ const clients_1 = require("../../clients");
5
+ const helpers_1 = require("../../helpers");
6
+ class ShopifyAppInstallsDbService {
7
+ TABLE_NAME;
8
+ constructor(tableName) {
9
+ this.TABLE_NAME = tableName;
10
+ }
11
+ getShopifyAppInstallByShop = async (indexName, shop) => {
12
+ try {
13
+ const values = {
14
+ ':shop': shop
15
+ };
16
+ const query = {
17
+ TableName: this.TABLE_NAME,
18
+ IndexName: indexName,
19
+ KeyConditionExpression: 'shop = :shop',
20
+ ExpressionAttributeValues: values
21
+ };
22
+ const shopifyAppInstalls = await clients_1.DynamoDbClient.queryAll(query);
23
+ if (shopifyAppInstalls && shopifyAppInstalls.length > 0) {
24
+ return shopifyAppInstalls[0];
25
+ }
26
+ return null;
27
+ }
28
+ catch (error) {
29
+ helpers_1.Logger.error('failed to shopifyAppInstall by shop', { error, indexName, shop });
30
+ return null;
31
+ }
32
+ };
33
+ getShopifyAppInstallByPixelId = async (indexName, pixelId) => {
34
+ try {
35
+ const shopifyAppInstalls = await clients_1.DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, 'pixelId', pixelId);
36
+ if (shopifyAppInstalls && shopifyAppInstalls?.length > 0) {
37
+ return shopifyAppInstalls[0];
38
+ }
39
+ return null;
40
+ }
41
+ catch (error) {
42
+ helpers_1.Logger.error('failed to fetch shopifyAppInstall by pixelId', { error, indexName, pixelId });
43
+ return null;
44
+ }
45
+ };
46
+ }
47
+ exports.ShopifyAppInstallsDbService = ShopifyAppInstallsDbService;
48
+ //# sourceMappingURL=shopify-app-installs-db-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify-app-installs-db-service.js","sourceRoot":"","sources":["../../../../src/services/db/shopify-app-installs-db-service.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAC/C,2CAAuC;AAEvC,MAAa,2BAA2B;IAC/B,UAAU,CAAS;IAE1B,YAAY,SAAiB;QAC3B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;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@@ -2,3 +2,5 @@ export * from './destinations-service.js';
2
2
  export * from './log-events-db-service.js';
3
3
  export * from './purchased-contacts-db-service.js';
4
4
  export * from './tracking-events-db-service.js';
5
+ export * from './shopify-products-cache-db-service.js';
6
+ export * from './shopify-app-installs-db-service.js';
@@ -2,4 +2,6 @@ export * from './destinations-service.js';
2
2
  export * from './log-events-db-service.js';
3
3
  export * from './purchased-contacts-db-service.js';
4
4
  export * from './tracking-events-db-service.js';
5
+ export * from './shopify-products-cache-db-service.js';
6
+ export * from './shopify-app-installs-db-service.js';
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/db/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/db/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ShopifyAppInstall } from '@adtrackify/at-tracking-event-types';
2
+ export declare class ShopifyAppInstallsDbService {
3
+ TABLE_NAME: string;
4
+ constructor(tableName: string);
5
+ getShopifyAppInstallByShop: (indexName: string, shop: string) => Promise<ShopifyAppInstall | null>;
6
+ getShopifyAppInstallByPixelId: (indexName: string, pixelId: string) => Promise<ShopifyAppInstall | null>;
7
+ }
@@ -0,0 +1,44 @@
1
+ import { DynamoDbClient } from '../../clients';
2
+ import { Logger } from '../../helpers';
3
+ export class ShopifyAppInstallsDbService {
4
+ TABLE_NAME;
5
+ constructor(tableName) {
6
+ this.TABLE_NAME = tableName;
7
+ }
8
+ getShopifyAppInstallByShop = async (indexName, shop) => {
9
+ try {
10
+ const values = {
11
+ ':shop': shop
12
+ };
13
+ const query = {
14
+ TableName: this.TABLE_NAME,
15
+ IndexName: indexName,
16
+ KeyConditionExpression: 'shop = :shop',
17
+ ExpressionAttributeValues: values
18
+ };
19
+ const shopifyAppInstalls = await DynamoDbClient.queryAll(query);
20
+ if (shopifyAppInstalls && shopifyAppInstalls.length > 0) {
21
+ return shopifyAppInstalls[0];
22
+ }
23
+ return null;
24
+ }
25
+ catch (error) {
26
+ Logger.error('failed to shopifyAppInstall by shop', { error, indexName, shop });
27
+ return null;
28
+ }
29
+ };
30
+ getShopifyAppInstallByPixelId = async (indexName, pixelId) => {
31
+ try {
32
+ const shopifyAppInstalls = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, 'pixelId', pixelId);
33
+ if (shopifyAppInstalls && shopifyAppInstalls?.length > 0) {
34
+ return shopifyAppInstalls[0];
35
+ }
36
+ return null;
37
+ }
38
+ catch (error) {
39
+ Logger.error('failed to fetch shopifyAppInstall by pixelId', { error, indexName, pixelId });
40
+ return null;
41
+ }
42
+ };
43
+ }
44
+ //# sourceMappingURL=shopify-app-installs-db-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify-app-installs-db-service.js","sourceRoot":"","sources":["../../../../src/services/db/shopify-app-installs-db-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,OAAO,2BAA2B;IAC/B,UAAU,CAAS;IAE1B,YAAY,SAAiB;QAC3B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEM,0BAA0B,GAAG,KAAK,EAAE,SAAiB,EAAE,IAAY,EAAqC,EAAE;QAC/G,IAAI;YACF,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,IAAI;aACd,CAAC;YACF,MAAM,KAAK,GAAG;gBACZ,SAAS,EAAE,IAAI,CAAC,UAAU;gBAC1B,SAAS,EAAE,SAAS;gBACpB,sBAAsB,EAAE,cAAc;gBACtC,yBAAyB,EAAE,MAAM;aAClC,CAAC;YACF,MAAM,kBAAkB,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChE,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvD,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;aAC9B;YACD,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChF,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC;IAEK,6BAA6B,GAAG,KAAK,EAAE,SAAiB,EAAE,OAAe,EAAqC,EAAE;QACrH,IAAI;YACF,MAAM,kBAAkB,GAAG,MAAM,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAC/G,IAAI,kBAAkB,IAAI,kBAAkB,EAAE,MAAM,GAAG,CAAC,EAAE;gBACxD,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;aAC9B;YACD,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,8CAA8C,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5F,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "3.0.39",
3
+ "version": "3.0.41",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/*"
@@ -51,7 +51,7 @@
51
51
  "uuid": "^9.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@adtrackify/at-tracking-event-types": "^3.0.86",
54
+ "@adtrackify/at-tracking-event-types": "^3.0.98",
55
55
  "@aws-sdk/client-cognito-identity-provider": "^3.345.0",
56
56
  "@aws-sdk/client-dynamodb": "^3.345.0",
57
57
  "@aws-sdk/client-eventbridge": "^3.345.0",