@adtrackify/at-service-common 3.1.3 → 3.1.5

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.
Files changed (57) hide show
  1. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.d.ts +1 -0
  2. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.js +109 -0
  3. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.js.map +1 -0
  4. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -0
  5. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.js +97 -0
  6. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.js.map +1 -0
  7. package/dist/cjs/clients/third-party/shopify-client.d.ts +0 -2
  8. package/dist/cjs/clients/third-party/shopify-client.js +0 -54
  9. package/dist/cjs/clients/third-party/shopify-client.js.map +1 -1
  10. package/dist/cjs/services/cache/product-cache-service.d.ts +9 -0
  11. package/dist/cjs/services/cache/product-cache-service.js +32 -0
  12. package/dist/cjs/services/cache/product-cache-service.js.map +1 -0
  13. package/dist/cjs/services/db/shopify-products-cache-db-service.d.ts +2 -6
  14. package/dist/cjs/services/db/shopify-products-cache-db-service.js +16 -64
  15. package/dist/cjs/services/db/shopify-products-cache-db-service.js.map +1 -1
  16. package/dist/cjs/services/generic-cache-service.d.ts +8 -0
  17. package/dist/cjs/services/generic-cache-service.js +31 -0
  18. package/dist/cjs/services/generic-cache-service.js.map +1 -0
  19. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.d.ts +7 -0
  20. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.js +48 -0
  21. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.js.map +1 -0
  22. package/dist/cjs/services/shopify/shopify-graphql-transformer.d.ts +6 -0
  23. package/dist/cjs/services/shopify/shopify-graphql-transformer.js +80 -0
  24. package/dist/cjs/services/shopify/shopify-graphql-transformer.js.map +1 -0
  25. package/dist/cjs/services/shopify/types/product.d.ts +83 -0
  26. package/dist/cjs/services/shopify/types/product.js +10 -0
  27. package/dist/cjs/services/shopify/types/product.js.map +1 -0
  28. package/dist/cjs/types/shopify-graphql-types/admin.generated.d.ts +34 -3
  29. package/dist/esm/clients/third-party/shopify/graphql-product-queries.d.ts +1 -0
  30. package/dist/esm/clients/third-party/shopify/graphql-product-queries.js +106 -0
  31. package/dist/esm/clients/third-party/shopify/graphql-product-queries.js.map +1 -0
  32. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -0
  33. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.js +93 -0
  34. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.js.map +1 -0
  35. package/dist/esm/clients/third-party/shopify-client.d.ts +0 -2
  36. package/dist/esm/clients/third-party/shopify-client.js +0 -54
  37. package/dist/esm/clients/third-party/shopify-client.js.map +1 -1
  38. package/dist/esm/services/cache/product-cache-service.d.ts +9 -0
  39. package/dist/esm/services/cache/product-cache-service.js +28 -0
  40. package/dist/esm/services/cache/product-cache-service.js.map +1 -0
  41. package/dist/esm/services/db/shopify-products-cache-db-service.d.ts +2 -6
  42. package/dist/esm/services/db/shopify-products-cache-db-service.js +16 -64
  43. package/dist/esm/services/db/shopify-products-cache-db-service.js.map +1 -1
  44. package/dist/esm/services/generic-cache-service.d.ts +8 -0
  45. package/dist/esm/services/generic-cache-service.js +27 -0
  46. package/dist/esm/services/generic-cache-service.js.map +1 -0
  47. package/dist/esm/services/shopify/products/shopify-products-serviceV2.d.ts +7 -0
  48. package/dist/esm/services/shopify/products/shopify-products-serviceV2.js +44 -0
  49. package/dist/esm/services/shopify/products/shopify-products-serviceV2.js.map +1 -0
  50. package/dist/esm/services/shopify/shopify-graphql-transformer.d.ts +6 -0
  51. package/dist/esm/services/shopify/shopify-graphql-transformer.js +77 -0
  52. package/dist/esm/services/shopify/shopify-graphql-transformer.js.map +1 -0
  53. package/dist/esm/services/shopify/types/product.d.ts +83 -0
  54. package/dist/esm/services/shopify/types/product.js +7 -0
  55. package/dist/esm/services/shopify/types/product.js.map +1 -0
  56. package/dist/esm/types/shopify-graphql-types/admin.generated.d.ts +34 -3
  57. package/package.json +6 -1
@@ -1,13 +1,9 @@
1
- import { Product } from '../../types/shopify-graphql-types/admin.types';
2
1
  import Shopify from 'shopify-api-node';
3
2
  export declare class ShopifyProductsCacheDbService {
4
3
  TABLE_NAME: string;
5
4
  KEY_NAME: string;
6
5
  constructor(tableName: string, keyName: string);
7
- getShopifyProductCacheREST: (pixelId: string, productId: string) => Promise<Record<string, any> | null>;
6
+ getShopifyProductWithCachingREST: (pixelId: string, shop: string, accessToken: string, productId: string) => Promise<Shopify.IProduct | null>;
7
+ getShopifyProductFromCacheREST: (pixelId: string, productId: string) => Promise<Record<string, any> | null>;
8
8
  putShopifyProductCacheREST: (pixelId: string, productId: string, product: Shopify.IProduct, ttlInDays?: number) => Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput | null>;
9
- lookupShopifyProductCacheREST: (pixelId: string, shop: string, accessToken: string, productId: string) => Promise<Shopify.IProduct | null>;
10
- putShopifyProductCacheGraphQL: (pixelId: string, productId: string, product: Partial<Product>, ttlInDays?: number) => Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput | null>;
11
- getShopifyProductCacheGraphQL: (pixelId: string, productId: string) => Promise<Record<string, any> | null>;
12
- lookupShopifyProductCacheGraphQL: (pixelId: string, shop: string, accessToken: string, productId: string) => Promise<Partial<Product> | null>;
13
9
  }
@@ -9,36 +9,9 @@ export class ShopifyProductsCacheDbService {
9
9
  this.TABLE_NAME = tableName;
10
10
  this.KEY_NAME = keyName;
11
11
  }
12
- getShopifyProductCacheREST = async (pixelId, productId) => {
12
+ getShopifyProductWithCachingREST = async (pixelId, shop, accessToken, productId) => {
13
13
  try {
14
- const cachedProduct = await DynamoDbClient.safeGet(this.TABLE_NAME, this.KEY_NAME, `${pixelId}_${productId}`);
15
- if (cachedProduct) {
16
- cachedProduct.product = decompressJSON(cachedProduct.productCompressed);
17
- return cachedProduct;
18
- }
19
- return null;
20
- }
21
- catch (error) {
22
- Logger.error('Failed getShopifyProductCacheREST', { keyName: this.KEY_NAME, pixelId, productId, error });
23
- return null;
24
- }
25
- };
26
- putShopifyProductCacheREST = async (pixelId, productId, product, ttlInDays) => {
27
- const ttl = ttlInDays || 7;
28
- const expiresAt = DateTime.now().plus({ days: ttl }).toSeconds();
29
- const shopifyProductCache = {
30
- pixelId_productId: `${pixelId}_${productId}`,
31
- pixelId,
32
- productId,
33
- productCompressed: compressJSON(product),
34
- createdAt: getCurrentTimestamp(),
35
- expiresAt
36
- };
37
- return await DynamoDbClient.safePut(this.TABLE_NAME, shopifyProductCache);
38
- };
39
- lookupShopifyProductCacheREST = async (pixelId, shop, accessToken, productId) => {
40
- try {
41
- const cachedShopifyProduct = await this.getShopifyProductCacheREST(pixelId, productId);
14
+ const cachedShopifyProduct = await this.getShopifyProductFromCacheREST(pixelId, productId);
42
15
  if (cachedShopifyProduct) {
43
16
  return cachedShopifyProduct.product;
44
17
  }
@@ -57,20 +30,7 @@ export class ShopifyProductsCacheDbService {
57
30
  return null;
58
31
  }
59
32
  };
60
- putShopifyProductCacheGraphQL = async (pixelId, productId, product, ttlInDays) => {
61
- const ttl = ttlInDays || 7;
62
- const expiresAt = DateTime.now().plus({ days: ttl }).toSeconds();
63
- const shopifyProductCache = {
64
- pixelId_productId: `${pixelId}_${productId}`,
65
- pixelId,
66
- productId,
67
- productCompressed: compressJSON(product),
68
- createdAt: getCurrentTimestamp(),
69
- expiresAt
70
- };
71
- return await DynamoDbClient.safePut(this.TABLE_NAME, shopifyProductCache);
72
- };
73
- getShopifyProductCacheGraphQL = async (pixelId, productId) => {
33
+ getShopifyProductFromCacheREST = async (pixelId, productId) => {
74
34
  try {
75
35
  const cachedProduct = await DynamoDbClient.safeGet(this.TABLE_NAME, this.KEY_NAME, `${pixelId}_${productId}`);
76
36
  if (cachedProduct) {
@@ -80,30 +40,22 @@ export class ShopifyProductsCacheDbService {
80
40
  return null;
81
41
  }
82
42
  catch (error) {
83
- Logger.error('Failed getShopifyProductCacheGraphQL', { keyName: this.KEY_NAME, pixelId, productId, error });
43
+ Logger.error('Failed getShopifyProductCacheREST', { keyName: this.KEY_NAME, pixelId, productId, error });
84
44
  return null;
85
45
  }
86
46
  };
87
- lookupShopifyProductCacheGraphQL = async (pixelId, shop, accessToken, productId) => {
88
- try {
89
- const cachedShopifyProduct = await this.getShopifyProductCacheGraphQL(pixelId, productId);
90
- if (cachedShopifyProduct) {
91
- return cachedShopifyProduct.product;
92
- }
93
- else {
94
- const productRes = await ShopifyClient.getProductGraphQL(shop, accessToken, productId);
95
- if (productRes?.product) {
96
- const product = productRes.product;
97
- await this.putShopifyProductCacheGraphQL(pixelId, productId, product);
98
- return product;
99
- }
100
- }
101
- return null;
102
- }
103
- catch (error) {
104
- Logger.error('Failed lookupShopifyProductCacheGraphQL', { error });
105
- return null;
106
- }
47
+ putShopifyProductCacheREST = async (pixelId, productId, product, ttlInDays) => {
48
+ const ttl = ttlInDays || 7;
49
+ const expiresAt = DateTime.now().plus({ days: ttl }).toSeconds();
50
+ const shopifyProductCache = {
51
+ pixelId_productId: `${pixelId}_${productId}`,
52
+ pixelId,
53
+ productId,
54
+ productCompressed: compressJSON(product),
55
+ createdAt: getCurrentTimestamp(),
56
+ expiresAt
57
+ };
58
+ return await DynamoDbClient.safePut(this.TABLE_NAME, shopifyProductCache);
107
59
  };
108
60
  }
109
61
  //# sourceMappingURL=shopify-products-cache-db-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shopify-products-cache-db-service.js","sourceRoot":"","sources":["../../../../src/services/db/shopify-products-cache-db-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OA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AI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;gBACvF,IAAI,UAAU,EAAE,OAAO,EAAE;oBACvB,MAAM,OAAO,GAAG,UAAU,CAAC,OAA2B,CAAC;oBACvD,MAAM,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;oBACtE,OAAO,OAAO,CAAC;iBAChB;aACF;YAED,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC;CACH"}
1
+ {"version":3,"file":"shopify-products-cache-db-service.js","sourceRoot":"","sources":["../../../../src/services/db/shopify-products-cache-db-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,MAAM,OAAO,6BAA6B;IACjC,UAAU,CAAS;IACnB,QAAQ,CAAS;IAExB,YAAY,SAAiB,EAAE,OAAe;QAC5C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IACM,gCAAgC,GAAG,KAAK,EAAE,OAAe,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB,EAAoC,EAAE;QAC1J,IAAI;YACF,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC3F,IAAI,oBAAoB,EAAE;gBACxB,OAAO,oBAAoB,CAAC,OAA2B,CAAC;aACzD;iBAAM;gBACL,M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,IAAI,CAAC,CAAC;QAC3B,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAEjE,MAAM,mBAAmB,GAAG;YAC1B,iBAAiB,EAAE,GAAG,OAAO,IAAI,SAAS,EAAE;YAC5C,OAAO;YACP,SAAS;YACT,iBAAiB,EAAE,YAAY,CAAC,OAAO,CAAC;YACxC,SAAS,EAAE,mBAAmB,EAAE;YAChC,SAAS;SACV,CAAC;QACF,OAAO,MAAM,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAC5E,CAAC,CAAC;CA8DH"}
@@ -0,0 +1,8 @@
1
+ export declare class GenericCacheService {
2
+ private cacheLambdaClient;
3
+ private lambdaInvokeClient;
4
+ constructor(cacheLambdaFunctionArn: string);
5
+ getCachedData: <T>(cacheKey: string) => Promise<T | undefined>;
6
+ putCachedData: <T>(cacheKey: string, data: T) => Promise<void>;
7
+ deleteCachedData: (cacheKey: string) => Promise<void>;
8
+ }
@@ -0,0 +1,27 @@
1
+ import { CacheLambdaClient, LambdaInvokeClient } from '../clients';
2
+ import { Logger } from '../helpers';
3
+ export class GenericCacheService {
4
+ cacheLambdaClient;
5
+ lambdaInvokeClient;
6
+ constructor(cacheLambdaFunctionArn) {
7
+ this.cacheLambdaClient = new CacheLambdaClient(cacheLambdaFunctionArn);
8
+ this.lambdaInvokeClient = new LambdaInvokeClient();
9
+ }
10
+ getCachedData = async (cacheKey) => {
11
+ const start = performance.now();
12
+ const cacheResponse = await this.cacheLambdaClient.invokeGet(cacheKey);
13
+ const end = performance.now();
14
+ Logger.debug('getCachedData', { cacheKey, cacheResponse, duration: end - start });
15
+ if (cacheResponse && cacheResponse.responseData) {
16
+ return cacheResponse.responseData;
17
+ }
18
+ return undefined;
19
+ };
20
+ putCachedData = async (cacheKey, data) => {
21
+ await this.cacheLambdaClient.invokeSet(cacheKey, JSON.stringify(data));
22
+ };
23
+ deleteCachedData = async (cacheKey) => {
24
+ await this.cacheLambdaClient.invokeDelete(cacheKey);
25
+ };
26
+ }
27
+ //# sourceMappingURL=generic-cache-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-cache-service.js","sourceRoot":"","sources":["../../../src/services/generic-cache-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,OAAO,mBAAmB;IAEtB,iBAAiB,CAAoB;IACrC,kBAAkB,CAAqB;IAE/C,YAAY,sBAA8B;QACxC,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;QACvE,IAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACrD,CAAC;IAEM,aAAa,GAAG,KAAK,EAAK,QAAgB,EAA0B,EAAE;QAC3E,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC;QAClF,IAAI,aAAa,IAAI,aAAa,CAAC,YAAY,EAAE;YAC/C,OAAO,aAAa,CAAC,YAAiB,CAAC;SACxC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAA;IACM,aAAa,GAAG,KAAK,EAAK,QAAgB,EAAE,IAAO,EAAE,EAAE;QAC5D,MAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,CAAC,CAAA;IACM,gBAAgB,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;QACnD,MAAM,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAA;CACF"}
@@ -0,0 +1,7 @@
1
+ import { InternalProduct } from '../types/product';
2
+ export declare class ShopifyProductsServiceV2 {
3
+ private productCacheService;
4
+ constructor(cacheLambdaFunctionArn: string);
5
+ getShopifyProduct: (pixelId: string, shop: string, accessToken: string, productId: string, useCache?: boolean, updateCache?: boolean) => Promise<InternalProduct | undefined | null>;
6
+ private getShopifyProductFromAPI;
7
+ }
@@ -0,0 +1,44 @@
1
+ import { Logger } from '../../../helpers';
2
+ import { ProductCacheService } from '../../cache/product-cache-service';
3
+ import { ShopifyGraphQLTransformer } from '../shopify-graphql-transformer';
4
+ import { ShopifyGraphQLClient } from '../../../clients/third-party/shopify/shopify-graphql-client';
5
+ export class ShopifyProductsServiceV2 {
6
+ productCacheService;
7
+ constructor(cacheLambdaFunctionArn) {
8
+ this.productCacheService = new ProductCacheService(cacheLambdaFunctionArn);
9
+ }
10
+ getShopifyProduct = async (pixelId, shop, accessToken, productId, useCache = true, updateCache = true) => {
11
+ try {
12
+ let product = null;
13
+ if (useCache) {
14
+ product = await this.productCacheService.getProductFromCache(pixelId, productId);
15
+ if (product) {
16
+ return product;
17
+ }
18
+ }
19
+ product = await this.getShopifyProductFromAPI(pixelId, shop, accessToken, productId, true);
20
+ if (product && updateCache) {
21
+ await this.productCacheService.putProductInCache(pixelId, productId, product);
22
+ }
23
+ return product;
24
+ }
25
+ catch (error) {
26
+ Logger.error('Failed getShopifyProductWithCachingGraphQL', { error });
27
+ return null;
28
+ }
29
+ };
30
+ getShopifyProductFromAPI = async (pixelId, shop, accessToken, productId, useTransformer = true) => {
31
+ try {
32
+ const product = await ShopifyGraphQLClient.getProductWithVariantsGraphQL(shop, accessToken, productId, 100);
33
+ if (product) {
34
+ return useTransformer ? ShopifyGraphQLTransformer.transformToInternalProduct(product) : product;
35
+ }
36
+ return null;
37
+ }
38
+ catch (error) {
39
+ Logger.error('Failed getShopifyProductFromAPI', { e: error, pixelId, shop, accessToken, productId, useTransformer, error });
40
+ return null;
41
+ }
42
+ };
43
+ }
44
+ //# sourceMappingURL=shopify-products-serviceV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify-products-serviceV2.js","sourceRoot":"","sources":["../../../../../src/services/shopify/products/shopify-products-serviceV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAEnG,MAAM,OAAO,wBAAwB;IAE3B,mBAAmB,CAAsB;IACjD,YAAY,sBAA8B;QACxC,IAAI,CAAC,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;IAC7E,CAAC;IAEM,iBAAiB,GAAG,KAAK,EAAE,OAAe,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB,EAAE,QAAQ,GAAG,IAAI,EAAE,WAAW,GAAG,IAAI,EAA+C,EAAE;QAC3L,IAAI;YACF,IAAI,OAAO,GAAuC,IAAI,CAAC;YACvD,IAAI,QAAQ,EAAE;gBACZ,OAAO,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACjF,IAAI,OAAO,EAAE;oBACX,OAAO,OAAO,CAAC;iBAChB;aACF;YAED,OAAO,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAoB,CAAC;YAC9G,IAAI,OAAO,IAAI,WAAW,EAAE;gBAC1B,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;aAC/E;YACD,OAAO,OAAO,CAAC;SAChB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,4CAA4C,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC;IAEM,wBAAwB,GAAG,KAAK,EAAE,OAAe,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB,EAAE,cAAc,GAAG,IAAI,EAAkE,EAAE;QACxM,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,6BAA6B,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;YAC5G,IAAI,OAAO,EAAE;gBACX,OAAO,cAAc,CAAC,CAAC,CAAC,yBAAyB,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;aACjG;YACD,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5H,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAA;CAGF"}
@@ -0,0 +1,6 @@
1
+ import { Product, ProductVariant } from '../../types/shopify-graphql-types/admin.types';
2
+ import { InternalProduct, InternalProductVariant } from './types/product';
3
+ export declare const ShopifyGraphQLTransformer: {
4
+ transformToInternalProduct: (product: Partial<Product>) => InternalProduct | undefined;
5
+ transformToInternalProductVariant: (variant: Partial<ProductVariant>) => InternalProductVariant | undefined;
6
+ };
@@ -0,0 +1,77 @@
1
+ export const ShopifyGraphQLTransformer = {
2
+ transformToInternalProduct: (product) => {
3
+ if (!product)
4
+ return undefined;
5
+ const internalProduct = {
6
+ id: product?.id,
7
+ legacyResourceId: Number(product.legacyResourceId),
8
+ title: product.title,
9
+ description: product.description,
10
+ handle: product?.handle,
11
+ productType: product?.productType,
12
+ vendor: product.vendor,
13
+ status: product.status,
14
+ createdAt: product.createdAt,
15
+ updatedAt: product.updatedAt,
16
+ publishedAt: product.publishedAt,
17
+ hasOnlyDefaultVariant: product?.hasOnlyDefaultVariant ?? false,
18
+ hasOutOfStockVariants: product?.hasOutOfStockVariants ?? false,
19
+ hasVariantsThatRequiresComponents: product?.hasVariantsThatRequiresComponents ?? false,
20
+ isGiftCard: product?.isGiftCard ?? false,
21
+ onlineStoreUrl: product.onlineStoreUrl,
22
+ tags: product.tags || [],
23
+ totalInventory: product.totalInventory || 0,
24
+ tracksInventory: product.tracksInventory || false,
25
+ featuredImageUrl: product.featuredImage?.url,
26
+ images: product.images?.nodes?.map(image => image.url) || [],
27
+ variantsCount: product?.variantsCount?.count,
28
+ maxVariantCompareAtPrice: Number(product.compareAtPriceRange?.maxVariantCompareAtPrice?.amount || 0),
29
+ minVariantCompareAtPrice: Number(product.compareAtPriceRange?.minVariantCompareAtPrice?.amount || 0),
30
+ maxVariantPrice: Number(product.priceRangeV2?.maxVariantPrice?.amount || 0),
31
+ minVariantPrice: Number(product.priceRangeV2?.minVariantPrice?.amount || 0),
32
+ variants: product?.variants?.nodes
33
+ ?.map(variant => ShopifyGraphQLTransformer.transformToInternalProductVariant(variant))
34
+ .filter(variant => variant !== undefined) || [],
35
+ category: product.category ? {
36
+ id: product.category.id,
37
+ name: product.category.name,
38
+ fullName: product.category.fullName,
39
+ ancestorIds: product.category.ancestorIds,
40
+ childrenIds: product.category.childrenIds,
41
+ } : undefined,
42
+ };
43
+ return internalProduct;
44
+ },
45
+ transformToInternalProductVariant: (variant) => {
46
+ if (!variant)
47
+ return undefined;
48
+ const internalVariant = {
49
+ availableForSale: variant.availableForSale || false,
50
+ id: variant.id,
51
+ legacyResourceId: variant?.legacyResourceId,
52
+ title: variant.title,
53
+ displayName: variant.displayName,
54
+ sku: variant?.sku,
55
+ barcode: variant?.barcode,
56
+ price: variant.price,
57
+ amount: Number(variant.price || 0),
58
+ compareAtPrice: variant.compareAtPrice,
59
+ createdAt: variant.createdAt,
60
+ updatedAt: variant.updatedAt,
61
+ position: variant.position || 0,
62
+ inventoryQuantity: variant?.inventoryQuantity,
63
+ sellableOnlineQuantity: variant.sellableOnlineQuantity || 0,
64
+ taxable: variant.taxable || false,
65
+ taxCode: variant?.taxCode,
66
+ productId: variant.product?.id || '',
67
+ legacyProductResourceId: Number(variant.product?.legacyResourceId || 0),
68
+ featuredImageUrl: variant.image?.url,
69
+ selectedOptions: variant.selectedOptions?.map(option => ({
70
+ name: option.name,
71
+ value: option.value
72
+ })) || [],
73
+ };
74
+ return internalVariant;
75
+ },
76
+ };
77
+ //# sourceMappingURL=shopify-graphql-transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify-graphql-transformer.js","sourceRoot":"","sources":["../../../../src/services/shopify/shopify-graphql-transformer.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IAEvC,0BAA0B,EAAE,CAAC,OAAyB,EAA+B,EAAE;QACrF,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,MAAM,eAAe,GAAoB;YACvC,EAAE,EAAE,OAAO,EAAE,EAAY;YACzB,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAClD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,EAAE,MAAgB;YACjC,WAAW,EAAE,OAAO,EAAE,WAAqB;YAC3C,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAyC;YACzD,SAAS,EAAE,OAAO,CAAC,SAA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EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;YACjC,OAAO,EAAE,OAAO,EAAE,OAAiB;YACnC,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE;YACpC,uBAAuB,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,IAAI,CAAC,CAAC;YACvE,gBAAgB,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG;YACpC,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACvD,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC,IAAI,EAAE;SACV,CAAC;QACF,OAAO,eAAe,CAAC;IACzB,CAAC;CACF,CAAA"}
@@ -0,0 +1,83 @@
1
+ export interface InternalProductOption {
2
+ name: string;
3
+ value: string;
4
+ }
5
+ export interface InternalProductCollection {
6
+ id: string;
7
+ legacyResourceId: number;
8
+ title: string;
9
+ handle: string;
10
+ imageUrl?: string;
11
+ productsCount?: number;
12
+ }
13
+ export interface InteralProductCategory {
14
+ id: string;
15
+ name: string;
16
+ fullName: string;
17
+ ancestorIds?: string[];
18
+ childrenIds?: string[];
19
+ productsCount?: number;
20
+ }
21
+ export declare enum InternalProductStatus {
22
+ Active = "ACTIVE",
23
+ Archived = "ARCHIVED",
24
+ Draft = "DRAFT"
25
+ }
26
+ export interface InternalProduct {
27
+ __typename?: 'Product';
28
+ category?: InteralProductCategory;
29
+ collections?: InternalProductCollection[];
30
+ maxVariantCompareAtPrice?: number;
31
+ minVariantCompareAtPrice?: number;
32
+ createdAt?: string;
33
+ description?: string;
34
+ featuredImageUrl?: string;
35
+ handle?: string;
36
+ hasOnlyDefaultVariant?: boolean;
37
+ hasOutOfStockVariants?: boolean;
38
+ hasVariantsThatRequiresComponents?: boolean;
39
+ id?: string;
40
+ legacyResourceId: number;
41
+ images?: string[];
42
+ inCollection?: boolean;
43
+ isGiftCard?: boolean;
44
+ onlineStoreUrl?: string;
45
+ minVariantPrice?: number;
46
+ maxVariantPrice?: number;
47
+ productType?: string;
48
+ publishedAt?: string;
49
+ status?: InternalProductStatus;
50
+ tags?: Array<string>;
51
+ title?: string;
52
+ totalInventory?: number;
53
+ tracksInventory?: boolean;
54
+ updatedAt?: string;
55
+ variantsCount?: number;
56
+ vendor?: string;
57
+ variants?: InternalProductVariant[];
58
+ }
59
+ export interface InternalProductVariant {
60
+ availableForSale: boolean;
61
+ barcode?: string;
62
+ compareAtPrice?: string;
63
+ createdAt: string;
64
+ displayName?: string;
65
+ id?: string;
66
+ featuredImageUrl?: string;
67
+ inventoryQuantity?: number;
68
+ legacyResourceId: number;
69
+ position: number;
70
+ price: string;
71
+ currency?: string;
72
+ amount: number;
73
+ productId?: string;
74
+ legacyProductResourceId: number;
75
+ selectedOptions?: InternalProductOption[];
76
+ sellableOnlineQuantity: number;
77
+ sellingPlanGroupsCount?: number;
78
+ sku?: string;
79
+ taxCode?: string;
80
+ taxable?: boolean;
81
+ title?: string;
82
+ updatedAt?: string;
83
+ }
@@ -0,0 +1,7 @@
1
+ export var InternalProductStatus;
2
+ (function (InternalProductStatus) {
3
+ InternalProductStatus["Active"] = "ACTIVE";
4
+ InternalProductStatus["Archived"] = "ARCHIVED";
5
+ InternalProductStatus["Draft"] = "DRAFT";
6
+ })(InternalProductStatus || (InternalProductStatus = {}));
7
+ //# sourceMappingURL=product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../../../src/services/shopify/types/product.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAE/B,0CAAiB,CAAA;IAEjB,8CAAqB,CAAA;IAErB,wCAAe,CAAA;AACjB,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC"}
@@ -1,12 +1,42 @@
1
1
  import * as AdminTypes from './admin.types';
2
2
  export type GetProductQueryVariables = AdminTypes.Exact<{
3
3
  id: AdminTypes.Scalars['ID']['input'];
4
+ first: AdminTypes.Scalars['Int']['input'];
5
+ after?: AdminTypes.InputMaybe<AdminTypes.Scalars['String']['input']>;
4
6
  }>;
5
7
  export type GetProductQuery = {
6
- product?: AdminTypes.Maybe<(Pick<AdminTypes.Product, 'id' | 'handle' | 'title' | 'productType' | 'tags'> & {
8
+ product?: AdminTypes.Maybe<(Pick<AdminTypes.Product, 'id' | 'handle' | 'productType' | 'hasOnlyDefaultVariant' | 'isGiftCard' | 'legacyResourceId' | 'onlineStoreUrl' | 'publishedAt' | 'requiresSellingPlan' | 'status' | 'tags' | 'title' | 'totalInventory' | 'tracksInventory' | 'vendor' | 'createdAt' | 'updatedAt'> & {
9
+ priceRangeV2: {
10
+ maxVariantPrice: Pick<AdminTypes.MoneyV2, 'amount' | 'currencyCode'>;
11
+ minVariantPrice: Pick<AdminTypes.MoneyV2, 'amount' | 'currencyCode'>;
12
+ };
7
13
  variantsCount?: AdminTypes.Maybe<Pick<AdminTypes.Count, 'count'>>;
14
+ seo: Pick<AdminTypes.Seo, 'title' | 'description'>;
8
15
  variants: {
9
- nodes: Array<Pick<AdminTypes.ProductVariant, 'id' | 'title' | 'sku'>>;
16
+ pageInfo: Pick<AdminTypes.PageInfo, 'hasNextPage' | 'endCursor'>;
17
+ nodes: Array<(Pick<AdminTypes.ProductVariant, 'availableForSale' | 'barcode' | 'compareAtPrice' | 'createdAt' | 'displayName' | 'id' | 'inventoryQuantity' | 'price' | 'sellableOnlineQuantity' | 'sku' | 'taxable' | 'title' | 'updatedAt'> & {
18
+ image?: AdminTypes.Maybe<Pick<AdminTypes.Image, 'id' | 'url'>>;
19
+ media: {
20
+ nodes: Array<(Pick<AdminTypes.ExternalVideo, 'id' | 'mediaContentType' | 'status'> & {
21
+ preview?: AdminTypes.Maybe<(Pick<AdminTypes.MediaPreviewImage, 'status'> & {
22
+ image?: AdminTypes.Maybe<Pick<AdminTypes.Image, 'id' | 'url'>>;
23
+ })>;
24
+ }) | (Pick<AdminTypes.MediaImage, 'id' | 'mediaContentType' | 'status'> & {
25
+ preview?: AdminTypes.Maybe<(Pick<AdminTypes.MediaPreviewImage, 'status'> & {
26
+ image?: AdminTypes.Maybe<Pick<AdminTypes.Image, 'id' | 'url'>>;
27
+ })>;
28
+ }) | (Pick<AdminTypes.Model3d, 'id' | 'mediaContentType' | 'status'> & {
29
+ preview?: AdminTypes.Maybe<(Pick<AdminTypes.MediaPreviewImage, 'status'> & {
30
+ image?: AdminTypes.Maybe<Pick<AdminTypes.Image, 'id' | 'url'>>;
31
+ })>;
32
+ }) | (Pick<AdminTypes.Video, 'id' | 'mediaContentType' | 'status'> & {
33
+ preview?: AdminTypes.Maybe<(Pick<AdminTypes.MediaPreviewImage, 'status'> & {
34
+ image?: AdminTypes.Maybe<Pick<AdminTypes.Image, 'id' | 'url'>>;
35
+ })>;
36
+ })>;
37
+ };
38
+ selectedOptions: Array<Pick<AdminTypes.SelectedOption, 'name' | 'value'>>;
39
+ })>;
10
40
  };
11
41
  media: {
12
42
  nodes: Array<(Pick<AdminTypes.ExternalVideo, 'id' | 'mediaContentType' | 'status'> & {
@@ -27,10 +57,11 @@ export type GetProductQuery = {
27
57
  })>;
28
58
  })>;
29
59
  };
60
+ category?: AdminTypes.Maybe<Pick<AdminTypes.TaxonomyCategory, 'id' | 'name' | 'fullName' | 'parentId'>>;
30
61
  })>;
31
62
  };
32
63
  interface GeneratedQueryTypes {
33
- "\n #graphql\n query GetProduct($id: ID!) {\n product(id: $id) {\n id\n handle\n title\n productType\n variantsCount {\n count\n }\n variants (first: 100) {\n nodes {\n id\n title\n sku\n }\n }\n media (first: 10) {\n nodes {\n id\n mediaContentType\n status\n preview {\n image {\n id\n url\n }\n status\n }\n }\n }\n tags\n }\n }\n ": {
64
+ "\n#graphql\nquery GetProduct($id: ID!, $first: Int!, $after: String) {\n product(id: $id) { \n id\n handle\n productType\n hasOnlyDefaultVariant\n isGiftCard\n legacyResourceId\n onlineStoreUrl\n productType\n publishedAt\n requiresSellingPlan\n status\n tags\n title\n totalInventory\n tracksInventory\n vendor\n createdAt\n updatedAt\n priceRangeV2 {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variantsCount {\n count\n }\n seo {\n title\n description\n }\n variants (first: $first, after: $after) { \n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n availableForSale\n barcode\n compareAtPrice\n createdAt\n displayName\n id\n image {\n id\n url \n }\n inventoryQuantity\n price \n media (first: 10) {\n nodes {\n id\n mediaContentType\n status\n preview {\n image {\n id\n url\n }\n status\n }\n }\n }\n selectedOptions {\n name\n value\n }\n sellableOnlineQuantity\n sku\n taxable\n title\n updatedAt\n }\n }\n media (first: 10) {\n nodes {\n id\n mediaContentType\n status\n preview {\n image {\n id\n url\n }\n status\n }\n }\n }\n category {\n id\n name\n fullName\n parentId\n }\n }\n}\n": {
34
65
  return: GetProductQuery;
35
66
  variables: GetProductQueryVariables;
36
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/*"
@@ -39,6 +39,8 @@
39
39
  "@adtrackify/at-shared-utils": "^3.0.33",
40
40
  "@aws-sdk/util-utf8": "^3.374.0",
41
41
  "@shopify/admin-api-client": "^1.0.4",
42
+ "@shopify/shopify-api": "^11.6.1",
43
+ "@shopify/storefront-api-client": "^1.0.3",
42
44
  "ioredis": "^5.4.1",
43
45
  "pako": "^2.1.0",
44
46
  "shopify-api-node": "^3.12.7"
@@ -66,6 +68,9 @@
66
68
  "@aws-sdk/client-sqs": "^3.345.0",
67
69
  "@aws-sdk/lib-dynamodb": "^3.345.0",
68
70
  "@faker-js/faker": "^7.5.0",
71
+ "@graphql-codegen/graphql-modules-preset": "^4.0.12",
72
+ "@graphql-codegen/typescript": "^4.1.2",
73
+ "@graphql-codegen/typescript-resolvers": "^4.4.1",
69
74
  "@shopify/api-codegen-preset": "^1.1.3",
70
75
  "@swc/core": "^1.7.35",
71
76
  "@swc/jest": "^0.2.36",