@adtrackify/at-service-common 3.17.2 → 3.17.3

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 (425) hide show
  1. package/dist/cjs/__tests__/clients/sqs-client.spec.d.ts +1 -1
  2. package/dist/cjs/__tests__/clients/sqs-client.spec.js +121 -121
  3. package/dist/cjs/__tests__/db/shared-read-db-services.spec.d.ts +1 -1
  4. package/dist/cjs/__tests__/db/shared-read-db-services.spec.js +89 -89
  5. package/dist/cjs/__tests__/helpers/account-users-helper.spec.d.ts +1 -1
  6. package/dist/cjs/__tests__/helpers/account-users-helper.spec.js +220 -220
  7. package/dist/cjs/__tests__/identity-cache/identity-cache-db-service.spec.d.ts +1 -1
  8. package/dist/cjs/__tests__/identity-cache/identity-cache-db-service.spec.js +674 -674
  9. package/dist/cjs/__tests__/identity-cache/trait-merging-and-staleness.spec.d.ts +1 -1
  10. package/dist/cjs/__tests__/identity-cache/trait-merging-and-staleness.spec.js +588 -588
  11. package/dist/cjs/__tests__/libs/compress-decompress.spec.d.ts +1 -1
  12. package/dist/cjs/__tests__/libs/compress-decompress.spec.js +16 -16
  13. package/dist/cjs/__tests__/libs/currency.spec.d.ts +1 -1
  14. package/dist/cjs/__tests__/libs/currency.spec.js +220 -220
  15. package/dist/cjs/__tests__/libs/dates.spec.d.ts +1 -1
  16. package/dist/cjs/__tests__/libs/dates.spec.js +130 -130
  17. package/dist/cjs/__tests__/libs/domain.spec.d.ts +1 -1
  18. package/dist/cjs/__tests__/libs/domain.spec.js +107 -107
  19. package/dist/cjs/__tests__/libs/numbers.spec.d.ts +1 -1
  20. package/dist/cjs/__tests__/libs/numbers.spec.js +261 -261
  21. package/dist/cjs/__tests__/s3-client/s3-client.spec.d.ts +1 -1
  22. package/dist/cjs/__tests__/s3-client/s3-client.spec.js +33 -33
  23. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.d.ts +1 -1
  24. package/dist/cjs/__tests__/shopify/shopify-graphql-transformer.spec.js +35 -35
  25. package/dist/cjs/clients/generic/cognito-client.d.ts +23 -23
  26. package/dist/cjs/clients/generic/cognito-client.js +209 -209
  27. package/dist/cjs/clients/generic/dynamodb-client.d.ts +18 -18
  28. package/dist/cjs/clients/generic/dynamodb-client.js +172 -172
  29. package/dist/cjs/clients/generic/eventbridge-client.d.ts +14 -14
  30. package/dist/cjs/clients/generic/eventbridge-client.js +51 -51
  31. package/dist/cjs/clients/generic/http-client.d.ts +14 -14
  32. package/dist/cjs/clients/generic/http-client.js +61 -61
  33. package/dist/cjs/clients/generic/index.d.ts +10 -10
  34. package/dist/cjs/clients/generic/index.js +26 -26
  35. package/dist/cjs/clients/generic/lambda-invoke-client.d.ts +10 -10
  36. package/dist/cjs/clients/generic/lambda-invoke-client.js +39 -39
  37. package/dist/cjs/clients/generic/location-client.d.ts +8 -8
  38. package/dist/cjs/clients/generic/location-client.js +31 -31
  39. package/dist/cjs/clients/generic/redis-client.d.ts +33 -33
  40. package/dist/cjs/clients/generic/redis-client.js +191 -191
  41. package/dist/cjs/clients/generic/s3-client.d.ts +23 -23
  42. package/dist/cjs/clients/generic/s3-client.js +216 -216
  43. package/dist/cjs/clients/generic/singlestore-db-client.d.ts +14 -14
  44. package/dist/cjs/clients/generic/singlestore-db-client.js +67 -67
  45. package/dist/cjs/clients/generic/sqs-client.d.ts +33 -33
  46. package/dist/cjs/clients/generic/sqs-client.js +111 -111
  47. package/dist/cjs/clients/index.d.ts +3 -3
  48. package/dist/cjs/clients/index.js +19 -19
  49. package/dist/cjs/clients/internal-api/accounts-client.d.ts +91 -91
  50. package/dist/cjs/clients/internal-api/accounts-client.js +129 -129
  51. package/dist/cjs/clients/internal-api/cache-lambda-client.d.ts +26 -26
  52. package/dist/cjs/clients/internal-api/cache-lambda-client.js +89 -89
  53. package/dist/cjs/clients/internal-api/db-management-client.d.ts +18 -18
  54. package/dist/cjs/clients/internal-api/db-management-client.js +36 -36
  55. package/dist/cjs/clients/internal-api/destinations-client.d.ts +34 -34
  56. package/dist/cjs/clients/internal-api/destinations-client.js +79 -79
  57. package/dist/cjs/clients/internal-api/event-collector-client.d.ts +20 -20
  58. package/dist/cjs/clients/internal-api/event-collector-client.js +36 -36
  59. package/dist/cjs/clients/internal-api/identity-client.d.ts +31 -31
  60. package/dist/cjs/clients/internal-api/identity-client.js +91 -91
  61. package/dist/cjs/clients/internal-api/index.d.ts +9 -9
  62. package/dist/cjs/clients/internal-api/index.js +25 -25
  63. package/dist/cjs/clients/internal-api/shopify-app-install-client.d.ts +37 -37
  64. package/dist/cjs/clients/internal-api/shopify-app-install-client.js +81 -81
  65. package/dist/cjs/clients/internal-api/subscriptions-client.d.ts +26 -26
  66. package/dist/cjs/clients/internal-api/subscriptions-client.js +77 -77
  67. package/dist/cjs/clients/internal-api/users-auth-client.d.ts +35 -35
  68. package/dist/cjs/clients/internal-api/users-auth-client.js +110 -110
  69. package/dist/cjs/clients/third-party/emailable-client.d.ts +7 -7
  70. package/dist/cjs/clients/third-party/emailable-client.js +25 -25
  71. package/dist/cjs/clients/third-party/exchange-rate-api-client.d.ts +17 -17
  72. package/dist/cjs/clients/third-party/exchange-rate-api-client.js +19 -19
  73. package/dist/cjs/clients/third-party/index.d.ts +4 -4
  74. package/dist/cjs/clients/third-party/index.js +20 -20
  75. package/dist/cjs/clients/third-party/loops-client.d.ts +10 -10
  76. package/dist/cjs/clients/third-party/loops-client.js +30 -30
  77. package/dist/cjs/clients/third-party/shopify/graphql-order-queries.d.ts +25 -25
  78. package/dist/cjs/clients/third-party/shopify/graphql-order-queries.js +30 -30
  79. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  80. package/dist/cjs/clients/third-party/shopify/graphql-product-queries.js +180 -180
  81. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.d.ts +10 -10
  82. package/dist/cjs/clients/third-party/shopify/shopify-graphql-client.js +161 -161
  83. package/dist/cjs/clients/third-party/shopify-client.d.ts +29 -29
  84. package/dist/cjs/clients/third-party/shopify-client.js +146 -146
  85. package/dist/cjs/helpers/account-users-helper.d.ts +2 -2
  86. package/dist/cjs/helpers/account-users-helper.js +22 -22
  87. package/dist/cjs/helpers/identity-cache-helper.d.ts +21 -21
  88. package/dist/cjs/helpers/identity-cache-helper.js +156 -156
  89. package/dist/cjs/helpers/index.d.ts +7 -7
  90. package/dist/cjs/helpers/index.js +23 -23
  91. package/dist/cjs/helpers/input-validation-helper.d.ts +3 -3
  92. package/dist/cjs/helpers/input-validation-helper.js +22 -22
  93. package/dist/cjs/helpers/logging-helper.d.ts +16 -16
  94. package/dist/cjs/helpers/logging-helper.js +84 -84
  95. package/dist/cjs/helpers/response-helper.d.ts +18 -18
  96. package/dist/cjs/helpers/response-helper.js +43 -43
  97. package/dist/cjs/helpers/shopify-helper.d.ts +9 -9
  98. package/dist/cjs/helpers/shopify-helper.js +26 -26
  99. package/dist/cjs/helpers/sqs-utils.d.ts +6 -6
  100. package/dist/cjs/helpers/sqs-utils.js +14 -14
  101. package/dist/cjs/index.d.ts +5 -5
  102. package/dist/cjs/index.js +21 -21
  103. package/dist/cjs/libs/click-id-parser.d.ts +23 -23
  104. package/dist/cjs/libs/click-id-parser.js +49 -49
  105. package/dist/cjs/libs/compression.d.ts +2 -2
  106. package/dist/cjs/libs/compression.js +33 -33
  107. package/dist/cjs/libs/cookie.d.ts +17 -17
  108. package/dist/cjs/libs/cookie.js +76 -76
  109. package/dist/cjs/libs/crypto.d.ts +4 -4
  110. package/dist/cjs/libs/crypto.js +25 -25
  111. package/dist/cjs/libs/csv.d.ts +2 -2
  112. package/dist/cjs/libs/csv.js +35 -35
  113. package/dist/cjs/libs/currency.d.ts +1 -1
  114. package/dist/cjs/libs/currency.js +29 -29
  115. package/dist/cjs/libs/dates.d.ts +12 -12
  116. package/dist/cjs/libs/dates.js +96 -96
  117. package/dist/cjs/libs/domain.d.ts +2 -2
  118. package/dist/cjs/libs/domain.js +38 -38
  119. package/dist/cjs/libs/emails.d.ts +6 -6
  120. package/dist/cjs/libs/emails.js +122 -122
  121. package/dist/cjs/libs/http-error.d.ts +21 -21
  122. package/dist/cjs/libs/http-error.js +63 -63
  123. package/dist/cjs/libs/http-status-codes.d.ts +58 -58
  124. package/dist/cjs/libs/http-status-codes.js +62 -62
  125. package/dist/cjs/libs/index.d.ts +17 -17
  126. package/dist/cjs/libs/index.js +33 -33
  127. package/dist/cjs/libs/numbers.d.ts +1 -1
  128. package/dist/cjs/libs/numbers.js +15 -15
  129. package/dist/cjs/libs/referrer-parser/index.d.ts +2 -2
  130. package/dist/cjs/libs/referrer-parser/index.js +18 -18
  131. package/dist/cjs/libs/referrer-parser/referrer-data.d.ts +9 -9
  132. package/dist/cjs/libs/referrer-parser/referrer-data.js +3307 -3307
  133. package/dist/cjs/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  134. package/dist/cjs/libs/referrer-parser/referrer-parser-util.js +131 -131
  135. package/dist/cjs/libs/strings.d.ts +3 -3
  136. package/dist/cjs/libs/strings.js +46 -46
  137. package/dist/cjs/libs/traits.d.ts +6 -6
  138. package/dist/cjs/libs/traits.js +65 -65
  139. package/dist/cjs/libs/url.d.ts +1 -1
  140. package/dist/cjs/libs/url.js +13 -13
  141. package/dist/cjs/services/cache/generic-cached-object.d.ts +5 -5
  142. package/dist/cjs/services/cache/generic-cached-object.js +2 -2
  143. package/dist/cjs/services/cache/index.d.ts +1 -1
  144. package/dist/cjs/services/cache/index.js +17 -17
  145. package/dist/cjs/services/cache/product-cache-service.d.ts +21 -21
  146. package/dist/cjs/services/cache/product-cache-service.js +76 -76
  147. package/dist/cjs/services/currency-exchange-rate-lookup-service.d.ts +11 -11
  148. package/dist/cjs/services/currency-exchange-rate-lookup-service.js +66 -66
  149. package/dist/cjs/services/db/accounts-db-service.d.ts +9 -9
  150. package/dist/cjs/services/db/accounts-db-service.js +33 -33
  151. package/dist/cjs/services/db/currency-exchange-rates-db-service.d.ts +21 -21
  152. package/dist/cjs/services/db/currency-exchange-rates-db-service.js +39 -39
  153. package/dist/cjs/services/db/destinations-db-service.d.ts +12 -12
  154. package/dist/cjs/services/db/destinations-db-service.js +76 -76
  155. package/dist/cjs/services/db/identity-cache-db-service.d.ts +28 -28
  156. package/dist/cjs/services/db/identity-cache-db-service.js +320 -320
  157. package/dist/cjs/services/db/index.d.ts +12 -12
  158. package/dist/cjs/services/db/index.js +28 -28
  159. package/dist/cjs/services/db/log-events-db-service.d.ts +11 -11
  160. package/dist/cjs/services/db/log-events-db-service.js +181 -181
  161. package/dist/cjs/services/db/pixels-db-service.d.ts +8 -8
  162. package/dist/cjs/services/db/pixels-db-service.js +35 -35
  163. package/dist/cjs/services/db/purchasable-contacts-db-service.d.ts +9 -9
  164. package/dist/cjs/services/db/purchasable-contacts-db-service.js +43 -43
  165. package/dist/cjs/services/db/purchased-contacts-db-service.d.ts +17 -17
  166. package/dist/cjs/services/db/purchased-contacts-db-service.js +143 -143
  167. package/dist/cjs/services/db/shopify-app-installs-db-service.d.ts +8 -8
  168. package/dist/cjs/services/db/shopify-app-installs-db-service.js +51 -51
  169. package/dist/cjs/services/db/shopify-products-cache-db-service.d.ts +16 -16
  170. package/dist/cjs/services/db/shopify-products-cache-db-service.js +73 -73
  171. package/dist/cjs/services/db/subscriptions-db-service.d.ts +10 -10
  172. package/dist/cjs/services/db/subscriptions-db-service.js +34 -34
  173. package/dist/cjs/services/db/tracking-events-db-service.d.ts +20 -20
  174. package/dist/cjs/services/db/tracking-events-db-service.js +165 -165
  175. package/dist/cjs/services/eventbridge-integration-service.d.ts +9 -9
  176. package/dist/cjs/services/eventbridge-integration-service.js +28 -28
  177. package/dist/cjs/services/events/index.d.ts +3 -3
  178. package/dist/cjs/services/events/index.js +19 -19
  179. package/dist/cjs/services/events/log-event-service.d.ts +9 -9
  180. package/dist/cjs/services/events/log-event-service.js +56 -56
  181. package/dist/cjs/services/events/metric-event-service.d.ts +9 -9
  182. package/dist/cjs/services/events/metric-event-service.js +49 -49
  183. package/dist/cjs/services/events/tracking-event-sqs-service.d.ts +8 -8
  184. package/dist/cjs/services/events/tracking-event-sqs-service.js +34 -34
  185. package/dist/cjs/services/generic-cache-service.d.ts +7 -7
  186. package/dist/cjs/services/generic-cache-service.js +33 -33
  187. package/dist/cjs/services/index.d.ts +8 -8
  188. package/dist/cjs/services/index.js +24 -24
  189. package/dist/cjs/services/ipdata-lookup-service.d.ts +20 -20
  190. package/dist/cjs/services/ipdata-lookup-service.js +112 -112
  191. package/dist/cjs/services/shopify/index.d.ts +2 -2
  192. package/dist/cjs/services/shopify/index.js +18 -18
  193. package/dist/cjs/services/shopify/products/index.d.ts +1 -1
  194. package/dist/cjs/services/shopify/products/index.js +17 -17
  195. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  196. package/dist/cjs/services/shopify/products/shopify-products-serviceV2.js +112 -112
  197. package/dist/cjs/services/shopify/shopify-graphql-transformer.d.ts +8 -8
  198. package/dist/cjs/services/shopify/shopify-graphql-transformer.js +141 -141
  199. package/dist/cjs/types/api-response.d.ts +6 -6
  200. package/dist/cjs/types/api-response.js +2 -2
  201. package/dist/cjs/types/index.d.ts +1 -1
  202. package/dist/cjs/types/index.js +17 -17
  203. package/dist/cjs/types/internal-events/event-detail-types.d.ts +20 -20
  204. package/dist/cjs/types/internal-events/event-detail-types.js +27 -27
  205. package/dist/cjs/types/internal-events/index.d.ts +1 -1
  206. package/dist/cjs/types/internal-events/index.js +17 -17
  207. package/dist/cjs/types/shopify-graphql-types/admin.generated.d.ts +123 -123
  208. package/dist/cjs/types/shopify-graphql-types/admin.generated.js +2 -2
  209. package/dist/cjs/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  210. package/dist/cjs/types/shopify-graphql-types/admin.types.js +5311 -5311
  211. package/dist/cjs/types/shopify-graphql-types/index.d.ts +2 -2
  212. package/dist/cjs/types/shopify-graphql-types/index.js +18 -18
  213. package/dist/esm/__tests__/clients/sqs-client.spec.d.ts +1 -1
  214. package/dist/esm/__tests__/clients/sqs-client.spec.js +119 -119
  215. package/dist/esm/__tests__/db/shared-read-db-services.spec.d.ts +1 -1
  216. package/dist/esm/__tests__/db/shared-read-db-services.spec.js +87 -87
  217. package/dist/esm/__tests__/helpers/account-users-helper.spec.d.ts +1 -1
  218. package/dist/esm/__tests__/helpers/account-users-helper.spec.js +218 -218
  219. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.d.ts +1 -1
  220. package/dist/esm/__tests__/identity-cache/identity-cache-db-service.spec.js +672 -672
  221. package/dist/esm/__tests__/identity-cache/trait-merging-and-staleness.spec.d.ts +1 -1
  222. package/dist/esm/__tests__/identity-cache/trait-merging-and-staleness.spec.js +586 -586
  223. package/dist/esm/__tests__/libs/compress-decompress.spec.d.ts +1 -1
  224. package/dist/esm/__tests__/libs/compress-decompress.spec.js +14 -14
  225. package/dist/esm/__tests__/libs/currency.spec.d.ts +1 -1
  226. package/dist/esm/__tests__/libs/currency.spec.js +218 -218
  227. package/dist/esm/__tests__/libs/dates.spec.d.ts +1 -1
  228. package/dist/esm/__tests__/libs/dates.spec.js +128 -128
  229. package/dist/esm/__tests__/libs/domain.spec.d.ts +1 -1
  230. package/dist/esm/__tests__/libs/domain.spec.js +105 -105
  231. package/dist/esm/__tests__/libs/numbers.spec.d.ts +1 -1
  232. package/dist/esm/__tests__/libs/numbers.spec.js +259 -259
  233. package/dist/esm/__tests__/s3-client/s3-client.spec.d.ts +1 -1
  234. package/dist/esm/__tests__/s3-client/s3-client.spec.js +31 -31
  235. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.d.ts +1 -1
  236. package/dist/esm/__tests__/shopify/shopify-graphql-transformer.spec.js +33 -33
  237. package/dist/esm/clients/generic/cognito-client.d.ts +23 -23
  238. package/dist/esm/clients/generic/cognito-client.js +204 -204
  239. package/dist/esm/clients/generic/dynamodb-client.d.ts +18 -18
  240. package/dist/esm/clients/generic/dynamodb-client.js +168 -168
  241. package/dist/esm/clients/generic/eventbridge-client.d.ts +14 -14
  242. package/dist/esm/clients/generic/eventbridge-client.js +47 -47
  243. package/dist/esm/clients/generic/http-client.d.ts +14 -14
  244. package/dist/esm/clients/generic/http-client.js +53 -53
  245. package/dist/esm/clients/generic/index.d.ts +10 -10
  246. package/dist/esm/clients/generic/index.js +10 -10
  247. package/dist/esm/clients/generic/lambda-invoke-client.d.ts +10 -10
  248. package/dist/esm/clients/generic/lambda-invoke-client.js +35 -35
  249. package/dist/esm/clients/generic/location-client.d.ts +8 -8
  250. package/dist/esm/clients/generic/location-client.js +27 -27
  251. package/dist/esm/clients/generic/redis-client.d.ts +33 -33
  252. package/dist/esm/clients/generic/redis-client.js +184 -184
  253. package/dist/esm/clients/generic/s3-client.d.ts +23 -23
  254. package/dist/esm/clients/generic/s3-client.js +209 -209
  255. package/dist/esm/clients/generic/singlestore-db-client.d.ts +14 -14
  256. package/dist/esm/clients/generic/singlestore-db-client.js +40 -40
  257. package/dist/esm/clients/generic/sqs-client.d.ts +33 -33
  258. package/dist/esm/clients/generic/sqs-client.js +107 -107
  259. package/dist/esm/clients/index.d.ts +3 -3
  260. package/dist/esm/clients/index.js +3 -3
  261. package/dist/esm/clients/internal-api/accounts-client.d.ts +91 -91
  262. package/dist/esm/clients/internal-api/accounts-client.js +125 -125
  263. package/dist/esm/clients/internal-api/cache-lambda-client.d.ts +26 -26
  264. package/dist/esm/clients/internal-api/cache-lambda-client.js +85 -85
  265. package/dist/esm/clients/internal-api/db-management-client.d.ts +18 -18
  266. package/dist/esm/clients/internal-api/db-management-client.js +32 -32
  267. package/dist/esm/clients/internal-api/destinations-client.d.ts +34 -34
  268. package/dist/esm/clients/internal-api/destinations-client.js +75 -75
  269. package/dist/esm/clients/internal-api/event-collector-client.d.ts +20 -20
  270. package/dist/esm/clients/internal-api/event-collector-client.js +32 -32
  271. package/dist/esm/clients/internal-api/identity-client.d.ts +31 -31
  272. package/dist/esm/clients/internal-api/identity-client.js +87 -87
  273. package/dist/esm/clients/internal-api/index.d.ts +9 -9
  274. package/dist/esm/clients/internal-api/index.js +9 -9
  275. package/dist/esm/clients/internal-api/shopify-app-install-client.d.ts +37 -37
  276. package/dist/esm/clients/internal-api/shopify-app-install-client.js +77 -77
  277. package/dist/esm/clients/internal-api/subscriptions-client.d.ts +26 -26
  278. package/dist/esm/clients/internal-api/subscriptions-client.js +73 -73
  279. package/dist/esm/clients/internal-api/users-auth-client.d.ts +35 -35
  280. package/dist/esm/clients/internal-api/users-auth-client.js +106 -106
  281. package/dist/esm/clients/third-party/emailable-client.d.ts +7 -7
  282. package/dist/esm/clients/third-party/emailable-client.js +21 -21
  283. package/dist/esm/clients/third-party/exchange-rate-api-client.d.ts +17 -17
  284. package/dist/esm/clients/third-party/exchange-rate-api-client.js +15 -15
  285. package/dist/esm/clients/third-party/index.d.ts +4 -4
  286. package/dist/esm/clients/third-party/index.js +4 -4
  287. package/dist/esm/clients/third-party/loops-client.d.ts +10 -10
  288. package/dist/esm/clients/third-party/loops-client.js +26 -26
  289. package/dist/esm/clients/third-party/shopify/graphql-order-queries.d.ts +25 -25
  290. package/dist/esm/clients/third-party/shopify/graphql-order-queries.js +27 -27
  291. package/dist/esm/clients/third-party/shopify/graphql-product-queries.d.ts +2 -2
  292. package/dist/esm/clients/third-party/shopify/graphql-product-queries.js +177 -177
  293. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.d.ts +10 -10
  294. package/dist/esm/clients/third-party/shopify/shopify-graphql-client.js +157 -157
  295. package/dist/esm/clients/third-party/shopify-client.d.ts +29 -29
  296. package/dist/esm/clients/third-party/shopify-client.js +142 -142
  297. package/dist/esm/helpers/account-users-helper.d.ts +2 -2
  298. package/dist/esm/helpers/account-users-helper.js +18 -18
  299. package/dist/esm/helpers/identity-cache-helper.d.ts +21 -21
  300. package/dist/esm/helpers/identity-cache-helper.js +151 -151
  301. package/dist/esm/helpers/index.d.ts +7 -7
  302. package/dist/esm/helpers/index.js +7 -7
  303. package/dist/esm/helpers/input-validation-helper.d.ts +3 -3
  304. package/dist/esm/helpers/input-validation-helper.js +18 -18
  305. package/dist/esm/helpers/logging-helper.d.ts +16 -16
  306. package/dist/esm/helpers/logging-helper.js +56 -56
  307. package/dist/esm/helpers/response-helper.d.ts +18 -18
  308. package/dist/esm/helpers/response-helper.js +37 -37
  309. package/dist/esm/helpers/shopify-helper.d.ts +9 -9
  310. package/dist/esm/helpers/shopify-helper.js +21 -21
  311. package/dist/esm/helpers/sqs-utils.d.ts +6 -6
  312. package/dist/esm/helpers/sqs-utils.js +9 -9
  313. package/dist/esm/index.d.ts +5 -5
  314. package/dist/esm/index.js +5 -5
  315. package/dist/esm/libs/click-id-parser.d.ts +23 -23
  316. package/dist/esm/libs/click-id-parser.js +45 -45
  317. package/dist/esm/libs/compression.d.ts +2 -2
  318. package/dist/esm/libs/compression.js +25 -25
  319. package/dist/esm/libs/cookie.d.ts +17 -17
  320. package/dist/esm/libs/cookie.js +70 -70
  321. package/dist/esm/libs/crypto.d.ts +4 -4
  322. package/dist/esm/libs/crypto.js +15 -15
  323. package/dist/esm/libs/csv.d.ts +2 -2
  324. package/dist/esm/libs/csv.js +30 -30
  325. package/dist/esm/libs/currency.d.ts +1 -1
  326. package/dist/esm/libs/currency.js +22 -22
  327. package/dist/esm/libs/dates.d.ts +12 -12
  328. package/dist/esm/libs/dates.js +83 -83
  329. package/dist/esm/libs/domain.d.ts +2 -2
  330. package/dist/esm/libs/domain.js +33 -33
  331. package/dist/esm/libs/emails.d.ts +6 -6
  332. package/dist/esm/libs/emails.js +115 -115
  333. package/dist/esm/libs/http-error.d.ts +21 -21
  334. package/dist/esm/libs/http-error.js +59 -59
  335. package/dist/esm/libs/http-status-codes.d.ts +58 -58
  336. package/dist/esm/libs/http-status-codes.js +59 -59
  337. package/dist/esm/libs/index.d.ts +17 -17
  338. package/dist/esm/libs/index.js +17 -17
  339. package/dist/esm/libs/numbers.d.ts +1 -1
  340. package/dist/esm/libs/numbers.js +11 -11
  341. package/dist/esm/libs/referrer-parser/index.d.ts +2 -2
  342. package/dist/esm/libs/referrer-parser/index.js +2 -2
  343. package/dist/esm/libs/referrer-parser/referrer-data.d.ts +9 -9
  344. package/dist/esm/libs/referrer-parser/referrer-data.js +3304 -3304
  345. package/dist/esm/libs/referrer-parser/referrer-parser-util.d.ts +20 -20
  346. package/dist/esm/libs/referrer-parser/referrer-parser-util.js +124 -124
  347. package/dist/esm/libs/strings.d.ts +3 -3
  348. package/dist/esm/libs/strings.js +40 -40
  349. package/dist/esm/libs/traits.d.ts +6 -6
  350. package/dist/esm/libs/traits.js +54 -54
  351. package/dist/esm/libs/url.d.ts +1 -1
  352. package/dist/esm/libs/url.js +9 -9
  353. package/dist/esm/services/cache/generic-cached-object.d.ts +5 -5
  354. package/dist/esm/services/cache/generic-cached-object.js +1 -1
  355. package/dist/esm/services/cache/index.d.ts +1 -1
  356. package/dist/esm/services/cache/index.js +1 -1
  357. package/dist/esm/services/cache/product-cache-service.d.ts +21 -21
  358. package/dist/esm/services/cache/product-cache-service.js +68 -68
  359. package/dist/esm/services/currency-exchange-rate-lookup-service.d.ts +11 -11
  360. package/dist/esm/services/currency-exchange-rate-lookup-service.js +62 -62
  361. package/dist/esm/services/db/accounts-db-service.d.ts +9 -9
  362. package/dist/esm/services/db/accounts-db-service.js +29 -29
  363. package/dist/esm/services/db/currency-exchange-rates-db-service.d.ts +21 -21
  364. package/dist/esm/services/db/currency-exchange-rates-db-service.js +35 -35
  365. package/dist/esm/services/db/destinations-db-service.d.ts +12 -12
  366. package/dist/esm/services/db/destinations-db-service.js +72 -72
  367. package/dist/esm/services/db/identity-cache-db-service.d.ts +28 -28
  368. package/dist/esm/services/db/identity-cache-db-service.js +313 -313
  369. package/dist/esm/services/db/index.d.ts +12 -12
  370. package/dist/esm/services/db/index.js +12 -12
  371. package/dist/esm/services/db/log-events-db-service.d.ts +11 -11
  372. package/dist/esm/services/db/log-events-db-service.js +177 -177
  373. package/dist/esm/services/db/pixels-db-service.d.ts +8 -8
  374. package/dist/esm/services/db/pixels-db-service.js +31 -31
  375. package/dist/esm/services/db/purchasable-contacts-db-service.d.ts +9 -9
  376. package/dist/esm/services/db/purchasable-contacts-db-service.js +39 -39
  377. package/dist/esm/services/db/purchased-contacts-db-service.d.ts +17 -17
  378. package/dist/esm/services/db/purchased-contacts-db-service.js +139 -139
  379. package/dist/esm/services/db/shopify-app-installs-db-service.d.ts +8 -8
  380. package/dist/esm/services/db/shopify-app-installs-db-service.js +47 -47
  381. package/dist/esm/services/db/shopify-products-cache-db-service.d.ts +16 -16
  382. package/dist/esm/services/db/shopify-products-cache-db-service.js +66 -66
  383. package/dist/esm/services/db/subscriptions-db-service.d.ts +10 -10
  384. package/dist/esm/services/db/subscriptions-db-service.js +30 -30
  385. package/dist/esm/services/db/tracking-events-db-service.d.ts +20 -20
  386. package/dist/esm/services/db/tracking-events-db-service.js +161 -161
  387. package/dist/esm/services/eventbridge-integration-service.d.ts +9 -9
  388. package/dist/esm/services/eventbridge-integration-service.js +24 -24
  389. package/dist/esm/services/events/index.d.ts +3 -3
  390. package/dist/esm/services/events/index.js +3 -3
  391. package/dist/esm/services/events/log-event-service.d.ts +9 -9
  392. package/dist/esm/services/events/log-event-service.js +52 -52
  393. package/dist/esm/services/events/metric-event-service.d.ts +9 -9
  394. package/dist/esm/services/events/metric-event-service.js +45 -45
  395. package/dist/esm/services/events/tracking-event-sqs-service.d.ts +8 -8
  396. package/dist/esm/services/events/tracking-event-sqs-service.js +30 -30
  397. package/dist/esm/services/generic-cache-service.d.ts +7 -7
  398. package/dist/esm/services/generic-cache-service.js +29 -29
  399. package/dist/esm/services/index.d.ts +8 -8
  400. package/dist/esm/services/index.js +8 -8
  401. package/dist/esm/services/ipdata-lookup-service.d.ts +20 -20
  402. package/dist/esm/services/ipdata-lookup-service.js +108 -108
  403. package/dist/esm/services/shopify/index.d.ts +2 -2
  404. package/dist/esm/services/shopify/index.js +2 -2
  405. package/dist/esm/services/shopify/products/index.d.ts +1 -1
  406. package/dist/esm/services/shopify/products/index.js +1 -1
  407. package/dist/esm/services/shopify/products/shopify-products-serviceV2.d.ts +17 -17
  408. package/dist/esm/services/shopify/products/shopify-products-serviceV2.js +108 -108
  409. package/dist/esm/services/shopify/shopify-graphql-transformer.d.ts +8 -8
  410. package/dist/esm/services/shopify/shopify-graphql-transformer.js +138 -138
  411. package/dist/esm/types/api-response.d.ts +6 -6
  412. package/dist/esm/types/api-response.js +1 -1
  413. package/dist/esm/types/index.d.ts +1 -1
  414. package/dist/esm/types/index.js +1 -1
  415. package/dist/esm/types/internal-events/event-detail-types.d.ts +20 -20
  416. package/dist/esm/types/internal-events/event-detail-types.js +24 -24
  417. package/dist/esm/types/internal-events/index.d.ts +1 -1
  418. package/dist/esm/types/internal-events/index.js +1 -1
  419. package/dist/esm/types/shopify-graphql-types/admin.generated.d.ts +123 -123
  420. package/dist/esm/types/shopify-graphql-types/admin.generated.js +1 -1
  421. package/dist/esm/types/shopify-graphql-types/admin.types.d.ts +26289 -26289
  422. package/dist/esm/types/shopify-graphql-types/admin.types.js +5299 -5299
  423. package/dist/esm/types/shopify-graphql-types/index.d.ts +2 -2
  424. package/dist/esm/types/shopify-graphql-types/index.js +2 -2
  425. package/package.json +1 -1
@@ -1,140 +1,140 @@
1
- import { PURCHASED_CONTACT_STATUS, } from '@adtrackify/at-tracking-event-types';
2
- import { DynamoDbClient } from '../../clients';
3
- import { HttpError, getCurrentTimestamp } from '../../libs';
4
- import { Logger } from '../../helpers';
5
- import { ulid } from 'ulid';
6
- export class PurchasedContactsDbService {
7
- TABLE_NAME;
8
- TABLE_KEY;
9
- IDENTITY_ID_PIXEL_ID_INDEX_NAME;
10
- IP_ADDRESS_PIXEL_ID_INDEX_NAME;
11
- EMAIL_PIXEL_ID_INDEX_NAME;
12
- constructor(tableName, purchasedContactsKey, STAGE) {
13
- this.TABLE_NAME = tableName;
14
- this.TABLE_KEY = purchasedContactsKey;
15
- this.IDENTITY_ID_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-identity-id-pixel-id`;
16
- this.IP_ADDRESS_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-ip-address-pixel-id`;
17
- this.EMAIL_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-email-pixel-id`;
18
- }
19
- buildPurchasedContact = (accountId, primaryContact, contacts, deliverableContacts) => {
20
- const currentTimestamp = getCurrentTimestamp();
21
- const purchasedContact = {
22
- ...primaryContact,
23
- primaryIdentityId: primaryContact.identityId,
24
- matchedIdentityId: primaryContact.matchedIdentityId,
25
- isIdentityMerged: primaryContact.isIdentityMerged,
26
- id: ulid(),
27
- contacts,
28
- deliverableContacts: deliverableContacts,
29
- contactId: primaryContact.id,
30
- accountId,
31
- emailStatus: primaryContact?.emailVerification?.state,
32
- purchasedStatus: PURCHASED_CONTACT_STATUS.ACTIVE,
33
- purchasedAt: currentTimestamp,
34
- createdAt: currentTimestamp,
35
- updatedAt: currentTimestamp,
36
- };
37
- return purchasedContact;
38
- };
39
- getPurchasedContact = async (id) => {
40
- const purchasedContact = await DynamoDbClient.safeGet(this.TABLE_NAME, this.TABLE_KEY, id);
41
- if (!purchasedContact) {
42
- throw HttpError.notFound();
43
- }
44
- return purchasedContact;
45
- };
46
- getPurchasedContactByIdentityIdPixelId = async (identityId, pixelId) => {
47
- try {
48
- const values = {
49
- ':identityId': identityId,
50
- ':pixelId': pixelId,
51
- };
52
- const query = {
53
- TableName: this.TABLE_NAME,
54
- IndexName: this.IDENTITY_ID_PIXEL_ID_INDEX_NAME,
55
- KeyConditionExpression: 'identityId = :identityId and pixelId = :pixelId',
56
- ExpressionAttributeValues: values,
57
- };
58
- const purchasedContacts = await DynamoDbClient.queryAll(query);
59
- if (purchasedContacts && purchasedContacts.length > 0) {
60
- return purchasedContacts;
61
- }
62
- return [];
63
- }
64
- catch (error) {
65
- Logger.error('failed to getPurchasedContactByIdentityIdPixelId', { error, identityId, pixelId });
66
- return [];
67
- }
68
- };
69
- getPurchasedContactByEmailPixelId = async (email, pixelId) => {
70
- try {
71
- const values = {
72
- ':email': email,
73
- ':pixelId': pixelId,
74
- };
75
- const query = {
76
- TableName: this.TABLE_NAME,
77
- IndexName: this.EMAIL_PIXEL_ID_INDEX_NAME,
78
- KeyConditionExpression: 'email = :email and pixelId = :pixelId',
79
- ExpressionAttributeValues: values,
80
- };
81
- const purchasedContacts = await DynamoDbClient.queryAll(query);
82
- if (purchasedContacts && purchasedContacts.length > 0) {
83
- return purchasedContacts;
84
- }
85
- return [];
86
- }
87
- catch (error) {
88
- Logger.error('failed to getPurchasedContactByEmailPixelId', { error, email, pixelId });
89
- return [];
90
- }
91
- };
92
- getPurchasedContactByIpAddressPixelId = async (ipAddress, pixelId) => {
93
- try {
94
- const values = {
95
- ':ipAddress': ipAddress,
96
- ':pixelId': pixelId,
97
- };
98
- const query = {
99
- TableName: this.TABLE_NAME,
100
- IndexName: this.IP_ADDRESS_PIXEL_ID_INDEX_NAME,
101
- KeyConditionExpression: 'ipAddress = :ipAddress and pixelId = :pixelId',
102
- ExpressionAttributeValues: values,
103
- };
104
- const purchasedContacts = await DynamoDbClient.queryAll(query);
105
- if (purchasedContacts && purchasedContacts.length > 0) {
106
- return purchasedContacts;
107
- }
108
- return [];
109
- }
110
- catch (error) {
111
- Logger.error('failed to getPurchasedContactByIpAddressPixelId', { error, ipAddress, pixelId });
112
- return [];
113
- }
114
- };
115
- batchGetPurchasedContacts = async (ids) => {
116
- if (ids.length === 0) {
117
- return [];
118
- }
119
- const keys = ids.map((id) => ({ [this.TABLE_KEY]: id }));
120
- const purchasedContacts = await DynamoDbClient.safeBatchGet(this.TABLE_NAME, keys);
121
- return purchasedContacts;
122
- };
123
- putPurchasedContact = async (purchasedContact) => {
124
- await DynamoDbClient.safePut(this.TABLE_NAME, purchasedContact);
125
- return purchasedContact;
126
- };
127
- updatePurchasedContact = async (id, data) => {
128
- const purchasedContact = await this.getPurchasedContact(id);
129
- Object.assign(purchasedContact, data);
130
- const currentTimestamp = getCurrentTimestamp();
131
- purchasedContact.updatedAt = currentTimestamp;
132
- const res = await DynamoDbClient.safePut(this.TABLE_NAME, purchasedContact);
133
- if (!res) {
134
- Logger.error('purchased contact update failed', { purchasedContact });
135
- throw HttpError.internal();
136
- }
137
- return purchasedContact;
138
- };
139
- }
1
+ import { PURCHASED_CONTACT_STATUS, } from '@adtrackify/at-tracking-event-types';
2
+ import { DynamoDbClient } from '../../clients';
3
+ import { HttpError, getCurrentTimestamp } from '../../libs';
4
+ import { Logger } from '../../helpers';
5
+ import { ulid } from 'ulid';
6
+ export class PurchasedContactsDbService {
7
+ TABLE_NAME;
8
+ TABLE_KEY;
9
+ IDENTITY_ID_PIXEL_ID_INDEX_NAME;
10
+ IP_ADDRESS_PIXEL_ID_INDEX_NAME;
11
+ EMAIL_PIXEL_ID_INDEX_NAME;
12
+ constructor(tableName, purchasedContactsKey, STAGE) {
13
+ this.TABLE_NAME = tableName;
14
+ this.TABLE_KEY = purchasedContactsKey;
15
+ this.IDENTITY_ID_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-identity-id-pixel-id`;
16
+ this.IP_ADDRESS_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-ip-address-pixel-id`;
17
+ this.EMAIL_PIXEL_ID_INDEX_NAME = `${STAGE}-purchased-contacts-gsi-email-pixel-id`;
18
+ }
19
+ buildPurchasedContact = (accountId, primaryContact, contacts, deliverableContacts) => {
20
+ const currentTimestamp = getCurrentTimestamp();
21
+ const purchasedContact = {
22
+ ...primaryContact,
23
+ primaryIdentityId: primaryContact.identityId,
24
+ matchedIdentityId: primaryContact.matchedIdentityId,
25
+ isIdentityMerged: primaryContact.isIdentityMerged,
26
+ id: ulid(),
27
+ contacts,
28
+ deliverableContacts: deliverableContacts,
29
+ contactId: primaryContact.id,
30
+ accountId,
31
+ emailStatus: primaryContact?.emailVerification?.state,
32
+ purchasedStatus: PURCHASED_CONTACT_STATUS.ACTIVE,
33
+ purchasedAt: currentTimestamp,
34
+ createdAt: currentTimestamp,
35
+ updatedAt: currentTimestamp,
36
+ };
37
+ return purchasedContact;
38
+ };
39
+ getPurchasedContact = async (id) => {
40
+ const purchasedContact = await DynamoDbClient.safeGet(this.TABLE_NAME, this.TABLE_KEY, id);
41
+ if (!purchasedContact) {
42
+ throw HttpError.notFound();
43
+ }
44
+ return purchasedContact;
45
+ };
46
+ getPurchasedContactByIdentityIdPixelId = async (identityId, pixelId) => {
47
+ try {
48
+ const values = {
49
+ ':identityId': identityId,
50
+ ':pixelId': pixelId,
51
+ };
52
+ const query = {
53
+ TableName: this.TABLE_NAME,
54
+ IndexName: this.IDENTITY_ID_PIXEL_ID_INDEX_NAME,
55
+ KeyConditionExpression: 'identityId = :identityId and pixelId = :pixelId',
56
+ ExpressionAttributeValues: values,
57
+ };
58
+ const purchasedContacts = await DynamoDbClient.queryAll(query);
59
+ if (purchasedContacts && purchasedContacts.length > 0) {
60
+ return purchasedContacts;
61
+ }
62
+ return [];
63
+ }
64
+ catch (error) {
65
+ Logger.error('failed to getPurchasedContactByIdentityIdPixelId', { error, identityId, pixelId });
66
+ return [];
67
+ }
68
+ };
69
+ getPurchasedContactByEmailPixelId = async (email, pixelId) => {
70
+ try {
71
+ const values = {
72
+ ':email': email,
73
+ ':pixelId': pixelId,
74
+ };
75
+ const query = {
76
+ TableName: this.TABLE_NAME,
77
+ IndexName: this.EMAIL_PIXEL_ID_INDEX_NAME,
78
+ KeyConditionExpression: 'email = :email and pixelId = :pixelId',
79
+ ExpressionAttributeValues: values,
80
+ };
81
+ const purchasedContacts = await DynamoDbClient.queryAll(query);
82
+ if (purchasedContacts && purchasedContacts.length > 0) {
83
+ return purchasedContacts;
84
+ }
85
+ return [];
86
+ }
87
+ catch (error) {
88
+ Logger.error('failed to getPurchasedContactByEmailPixelId', { error, email, pixelId });
89
+ return [];
90
+ }
91
+ };
92
+ getPurchasedContactByIpAddressPixelId = async (ipAddress, pixelId) => {
93
+ try {
94
+ const values = {
95
+ ':ipAddress': ipAddress,
96
+ ':pixelId': pixelId,
97
+ };
98
+ const query = {
99
+ TableName: this.TABLE_NAME,
100
+ IndexName: this.IP_ADDRESS_PIXEL_ID_INDEX_NAME,
101
+ KeyConditionExpression: 'ipAddress = :ipAddress and pixelId = :pixelId',
102
+ ExpressionAttributeValues: values,
103
+ };
104
+ const purchasedContacts = await DynamoDbClient.queryAll(query);
105
+ if (purchasedContacts && purchasedContacts.length > 0) {
106
+ return purchasedContacts;
107
+ }
108
+ return [];
109
+ }
110
+ catch (error) {
111
+ Logger.error('failed to getPurchasedContactByIpAddressPixelId', { error, ipAddress, pixelId });
112
+ return [];
113
+ }
114
+ };
115
+ batchGetPurchasedContacts = async (ids) => {
116
+ if (ids.length === 0) {
117
+ return [];
118
+ }
119
+ const keys = ids.map((id) => ({ [this.TABLE_KEY]: id }));
120
+ const purchasedContacts = await DynamoDbClient.safeBatchGet(this.TABLE_NAME, keys);
121
+ return purchasedContacts;
122
+ };
123
+ putPurchasedContact = async (purchasedContact) => {
124
+ await DynamoDbClient.safePut(this.TABLE_NAME, purchasedContact);
125
+ return purchasedContact;
126
+ };
127
+ updatePurchasedContact = async (id, data) => {
128
+ const purchasedContact = await this.getPurchasedContact(id);
129
+ Object.assign(purchasedContact, data);
130
+ const currentTimestamp = getCurrentTimestamp();
131
+ purchasedContact.updatedAt = currentTimestamp;
132
+ const res = await DynamoDbClient.safePut(this.TABLE_NAME, purchasedContact);
133
+ if (!res) {
134
+ Logger.error('purchased contact update failed', { purchasedContact });
135
+ throw HttpError.internal();
136
+ }
137
+ return purchasedContact;
138
+ };
139
+ }
140
140
  //# sourceMappingURL=purchased-contacts-db-service.js.map
@@ -1,8 +1,8 @@
1
- import { type ShopifyAppInstall } from '@adtrackify/at-tracking-event-types';
2
- export declare class ShopifyAppInstallsDbService {
3
- TABLE_NAME: string;
4
- constructor(tableName: string);
5
- getShopifyAppInstallById: (tableKey: string, shopifyAppInstallId: string) => Promise<ShopifyAppInstall | null>;
6
- getShopifyAppInstallByShop: (indexName: string, shop: string) => Promise<ShopifyAppInstall | null>;
7
- getShopifyAppInstallByPixelId: (indexName: string, pixelId: string) => Promise<ShopifyAppInstall | null>;
8
- }
1
+ import { type ShopifyAppInstall } from '@adtrackify/at-tracking-event-types';
2
+ export declare class ShopifyAppInstallsDbService {
3
+ TABLE_NAME: string;
4
+ constructor(tableName: string);
5
+ getShopifyAppInstallById: (tableKey: string, shopifyAppInstallId: string) => Promise<ShopifyAppInstall | null>;
6
+ getShopifyAppInstallByShop: (indexName: string, shop: string) => Promise<ShopifyAppInstall | null>;
7
+ getShopifyAppInstallByPixelId: (indexName: string, pixelId: string) => Promise<ShopifyAppInstall | null>;
8
+ }
@@ -1,48 +1,48 @@
1
- import { DynamoDbClient } from '../../clients/generic/dynamodb-client.js';
2
- import { Logger } from '../../helpers/index.js';
3
- export class ShopifyAppInstallsDbService {
4
- TABLE_NAME;
5
- constructor(tableName) {
6
- this.TABLE_NAME = tableName;
7
- }
8
- getShopifyAppInstallById = async (tableKey, shopifyAppInstallId) => {
9
- const shopifyAppInstall = await DynamoDbClient.safeGet(this.TABLE_NAME, tableKey, shopifyAppInstallId);
10
- return shopifyAppInstall ?? null;
11
- };
12
- getShopifyAppInstallByShop = async (indexName, shop) => {
13
- try {
14
- const values = {
15
- ':shop': shop,
16
- };
17
- const query = {
18
- TableName: this.TABLE_NAME,
19
- IndexName: indexName,
20
- KeyConditionExpression: 'shop = :shop',
21
- ExpressionAttributeValues: values,
22
- };
23
- const shopifyAppInstalls = await DynamoDbClient.queryAll(query);
24
- if (shopifyAppInstalls && shopifyAppInstalls.length > 0) {
25
- return shopifyAppInstalls[0];
26
- }
27
- return null;
28
- }
29
- catch (error) {
30
- Logger.error('failed to shopifyAppInstall by shop', { error, indexName, shop });
31
- return null;
32
- }
33
- };
34
- getShopifyAppInstallByPixelId = async (indexName, pixelId) => {
35
- try {
36
- const shopifyAppInstalls = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, 'pixelId', pixelId);
37
- if (shopifyAppInstalls && shopifyAppInstalls?.length > 0) {
38
- return shopifyAppInstalls[0];
39
- }
40
- return null;
41
- }
42
- catch (error) {
43
- Logger.error('failed to fetch shopifyAppInstall by pixelId', { error, indexName, pixelId });
44
- return null;
45
- }
46
- };
47
- }
1
+ import { DynamoDbClient } from '../../clients/generic/dynamodb-client.js';
2
+ import { Logger } from '../../helpers/index.js';
3
+ export class ShopifyAppInstallsDbService {
4
+ TABLE_NAME;
5
+ constructor(tableName) {
6
+ this.TABLE_NAME = tableName;
7
+ }
8
+ getShopifyAppInstallById = async (tableKey, shopifyAppInstallId) => {
9
+ const shopifyAppInstall = await DynamoDbClient.safeGet(this.TABLE_NAME, tableKey, shopifyAppInstallId);
10
+ return shopifyAppInstall ?? null;
11
+ };
12
+ getShopifyAppInstallByShop = async (indexName, shop) => {
13
+ try {
14
+ const values = {
15
+ ':shop': shop,
16
+ };
17
+ const query = {
18
+ TableName: this.TABLE_NAME,
19
+ IndexName: indexName,
20
+ KeyConditionExpression: 'shop = :shop',
21
+ ExpressionAttributeValues: values,
22
+ };
23
+ const shopifyAppInstalls = await DynamoDbClient.queryAll(query);
24
+ if (shopifyAppInstalls && shopifyAppInstalls.length > 0) {
25
+ return shopifyAppInstalls[0];
26
+ }
27
+ return null;
28
+ }
29
+ catch (error) {
30
+ Logger.error('failed to shopifyAppInstall by shop', { error, indexName, shop });
31
+ return null;
32
+ }
33
+ };
34
+ getShopifyAppInstallByPixelId = async (indexName, pixelId) => {
35
+ try {
36
+ const shopifyAppInstalls = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, 'pixelId', pixelId);
37
+ if (shopifyAppInstalls && shopifyAppInstalls?.length > 0) {
38
+ return shopifyAppInstalls[0];
39
+ }
40
+ return null;
41
+ }
42
+ catch (error) {
43
+ Logger.error('failed to fetch shopifyAppInstall by pixelId', { error, indexName, pixelId });
44
+ return null;
45
+ }
46
+ };
47
+ }
48
48
  //# sourceMappingURL=shopify-app-installs-db-service.js.map
@@ -1,16 +1,16 @@
1
- import { type InternalProduct } from '@adtrackify/at-tracking-event-types';
2
- import { ProductCache } from '../cache/index.js';
3
- export interface ShopifyProductDynamoDbCache extends ProductCache {
4
- pixelId_productId: string;
5
- pixelId: string;
6
- productId: string;
7
- }
8
- export declare class ShopifyProductsCacheDbService {
9
- TABLE_NAME: string;
10
- KEY_NAME: string;
11
- private dynamoDbCacheTtlInSeconds;
12
- constructor(tableName: string, keyName: string, dynamoDbCacheTtlInSeconds: number);
13
- getProductFromDynamoDBCache: (pixelId: string, productId: string) => Promise<InternalProduct | undefined>;
14
- putProductInDynamoDBCache: (pixelId: string, productId: string, product: InternalProduct, ttlInSeconds?: number) => Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput | null>;
15
- private isProductCacheStale;
16
- }
1
+ import { type InternalProduct } from '@adtrackify/at-tracking-event-types';
2
+ import { ProductCache } from '../cache/index.js';
3
+ export interface ShopifyProductDynamoDbCache extends ProductCache {
4
+ pixelId_productId: string;
5
+ pixelId: string;
6
+ productId: string;
7
+ }
8
+ export declare class ShopifyProductsCacheDbService {
9
+ TABLE_NAME: string;
10
+ KEY_NAME: string;
11
+ private dynamoDbCacheTtlInSeconds;
12
+ constructor(tableName: string, keyName: string, dynamoDbCacheTtlInSeconds: number);
13
+ getProductFromDynamoDBCache: (pixelId: string, productId: string) => Promise<InternalProduct | undefined>;
14
+ putProductInDynamoDBCache: (pixelId: string, productId: string, product: InternalProduct, ttlInSeconds?: number) => Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput | null>;
15
+ private isProductCacheStale;
16
+ }
@@ -1,67 +1,67 @@
1
- import { DateTime } from 'luxon';
2
- import crypto from 'crypto';
3
- import { DynamoDbClient } from '../../clients/index.js';
4
- import { compressJSON, decompressJSON, getCurrentTimestamp } from '../../libs/index.js';
5
- import { Logger } from '../../helpers/index.js';
6
- const DEFAULT_TTL_IN_SECONDS = 7 * 24 * 3600;
7
- export class ShopifyProductsCacheDbService {
8
- TABLE_NAME;
9
- KEY_NAME;
10
- dynamoDbCacheTtlInSeconds;
11
- constructor(tableName, keyName, dynamoDbCacheTtlInSeconds) {
12
- this.TABLE_NAME = tableName;
13
- this.KEY_NAME = keyName;
14
- this.dynamoDbCacheTtlInSeconds = dynamoDbCacheTtlInSeconds || DEFAULT_TTL_IN_SECONDS;
15
- }
16
- getProductFromDynamoDBCache = async (pixelId, productId) => {
17
- try {
18
- const cachedProduct = (await DynamoDbClient.safeGet(this.TABLE_NAME, this.KEY_NAME, `${pixelId}_${productId}`));
19
- if (cachedProduct && !this.isProductCacheStale(cachedProduct)) {
20
- const product = decompressJSON(cachedProduct.productCompressed);
21
- return product;
22
- }
23
- return undefined;
24
- }
25
- catch (error) {
26
- Logger.error('Failed getShopifyProductCacheREST', { keyName: this.KEY_NAME, pixelId, productId, error });
27
- return undefined;
28
- }
29
- };
30
- putProductInDynamoDBCache = async (pixelId, productId, product, ttlInSeconds) => {
31
- const ttl = ttlInSeconds || this.dynamoDbCacheTtlInSeconds;
32
- const expiresAt = DateTime.utc().plus({ seconds: ttl }).toSeconds();
33
- const cachedAt = getCurrentTimestamp();
34
- const cachedAtEpoch = DateTime.utc().toSeconds();
35
- const fullSha256 = crypto.createHash('sha256').update(JSON.stringify(product)).digest('hex');
36
- const noInventoryProduct = {
37
- ...product,
38
- totalInventory: undefined,
39
- variants: product?.variants?.map((variant) => ({
40
- ...variant,
41
- inventoryQuantity: undefined,
42
- inventoryItem: undefined,
43
- })),
44
- };
45
- const noInventorySha256 = crypto.createHash('sha256').update(JSON.stringify(noInventoryProduct)).digest('hex');
46
- const productCompressed = compressJSON(product);
47
- const shopifyProductCache = {
48
- pixelId_productId: `${pixelId}_${productId}`,
49
- pixelId,
50
- productId,
51
- productCompressed,
52
- fullSha256,
53
- noInventorySha256,
54
- cachedAt,
55
- cachedAtEpoch,
56
- expiresAt,
57
- };
58
- return await DynamoDbClient.safePut(this.TABLE_NAME, shopifyProductCache);
59
- };
60
- isProductCacheStale = (cachedData) => {
61
- if (cachedData?.expiresAt && cachedData.expiresAt < DateTime.utc().toSeconds()) {
62
- return true;
63
- }
64
- return false;
65
- };
66
- }
1
+ import { DateTime } from 'luxon';
2
+ import crypto from 'crypto';
3
+ import { DynamoDbClient } from '../../clients/index.js';
4
+ import { compressJSON, decompressJSON, getCurrentTimestamp } from '../../libs/index.js';
5
+ import { Logger } from '../../helpers/index.js';
6
+ const DEFAULT_TTL_IN_SECONDS = 7 * 24 * 3600;
7
+ export class ShopifyProductsCacheDbService {
8
+ TABLE_NAME;
9
+ KEY_NAME;
10
+ dynamoDbCacheTtlInSeconds;
11
+ constructor(tableName, keyName, dynamoDbCacheTtlInSeconds) {
12
+ this.TABLE_NAME = tableName;
13
+ this.KEY_NAME = keyName;
14
+ this.dynamoDbCacheTtlInSeconds = dynamoDbCacheTtlInSeconds || DEFAULT_TTL_IN_SECONDS;
15
+ }
16
+ getProductFromDynamoDBCache = async (pixelId, productId) => {
17
+ try {
18
+ const cachedProduct = (await DynamoDbClient.safeGet(this.TABLE_NAME, this.KEY_NAME, `${pixelId}_${productId}`));
19
+ if (cachedProduct && !this.isProductCacheStale(cachedProduct)) {
20
+ const product = decompressJSON(cachedProduct.productCompressed);
21
+ return product;
22
+ }
23
+ return undefined;
24
+ }
25
+ catch (error) {
26
+ Logger.error('Failed getShopifyProductCacheREST', { keyName: this.KEY_NAME, pixelId, productId, error });
27
+ return undefined;
28
+ }
29
+ };
30
+ putProductInDynamoDBCache = async (pixelId, productId, product, ttlInSeconds) => {
31
+ const ttl = ttlInSeconds || this.dynamoDbCacheTtlInSeconds;
32
+ const expiresAt = DateTime.utc().plus({ seconds: ttl }).toSeconds();
33
+ const cachedAt = getCurrentTimestamp();
34
+ const cachedAtEpoch = DateTime.utc().toSeconds();
35
+ const fullSha256 = crypto.createHash('sha256').update(JSON.stringify(product)).digest('hex');
36
+ const noInventoryProduct = {
37
+ ...product,
38
+ totalInventory: undefined,
39
+ variants: product?.variants?.map((variant) => ({
40
+ ...variant,
41
+ inventoryQuantity: undefined,
42
+ inventoryItem: undefined,
43
+ })),
44
+ };
45
+ const noInventorySha256 = crypto.createHash('sha256').update(JSON.stringify(noInventoryProduct)).digest('hex');
46
+ const productCompressed = compressJSON(product);
47
+ const shopifyProductCache = {
48
+ pixelId_productId: `${pixelId}_${productId}`,
49
+ pixelId,
50
+ productId,
51
+ productCompressed,
52
+ fullSha256,
53
+ noInventorySha256,
54
+ cachedAt,
55
+ cachedAtEpoch,
56
+ expiresAt,
57
+ };
58
+ return await DynamoDbClient.safePut(this.TABLE_NAME, shopifyProductCache);
59
+ };
60
+ isProductCacheStale = (cachedData) => {
61
+ if (cachedData?.expiresAt && cachedData.expiresAt < DateTime.utc().toSeconds()) {
62
+ return true;
63
+ }
64
+ return false;
65
+ };
66
+ }
67
67
  //# sourceMappingURL=shopify-products-cache-db-service.js.map
@@ -1,10 +1,10 @@
1
- import { type Subscription } from '@adtrackify/at-tracking-event-types';
2
- export declare class SubscriptionsDbService {
3
- TABLE_NAME: string;
4
- TABLE_KEY: string;
5
- constructor(tableName: string, tableKey?: string);
6
- getSubscriptionById: (subscriptionId: string) => Promise<Subscription | null>;
7
- getSubscriptionByAccountId: (indexName: string, accountIdKey: string, accountId: string) => Promise<Subscription | null>;
8
- getSubscriptionByShopifyAppInstallId: (indexName: string, shopifyAppInstallIdKey: string, shopifyAppInstallId: string) => Promise<Subscription | null>;
9
- private getFirstSubscription;
10
- }
1
+ import { type Subscription } from '@adtrackify/at-tracking-event-types';
2
+ export declare class SubscriptionsDbService {
3
+ TABLE_NAME: string;
4
+ TABLE_KEY: string;
5
+ constructor(tableName: string, tableKey?: string);
6
+ getSubscriptionById: (subscriptionId: string) => Promise<Subscription | null>;
7
+ getSubscriptionByAccountId: (indexName: string, accountIdKey: string, accountId: string) => Promise<Subscription | null>;
8
+ getSubscriptionByShopifyAppInstallId: (indexName: string, shopifyAppInstallIdKey: string, shopifyAppInstallId: string) => Promise<Subscription | null>;
9
+ private getFirstSubscription;
10
+ }
@@ -1,31 +1,31 @@
1
- import { DynamoDbClient } from '../../clients/generic/dynamodb-client.js';
2
- import { Logger } from '../../helpers/index.js';
3
- export class SubscriptionsDbService {
4
- TABLE_NAME;
5
- TABLE_KEY;
6
- constructor(tableName, tableKey = 'id') {
7
- this.TABLE_NAME = tableName;
8
- this.TABLE_KEY = tableKey;
9
- }
10
- getSubscriptionById = async (subscriptionId) => {
11
- const subscription = await DynamoDbClient.safeGet(this.TABLE_NAME, this.TABLE_KEY, subscriptionId);
12
- return subscription ?? null;
13
- };
14
- getSubscriptionByAccountId = async (indexName, accountIdKey, accountId) => {
15
- Logger.info('Looking up subscription by account id', { accountId });
16
- const subscriptions = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, accountIdKey, accountId);
17
- return this.getFirstSubscription(subscriptions);
18
- };
19
- getSubscriptionByShopifyAppInstallId = async (indexName, shopifyAppInstallIdKey, shopifyAppInstallId) => {
20
- Logger.info('Looking up subscription by shopify app install id', { shopifyAppInstallId });
21
- const subscriptions = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, shopifyAppInstallIdKey, shopifyAppInstallId);
22
- return this.getFirstSubscription(subscriptions);
23
- };
24
- getFirstSubscription = (subscriptions) => {
25
- if (!subscriptions || subscriptions.length === 0) {
26
- return null;
27
- }
28
- return subscriptions[0];
29
- };
30
- }
1
+ import { DynamoDbClient } from '../../clients/generic/dynamodb-client.js';
2
+ import { Logger } from '../../helpers/index.js';
3
+ export class SubscriptionsDbService {
4
+ TABLE_NAME;
5
+ TABLE_KEY;
6
+ constructor(tableName, tableKey = 'id') {
7
+ this.TABLE_NAME = tableName;
8
+ this.TABLE_KEY = tableKey;
9
+ }
10
+ getSubscriptionById = async (subscriptionId) => {
11
+ const subscription = await DynamoDbClient.safeGet(this.TABLE_NAME, this.TABLE_KEY, subscriptionId);
12
+ return subscription ?? null;
13
+ };
14
+ getSubscriptionByAccountId = async (indexName, accountIdKey, accountId) => {
15
+ Logger.info('Looking up subscription by account id', { accountId });
16
+ const subscriptions = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, accountIdKey, accountId);
17
+ return this.getFirstSubscription(subscriptions);
18
+ };
19
+ getSubscriptionByShopifyAppInstallId = async (indexName, shopifyAppInstallIdKey, shopifyAppInstallId) => {
20
+ Logger.info('Looking up subscription by shopify app install id', { shopifyAppInstallId });
21
+ const subscriptions = await DynamoDbClient.safeQueryByGSI(this.TABLE_NAME, indexName, shopifyAppInstallIdKey, shopifyAppInstallId);
22
+ return this.getFirstSubscription(subscriptions);
23
+ };
24
+ getFirstSubscription = (subscriptions) => {
25
+ if (!subscriptions || subscriptions.length === 0) {
26
+ return null;
27
+ }
28
+ return subscriptions[0];
29
+ };
30
+ }
31
31
  //# sourceMappingURL=subscriptions-db-service.js.map