@segment/action-destinations 3.31.1-alpha.0 → 3.33.1-alpha.0

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 (82) hide show
  1. package/dist/destinations/amplitude/generated-types.d.ts +1 -0
  2. package/dist/destinations/amplitude/groupIdentifyUser/index.js +3 -2
  3. package/dist/destinations/amplitude/groupIdentifyUser/index.js.map +1 -1
  4. package/dist/destinations/amplitude/identifyUser/index.js +2 -1
  5. package/dist/destinations/amplitude/identifyUser/index.js.map +1 -1
  6. package/dist/destinations/amplitude/index.js +21 -2
  7. package/dist/destinations/amplitude/index.js.map +1 -1
  8. package/dist/destinations/amplitude/logEvent/index.js +2 -3
  9. package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
  10. package/dist/destinations/amplitude/mapUser/index.js +2 -1
  11. package/dist/destinations/amplitude/mapUser/index.js.map +1 -1
  12. package/dist/destinations/amplitude/regional-endpoints.d.ts +32 -0
  13. package/dist/destinations/amplitude/regional-endpoints.js +39 -0
  14. package/dist/destinations/amplitude/regional-endpoints.js.map +1 -0
  15. package/dist/destinations/customerio/createUpdatePerson/index.js +11 -8
  16. package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
  17. package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +1 -1
  18. package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +4 -44
  19. package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
  20. package/dist/destinations/google-analytics-4/addToCart/index.js +4 -38
  21. package/dist/destinations/google-analytics-4/addToCart/index.js.map +1 -1
  22. package/dist/destinations/google-analytics-4/addToWishlist/index.js +3 -37
  23. package/dist/destinations/google-analytics-4/addToWishlist/index.js.map +1 -1
  24. package/dist/destinations/google-analytics-4/beginCheckout/index.js +5 -42
  25. package/dist/destinations/google-analytics-4/beginCheckout/index.js.map +1 -1
  26. package/dist/destinations/google-analytics-4/customEvent/index.js +5 -2
  27. package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
  28. package/dist/destinations/google-analytics-4/ga4-properties.d.ts +3 -1
  29. package/dist/destinations/google-analytics-4/ga4-properties.js +86 -4
  30. package/dist/destinations/google-analytics-4/ga4-properties.js.map +1 -1
  31. package/dist/destinations/google-analytics-4/generateLead/index.js +1 -1
  32. package/dist/destinations/google-analytics-4/generateLead/index.js.map +1 -1
  33. package/dist/destinations/google-analytics-4/login/index.js +1 -1
  34. package/dist/destinations/google-analytics-4/login/index.js.map +1 -1
  35. package/dist/destinations/google-analytics-4/pageView/index.js +1 -1
  36. package/dist/destinations/google-analytics-4/pageView/index.js.map +1 -1
  37. package/dist/destinations/google-analytics-4/purchase/index.js +4 -41
  38. package/dist/destinations/google-analytics-4/purchase/index.js.map +1 -1
  39. package/dist/destinations/google-analytics-4/refund/index.js +3 -40
  40. package/dist/destinations/google-analytics-4/refund/index.js.map +1 -1
  41. package/dist/destinations/google-analytics-4/removeFromCart/index.js +3 -37
  42. package/dist/destinations/google-analytics-4/removeFromCart/index.js.map +1 -1
  43. package/dist/destinations/google-analytics-4/search/index.js +1 -1
  44. package/dist/destinations/google-analytics-4/search/index.js.map +1 -1
  45. package/dist/destinations/google-analytics-4/selectItem/index.js +3 -37
  46. package/dist/destinations/google-analytics-4/selectItem/index.js.map +1 -1
  47. package/dist/destinations/google-analytics-4/selectPromotion/index.js +6 -40
  48. package/dist/destinations/google-analytics-4/selectPromotion/index.js.map +1 -1
  49. package/dist/destinations/google-analytics-4/signUp/index.js +1 -1
  50. package/dist/destinations/google-analytics-4/signUp/index.js.map +1 -1
  51. package/dist/destinations/google-analytics-4/viewCart/index.js +3 -40
  52. package/dist/destinations/google-analytics-4/viewCart/index.js.map +1 -1
  53. package/dist/destinations/google-analytics-4/viewItem/index.js +5 -39
  54. package/dist/destinations/google-analytics-4/viewItem/index.js.map +1 -1
  55. package/dist/destinations/google-analytics-4/viewItemList/index.js +3 -40
  56. package/dist/destinations/google-analytics-4/viewItemList/index.js.map +1 -1
  57. package/dist/destinations/google-analytics-4/viewPromotion/index.js +3 -37
  58. package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
  59. package/dist/destinations/mixpanel/alias/generated-types.d.ts +1 -1
  60. package/dist/destinations/mixpanel/alias/index.js +6 -6
  61. package/dist/destinations/mixpanel/alias/index.js.map +1 -1
  62. package/dist/destinations/mixpanel/groupIdentifyUser/generated-types.d.ts +1 -0
  63. package/dist/destinations/mixpanel/groupIdentifyUser/index.js +14 -9
  64. package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
  65. package/dist/destinations/mixpanel/identifyUser/generated-types.d.ts +1 -0
  66. package/dist/destinations/mixpanel/identifyUser/index.js +43 -10
  67. package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
  68. package/dist/destinations/mixpanel/trackEvent/generated-types.d.ts +1 -0
  69. package/dist/destinations/mixpanel/trackEvent/index.js +9 -0
  70. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  71. package/dist/destinations/mixpanel/trackEvent/types.d.ts +1 -0
  72. package/dist/destinations/slack/index.js +1 -1
  73. package/dist/destinations/slack/index.js.map +1 -1
  74. package/dist/destinations/slack/postToChannel/index.d.ts +1 -1
  75. package/dist/destinations/slack/postToChannel/index.js +18 -9
  76. package/dist/destinations/slack/postToChannel/index.js.map +1 -1
  77. package/dist/destinations/webhook/__test__/webhook.test.js +51 -8
  78. package/dist/destinations/webhook/__test__/webhook.test.js.map +1 -1
  79. package/dist/destinations/webhook/send/index.d.ts +1 -1
  80. package/dist/destinations/webhook/send/index.js +11 -0
  81. package/dist/destinations/webhook/send/index.js.map +1 -1
  82. package/package.json +3 -3
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ function isValidSlackUrl(webhookUrl) {
5
+ return /^https:\/\/[a-zA-Z0-9.-]+\.slack.com/.test(webhookUrl);
6
+ }
3
7
  const action = {
4
8
  title: 'Post Message',
5
9
  description: 'Post a message to the specified Slack workspace and channel when the associated trigger criteria are met.',
@@ -36,15 +40,20 @@ const action = {
36
40
  }
37
41
  },
38
42
  perform: (request, { payload }) => {
39
- return request(payload.url, {
40
- method: 'post',
41
- json: {
42
- channel: payload.channel,
43
- text: payload.text,
44
- username: payload.username,
45
- icon_url: payload.icon_url
46
- }
47
- });
43
+ if (!isValidSlackUrl(payload.url)) {
44
+ throw new actions_core_1.IntegrationError('Invalid Slack URL', 'Bad Request', 400);
45
+ }
46
+ else {
47
+ return request(payload.url, {
48
+ method: 'post',
49
+ json: {
50
+ channel: payload.channel,
51
+ text: payload.text,
52
+ username: payload.username,
53
+ icon_url: payload.icon_url
54
+ }
55
+ });
56
+ }
48
57
  }
49
58
  };
50
59
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/slack/postToChannel/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,2GAA2G;IAC7G,MAAM,EAAE;QACN,GAAG,EAAE;YACH,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,4EAA4E;YACzF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;SACd;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,kIAAkI;YACpI,IAAI,EAAE,MAAM;SACb;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EACT,uHAAuH;YACzH,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,mCAAmC;YAChD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;SACnB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,qDAAqD;YAClE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uCAAuC;SACjD;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/slack/postToChannel/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,SAAS,eAAe,CAAC,UAAkB;IACzC,OAAO,sCAAsC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,2GAA2G;IAC7G,MAAM,EAAE;QACN,GAAG,EAAE;YACH,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,4EAA4E;YACzF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;SACd;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,kIAAkI;YACpI,IAAI,EAAE,MAAM;SACb;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EACT,uHAAuH;YACzH,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,mCAAmC;YAChD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;SACnB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,qDAAqD;YAClE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uCAAuC;SACjD;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACjC,MAAM,IAAI,+BAAgB,CAAC,mBAAmB,EAAE,aAAa,EAAE,GAAG,CAAC,CAAA;SACpE;aAAM;YACL,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC1B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;iBAC3B;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -11,19 +11,18 @@ const timestamp = new Date().toISOString();
11
11
  describe('Webhook', () => {
12
12
  describe('send', () => {
13
13
  it('should work with default mapping', async () => {
14
- const url = 'https://my.webhook.com';
15
- const path = '/1234';
14
+ const url = 'https://mme-e2e.segment.com';
16
15
  const event = actions_core_1.createTestEvent({
17
16
  timestamp,
18
17
  event: 'Test Event'
19
18
  });
20
19
  nock_1.default(url)
21
- .post(path, event)
20
+ .post('/', event)
22
21
  .reply(200);
23
22
  const responses = await testDestination.testAction('send', {
24
23
  event,
25
24
  mapping: {
26
- url: url + path
25
+ url
27
26
  },
28
27
  useDefaultMappings: true
29
28
  });
@@ -31,18 +30,17 @@ describe('Webhook', () => {
31
30
  expect(responses[0].status).toBe(200);
32
31
  });
33
32
  it('supports customizations', async () => {
34
- const url = 'https://my.webhook.com';
35
- const path = '/1234';
33
+ const url = 'https://mme-e2e.segment.build';
36
34
  const event = actions_core_1.createTestEvent({
37
35
  timestamp,
38
36
  event: 'Test Event'
39
37
  });
40
38
  const data = { cool: true };
41
- nock_1.default(url).put(path, data).reply(200);
39
+ nock_1.default(url).put('/', data).reply(200);
42
40
  const responses = await testDestination.testAction('send', {
43
41
  event,
44
42
  mapping: {
45
- url: url + path,
43
+ url,
46
44
  method: 'PUT',
47
45
  data: { cool: true }
48
46
  }
@@ -50,6 +48,51 @@ describe('Webhook', () => {
50
48
  expect(responses.length).toBe(1);
51
49
  expect(responses[0].status).toBe(200);
52
50
  });
51
+ it('supports customizations', async () => {
52
+ const url = 'https://mme-e2e.segment.build';
53
+ const event = actions_core_1.createTestEvent({
54
+ timestamp,
55
+ event: 'Test Event'
56
+ });
57
+ const data = { cool: true };
58
+ nock_1.default(url).put('/', data).reply(200);
59
+ const responses = await testDestination.testAction('send', {
60
+ event,
61
+ mapping: {
62
+ url,
63
+ method: 'PUT',
64
+ data: { cool: true }
65
+ }
66
+ });
67
+ expect(responses.length).toBe(1);
68
+ expect(responses[0].status).toBe(200);
69
+ });
70
+ it('restricts usage to mme-e2e urls', async () => {
71
+ const url = 'https://api.acme.com/webhook';
72
+ const event = actions_core_1.createTestEvent({
73
+ timestamp,
74
+ event: 'Test Event'
75
+ });
76
+ const data = { cool: true };
77
+ nock_1.default(url).put('/', data).reply(200);
78
+ try {
79
+ await testDestination.testAction('send', {
80
+ event,
81
+ mapping: {
82
+ url,
83
+ method: 'PUT',
84
+ data: { cool: true }
85
+ }
86
+ });
87
+ fail('expected testAction to reject');
88
+ }
89
+ catch (err) {
90
+ const error = err;
91
+ expect(error.status).toBe(400);
92
+ expect(error.code).toBe('Bad Request');
93
+ expect(error.message).toBe("invalid url 'https://api.acme.com/webhook'");
94
+ }
95
+ });
53
96
  });
54
97
  });
55
98
  //# sourceMappingURL=webhook.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/__test__/webhook.test.ts"],"names":[],"mappings":";;;;;A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AA+B,CAAC,CAAA;aACtC;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,KAAK,GAAG,GAAuB,CAAA;gBACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;gBACtC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAA;aACzE;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { ActionDefinition } from '@segment/actions-core';
1
+ import { ActionDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from '../generated-types';
3
3
  import type { Payload } from './generated-types';
4
4
  declare const action: ActionDefinition<Settings, Payload>;
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const MME_E2E_URLS = [
5
+ 'https://mme-e2e.segment.com',
6
+ 'https://mme-e2e.segment.build'
7
+ ];
3
8
  const action = {
4
9
  title: 'Send',
5
10
  description: 'Send an HTTP request.',
@@ -33,6 +38,9 @@ const action = {
33
38
  }
34
39
  },
35
40
  perform: (request, { payload }) => {
41
+ if (!MME_E2E_URLS.includes(payload.url)) {
42
+ throw new actions_core_1.IntegrationError(`invalid url '${payload.url}'`, 'Bad Request', 400);
43
+ }
36
44
  return request(payload.url, {
37
45
  method: payload.method,
38
46
  json: payload.data
@@ -40,6 +48,9 @@ const action = {
40
48
  },
41
49
  performBatch: (request, { payload }) => {
42
50
  const { url, method } = payload[0];
51
+ if (!MME_E2E_URLS.includes(url)) {
52
+ throw new actions_core_1.IntegrationError(`invalid url '${url}'`, 'Bad Request', 400);
53
+ }
43
54
  return request(url, {
44
55
  method: method,
45
56
  json: payload.map(({ data }) => data)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/send/index.ts"],"names":[],"mappings":";;AAMA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,uBAAuB;IACpC,MAAM,EAAE;QACN,GAAG,EAAE;YACH,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;SACd;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;gBAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;gBAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;aAC/B;YACD,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,mDAAmD;YAChE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SAC3B;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAuB;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE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b,WAAW,EAAE,mDAAmD;YAChE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SAC3B;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACvC,MAAM,IAAI,+BAAgB,CAAC,gBAAgB,OAAO,CAAC,GAAG,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,CAAA;SAC/E;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAuB;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAErC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;QAElC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC/B,MAAM,IAAI,+BAAgB,CAAC,gBAAgB,GAAG,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,CAAA;SACvE;QAED,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAuB;YAC/B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;SACtC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.31.1-alpha.0",
4
+ "version": "3.33.1-alpha.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@amplitude/ua-parser-js": "^0.7.25",
41
- "@segment/actions-core": "^3.21.2-alpha.0",
41
+ "@segment/actions-core": "^3.21.1",
42
42
  "dayjs": "^1.10.7",
43
43
  "lodash": "^4.17.21",
44
44
  "mustache": "^4.2.0"
@@ -58,5 +58,5 @@
58
58
  "<rootDir>/test/setup-after-env.ts"
59
59
  ]
60
60
  },
61
- "gitHead": "50f5a66751cdaba2fffc7bd87be3d5a647f908ca"
61
+ "gitHead": "183ec9460008f0df3abfdcec686b037bdd493671"
62
62
  }