@adtrackify/at-service-common 3.1.53 → 3.1.54

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 (317) hide show
  1. package/dist/cjs/__tests__/identity-cache/identity-cache-db-service.spec.d.ts +1 -1
  2. package/dist/cjs/__tests__/identity-cache/identity-cache-db-service.spec.js +527 -527
  3. package/dist/cjs/__tests__/libs/compress-decompress.spec.d.ts +1 -1
  4. package/dist/cjs/__tests__/libs/compress-decompress.spec.js +16 -16
  5. package/dist/cjs/__tests__/s3-client/s3-client.spec.d.ts +1 -1
  6. package/dist/cjs/__tests__/s3-client/s3-client.spec.js +26 -26
  7. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.d.ts +1 -1
  8. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.js +35 -35
  9. package/dist/cjs/clients/generic/cognito-client.d.ts +23 -23
  10. package/dist/cjs/clients/generic/cognito-client.js +209 -209
  11. package/dist/cjs/clients/generic/dynamodb-client.d.ts +17 -17
  12. package/dist/cjs/clients/generic/dynamodb-client.js +167 -167
  13. package/dist/cjs/clients/generic/eventbridge-client.d.ts +14 -14
  14. package/dist/cjs/clients/generic/eventbridge-client.js +49 -49
  15. package/dist/cjs/clients/generic/http-client.d.ts +14 -88
  16. package/dist/cjs/clients/generic/http-client.js +61 -60
  17. package/dist/cjs/clients/generic/http-client.js.map +1 -1
  18. package/dist/cjs/clients/generic/index.d.ts +10 -10
  19. package/dist/cjs/clients/generic/index.js +26 -26
  20. package/dist/cjs/clients/generic/lambda-invoke-client.d.ts +10 -10
  21. package/dist/cjs/clients/generic/lambda-invoke-client.js +35 -35
  22. package/dist/cjs/clients/generic/location-client.d.ts +8 -8
  23. package/dist/cjs/clients/generic/location-client.js +31 -31
  24. package/dist/cjs/clients/generic/redis-client.d.ts +18 -18
  25. package/dist/cjs/clients/generic/redis-client.js +128 -128
  26. package/dist/cjs/clients/generic/s3-client.d.ts +16 -16
  27. package/dist/cjs/clients/generic/s3-client.js +110 -110
  28. package/dist/cjs/clients/generic/singlestore-db-client.d.ts +14 -14
  29. package/dist/cjs/clients/generic/singlestore-db-client.js +67 -67
  30. package/dist/cjs/clients/generic/sqs-client.d.ts +20 -20
  31. package/dist/cjs/clients/generic/sqs-client.js +36 -36
  32. package/dist/cjs/clients/index.d.ts +3 -3
  33. package/dist/cjs/clients/index.js +19 -19
  34. package/dist/cjs/clients/internal-api/accounts-client.d.ts +67 -112
  35. package/dist/cjs/clients/internal-api/accounts-client.js +117 -117
  36. package/dist/cjs/clients/internal-api/cache-lambda-client.d.ts +25 -25
  37. package/dist/cjs/clients/internal-api/cache-lambda-client.js +79 -79
  38. package/dist/cjs/clients/internal-api/db-management-client.d.ts +18 -18
  39. package/dist/cjs/clients/internal-api/db-management-client.js +39 -39
  40. package/dist/cjs/clients/internal-api/destinations-client.d.ts +29 -29
  41. package/dist/cjs/clients/internal-api/destinations-client.js +54 -54
  42. package/dist/cjs/clients/internal-api/event-collector-client.d.ts +20 -20
  43. package/dist/cjs/clients/internal-api/event-collector-client.js +39 -39
  44. package/dist/cjs/clients/internal-api/identity-client.d.ts +25 -25
  45. package/dist/cjs/clients/internal-api/identity-client.js +92 -92
  46. package/dist/cjs/clients/internal-api/index.d.ts +8 -8
  47. package/dist/cjs/clients/internal-api/index.js +24 -24
  48. package/dist/cjs/clients/internal-api/shopify-app-install-client.d.ts +34 -34
  49. package/dist/cjs/clients/internal-api/shopify-app-install-client.js +63 -63
  50. package/dist/cjs/clients/internal-api/subscriptions-client.d.ts +32 -0
  51. package/dist/cjs/clients/internal-api/subscriptions-client.js +53 -0
  52. package/dist/cjs/clients/internal-api/subscriptions-client.js.map +1 -0
  53. package/dist/cjs/clients/internal-api/users-auth-client.d.ts +35 -35
  54. package/dist/cjs/clients/internal-api/users-auth-client.js +110 -110
  55. package/dist/cjs/clients/third-party/index.d.ts +1 -1
  56. package/dist/cjs/clients/third-party/index.js +17 -17
  57. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  58. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.js +5 -5
  59. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -9
  60. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.js +95 -95
  61. package/dist/cjs/clients/third-party/shopify-client.d.ts +33 -198
  62. package/dist/cjs/clients/third-party/shopify-client.js +150 -150
  63. package/dist/cjs/helpers/identity-cache-helper.d.ts +4 -4
  64. package/dist/cjs/helpers/identity-cache-helper.js +150 -150
  65. package/dist/cjs/helpers/index.d.ts +5 -5
  66. package/dist/cjs/helpers/index.js +21 -21
  67. package/dist/cjs/helpers/input-validation-helper.d.ts +3 -3
  68. package/dist/cjs/helpers/input-validation-helper.js +22 -22
  69. package/dist/cjs/helpers/logging-helper.d.ts +16 -16
  70. package/dist/cjs/helpers/logging-helper.js +84 -84
  71. package/dist/cjs/helpers/response-helper.d.ts +15 -15
  72. package/dist/cjs/helpers/response-helper.js +42 -42
  73. package/dist/cjs/helpers/shopify-helper.d.ts +9 -9
  74. package/dist/cjs/helpers/shopify-helper.js +28 -28
  75. package/dist/cjs/index.d.ts +5 -5
  76. package/dist/cjs/index.js +21 -21
  77. package/dist/cjs/libs/clickId-parser.d.ts +23 -23
  78. package/dist/cjs/libs/clickId-parser.js +49 -49
  79. package/dist/cjs/libs/compression.d.ts +2 -2
  80. package/dist/cjs/libs/compression.js +33 -33
  81. package/dist/cjs/libs/crypto.d.ts +1 -1
  82. package/dist/cjs/libs/crypto.js +12 -12
  83. package/dist/cjs/libs/dates.d.ts +6 -6
  84. package/dist/cjs/libs/dates.js +31 -31
  85. package/dist/cjs/libs/http-error.d.ts +21 -21
  86. package/dist/cjs/libs/http-error.js +59 -59
  87. package/dist/cjs/libs/http-status-codes.d.ts +58 -58
  88. package/dist/cjs/libs/http-status-codes.js +62 -62
  89. package/dist/cjs/libs/index.d.ts +9 -9
  90. package/dist/cjs/libs/index.js +25 -25
  91. package/dist/cjs/libs/referrer-parser/index.d.ts +2 -2
  92. package/dist/cjs/libs/referrer-parser/index.js +18 -18
  93. package/dist/cjs/libs/referrer-parser/referrer-data.d.ts +9 -9
  94. package/dist/cjs/libs/referrer-parser/referrer-data.js +4712 -4712
  95. package/dist/cjs/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  96. package/dist/cjs/libs/referrer-parser/referrer-parser-util.js +128 -128
  97. package/dist/cjs/libs/url.d.ts +1 -1
  98. package/dist/cjs/libs/url.js +13 -13
  99. package/dist/cjs/services/cache/generic-cached-object.d.ts +5 -5
  100. package/dist/cjs/services/cache/generic-cached-object.js +2 -2
  101. package/dist/cjs/services/cache/index.d.ts +1 -1
  102. package/dist/cjs/services/cache/index.js +17 -17
  103. package/dist/cjs/services/cache/product-cache-service.d.ts +21 -21
  104. package/dist/cjs/services/cache/product-cache-service.js +68 -68
  105. package/dist/cjs/services/db/destinations-db-service.d.ts +9 -9
  106. package/dist/cjs/services/db/destinations-db-service.js +57 -57
  107. package/dist/cjs/services/db/identity-cache-db-service.d.ts +24 -24
  108. package/dist/cjs/services/db/identity-cache-db-service.js +233 -233
  109. package/dist/cjs/services/db/index.d.ts +7 -7
  110. package/dist/cjs/services/db/index.js +23 -23
  111. package/dist/cjs/services/db/log-events-db-service.d.ts +11 -11
  112. package/dist/cjs/services/db/log-events-db-service.js +172 -172
  113. package/dist/cjs/services/db/purchased-contacts-db-service.d.ts +9 -9
  114. package/dist/cjs/services/db/purchased-contacts-db-service.js +38 -38
  115. package/dist/cjs/services/db/shopify-app-installs-db-service.d.ts +7 -7
  116. package/dist/cjs/services/db/shopify-app-installs-db-service.js +47 -47
  117. package/dist/cjs/services/db/shopify-products-cache-db-service.d.ts +16 -16
  118. package/dist/cjs/services/db/shopify-products-cache-db-service.js +65 -65
  119. package/dist/cjs/services/db/tracking-events-db-service.d.ts +20 -20
  120. package/dist/cjs/services/db/tracking-events-db-service.js +162 -162
  121. package/dist/cjs/services/eventbridge-integration-service.d.ts +9 -9
  122. package/dist/cjs/services/eventbridge-integration-service.js +28 -28
  123. package/dist/cjs/services/generic-cache-service.d.ts +7 -7
  124. package/dist/cjs/services/generic-cache-service.js +33 -33
  125. package/dist/cjs/services/index.d.ts +8 -8
  126. package/dist/cjs/services/index.js +24 -24
  127. package/dist/cjs/services/ipdata-lookup-service.d.ts +19 -19
  128. package/dist/cjs/services/ipdata-lookup-service.js +77 -77
  129. package/dist/cjs/services/log-event-service.d.ts +9 -9
  130. package/dist/cjs/services/log-event-service.js +56 -56
  131. package/dist/cjs/services/metric-event-service.d.ts +9 -9
  132. package/dist/cjs/services/metric-event-service.js +49 -49
  133. package/dist/cjs/services/shopify/index.d.ts +3 -3
  134. package/dist/cjs/services/shopify/index.js +19 -19
  135. package/dist/cjs/services/shopify/products/index.d.ts +1 -1
  136. package/dist/cjs/services/shopify/products/index.js +17 -17
  137. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  138. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.js +103 -103
  139. package/dist/cjs/services/shopify/shopify-graphql-transformer.d.ts +9 -9
  140. package/dist/cjs/services/shopify/shopify-graphql-transformer.js +137 -137
  141. package/dist/cjs/services/shopify/types/index.d.ts +1 -1
  142. package/dist/cjs/services/shopify/types/index.js +17 -17
  143. package/dist/cjs/services/shopify/types/product.d.ts +115 -115
  144. package/dist/cjs/services/shopify/types/product.js +9 -9
  145. package/dist/cjs/types/api-response.d.ts +6 -6
  146. package/dist/cjs/types/api-response.js +2 -2
  147. package/dist/cjs/types/index.d.ts +2 -2
  148. package/dist/cjs/types/index.js +18 -18
  149. package/dist/cjs/types/internal-events/event-detail-types.d.ts +20 -20
  150. package/dist/cjs/types/internal-events/event-detail-types.js +27 -27
  151. package/dist/cjs/types/internal-events/index.d.ts +1 -1
  152. package/dist/cjs/types/internal-events/index.js +17 -17
  153. package/dist/cjs/types/shopify-graphql-types/admin.generated.d.ts +105 -105
  154. package/dist/cjs/types/shopify-graphql-types/admin.generated.js +2 -2
  155. package/dist/cjs/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  156. package/dist/cjs/types/shopify-graphql-types/admin.types.js +5311 -5311
  157. package/dist/cjs/types/shopify-graphql-types/index.d.ts +2 -2
  158. package/dist/cjs/types/shopify-graphql-types/index.js +18 -18
  159. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.d.ts +1 -1
  160. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.js +525 -525
  161. package/dist/esm/__tests__/libs/compress-decompress.spec.d.ts +1 -1
  162. package/dist/esm/__tests__/libs/compress-decompress.spec.js +14 -14
  163. package/dist/esm/__tests__/s3-client/s3-client.spec.d.ts +1 -1
  164. package/dist/esm/__tests__/s3-client/s3-client.spec.js +24 -24
  165. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.d.ts +1 -1
  166. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.js +33 -33
  167. package/dist/esm/clients/generic/cognito-client.d.ts +23 -23
  168. package/dist/esm/clients/generic/cognito-client.js +204 -204
  169. package/dist/esm/clients/generic/dynamodb-client.d.ts +17 -17
  170. package/dist/esm/clients/generic/dynamodb-client.js +163 -163
  171. package/dist/esm/clients/generic/eventbridge-client.d.ts +14 -14
  172. package/dist/esm/clients/generic/eventbridge-client.js +45 -45
  173. package/dist/esm/clients/generic/http-client.d.ts +14 -88
  174. package/dist/esm/clients/generic/http-client.js +53 -52
  175. package/dist/esm/clients/generic/http-client.js.map +1 -1
  176. package/dist/esm/clients/generic/index.d.ts +10 -10
  177. package/dist/esm/clients/generic/index.js +10 -10
  178. package/dist/esm/clients/generic/lambda-invoke-client.d.ts +10 -10
  179. package/dist/esm/clients/generic/lambda-invoke-client.js +31 -31
  180. package/dist/esm/clients/generic/location-client.d.ts +8 -8
  181. package/dist/esm/clients/generic/location-client.js +27 -27
  182. package/dist/esm/clients/generic/redis-client.d.ts +18 -18
  183. package/dist/esm/clients/generic/redis-client.js +121 -121
  184. package/dist/esm/clients/generic/s3-client.d.ts +16 -16
  185. package/dist/esm/clients/generic/s3-client.js +106 -106
  186. package/dist/esm/clients/generic/singlestore-db-client.d.ts +14 -14
  187. package/dist/esm/clients/generic/singlestore-db-client.js +40 -40
  188. package/dist/esm/clients/generic/sqs-client.d.ts +20 -20
  189. package/dist/esm/clients/generic/sqs-client.js +32 -32
  190. package/dist/esm/clients/index.d.ts +3 -3
  191. package/dist/esm/clients/index.js +3 -3
  192. package/dist/esm/clients/internal-api/accounts-client.d.ts +67 -112
  193. package/dist/esm/clients/internal-api/accounts-client.js +113 -113
  194. package/dist/esm/clients/internal-api/cache-lambda-client.d.ts +25 -25
  195. package/dist/esm/clients/internal-api/cache-lambda-client.js +75 -75
  196. package/dist/esm/clients/internal-api/db-management-client.d.ts +18 -18
  197. package/dist/esm/clients/internal-api/db-management-client.js +32 -32
  198. package/dist/esm/clients/internal-api/destinations-client.d.ts +29 -29
  199. package/dist/esm/clients/internal-api/destinations-client.js +50 -50
  200. package/dist/esm/clients/internal-api/event-collector-client.d.ts +20 -20
  201. package/dist/esm/clients/internal-api/event-collector-client.js +32 -32
  202. package/dist/esm/clients/internal-api/identity-client.d.ts +25 -25
  203. package/dist/esm/clients/internal-api/identity-client.js +88 -88
  204. package/dist/esm/clients/internal-api/index.d.ts +8 -8
  205. package/dist/esm/clients/internal-api/index.js +8 -8
  206. package/dist/esm/clients/internal-api/shopify-app-install-client.d.ts +34 -34
  207. package/dist/esm/clients/internal-api/shopify-app-install-client.js +56 -56
  208. package/dist/esm/clients/internal-api/subscriptions-client.d.ts +32 -0
  209. package/dist/esm/clients/internal-api/subscriptions-client.js +46 -0
  210. package/dist/esm/clients/internal-api/subscriptions-client.js.map +1 -0
  211. package/dist/esm/clients/internal-api/users-auth-client.d.ts +35 -35
  212. package/dist/esm/clients/internal-api/users-auth-client.js +106 -106
  213. package/dist/esm/clients/third-party/index.d.ts +1 -1
  214. package/dist/esm/clients/third-party/index.js +1 -1
  215. package/dist/esm/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  216. package/dist/esm/clients/third-party/shopify/graphql-product-queries.js +2 -2
  217. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -9
  218. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.js +91 -91
  219. package/dist/esm/clients/third-party/shopify-client.d.ts +33 -198
  220. package/dist/esm/clients/third-party/shopify-client.js +146 -146
  221. package/dist/esm/helpers/identity-cache-helper.d.ts +4 -4
  222. package/dist/esm/helpers/identity-cache-helper.js +145 -145
  223. package/dist/esm/helpers/index.d.ts +5 -5
  224. package/dist/esm/helpers/index.js +5 -5
  225. package/dist/esm/helpers/input-validation-helper.d.ts +3 -3
  226. package/dist/esm/helpers/input-validation-helper.js +18 -18
  227. package/dist/esm/helpers/logging-helper.d.ts +16 -16
  228. package/dist/esm/helpers/logging-helper.js +56 -56
  229. package/dist/esm/helpers/response-helper.d.ts +15 -15
  230. package/dist/esm/helpers/response-helper.js +36 -36
  231. package/dist/esm/helpers/shopify-helper.d.ts +9 -9
  232. package/dist/esm/helpers/shopify-helper.js +23 -23
  233. package/dist/esm/index.d.ts +5 -5
  234. package/dist/esm/index.js +5 -5
  235. package/dist/esm/libs/clickId-parser.d.ts +23 -23
  236. package/dist/esm/libs/clickId-parser.js +45 -45
  237. package/dist/esm/libs/compression.d.ts +2 -2
  238. package/dist/esm/libs/compression.js +25 -25
  239. package/dist/esm/libs/crypto.d.ts +1 -1
  240. package/dist/esm/libs/crypto.js +5 -5
  241. package/dist/esm/libs/dates.d.ts +6 -6
  242. package/dist/esm/libs/dates.js +22 -22
  243. package/dist/esm/libs/http-error.d.ts +21 -21
  244. package/dist/esm/libs/http-error.js +55 -55
  245. package/dist/esm/libs/http-status-codes.d.ts +58 -58
  246. package/dist/esm/libs/http-status-codes.js +59 -59
  247. package/dist/esm/libs/index.d.ts +9 -9
  248. package/dist/esm/libs/index.js +9 -9
  249. package/dist/esm/libs/referrer-parser/index.d.ts +2 -2
  250. package/dist/esm/libs/referrer-parser/index.js +2 -2
  251. package/dist/esm/libs/referrer-parser/referrer-data.d.ts +9 -9
  252. package/dist/esm/libs/referrer-parser/referrer-data.js +4709 -4709
  253. package/dist/esm/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  254. package/dist/esm/libs/referrer-parser/referrer-parser-util.js +121 -121
  255. package/dist/esm/libs/url.d.ts +1 -1
  256. package/dist/esm/libs/url.js +9 -9
  257. package/dist/esm/services/cache/generic-cached-object.d.ts +5 -5
  258. package/dist/esm/services/cache/generic-cached-object.js +1 -1
  259. package/dist/esm/services/cache/index.d.ts +1 -1
  260. package/dist/esm/services/cache/index.js +1 -1
  261. package/dist/esm/services/cache/product-cache-service.d.ts +21 -21
  262. package/dist/esm/services/cache/product-cache-service.js +60 -60
  263. package/dist/esm/services/db/destinations-db-service.d.ts +9 -9
  264. package/dist/esm/services/db/destinations-db-service.js +53 -53
  265. package/dist/esm/services/db/identity-cache-db-service.d.ts +24 -24
  266. package/dist/esm/services/db/identity-cache-db-service.js +229 -229
  267. package/dist/esm/services/db/index.d.ts +7 -7
  268. package/dist/esm/services/db/index.js +7 -7
  269. package/dist/esm/services/db/log-events-db-service.d.ts +11 -11
  270. package/dist/esm/services/db/log-events-db-service.js +168 -168
  271. package/dist/esm/services/db/purchased-contacts-db-service.d.ts +9 -9
  272. package/dist/esm/services/db/purchased-contacts-db-service.js +34 -34
  273. package/dist/esm/services/db/shopify-app-installs-db-service.d.ts +7 -7
  274. package/dist/esm/services/db/shopify-app-installs-db-service.js +43 -43
  275. package/dist/esm/services/db/shopify-products-cache-db-service.d.ts +16 -16
  276. package/dist/esm/services/db/shopify-products-cache-db-service.js +58 -58
  277. package/dist/esm/services/db/tracking-events-db-service.d.ts +20 -20
  278. package/dist/esm/services/db/tracking-events-db-service.js +158 -158
  279. package/dist/esm/services/eventbridge-integration-service.d.ts +9 -9
  280. package/dist/esm/services/eventbridge-integration-service.js +24 -24
  281. package/dist/esm/services/generic-cache-service.d.ts +7 -7
  282. package/dist/esm/services/generic-cache-service.js +29 -29
  283. package/dist/esm/services/index.d.ts +8 -8
  284. package/dist/esm/services/index.js +8 -8
  285. package/dist/esm/services/ipdata-lookup-service.d.ts +19 -19
  286. package/dist/esm/services/ipdata-lookup-service.js +73 -73
  287. package/dist/esm/services/log-event-service.d.ts +9 -9
  288. package/dist/esm/services/log-event-service.js +52 -52
  289. package/dist/esm/services/metric-event-service.d.ts +9 -9
  290. package/dist/esm/services/metric-event-service.js +45 -45
  291. package/dist/esm/services/shopify/index.d.ts +3 -3
  292. package/dist/esm/services/shopify/index.js +3 -3
  293. package/dist/esm/services/shopify/products/index.d.ts +1 -1
  294. package/dist/esm/services/shopify/products/index.js +1 -1
  295. package/dist/esm/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  296. package/dist/esm/services/shopify/products/shopify-products-serviceV2.js +99 -99
  297. package/dist/esm/services/shopify/shopify-graphql-transformer.d.ts +9 -9
  298. package/dist/esm/services/shopify/shopify-graphql-transformer.js +134 -134
  299. package/dist/esm/services/shopify/types/index.d.ts +1 -1
  300. package/dist/esm/services/shopify/types/index.js +1 -1
  301. package/dist/esm/services/shopify/types/product.d.ts +115 -115
  302. package/dist/esm/services/shopify/types/product.js +6 -6
  303. package/dist/esm/types/api-response.d.ts +6 -6
  304. package/dist/esm/types/api-response.js +1 -1
  305. package/dist/esm/types/index.d.ts +2 -2
  306. package/dist/esm/types/index.js +2 -2
  307. package/dist/esm/types/internal-events/event-detail-types.d.ts +20 -20
  308. package/dist/esm/types/internal-events/event-detail-types.js +24 -24
  309. package/dist/esm/types/internal-events/index.d.ts +1 -1
  310. package/dist/esm/types/internal-events/index.js +1 -1
  311. package/dist/esm/types/shopify-graphql-types/admin.generated.d.ts +105 -105
  312. package/dist/esm/types/shopify-graphql-types/admin.generated.js +1 -1
  313. package/dist/esm/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  314. package/dist/esm/types/shopify-graphql-types/admin.types.js +5299 -5299
  315. package/dist/esm/types/shopify-graphql-types/index.d.ts +2 -2
  316. package/dist/esm/types/shopify-graphql-types/index.js +2 -2
  317. package/package.json +1 -1
@@ -1,151 +1,151 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShopifyClient = void 0;
4
- const http_client_js_1 = require("../generic/http-client.js");
5
- const index_js_1 = require("../../index.js");
6
- class ShopifyClient {
7
- static _shopify_api_version = process.env.SHOPIFY_API_VERSION;
8
- static client;
9
- static getConfig = (shopifyDomain, accessToken) => {
10
- const config = {
11
- baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,
12
- headers: {
13
- common: {
14
- 'X-Shopify-Access-Token': accessToken,
15
- },
16
- },
17
- };
18
- return config;
19
- };
20
- static getClient = () => {
21
- this.client = this.client ?? (0, http_client_js_1.axiosHttpService)();
22
- return this.client;
23
- };
24
- static registerApp = async (shop, code, appKey, appSecret) => {
25
- const client = this.getClient();
26
- const url = 'https://' + shop + '/admin/oauth/access_token';
27
- const payload = {
28
- client_id: appKey,
29
- client_secret: appSecret,
30
- code
31
- };
32
- const res = await client.post(url, payload);
33
- return res;
34
- };
35
- static registerWebhookTopic = async (shop, accessToken, eventBridgeArn, topic) => {
36
- const client = this.getClient();
37
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;
38
- const payload = {
39
- webhook: {
40
- topic,
41
- address: eventBridgeArn,
42
- format: 'json'
43
- }
44
- };
45
- const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
46
- if (res.status >= 400) {
47
- index_js_1.Logger.error('Failed to register Webhook Topic', { res, shop, accessToken, eventBridgeArn, topic, url, payload });
48
- }
49
- index_js_1.Logger.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });
50
- return res;
51
- };
52
- static updateShopifyAppMetafield = async (shop, accessToken, pixelId) => {
53
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;
54
- const payload = {
55
- metafield: {
56
- namespace: 'adtr',
57
- key: 'adtr.config',
58
- value: pixelId,
59
- type: 'single_line_text_field'
60
- }
61
- };
62
- const res = await this.genericShopifyPost(url, accessToken, payload);
63
- if (res.status >= 400) {
64
- index_js_1.Logger.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });
65
- }
66
- return res;
67
- };
68
- static getShopifyStoreProperties = async (shop, accessToken) => {
69
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;
70
- const res = await this.genericShopifyGet(url, accessToken);
71
- if (res.status >= 400) {
72
- index_js_1.Logger.error('Failed to get Shopify Store Properties', { shop, accessToken, url });
73
- }
74
- return res;
75
- };
76
- static createAppSubscription = async (shop, accessToken, planName, price, returnUrl, trialDays, test) => {
77
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;
78
- const recurring_application_charge = {
79
- name: planName,
80
- price,
81
- return_url: returnUrl,
82
- trial_days: trialDays,
83
- test
84
- };
85
- const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });
86
- if (res.status >= 400) {
87
- index_js_1.Logger.error('Failed to create App Subscription', { shop, accessToken, url });
88
- }
89
- return res;
90
- };
91
- static cancelAppSubscription = async (shop, accessToken, chargeId) => {
92
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;
93
- const client = this.getClient();
94
- const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
95
- if (res.status !== 200) {
96
- index_js_1.Logger.error('Failed to cancel recurring App billing', { shop, accessToken, url });
97
- }
98
- return res;
99
- };
100
- static listAppSubscriptions = async (shop, accessToken) => {
101
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;
102
- const res = await this.genericShopifyGet(url, accessToken);
103
- if (res.status >= 400) {
104
- index_js_1.Logger.error('Failed to get App Subscriptions', { shop, accessToken, url });
105
- }
106
- return res;
107
- };
108
- static getOrder = async (shop, accessToken, orderId) => {
109
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/orders/${orderId}.json`;
110
- const res = await this.genericShopifyGet(url, accessToken);
111
- if (res.status >= 400) {
112
- index_js_1.Logger.error('Failed to get Order', { res, shop, accessToken, url, orderId });
113
- }
114
- return res;
115
- };
116
- static getProductREST = async (shop, accessToken, productId) => {
117
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/products/${productId}.json`;
118
- const res = await this.genericShopifyGet(url, accessToken);
119
- if (res.status >= 400) {
120
- index_js_1.Logger.error('Failed to get Product', { res, shop, accessToken, url, productId });
121
- }
122
- return res;
123
- };
124
- static genericShopifyPost = async (url, accessToken, payload) => {
125
- const client = this.getClient();
126
- const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });
127
- index_js_1.Logger.debug('Shopify Client Response', { res });
128
- return res;
129
- };
130
- static genericShopifyGet = async (url, accessToken) => {
131
- const client = this.getClient();
132
- const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
133
- index_js_1.Logger.debug('Shopify Client Response', { res });
134
- return res;
135
- };
136
- static genericShopifyPut = async (url, accessToken, payload) => {
137
- const client = this.getClient();
138
- const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
139
- index_js_1.Logger.debug('Shopify Client Response', { res });
140
- return res;
141
- };
142
- static unregisterWebhook = async (shop, webhookId, accessToken) => {
143
- const client = this.getClient();
144
- const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks/${webhookId}.json`;
145
- const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
146
- index_js_1.Logger.debug('Shopify Client Response', { res });
147
- return res;
148
- };
149
- }
150
- exports.ShopifyClient = ShopifyClient;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShopifyClient = void 0;
4
+ const http_client_js_1 = require("../generic/http-client.js");
5
+ const index_js_1 = require("../../index.js");
6
+ class ShopifyClient {
7
+ static _shopify_api_version = process.env.SHOPIFY_API_VERSION;
8
+ static client;
9
+ static getConfig = (shopifyDomain, accessToken) => {
10
+ const config = {
11
+ baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,
12
+ headers: {
13
+ common: {
14
+ 'X-Shopify-Access-Token': accessToken,
15
+ },
16
+ },
17
+ };
18
+ return config;
19
+ };
20
+ static getClient = () => {
21
+ this.client = this.client ?? (0, http_client_js_1.axiosHttpService)();
22
+ return this.client;
23
+ };
24
+ static registerApp = async (shop, code, appKey, appSecret) => {
25
+ const client = this.getClient();
26
+ const url = 'https://' + shop + '/admin/oauth/access_token';
27
+ const payload = {
28
+ client_id: appKey,
29
+ client_secret: appSecret,
30
+ code
31
+ };
32
+ const res = await client.post(url, payload);
33
+ return res;
34
+ };
35
+ static registerWebhookTopic = async (shop, accessToken, eventBridgeArn, topic) => {
36
+ const client = this.getClient();
37
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;
38
+ const payload = {
39
+ webhook: {
40
+ topic,
41
+ address: eventBridgeArn,
42
+ format: 'json'
43
+ }
44
+ };
45
+ const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
46
+ if (res.status >= 400) {
47
+ index_js_1.Logger.error('Failed to register Webhook Topic', { res, shop, accessToken, eventBridgeArn, topic, url, payload });
48
+ }
49
+ index_js_1.Logger.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });
50
+ return res;
51
+ };
52
+ static updateShopifyAppMetafield = async (shop, accessToken, pixelId) => {
53
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;
54
+ const payload = {
55
+ metafield: {
56
+ namespace: 'adtr',
57
+ key: 'adtr.config',
58
+ value: pixelId,
59
+ type: 'single_line_text_field'
60
+ }
61
+ };
62
+ const res = await this.genericShopifyPost(url, accessToken, payload);
63
+ if (res.status >= 400) {
64
+ index_js_1.Logger.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });
65
+ }
66
+ return res;
67
+ };
68
+ static getShopifyStoreProperties = async (shop, accessToken) => {
69
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;
70
+ const res = await this.genericShopifyGet(url, accessToken);
71
+ if (res.status >= 400) {
72
+ index_js_1.Logger.error('Failed to get Shopify Store Properties', { shop, accessToken, url });
73
+ }
74
+ return res;
75
+ };
76
+ static createAppSubscription = async (shop, accessToken, planName, price, returnUrl, trialDays, test) => {
77
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;
78
+ const recurring_application_charge = {
79
+ name: planName,
80
+ price,
81
+ return_url: returnUrl,
82
+ trial_days: trialDays,
83
+ test
84
+ };
85
+ const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });
86
+ if (res.status >= 400) {
87
+ index_js_1.Logger.error('Failed to create App Subscription', { shop, accessToken, url });
88
+ }
89
+ return res;
90
+ };
91
+ static cancelAppSubscription = async (shop, accessToken, chargeId) => {
92
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;
93
+ const client = this.getClient();
94
+ const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
95
+ if (res.status !== 200) {
96
+ index_js_1.Logger.error('Failed to cancel recurring App billing', { shop, accessToken, url });
97
+ }
98
+ return res;
99
+ };
100
+ static listAppSubscriptions = async (shop, accessToken) => {
101
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;
102
+ const res = await this.genericShopifyGet(url, accessToken);
103
+ if (res.status >= 400) {
104
+ index_js_1.Logger.error('Failed to get App Subscriptions', { shop, accessToken, url });
105
+ }
106
+ return res;
107
+ };
108
+ static getOrder = async (shop, accessToken, orderId) => {
109
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/orders/${orderId}.json`;
110
+ const res = await this.genericShopifyGet(url, accessToken);
111
+ if (res.status >= 400) {
112
+ index_js_1.Logger.error('Failed to get Order', { res, shop, accessToken, url, orderId });
113
+ }
114
+ return res;
115
+ };
116
+ static getProductREST = async (shop, accessToken, productId) => {
117
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/products/${productId}.json`;
118
+ const res = await this.genericShopifyGet(url, accessToken);
119
+ if (res.status >= 400) {
120
+ index_js_1.Logger.error('Failed to get Product', { res, shop, accessToken, url, productId });
121
+ }
122
+ return res;
123
+ };
124
+ static genericShopifyPost = async (url, accessToken, payload) => {
125
+ const client = this.getClient();
126
+ const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });
127
+ index_js_1.Logger.debug('Shopify Client Response', { res });
128
+ return res;
129
+ };
130
+ static genericShopifyGet = async (url, accessToken) => {
131
+ const client = this.getClient();
132
+ const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
133
+ index_js_1.Logger.debug('Shopify Client Response', { res });
134
+ return res;
135
+ };
136
+ static genericShopifyPut = async (url, accessToken, payload) => {
137
+ const client = this.getClient();
138
+ const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
139
+ index_js_1.Logger.debug('Shopify Client Response', { res });
140
+ return res;
141
+ };
142
+ static unregisterWebhook = async (shop, webhookId, accessToken) => {
143
+ const client = this.getClient();
144
+ const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks/${webhookId}.json`;
145
+ const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
146
+ index_js_1.Logger.debug('Shopify Client Response', { res });
147
+ return res;
148
+ };
149
+ }
150
+ exports.ShopifyClient = ShopifyClient;
151
151
  //# sourceMappingURL=shopify-client.js.map
@@ -1,4 +1,4 @@
1
- import { AdClickInfo, EventIdentity } from '@adtrackify/at-tracking-event-types';
2
- import { IdentityCache } from '../services';
3
- export declare const isIdentityCacheStale: (identityCache: IdentityCache, incomingIdentity: EventIdentity) => boolean;
4
- export declare const isClickInfosStale: (cachedClick: AdClickInfo, incomingClick: AdClickInfo) => boolean;
1
+ import { AdClickInfo, EventIdentity } from '@adtrackify/at-tracking-event-types';
2
+ import { IdentityCache } from '../services';
3
+ export declare const isIdentityCacheStale: (identityCache: IdentityCache, incomingIdentity: EventIdentity) => boolean;
4
+ export declare const isClickInfosStale: (cachedClick: AdClickInfo, incomingClick: AdClickInfo) => boolean;
@@ -1,151 +1,151 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isClickInfosStale = exports.isIdentityCacheStale = void 0;
4
- const at_shared_utils_1 = require("@adtrackify/at-shared-utils");
5
- const logging_helper_1 = require("./logging-helper");
6
- const isIdentityCacheStale = (identityCache, incomingIdentity) => {
7
- try {
8
- const cachedTraits = identityCache.response?.traits ?? {};
9
- const incomingTraits = incomingIdentity?.traits ?? {};
10
- const identityCacheStaleTracker = {
11
- cachedTraits: cachedTraits,
12
- incomingTraits: incomingTraits,
13
- isUserIdsStale: false,
14
- isIdsStale: false,
15
- isEmailsStale: false,
16
- isPhonesStale: false,
17
- isShopifyYIdsStale: false,
18
- isGendersStale: false,
19
- isDobsStale: false,
20
- isAddressesStale: false,
21
- isClickInfosStale: false,
22
- isIpAddressStale: false,
23
- isUserAgentStale: false,
24
- isCacheStale: false
25
- };
26
- const isNewUserIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.userIds ?? [], incomingTraits?.userIds ?? []);
27
- if (isNewUserIds) {
28
- logging_helper_1.Logger.debug('identity cache miss - userIds changed', { cachedTraits, incomingTraits });
29
- identityCacheStaleTracker.isUserIdsStale = true;
30
- identityCacheStaleTracker.isCacheStale = true;
31
- }
32
- const isNewIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.ids ?? [], incomingTraits?.ids ?? []);
33
- if (isNewIds) {
34
- logging_helper_1.Logger.debug('identity cache miss - ids changed', { cachedTraits, incomingTraits });
35
- identityCacheStaleTracker.isIdsStale = true;
36
- identityCacheStaleTracker.isCacheStale = true;
37
- }
38
- const isNewEmails = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.emails ?? [], incomingTraits?.emails ?? []);
39
- if (isNewEmails) {
40
- logging_helper_1.Logger.debug('identity cache miss - emails changed', { cachedTraits, incomingTraits });
41
- identityCacheStaleTracker.isEmailsStale = true;
42
- identityCacheStaleTracker.isCacheStale = true;
43
- }
44
- const isNewPhones = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.phones ?? [], incomingTraits?.phones ?? []);
45
- if (isNewPhones) {
46
- logging_helper_1.Logger.debug('identity cache miss - phones changed', { cachedTraits, incomingTraits });
47
- identityCacheStaleTracker.isPhonesStale = true;
48
- identityCacheStaleTracker.isCacheStale = true;
49
- }
50
- const isNewShopifyYIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.shopifyYIds ?? [], incomingTraits?.shopifyYIds ?? []);
51
- if (isNewShopifyYIds) {
52
- logging_helper_1.Logger.debug('identity cache miss - shopify Y ids changed', { cachedTraits, incomingTraits });
53
- identityCacheStaleTracker.isShopifyYIdsStale = true;
54
- identityCacheStaleTracker.isCacheStale = true;
55
- }
56
- const isNewGenders = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.genders ?? [], incomingTraits?.genders ?? []);
57
- if (isNewGenders) {
58
- logging_helper_1.Logger.debug('identity cache miss - genders changed', { cachedTraits, incomingTraits });
59
- identityCacheStaleTracker.isGendersStale = true;
60
- identityCacheStaleTracker.isCacheStale = true;
61
- }
62
- const isNewDobs = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.dobs ?? [], incomingTraits?.dobs ?? []);
63
- if (isNewDobs) {
64
- logging_helper_1.Logger.debug('identity cache miss - dobs changed', { cachedTraits, incomingTraits });
65
- identityCacheStaleTracker.isDobsStale = true;
66
- identityCacheStaleTracker.isCacheStale = true;
67
- }
68
- const isNewAddress = (0, at_shared_utils_1.hasNewAddress)(cachedTraits?.addresses ?? [], incomingTraits?.addresses ?? []);
69
- if (isNewAddress) {
70
- logging_helper_1.Logger.debug('identity cache miss - address changed', { cachedTraits, incomingTraits });
71
- identityCacheStaleTracker.isAddressesStale = true;
72
- identityCacheStaleTracker.isCacheStale = true;
73
- }
74
- const isNewClick = (0, exports.isClickInfosStale)(cachedTraits?.click ?? {}, incomingTraits?.click ?? {});
75
- if (isNewClick) {
76
- logging_helper_1.Logger.debug('identity cache miss - clickInfos changed', { cachedTraits, incomingTraits });
77
- identityCacheStaleTracker.isClickInfosStale = true;
78
- identityCacheStaleTracker.isCacheStale = true;
79
- }
80
- if (incomingTraits?.ipAddress && cachedTraits?.ipAddress !== incomingTraits?.ipAddress) {
81
- logging_helper_1.Logger.debug('identity cache miss - ip/userAgent changed', { cachedTraits, incomingTraits });
82
- identityCacheStaleTracker.isIpAddressStale = true;
83
- identityCacheStaleTracker.isCacheStale = true;
84
- }
85
- if (incomingTraits?.userAgent && cachedTraits?.userAgent !== incomingTraits?.userAgent) {
86
- logging_helper_1.Logger.debug('identity cache miss - userAgent changed', { cachedTraits, incomingTraits });
87
- identityCacheStaleTracker.isUserAgentStale = true;
88
- identityCacheStaleTracker.isCacheStale = true;
89
- }
90
- if (identityCacheStaleTracker.isCacheStale) {
91
- logging_helper_1.Logger.debug('identity cache miss - cache stale', { identityCacheStaleTracker });
92
- }
93
- return identityCacheStaleTracker.isCacheStale;
94
- }
95
- catch (err) {
96
- logging_helper_1.Logger.error('Error while checking if identity cache is stale', { err });
97
- return true;
98
- }
99
- };
100
- exports.isIdentityCacheStale = isIdentityCacheStale;
101
- const isClickInfosStale = (cachedClick, incomingClick) => {
102
- const cleanedCachedClick = (0, at_shared_utils_1.removeEmptyFields)(cachedClick);
103
- const cleanedIncomingClick = (0, at_shared_utils_1.removeEmptyFields)(incomingClick);
104
- const incomingKeys = Object.keys(cleanedIncomingClick);
105
- const clickInfoStaleTracker = {
106
- cleanedCachedClick,
107
- cleanedIncomingClick,
108
- isClickInfosStale: false,
109
- staleKeys: []
110
- };
111
- incomingKeys.forEach(key => {
112
- if (key === 'googleClientInfos' || key.includes('CollectedAt')) {
113
- return true;
114
- }
115
- else if (key === 'fbc') {
116
- const cachedClickValue = cleanedCachedClick?.[key];
117
- const incomingClickValue = cleanedIncomingClick?.[key];
118
- if (incomingClickValue && !cachedClickValue) {
119
- clickInfoStaleTracker.isClickInfosStale = true;
120
- clickInfoStaleTracker.staleKeys.push(key);
121
- }
122
- else if (incomingClickValue && cachedClickValue && incomingClickValue !== cachedClickValue) {
123
- const incomingFbcFbclid = incomingClickValue?.split('.')?.[3];
124
- const cachedFbcFbclid = cachedClickValue?.split('.')?.[3];
125
- if (incomingFbcFbclid !== cachedFbcFbclid) {
126
- clickInfoStaleTracker.isClickInfosStale = true;
127
- clickInfoStaleTracker.staleKeys.push(key);
128
- }
129
- if (!incomingFbcFbclid || !cachedFbcFbclid) {
130
- clickInfoStaleTracker.isClickInfosStale = true;
131
- clickInfoStaleTracker.staleKeys.push(key);
132
- }
133
- }
134
- }
135
- else {
136
- const cachedClickValue = cleanedCachedClick?.[key];
137
- const incomingClickValue = cleanedIncomingClick?.[key];
138
- if ((incomingClickValue && !cachedClickValue)
139
- || incomingClickValue !== cachedClickValue) {
140
- clickInfoStaleTracker.isClickInfosStale = true;
141
- clickInfoStaleTracker.staleKeys.push(key);
142
- }
143
- }
144
- });
145
- if (clickInfoStaleTracker.isClickInfosStale) {
146
- logging_helper_1.Logger.debug('identity cache miss - clickInfos changed', { clickInfoStaleTracker });
147
- }
148
- return clickInfoStaleTracker.isClickInfosStale;
149
- };
150
- exports.isClickInfosStale = isClickInfosStale;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isClickInfosStale = exports.isIdentityCacheStale = void 0;
4
+ const at_shared_utils_1 = require("@adtrackify/at-shared-utils");
5
+ const logging_helper_1 = require("./logging-helper");
6
+ const isIdentityCacheStale = (identityCache, incomingIdentity) => {
7
+ try {
8
+ const cachedTraits = identityCache.response?.traits ?? {};
9
+ const incomingTraits = incomingIdentity?.traits ?? {};
10
+ const identityCacheStaleTracker = {
11
+ cachedTraits: cachedTraits,
12
+ incomingTraits: incomingTraits,
13
+ isUserIdsStale: false,
14
+ isIdsStale: false,
15
+ isEmailsStale: false,
16
+ isPhonesStale: false,
17
+ isShopifyYIdsStale: false,
18
+ isGendersStale: false,
19
+ isDobsStale: false,
20
+ isAddressesStale: false,
21
+ isClickInfosStale: false,
22
+ isIpAddressStale: false,
23
+ isUserAgentStale: false,
24
+ isCacheStale: false
25
+ };
26
+ const isNewUserIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.userIds ?? [], incomingTraits?.userIds ?? []);
27
+ if (isNewUserIds) {
28
+ logging_helper_1.Logger.debug('identity cache miss - userIds changed', { cachedTraits, incomingTraits });
29
+ identityCacheStaleTracker.isUserIdsStale = true;
30
+ identityCacheStaleTracker.isCacheStale = true;
31
+ }
32
+ const isNewIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.ids ?? [], incomingTraits?.ids ?? []);
33
+ if (isNewIds) {
34
+ logging_helper_1.Logger.debug('identity cache miss - ids changed', { cachedTraits, incomingTraits });
35
+ identityCacheStaleTracker.isIdsStale = true;
36
+ identityCacheStaleTracker.isCacheStale = true;
37
+ }
38
+ const isNewEmails = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.emails ?? [], incomingTraits?.emails ?? []);
39
+ if (isNewEmails) {
40
+ logging_helper_1.Logger.debug('identity cache miss - emails changed', { cachedTraits, incomingTraits });
41
+ identityCacheStaleTracker.isEmailsStale = true;
42
+ identityCacheStaleTracker.isCacheStale = true;
43
+ }
44
+ const isNewPhones = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.phones ?? [], incomingTraits?.phones ?? []);
45
+ if (isNewPhones) {
46
+ logging_helper_1.Logger.debug('identity cache miss - phones changed', { cachedTraits, incomingTraits });
47
+ identityCacheStaleTracker.isPhonesStale = true;
48
+ identityCacheStaleTracker.isCacheStale = true;
49
+ }
50
+ const isNewShopifyYIds = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.shopifyYIds ?? [], incomingTraits?.shopifyYIds ?? []);
51
+ if (isNewShopifyYIds) {
52
+ logging_helper_1.Logger.debug('identity cache miss - shopify Y ids changed', { cachedTraits, incomingTraits });
53
+ identityCacheStaleTracker.isShopifyYIdsStale = true;
54
+ identityCacheStaleTracker.isCacheStale = true;
55
+ }
56
+ const isNewGenders = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.genders ?? [], incomingTraits?.genders ?? []);
57
+ if (isNewGenders) {
58
+ logging_helper_1.Logger.debug('identity cache miss - genders changed', { cachedTraits, incomingTraits });
59
+ identityCacheStaleTracker.isGendersStale = true;
60
+ identityCacheStaleTracker.isCacheStale = true;
61
+ }
62
+ const isNewDobs = (0, at_shared_utils_1.hasNewTrait)(cachedTraits?.dobs ?? [], incomingTraits?.dobs ?? []);
63
+ if (isNewDobs) {
64
+ logging_helper_1.Logger.debug('identity cache miss - dobs changed', { cachedTraits, incomingTraits });
65
+ identityCacheStaleTracker.isDobsStale = true;
66
+ identityCacheStaleTracker.isCacheStale = true;
67
+ }
68
+ const isNewAddress = (0, at_shared_utils_1.hasNewAddress)(cachedTraits?.addresses ?? [], incomingTraits?.addresses ?? []);
69
+ if (isNewAddress) {
70
+ logging_helper_1.Logger.debug('identity cache miss - address changed', { cachedTraits, incomingTraits });
71
+ identityCacheStaleTracker.isAddressesStale = true;
72
+ identityCacheStaleTracker.isCacheStale = true;
73
+ }
74
+ const isNewClick = (0, exports.isClickInfosStale)(cachedTraits?.click ?? {}, incomingTraits?.click ?? {});
75
+ if (isNewClick) {
76
+ logging_helper_1.Logger.debug('identity cache miss - clickInfos changed', { cachedTraits, incomingTraits });
77
+ identityCacheStaleTracker.isClickInfosStale = true;
78
+ identityCacheStaleTracker.isCacheStale = true;
79
+ }
80
+ if (incomingTraits?.ipAddress && cachedTraits?.ipAddress !== incomingTraits?.ipAddress) {
81
+ logging_helper_1.Logger.debug('identity cache miss - ip/userAgent changed', { cachedTraits, incomingTraits });
82
+ identityCacheStaleTracker.isIpAddressStale = true;
83
+ identityCacheStaleTracker.isCacheStale = true;
84
+ }
85
+ if (incomingTraits?.userAgent && cachedTraits?.userAgent !== incomingTraits?.userAgent) {
86
+ logging_helper_1.Logger.debug('identity cache miss - userAgent changed', { cachedTraits, incomingTraits });
87
+ identityCacheStaleTracker.isUserAgentStale = true;
88
+ identityCacheStaleTracker.isCacheStale = true;
89
+ }
90
+ if (identityCacheStaleTracker.isCacheStale) {
91
+ logging_helper_1.Logger.debug('identity cache miss - cache stale', { identityCacheStaleTracker });
92
+ }
93
+ return identityCacheStaleTracker.isCacheStale;
94
+ }
95
+ catch (err) {
96
+ logging_helper_1.Logger.error('Error while checking if identity cache is stale', { err });
97
+ return true;
98
+ }
99
+ };
100
+ exports.isIdentityCacheStale = isIdentityCacheStale;
101
+ const isClickInfosStale = (cachedClick, incomingClick) => {
102
+ const cleanedCachedClick = (0, at_shared_utils_1.removeEmptyFields)(cachedClick);
103
+ const cleanedIncomingClick = (0, at_shared_utils_1.removeEmptyFields)(incomingClick);
104
+ const incomingKeys = Object.keys(cleanedIncomingClick);
105
+ const clickInfoStaleTracker = {
106
+ cleanedCachedClick,
107
+ cleanedIncomingClick,
108
+ isClickInfosStale: false,
109
+ staleKeys: []
110
+ };
111
+ incomingKeys.forEach(key => {
112
+ if (key === 'googleClientInfos' || key.includes('CollectedAt')) {
113
+ return true;
114
+ }
115
+ else if (key === 'fbc') {
116
+ const cachedClickValue = cleanedCachedClick?.[key];
117
+ const incomingClickValue = cleanedIncomingClick?.[key];
118
+ if (incomingClickValue && !cachedClickValue) {
119
+ clickInfoStaleTracker.isClickInfosStale = true;
120
+ clickInfoStaleTracker.staleKeys.push(key);
121
+ }
122
+ else if (incomingClickValue && cachedClickValue && incomingClickValue !== cachedClickValue) {
123
+ const incomingFbcFbclid = incomingClickValue?.split('.')?.[3];
124
+ const cachedFbcFbclid = cachedClickValue?.split('.')?.[3];
125
+ if (incomingFbcFbclid !== cachedFbcFbclid) {
126
+ clickInfoStaleTracker.isClickInfosStale = true;
127
+ clickInfoStaleTracker.staleKeys.push(key);
128
+ }
129
+ if (!incomingFbcFbclid || !cachedFbcFbclid) {
130
+ clickInfoStaleTracker.isClickInfosStale = true;
131
+ clickInfoStaleTracker.staleKeys.push(key);
132
+ }
133
+ }
134
+ }
135
+ else {
136
+ const cachedClickValue = cleanedCachedClick?.[key];
137
+ const incomingClickValue = cleanedIncomingClick?.[key];
138
+ if ((incomingClickValue && !cachedClickValue)
139
+ || incomingClickValue !== cachedClickValue) {
140
+ clickInfoStaleTracker.isClickInfosStale = true;
141
+ clickInfoStaleTracker.staleKeys.push(key);
142
+ }
143
+ }
144
+ });
145
+ if (clickInfoStaleTracker.isClickInfosStale) {
146
+ logging_helper_1.Logger.debug('identity cache miss - clickInfos changed', { clickInfoStaleTracker });
147
+ }
148
+ return clickInfoStaleTracker.isClickInfosStale;
149
+ };
150
+ exports.isClickInfosStale = isClickInfosStale;
151
151
  //# sourceMappingURL=identity-cache-helper.js.map
@@ -1,5 +1,5 @@
1
- export * from './input-validation-helper.js';
2
- export * from './logging-helper.js';
3
- export * from './response-helper.js';
4
- export * from './shopify-helper.js';
5
- export * from './identity-cache-helper.js';
1
+ export * from './input-validation-helper.js';
2
+ export * from './logging-helper.js';
3
+ export * from './response-helper.js';
4
+ export * from './shopify-helper.js';
5
+ export * from './identity-cache-helper.js';