@adtrackify/at-service-common 3.1.52 → 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 (321) 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 -0
  8. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.js +36 -0
  9. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.js.map +1 -0
  10. package/dist/cjs/clients/generic/cognito-client.d.ts +23 -23
  11. package/dist/cjs/clients/generic/cognito-client.js +209 -209
  12. package/dist/cjs/clients/generic/dynamodb-client.d.ts +17 -17
  13. package/dist/cjs/clients/generic/dynamodb-client.js +167 -167
  14. package/dist/cjs/clients/generic/eventbridge-client.d.ts +14 -14
  15. package/dist/cjs/clients/generic/eventbridge-client.js +49 -49
  16. package/dist/cjs/clients/generic/http-client.d.ts +14 -88
  17. package/dist/cjs/clients/generic/http-client.js +61 -60
  18. package/dist/cjs/clients/generic/http-client.js.map +1 -1
  19. package/dist/cjs/clients/generic/index.d.ts +10 -10
  20. package/dist/cjs/clients/generic/index.js +26 -26
  21. package/dist/cjs/clients/generic/lambda-invoke-client.d.ts +10 -10
  22. package/dist/cjs/clients/generic/lambda-invoke-client.js +35 -35
  23. package/dist/cjs/clients/generic/location-client.d.ts +8 -8
  24. package/dist/cjs/clients/generic/location-client.js +31 -31
  25. package/dist/cjs/clients/generic/redis-client.d.ts +18 -18
  26. package/dist/cjs/clients/generic/redis-client.js +128 -128
  27. package/dist/cjs/clients/generic/s3-client.d.ts +16 -16
  28. package/dist/cjs/clients/generic/s3-client.js +110 -110
  29. package/dist/cjs/clients/generic/singlestore-db-client.d.ts +14 -14
  30. package/dist/cjs/clients/generic/singlestore-db-client.js +67 -67
  31. package/dist/cjs/clients/generic/sqs-client.d.ts +20 -20
  32. package/dist/cjs/clients/generic/sqs-client.js +36 -36
  33. package/dist/cjs/clients/index.d.ts +3 -3
  34. package/dist/cjs/clients/index.js +19 -19
  35. package/dist/cjs/clients/internal-api/accounts-client.d.ts +67 -112
  36. package/dist/cjs/clients/internal-api/accounts-client.js +117 -117
  37. package/dist/cjs/clients/internal-api/cache-lambda-client.d.ts +25 -25
  38. package/dist/cjs/clients/internal-api/cache-lambda-client.js +79 -79
  39. package/dist/cjs/clients/internal-api/db-management-client.d.ts +18 -18
  40. package/dist/cjs/clients/internal-api/db-management-client.js +39 -39
  41. package/dist/cjs/clients/internal-api/destinations-client.d.ts +29 -29
  42. package/dist/cjs/clients/internal-api/destinations-client.js +54 -54
  43. package/dist/cjs/clients/internal-api/event-collector-client.d.ts +20 -20
  44. package/dist/cjs/clients/internal-api/event-collector-client.js +39 -39
  45. package/dist/cjs/clients/internal-api/identity-client.d.ts +25 -25
  46. package/dist/cjs/clients/internal-api/identity-client.js +92 -92
  47. package/dist/cjs/clients/internal-api/index.d.ts +8 -8
  48. package/dist/cjs/clients/internal-api/index.js +24 -24
  49. package/dist/cjs/clients/internal-api/shopify-app-install-client.d.ts +34 -34
  50. package/dist/cjs/clients/internal-api/shopify-app-install-client.js +63 -63
  51. package/dist/cjs/clients/internal-api/subscriptions-client.d.ts +32 -0
  52. package/dist/cjs/clients/internal-api/subscriptions-client.js +53 -0
  53. package/dist/cjs/clients/internal-api/subscriptions-client.js.map +1 -0
  54. package/dist/cjs/clients/internal-api/users-auth-client.d.ts +35 -35
  55. package/dist/cjs/clients/internal-api/users-auth-client.js +110 -110
  56. package/dist/cjs/clients/third-party/index.d.ts +1 -1
  57. package/dist/cjs/clients/third-party/index.js +17 -17
  58. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  59. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.js +5 -5
  60. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -9
  61. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.js +95 -95
  62. package/dist/cjs/clients/third-party/shopify-client.d.ts +33 -198
  63. package/dist/cjs/clients/third-party/shopify-client.js +150 -150
  64. package/dist/cjs/helpers/identity-cache-helper.d.ts +4 -4
  65. package/dist/cjs/helpers/identity-cache-helper.js +150 -150
  66. package/dist/cjs/helpers/index.d.ts +5 -5
  67. package/dist/cjs/helpers/index.js +21 -21
  68. package/dist/cjs/helpers/input-validation-helper.d.ts +3 -3
  69. package/dist/cjs/helpers/input-validation-helper.js +22 -22
  70. package/dist/cjs/helpers/logging-helper.d.ts +16 -16
  71. package/dist/cjs/helpers/logging-helper.js +84 -84
  72. package/dist/cjs/helpers/response-helper.d.ts +15 -15
  73. package/dist/cjs/helpers/response-helper.js +42 -42
  74. package/dist/cjs/helpers/shopify-helper.d.ts +9 -9
  75. package/dist/cjs/helpers/shopify-helper.js +28 -28
  76. package/dist/cjs/index.d.ts +5 -5
  77. package/dist/cjs/index.js +21 -21
  78. package/dist/cjs/libs/clickId-parser.d.ts +23 -23
  79. package/dist/cjs/libs/clickId-parser.js +49 -49
  80. package/dist/cjs/libs/compression.d.ts +2 -2
  81. package/dist/cjs/libs/compression.js +33 -33
  82. package/dist/cjs/libs/crypto.d.ts +1 -1
  83. package/dist/cjs/libs/crypto.js +12 -12
  84. package/dist/cjs/libs/dates.d.ts +6 -6
  85. package/dist/cjs/libs/dates.js +31 -31
  86. package/dist/cjs/libs/http-error.d.ts +21 -21
  87. package/dist/cjs/libs/http-error.js +59 -59
  88. package/dist/cjs/libs/http-status-codes.d.ts +58 -58
  89. package/dist/cjs/libs/http-status-codes.js +62 -62
  90. package/dist/cjs/libs/index.d.ts +9 -9
  91. package/dist/cjs/libs/index.js +25 -25
  92. package/dist/cjs/libs/referrer-parser/index.d.ts +2 -2
  93. package/dist/cjs/libs/referrer-parser/index.js +18 -18
  94. package/dist/cjs/libs/referrer-parser/referrer-data.d.ts +9 -9
  95. package/dist/cjs/libs/referrer-parser/referrer-data.js +4712 -4712
  96. package/dist/cjs/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  97. package/dist/cjs/libs/referrer-parser/referrer-parser-util.js +128 -128
  98. package/dist/cjs/libs/url.d.ts +1 -1
  99. package/dist/cjs/libs/url.js +13 -13
  100. package/dist/cjs/services/cache/generic-cached-object.d.ts +5 -5
  101. package/dist/cjs/services/cache/generic-cached-object.js +2 -2
  102. package/dist/cjs/services/cache/index.d.ts +1 -1
  103. package/dist/cjs/services/cache/index.js +17 -17
  104. package/dist/cjs/services/cache/product-cache-service.d.ts +21 -21
  105. package/dist/cjs/services/cache/product-cache-service.js +68 -68
  106. package/dist/cjs/services/db/destinations-db-service.d.ts +9 -9
  107. package/dist/cjs/services/db/destinations-db-service.js +57 -57
  108. package/dist/cjs/services/db/identity-cache-db-service.d.ts +24 -24
  109. package/dist/cjs/services/db/identity-cache-db-service.js +233 -233
  110. package/dist/cjs/services/db/index.d.ts +7 -7
  111. package/dist/cjs/services/db/index.js +23 -23
  112. package/dist/cjs/services/db/log-events-db-service.d.ts +11 -11
  113. package/dist/cjs/services/db/log-events-db-service.js +172 -172
  114. package/dist/cjs/services/db/purchased-contacts-db-service.d.ts +9 -9
  115. package/dist/cjs/services/db/purchased-contacts-db-service.js +38 -38
  116. package/dist/cjs/services/db/shopify-app-installs-db-service.d.ts +7 -7
  117. package/dist/cjs/services/db/shopify-app-installs-db-service.js +47 -47
  118. package/dist/cjs/services/db/shopify-products-cache-db-service.d.ts +16 -16
  119. package/dist/cjs/services/db/shopify-products-cache-db-service.js +65 -65
  120. package/dist/cjs/services/db/tracking-events-db-service.d.ts +20 -20
  121. package/dist/cjs/services/db/tracking-events-db-service.js +162 -162
  122. package/dist/cjs/services/eventbridge-integration-service.d.ts +9 -9
  123. package/dist/cjs/services/eventbridge-integration-service.js +28 -28
  124. package/dist/cjs/services/generic-cache-service.d.ts +7 -7
  125. package/dist/cjs/services/generic-cache-service.js +33 -33
  126. package/dist/cjs/services/index.d.ts +8 -8
  127. package/dist/cjs/services/index.js +24 -24
  128. package/dist/cjs/services/ipdata-lookup-service.d.ts +19 -19
  129. package/dist/cjs/services/ipdata-lookup-service.js +77 -77
  130. package/dist/cjs/services/log-event-service.d.ts +9 -9
  131. package/dist/cjs/services/log-event-service.js +56 -56
  132. package/dist/cjs/services/metric-event-service.d.ts +9 -9
  133. package/dist/cjs/services/metric-event-service.js +49 -49
  134. package/dist/cjs/services/shopify/index.d.ts +3 -3
  135. package/dist/cjs/services/shopify/index.js +19 -19
  136. package/dist/cjs/services/shopify/products/index.d.ts +1 -1
  137. package/dist/cjs/services/shopify/products/index.js +17 -17
  138. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  139. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.js +103 -103
  140. package/dist/cjs/services/shopify/shopify-graphql-transformer.d.ts +9 -9
  141. package/dist/cjs/services/shopify/shopify-graphql-transformer.js +137 -130
  142. package/dist/cjs/services/shopify/shopify-graphql-transformer.js.map +1 -1
  143. package/dist/cjs/services/shopify/types/index.d.ts +1 -1
  144. package/dist/cjs/services/shopify/types/index.js +17 -17
  145. package/dist/cjs/services/shopify/types/product.d.ts +115 -115
  146. package/dist/cjs/services/shopify/types/product.js +9 -9
  147. package/dist/cjs/types/api-response.d.ts +6 -6
  148. package/dist/cjs/types/api-response.js +2 -2
  149. package/dist/cjs/types/index.d.ts +2 -2
  150. package/dist/cjs/types/index.js +18 -18
  151. package/dist/cjs/types/internal-events/event-detail-types.d.ts +20 -20
  152. package/dist/cjs/types/internal-events/event-detail-types.js +27 -27
  153. package/dist/cjs/types/internal-events/index.d.ts +1 -1
  154. package/dist/cjs/types/internal-events/index.js +17 -17
  155. package/dist/cjs/types/shopify-graphql-types/admin.generated.d.ts +105 -105
  156. package/dist/cjs/types/shopify-graphql-types/admin.generated.js +2 -2
  157. package/dist/cjs/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  158. package/dist/cjs/types/shopify-graphql-types/admin.types.js +5311 -5311
  159. package/dist/cjs/types/shopify-graphql-types/index.d.ts +2 -2
  160. package/dist/cjs/types/shopify-graphql-types/index.js +18 -18
  161. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.d.ts +1 -1
  162. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.js +525 -525
  163. package/dist/esm/__tests__/libs/compress-decompress.spec.d.ts +1 -1
  164. package/dist/esm/__tests__/libs/compress-decompress.spec.js +14 -14
  165. package/dist/esm/__tests__/s3-client/s3-client.spec.d.ts +1 -1
  166. package/dist/esm/__tests__/s3-client/s3-client.spec.js +24 -24
  167. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.d.ts +1 -0
  168. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.js +34 -0
  169. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.js.map +1 -0
  170. package/dist/esm/clients/generic/cognito-client.d.ts +23 -23
  171. package/dist/esm/clients/generic/cognito-client.js +204 -204
  172. package/dist/esm/clients/generic/dynamodb-client.d.ts +17 -17
  173. package/dist/esm/clients/generic/dynamodb-client.js +163 -163
  174. package/dist/esm/clients/generic/eventbridge-client.d.ts +14 -14
  175. package/dist/esm/clients/generic/eventbridge-client.js +45 -45
  176. package/dist/esm/clients/generic/http-client.d.ts +14 -88
  177. package/dist/esm/clients/generic/http-client.js +53 -52
  178. package/dist/esm/clients/generic/http-client.js.map +1 -1
  179. package/dist/esm/clients/generic/index.d.ts +10 -10
  180. package/dist/esm/clients/generic/index.js +10 -10
  181. package/dist/esm/clients/generic/lambda-invoke-client.d.ts +10 -10
  182. package/dist/esm/clients/generic/lambda-invoke-client.js +31 -31
  183. package/dist/esm/clients/generic/location-client.d.ts +8 -8
  184. package/dist/esm/clients/generic/location-client.js +27 -27
  185. package/dist/esm/clients/generic/redis-client.d.ts +18 -18
  186. package/dist/esm/clients/generic/redis-client.js +121 -121
  187. package/dist/esm/clients/generic/s3-client.d.ts +16 -16
  188. package/dist/esm/clients/generic/s3-client.js +106 -106
  189. package/dist/esm/clients/generic/singlestore-db-client.d.ts +14 -14
  190. package/dist/esm/clients/generic/singlestore-db-client.js +40 -40
  191. package/dist/esm/clients/generic/sqs-client.d.ts +20 -20
  192. package/dist/esm/clients/generic/sqs-client.js +32 -32
  193. package/dist/esm/clients/index.d.ts +3 -3
  194. package/dist/esm/clients/index.js +3 -3
  195. package/dist/esm/clients/internal-api/accounts-client.d.ts +67 -112
  196. package/dist/esm/clients/internal-api/accounts-client.js +113 -113
  197. package/dist/esm/clients/internal-api/cache-lambda-client.d.ts +25 -25
  198. package/dist/esm/clients/internal-api/cache-lambda-client.js +75 -75
  199. package/dist/esm/clients/internal-api/db-management-client.d.ts +18 -18
  200. package/dist/esm/clients/internal-api/db-management-client.js +32 -32
  201. package/dist/esm/clients/internal-api/destinations-client.d.ts +29 -29
  202. package/dist/esm/clients/internal-api/destinations-client.js +50 -50
  203. package/dist/esm/clients/internal-api/event-collector-client.d.ts +20 -20
  204. package/dist/esm/clients/internal-api/event-collector-client.js +32 -32
  205. package/dist/esm/clients/internal-api/identity-client.d.ts +25 -25
  206. package/dist/esm/clients/internal-api/identity-client.js +88 -88
  207. package/dist/esm/clients/internal-api/index.d.ts +8 -8
  208. package/dist/esm/clients/internal-api/index.js +8 -8
  209. package/dist/esm/clients/internal-api/shopify-app-install-client.d.ts +34 -34
  210. package/dist/esm/clients/internal-api/shopify-app-install-client.js +56 -56
  211. package/dist/esm/clients/internal-api/subscriptions-client.d.ts +32 -0
  212. package/dist/esm/clients/internal-api/subscriptions-client.js +46 -0
  213. package/dist/esm/clients/internal-api/subscriptions-client.js.map +1 -0
  214. package/dist/esm/clients/internal-api/users-auth-client.d.ts +35 -35
  215. package/dist/esm/clients/internal-api/users-auth-client.js +106 -106
  216. package/dist/esm/clients/third-party/index.d.ts +1 -1
  217. package/dist/esm/clients/third-party/index.js +1 -1
  218. package/dist/esm/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  219. package/dist/esm/clients/third-party/shopify/graphql-product-queries.js +2 -2
  220. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.d.ts +9 -9
  221. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.js +91 -91
  222. package/dist/esm/clients/third-party/shopify-client.d.ts +33 -198
  223. package/dist/esm/clients/third-party/shopify-client.js +146 -146
  224. package/dist/esm/helpers/identity-cache-helper.d.ts +4 -4
  225. package/dist/esm/helpers/identity-cache-helper.js +145 -145
  226. package/dist/esm/helpers/index.d.ts +5 -5
  227. package/dist/esm/helpers/index.js +5 -5
  228. package/dist/esm/helpers/input-validation-helper.d.ts +3 -3
  229. package/dist/esm/helpers/input-validation-helper.js +18 -18
  230. package/dist/esm/helpers/logging-helper.d.ts +16 -16
  231. package/dist/esm/helpers/logging-helper.js +56 -56
  232. package/dist/esm/helpers/response-helper.d.ts +15 -15
  233. package/dist/esm/helpers/response-helper.js +36 -36
  234. package/dist/esm/helpers/shopify-helper.d.ts +9 -9
  235. package/dist/esm/helpers/shopify-helper.js +23 -23
  236. package/dist/esm/index.d.ts +5 -5
  237. package/dist/esm/index.js +5 -5
  238. package/dist/esm/libs/clickId-parser.d.ts +23 -23
  239. package/dist/esm/libs/clickId-parser.js +45 -45
  240. package/dist/esm/libs/compression.d.ts +2 -2
  241. package/dist/esm/libs/compression.js +25 -25
  242. package/dist/esm/libs/crypto.d.ts +1 -1
  243. package/dist/esm/libs/crypto.js +5 -5
  244. package/dist/esm/libs/dates.d.ts +6 -6
  245. package/dist/esm/libs/dates.js +22 -22
  246. package/dist/esm/libs/http-error.d.ts +21 -21
  247. package/dist/esm/libs/http-error.js +55 -55
  248. package/dist/esm/libs/http-status-codes.d.ts +58 -58
  249. package/dist/esm/libs/http-status-codes.js +59 -59
  250. package/dist/esm/libs/index.d.ts +9 -9
  251. package/dist/esm/libs/index.js +9 -9
  252. package/dist/esm/libs/referrer-parser/index.d.ts +2 -2
  253. package/dist/esm/libs/referrer-parser/index.js +2 -2
  254. package/dist/esm/libs/referrer-parser/referrer-data.d.ts +9 -9
  255. package/dist/esm/libs/referrer-parser/referrer-data.js +4709 -4709
  256. package/dist/esm/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  257. package/dist/esm/libs/referrer-parser/referrer-parser-util.js +121 -121
  258. package/dist/esm/libs/url.d.ts +1 -1
  259. package/dist/esm/libs/url.js +9 -9
  260. package/dist/esm/services/cache/generic-cached-object.d.ts +5 -5
  261. package/dist/esm/services/cache/generic-cached-object.js +1 -1
  262. package/dist/esm/services/cache/index.d.ts +1 -1
  263. package/dist/esm/services/cache/index.js +1 -1
  264. package/dist/esm/services/cache/product-cache-service.d.ts +21 -21
  265. package/dist/esm/services/cache/product-cache-service.js +60 -60
  266. package/dist/esm/services/db/destinations-db-service.d.ts +9 -9
  267. package/dist/esm/services/db/destinations-db-service.js +53 -53
  268. package/dist/esm/services/db/identity-cache-db-service.d.ts +24 -24
  269. package/dist/esm/services/db/identity-cache-db-service.js +229 -229
  270. package/dist/esm/services/db/index.d.ts +7 -7
  271. package/dist/esm/services/db/index.js +7 -7
  272. package/dist/esm/services/db/log-events-db-service.d.ts +11 -11
  273. package/dist/esm/services/db/log-events-db-service.js +168 -168
  274. package/dist/esm/services/db/purchased-contacts-db-service.d.ts +9 -9
  275. package/dist/esm/services/db/purchased-contacts-db-service.js +34 -34
  276. package/dist/esm/services/db/shopify-app-installs-db-service.d.ts +7 -7
  277. package/dist/esm/services/db/shopify-app-installs-db-service.js +43 -43
  278. package/dist/esm/services/db/shopify-products-cache-db-service.d.ts +16 -16
  279. package/dist/esm/services/db/shopify-products-cache-db-service.js +58 -58
  280. package/dist/esm/services/db/tracking-events-db-service.d.ts +20 -20
  281. package/dist/esm/services/db/tracking-events-db-service.js +158 -158
  282. package/dist/esm/services/eventbridge-integration-service.d.ts +9 -9
  283. package/dist/esm/services/eventbridge-integration-service.js +24 -24
  284. package/dist/esm/services/generic-cache-service.d.ts +7 -7
  285. package/dist/esm/services/generic-cache-service.js +29 -29
  286. package/dist/esm/services/index.d.ts +8 -8
  287. package/dist/esm/services/index.js +8 -8
  288. package/dist/esm/services/ipdata-lookup-service.d.ts +19 -19
  289. package/dist/esm/services/ipdata-lookup-service.js +73 -73
  290. package/dist/esm/services/log-event-service.d.ts +9 -9
  291. package/dist/esm/services/log-event-service.js +52 -52
  292. package/dist/esm/services/metric-event-service.d.ts +9 -9
  293. package/dist/esm/services/metric-event-service.js +45 -45
  294. package/dist/esm/services/shopify/index.d.ts +3 -3
  295. package/dist/esm/services/shopify/index.js +3 -3
  296. package/dist/esm/services/shopify/products/index.d.ts +1 -1
  297. package/dist/esm/services/shopify/products/index.js +1 -1
  298. package/dist/esm/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  299. package/dist/esm/services/shopify/products/shopify-products-serviceV2.js +99 -99
  300. package/dist/esm/services/shopify/shopify-graphql-transformer.d.ts +9 -9
  301. package/dist/esm/services/shopify/shopify-graphql-transformer.js +134 -127
  302. package/dist/esm/services/shopify/shopify-graphql-transformer.js.map +1 -1
  303. package/dist/esm/services/shopify/types/index.d.ts +1 -1
  304. package/dist/esm/services/shopify/types/index.js +1 -1
  305. package/dist/esm/services/shopify/types/product.d.ts +115 -115
  306. package/dist/esm/services/shopify/types/product.js +6 -6
  307. package/dist/esm/types/api-response.d.ts +6 -6
  308. package/dist/esm/types/api-response.js +1 -1
  309. package/dist/esm/types/index.d.ts +2 -2
  310. package/dist/esm/types/index.js +2 -2
  311. package/dist/esm/types/internal-events/event-detail-types.d.ts +20 -20
  312. package/dist/esm/types/internal-events/event-detail-types.js +24 -24
  313. package/dist/esm/types/internal-events/index.d.ts +1 -1
  314. package/dist/esm/types/internal-events/index.js +1 -1
  315. package/dist/esm/types/shopify-graphql-types/admin.generated.d.ts +105 -105
  316. package/dist/esm/types/shopify-graphql-types/admin.generated.js +1 -1
  317. package/dist/esm/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  318. package/dist/esm/types/shopify-graphql-types/admin.types.js +5299 -5299
  319. package/dist/esm/types/shopify-graphql-types/index.d.ts +2 -2
  320. package/dist/esm/types/shopify-graphql-types/index.js +2 -2
  321. 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';