@adtrackify/at-service-common 1.2.12 → 1.2.14

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 (75) hide show
  1. package/dist/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
  2. package/dist/__tests__/helpers/subscription-helper.spec.js +27 -27
  3. package/dist/clients/generic/cognito-client.d.ts +19 -19
  4. package/dist/clients/generic/cognito-client.js +139 -139
  5. package/dist/clients/generic/dynamodb-client.d.ts +15 -15
  6. package/dist/clients/generic/dynamodb-client.js +122 -122
  7. package/dist/clients/generic/eventbridge-client.d.ts +14 -14
  8. package/dist/clients/generic/eventbridge-client.js +45 -45
  9. package/dist/clients/generic/http-client.d.ts +30 -30
  10. package/dist/clients/generic/http-client.js +28 -28
  11. package/dist/clients/generic/index.d.ts +6 -6
  12. package/dist/clients/generic/index.js +6 -6
  13. package/dist/clients/generic/s3-client.d.ts +6 -6
  14. package/dist/clients/generic/s3-client.js +24 -24
  15. package/dist/clients/generic/sqs-client.d.ts +14 -14
  16. package/dist/clients/generic/sqs-client.js +34 -34
  17. package/dist/clients/generic/sqs-client.js.map +1 -1
  18. package/dist/clients/index.d.ts +3 -3
  19. package/dist/clients/index.js +3 -3
  20. package/dist/clients/internal-api/accounts-client.d.ts +82 -82
  21. package/dist/clients/internal-api/accounts-client.js +78 -78
  22. package/dist/clients/internal-api/destinations-client.d.ts +54 -54
  23. package/dist/clients/internal-api/destinations-client.js +36 -36
  24. package/dist/clients/internal-api/index.d.ts +4 -4
  25. package/dist/clients/internal-api/index.js +4 -4
  26. package/dist/clients/internal-api/shopify-app-install-client.d.ts +57 -57
  27. package/dist/clients/internal-api/shopify-app-install-client.js +42 -42
  28. package/dist/clients/internal-api/users-auth-client.d.ts +61 -61
  29. package/dist/clients/internal-api/users-auth-client.js +73 -73
  30. package/dist/clients/third-party/index.d.ts +1 -1
  31. package/dist/clients/third-party/index.js +1 -1
  32. package/dist/clients/third-party/shopify-client.d.ts +90 -90
  33. package/dist/clients/third-party/shopify-client.js +121 -121
  34. package/dist/helpers/index.d.ts +5 -5
  35. package/dist/helpers/index.js +5 -5
  36. package/dist/helpers/input-validation-helper.d.ts +2 -2
  37. package/dist/helpers/input-validation-helper.js +18 -18
  38. package/dist/helpers/logging-helper.d.ts +1 -1
  39. package/dist/helpers/logging-helper.js +9 -9
  40. package/dist/helpers/response-helper.d.ts +36 -36
  41. package/dist/helpers/response-helper.js +35 -35
  42. package/dist/helpers/shopify-helper.d.ts +9 -9
  43. package/dist/helpers/shopify-helper.js +23 -23
  44. package/dist/helpers/subscription-helper.d.ts +8 -8
  45. package/dist/helpers/subscription-helper.js +181 -181
  46. package/dist/index.d.ts +5 -5
  47. package/dist/index.esm.js +11 -11
  48. package/dist/index.esm.js.map +2 -2
  49. package/dist/index.js +5 -5
  50. package/dist/index.js.map +1 -1
  51. package/dist/libs/crypto.d.ts +1 -1
  52. package/dist/libs/crypto.js +5 -5
  53. package/dist/libs/dates.d.ts +3 -3
  54. package/dist/libs/dates.js +10 -10
  55. package/dist/libs/http-error.d.ts +21 -21
  56. package/dist/libs/http-error.js +55 -55
  57. package/dist/libs/http-status-codes.d.ts +58 -58
  58. package/dist/libs/http-status-codes.js +59 -59
  59. package/dist/libs/index.d.ts +6 -6
  60. package/dist/libs/index.js +6 -6
  61. package/dist/libs/url.d.ts +1 -1
  62. package/dist/libs/url.js +9 -9
  63. package/dist/services/eventbridge-integration-service.d.ts +9 -9
  64. package/dist/services/eventbridge-integration-service.js +24 -24
  65. package/dist/services/index.d.ts +1 -1
  66. package/dist/services/index.js +1 -1
  67. package/dist/types/api-response.d.ts +6 -6
  68. package/dist/types/api-response.js +1 -1
  69. package/dist/types/index.d.ts +1 -1
  70. package/dist/types/index.js +1 -1
  71. package/dist/types/internal-events/event-detail-types.d.ts +20 -20
  72. package/dist/types/internal-events/event-detail-types.js +24 -24
  73. package/dist/types/internal-events/index.d.ts +1 -1
  74. package/dist/types/internal-events/index.js +1 -1
  75. package/package.json +2 -2
@@ -1,182 +1,182 @@
1
- import { PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';
2
- export const StripeBillingMap = {
3
- dev2: {
4
- 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
5
- 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
6
- 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
7
- 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
8
- 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
9
- 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
10
- 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
11
- },
12
- qa2: {
13
- 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
14
- 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
15
- 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
16
- 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
17
- 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
18
- 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
19
- 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
20
- },
21
- prod2: {
22
- 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
23
- 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
24
- 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
25
- 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
26
- 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
27
- 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
28
- 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
29
- },
30
- dev: {
31
- 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
32
- 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
33
- 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
34
- 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
35
- 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
36
- 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
37
- 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
38
- },
39
- qa: {
40
- 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
41
- 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
42
- 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
43
- 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
44
- 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
45
- 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
46
- 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
47
- },
48
- prod: {
49
- 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
50
- 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
51
- 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
52
- 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
53
- 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
54
- 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
55
- 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
56
- }
57
- };
58
- export const CommonPlanInfo = [
59
- 'Free Server Side Tracking & Conversion API',
60
- 'MultiPixel Support (Multiple facebook, tiktok, etc)',
61
- 'Corrects Facebook Conversion Tracking post IOS14',
62
- 'Increase ROAS & Attribution Data',
63
- 'Enhanced Fingerprinting & Identity Resolution',
64
- 'Unlimited Integrations',
65
- 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'
66
- ];
67
- export const SubscriptionPlanSeedItems = {
68
- items: [{
69
- id: 1,
70
- planName: 'free',
71
- displayName: 'Free',
72
- sku: 'ADT-001',
73
- description: 'Free Plan - Monthly',
74
- price: '0',
75
- displayPrice: '$0',
76
- billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
77
- trialLengthDays: 0,
78
- trialRequiresCreditCard: false,
79
- planDesc: [
80
- ...CommonPlanInfo,
81
- 'Free Up to 500 orders/month (50,000 events)*'
82
- ],
83
- unitPriceText: 'try now - free forever',
84
- isHighlighted: false,
85
- isBanner: false
86
- },
87
- {
88
- id: 2,
89
- planName: 'starter_monthly',
90
- displayName: 'Starter',
91
- sku: 'ADT-002',
92
- description: 'Starter Plan - Monthly',
93
- price: '79.99',
94
- displayPrice: '$79.99',
95
- billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
96
- trialLengthDays: 60,
97
- trialRequiresCreditCard: false,
98
- planDesc: [
99
- '60-day Risk Free Trial',
100
- ...CommonPlanInfo,
101
- 'Up to 2,000 orders/month (250,000 events)*'
102
- ],
103
- isHighlighted: true,
104
- isBanner: true,
105
- bannerColor: 'blue',
106
- bannerText: 'MOST POPULAR'
107
- }, {
108
- id: 3,
109
- planName: 'starter_yearly',
110
- displayName: 'Starter',
111
- sku: 'ADT-003',
112
- description: 'Starter Plan - Yearly',
113
- price: '767.90',
114
- displayPrice: '$63.99',
115
- billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
116
- trialLengthDays: 30,
117
- trialRequiresCreditCard: false,
118
- planDesc: [
119
- '60-day Risk Free Trial',
120
- ...CommonPlanInfo,
121
- 'Up to 2,000 orders/month (250,000 events)*'
122
- ],
123
- unitPriceText: 'billed yearly ($767.90) - 20% savings',
124
- isHighlighted: true,
125
- isBanner: true,
126
- bannerColor: 'blue',
127
- bannerText: 'MOST POPULAR'
128
- },
129
- {
130
- id: 4,
131
- planName: 'scale_monthly',
132
- displayName: 'Scale',
133
- sku: 'ADT-004',
134
- description: 'Scale Plan - Monthly',
135
- price: '199.99',
136
- displayPrice: '$199.99',
137
- billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
138
- trialLengthDays: 60,
139
- trialRequiresCreditCard: false,
140
- planDesc: [
141
- '60-day Risk Free Trial',
142
- ...CommonPlanInfo,
143
- 'Up to 7,500 orders/month (750,000 events)*'
144
- ],
145
- unitPriceText: '',
146
- isHighlighted: false,
147
- isBanner: false
148
- }, {
149
- id: 5,
150
- planName: 'scale_yearly',
151
- displayName: 'Scale',
152
- sku: 'ADT-005',
153
- description: 'Scale Plan - Yearly',
154
- price: '1823.91',
155
- displayPrice: '$151.99',
156
- billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
157
- trialLengthDays: 60,
158
- trialRequiresCreditCard: false,
159
- planDesc: [
160
- '60-day Risk Free Trial',
161
- ...CommonPlanInfo,
162
- 'Up to 7,500 orders/month (750,000 events)*'
163
- ],
164
- unitPriceText: 'billed yearly ($1823.91) - 24% savings',
165
- isHighlighted: false,
166
- isBanner: false
167
- },
168
- ]
169
- };
170
- export const getPlanDetails = (planId, stage) => {
171
- const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[0];
172
- plan.stripePriceId = StripeBillingMap[stage][plan.planName];
173
- return plan;
174
- };
175
- export const getPlanByStripePriceId = (stripePriceId, stage) => {
176
- const stripePriceIds = StripeBillingMap[stage];
177
- const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
178
- const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0];
179
- plan.stripePriceId = stripePriceId;
180
- return plan;
181
- };
1
+ import { PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';
2
+ export const StripeBillingMap = {
3
+ dev2: {
4
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
5
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
6
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
7
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
8
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
9
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
10
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
11
+ },
12
+ qa2: {
13
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
14
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
15
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
16
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
17
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
18
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
19
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
20
+ },
21
+ prod2: {
22
+ 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
23
+ 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
24
+ 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
25
+ 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
26
+ 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
27
+ 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
28
+ 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
29
+ },
30
+ dev: {
31
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
32
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
33
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
34
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
35
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
36
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
37
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
38
+ },
39
+ qa: {
40
+ 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',
41
+ 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
42
+ 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',
43
+ 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',
44
+ 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',
45
+ 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',
46
+ 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'
47
+ },
48
+ prod: {
49
+ 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',
50
+ 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',
51
+ 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',
52
+ 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',
53
+ 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',
54
+ 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',
55
+ 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'
56
+ }
57
+ };
58
+ export const CommonPlanInfo = [
59
+ 'Free Server Side Tracking & Conversion API',
60
+ 'MultiPixel Support (Multiple facebook, tiktok, etc)',
61
+ 'Corrects Facebook Conversion Tracking post IOS14',
62
+ 'Increase ROAS & Attribution Data',
63
+ 'Enhanced Fingerprinting & Identity Resolution',
64
+ 'Unlimited Integrations',
65
+ 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'
66
+ ];
67
+ export const SubscriptionPlanSeedItems = {
68
+ items: [{
69
+ id: 1,
70
+ planName: 'free',
71
+ displayName: 'Free',
72
+ sku: 'ADT-001',
73
+ description: 'Free Plan - Monthly',
74
+ price: '0',
75
+ displayPrice: '$0',
76
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
77
+ trialLengthDays: 0,
78
+ trialRequiresCreditCard: false,
79
+ planDesc: [
80
+ ...CommonPlanInfo,
81
+ 'Free Up to 500 orders/month (50,000 events)*'
82
+ ],
83
+ unitPriceText: 'try now - free forever',
84
+ isHighlighted: false,
85
+ isBanner: false
86
+ },
87
+ {
88
+ id: 2,
89
+ planName: 'starter_monthly',
90
+ displayName: 'Starter',
91
+ sku: 'ADT-002',
92
+ description: 'Starter Plan - Monthly',
93
+ price: '79.99',
94
+ displayPrice: '$79.99',
95
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
96
+ trialLengthDays: 60,
97
+ trialRequiresCreditCard: false,
98
+ planDesc: [
99
+ '60-day Risk Free Trial',
100
+ ...CommonPlanInfo,
101
+ 'Up to 2,000 orders/month (250,000 events)*'
102
+ ],
103
+ isHighlighted: true,
104
+ isBanner: true,
105
+ bannerColor: 'blue',
106
+ bannerText: 'MOST POPULAR'
107
+ }, {
108
+ id: 3,
109
+ planName: 'starter_yearly',
110
+ displayName: 'Starter',
111
+ sku: 'ADT-003',
112
+ description: 'Starter Plan - Yearly',
113
+ price: '767.90',
114
+ displayPrice: '$63.99',
115
+ billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
116
+ trialLengthDays: 30,
117
+ trialRequiresCreditCard: false,
118
+ planDesc: [
119
+ '60-day Risk Free Trial',
120
+ ...CommonPlanInfo,
121
+ 'Up to 2,000 orders/month (250,000 events)*'
122
+ ],
123
+ unitPriceText: 'billed yearly ($767.90) - 20% savings',
124
+ isHighlighted: true,
125
+ isBanner: true,
126
+ bannerColor: 'blue',
127
+ bannerText: 'MOST POPULAR'
128
+ },
129
+ {
130
+ id: 4,
131
+ planName: 'scale_monthly',
132
+ displayName: 'Scale',
133
+ sku: 'ADT-004',
134
+ description: 'Scale Plan - Monthly',
135
+ price: '199.99',
136
+ displayPrice: '$199.99',
137
+ billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
138
+ trialLengthDays: 60,
139
+ trialRequiresCreditCard: false,
140
+ planDesc: [
141
+ '60-day Risk Free Trial',
142
+ ...CommonPlanInfo,
143
+ 'Up to 7,500 orders/month (750,000 events)*'
144
+ ],
145
+ unitPriceText: '',
146
+ isHighlighted: false,
147
+ isBanner: false
148
+ }, {
149
+ id: 5,
150
+ planName: 'scale_yearly',
151
+ displayName: 'Scale',
152
+ sku: 'ADT-005',
153
+ description: 'Scale Plan - Yearly',
154
+ price: '1823.91',
155
+ displayPrice: '$151.99',
156
+ billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
157
+ trialLengthDays: 60,
158
+ trialRequiresCreditCard: false,
159
+ planDesc: [
160
+ '60-day Risk Free Trial',
161
+ ...CommonPlanInfo,
162
+ 'Up to 7,500 orders/month (750,000 events)*'
163
+ ],
164
+ unitPriceText: 'billed yearly ($1823.91) - 24% savings',
165
+ isHighlighted: false,
166
+ isBanner: false
167
+ },
168
+ ]
169
+ };
170
+ export const getPlanDetails = (planId, stage) => {
171
+ const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[0];
172
+ plan.stripePriceId = StripeBillingMap[stage][plan.planName];
173
+ return plan;
174
+ };
175
+ export const getPlanByStripePriceId = (stripePriceId, stage) => {
176
+ const stripePriceIds = StripeBillingMap[stage];
177
+ const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[key] === stripePriceId);
178
+ const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[0];
179
+ plan.stripePriceId = stripePriceId;
180
+ return plan;
181
+ };
182
182
  //# sourceMappingURL=subscription-helper.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './clients/index.js';
2
- export * from './helpers/index.js';
3
- export * from './libs/index.js';
4
- export * from './types/index.js';
5
- export * from './services/index.js';
1
+ export * from './clients/index.js';
2
+ export * from './helpers/index.js';
3
+ export * from './libs/index.js';
4
+ export * from './types/index.js';
5
+ export * from './services/index.js';
package/dist/index.esm.js CHANGED
@@ -393,26 +393,26 @@ var SQSClient = class {
393
393
  this.sqs = new SQS({ region });
394
394
  this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
395
395
  }
396
- buildAndSendEvent = async (eventType, eventData, deplaySeconds = 0) => {
397
- const event = this.buildEvent(eventType, eventData);
398
- return await this.putEvent(event, deplaySeconds);
396
+ buildAndSendMessage = async (messageType, messageBody, deplaySeconds = 0) => {
397
+ const message = this.buildMessage(messageType, messageBody);
398
+ return await this.sendMessage(message, deplaySeconds);
399
399
  };
400
- buildEvent = (eventType, eventData, eventId = uuidv42(), eventTime = getCurrentTimestamp()) => {
400
+ buildMessage = (messageType, messageBody, messageId = uuidv42(), messageTime = getCurrentTimestamp()) => {
401
401
  return {
402
- eventId,
403
- eventType,
404
- eventTime,
405
- eventData
402
+ messageId,
403
+ messageType,
404
+ messageTime,
405
+ messageBody
406
406
  };
407
407
  };
408
- putEvent = async (data, delaySeconds = 0) => {
408
+ sendMessage = async (messageBody, delaySeconds = 0) => {
409
409
  const params = {
410
410
  QueueUrl: this.queueUrl,
411
411
  DelaySeconds: delaySeconds,
412
- MessageBody: JSON.stringify(data)
412
+ MessageBody: JSON.stringify(messageBody)
413
413
  };
414
414
  const response = await this.sqs.sendMessage(params);
415
- log5.debug("SQS Event Published", { queueUrl: this.queueUrl, event: data });
415
+ log5.debug("SQS Message Sent", { queueUrl: this.queueUrl, messageBody, delaySeconds, response });
416
416
  return response;
417
417
  };
418
418
  };