@segment/action-destinations 3.248.0-staging-17722aeb7 → 3.248.1-staging-1

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 (79) hide show
  1. package/dist/destinations/engage/utils/track.d.ts +17 -17
  2. package/dist/destinations/klaviyo/properties.js +1 -1
  3. package/dist/destinations/klaviyo/properties.js.map +1 -1
  4. package/dist/destinations/segment-profiles/sendTrack/generated-types.d.ts +0 -1
  5. package/dist/destinations/segment-profiles/sendTrack/index.js +1 -2
  6. package/dist/destinations/segment-profiles/sendTrack/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +0 -1
  9. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +0 -184
  10. package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +0 -1
  11. package/dist/destinations/engage/sendgrid/Profile.d.ts +0 -6
  12. package/dist/destinations/engage/sendgrid/Profile.js +0 -3
  13. package/dist/destinations/engage/sendgrid/Profile.js.map +0 -1
  14. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +0 -21
  15. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +0 -174
  16. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +0 -1
  17. package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +0 -4
  18. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +0 -3
  19. package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +0 -1
  20. package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +0 -5
  21. package/dist/destinations/klaviyo/removeProfileToList/index.js +0 -43
  22. package/dist/destinations/klaviyo/removeProfileToList/index.js.map +0 -1
  23. package/dist/destinations/mixpanel/utils.d.ts +0 -13
  24. package/dist/destinations/mixpanel/utils.js +0 -117
  25. package/dist/destinations/mixpanel/utils.js.map +0 -1
  26. package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +0 -22
  27. package/dist/destinations/movable-ink/categoryView/generated-types.js +0 -3
  28. package/dist/destinations/movable-ink/categoryView/generated-types.js.map +0 -1
  29. package/dist/destinations/movable-ink/categoryView/index.d.ts +0 -5
  30. package/dist/destinations/movable-ink/categoryView/index.js +0 -43
  31. package/dist/destinations/movable-ink/categoryView/index.js.map +0 -1
  32. package/dist/destinations/movable-ink/conversion/generated-types.d.ts +0 -20
  33. package/dist/destinations/movable-ink/conversion/generated-types.js +0 -3
  34. package/dist/destinations/movable-ink/conversion/generated-types.js.map +0 -1
  35. package/dist/destinations/movable-ink/conversion/index.d.ts +0 -5
  36. package/dist/destinations/movable-ink/conversion/index.js +0 -45
  37. package/dist/destinations/movable-ink/conversion/index.js.map +0 -1
  38. package/dist/destinations/movable-ink/fields.d.ts +0 -21
  39. package/dist/destinations/movable-ink/fields.js +0 -236
  40. package/dist/destinations/movable-ink/fields.js.map +0 -1
  41. package/dist/destinations/movable-ink/identify/generated-types.d.ts +0 -7
  42. package/dist/destinations/movable-ink/identify/generated-types.js +0 -3
  43. package/dist/destinations/movable-ink/identify/generated-types.js.map +0 -1
  44. package/dist/destinations/movable-ink/identify/index.d.ts +0 -5
  45. package/dist/destinations/movable-ink/identify/index.js +0 -32
  46. package/dist/destinations/movable-ink/identify/index.js.map +0 -1
  47. package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +0 -22
  48. package/dist/destinations/movable-ink/productAdded/generated-types.js +0 -3
  49. package/dist/destinations/movable-ink/productAdded/generated-types.js.map +0 -1
  50. package/dist/destinations/movable-ink/productAdded/index.d.ts +0 -5
  51. package/dist/destinations/movable-ink/productAdded/index.js +0 -43
  52. package/dist/destinations/movable-ink/productAdded/index.js.map +0 -1
  53. package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +0 -21
  54. package/dist/destinations/movable-ink/productViewed/generated-types.js +0 -3
  55. package/dist/destinations/movable-ink/productViewed/generated-types.js.map +0 -1
  56. package/dist/destinations/movable-ink/productViewed/index.d.ts +0 -5
  57. package/dist/destinations/movable-ink/productViewed/index.js +0 -43
  58. package/dist/destinations/movable-ink/productViewed/index.js.map +0 -1
  59. package/dist/destinations/movable-ink/search/generated-types.d.ts +0 -12
  60. package/dist/destinations/movable-ink/search/generated-types.js +0 -3
  61. package/dist/destinations/movable-ink/search/generated-types.js.map +0 -1
  62. package/dist/destinations/movable-ink/search/index.d.ts +0 -5
  63. package/dist/destinations/movable-ink/search/index.js +0 -43
  64. package/dist/destinations/movable-ink/search/index.js.map +0 -1
  65. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +0 -25
  66. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +0 -3
  67. package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +0 -1
  68. package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +0 -5
  69. package/dist/destinations/movable-ink/sendCustomEvent/index.js +0 -48
  70. package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +0 -1
  71. package/dist/destinations/trackey/group.types.d.ts +0 -11
  72. package/dist/destinations/trackey/group.types.js +0 -3
  73. package/dist/destinations/trackey/group.types.js.map +0 -1
  74. package/dist/destinations/trackey/identify.types.d.ts +0 -11
  75. package/dist/destinations/trackey/identify.types.js +0 -3
  76. package/dist/destinations/trackey/identify.types.js.map +0 -1
  77. package/dist/destinations/trackey/track.types.d.ts +0 -12
  78. package/dist/destinations/trackey/track.types.js +0 -3
  79. package/dist/destinations/trackey/track.types.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { ContextFromDecorator } from './operationTracking';
2
2
  export declare const track: ((decoratorArgs?: ({
3
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
4
- } & {
5
3
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
6
- } & {
4
+ } & import("./operationTracking").OperationLoggerDecoratorArgs & {
7
5
  onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
8
6
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
9
- } & import("./operationTracking").OperationLoggerDecoratorArgs & {
7
+ } & {
8
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
9
+ } & {
10
10
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
11
11
  }) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
12
12
  getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
@@ -15,13 +15,8 @@ export declare const track: ((decoratorArgs?: ({
15
15
  }) | undefined;
16
16
  } & {
17
17
  _contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
18
- tags: string[];
19
- sharedContext: {
20
- tags: string[];
21
- };
22
- decoratorArgs?: {
23
- shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
24
- } | undefined;
18
+ start?: number | undefined;
19
+ duration?: number | undefined;
25
20
  } & {
26
21
  decoratorArgs?: {
27
22
  onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
@@ -30,8 +25,10 @@ export declare const track: ((decoratorArgs?: ({
30
25
  parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
31
26
  sharedContext: {};
32
27
  } & {
33
- start?: number | undefined;
34
- duration?: number | undefined;
28
+ logs: string[];
29
+ logMetadata?: Record<string, unknown> | undefined;
30
+ decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
31
+ sharedContext: import("./operationTracking").OperationLoggerSharedContext;
35
32
  } & {
36
33
  onFinally: (() => void)[];
37
34
  decoratorArgs?: {
@@ -39,10 +36,13 @@ export declare const track: ((decoratorArgs?: ({
39
36
  onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
40
37
  } | undefined;
41
38
  } & {
42
- logs: string[];
43
- logMetadata?: Record<string, unknown> | undefined;
44
- decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
45
- sharedContext: import("./operationTracking").OperationLoggerSharedContext;
39
+ tags: string[];
40
+ sharedContext: {
41
+ tags: string[];
42
+ };
43
+ decoratorArgs?: {
44
+ shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
45
+ } | undefined;
46
46
  } & {
47
47
  decoratorArgs?: {
48
48
  wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.batch_size = exports.enable_batching = exports.external_id = exports.email = exports.list_id = void 0;
4
4
  exports.list_id = {
5
5
  label: 'List Id',
6
- description: `Insert the ID of the default list that you'd like to subscribe users to when you call .identify().`,
6
+ description: `'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'`,
7
7
  type: 'string',
8
8
  default: {
9
9
  '@path': '$.context.personas.external_audience_id'
@@ -1 +1 @@
1
- {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,oGAAoG;IACjH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,wBAAwB;KAClC;IACD,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,iJAAiJ;IAC9J,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,0DAA0D;IACvE,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK;CACf,CAAA"}
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAe;IACjC,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,sGAAsG;IACnH,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,KAAK,GAAe;IAC/B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,wBAAwB;KAClC;IACD,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,iJAAiJ;IAC9J,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,0DAA0D;IACvE,OAAO,EAAE,IAAI;CACd,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,KAAK;IACf,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK;CACf,CAAA"}
@@ -1,5 +1,4 @@
1
1
  export interface Payload {
2
- engage_space: string;
3
2
  user_id?: string;
4
3
  anonymous_id?: string;
5
4
  timestamp?: string | number;
@@ -4,9 +4,8 @@ const segment_properties_1 = require("../segment-properties");
4
4
  const errors_1 = require("../errors");
5
5
  const action = {
6
6
  title: 'Send Track',
7
- description: 'Send a track call to Segment’s tracking API. This is used to record actions your users perform.',
7
+ description: '',
8
8
  fields: {
9
- engage_space: segment_properties_1.engage_space,
10
9
  user_id: segment_properties_1.user_id,
11
10
  anonymous_id: segment_properties_1.anonymous_id,
12
11
  timestamp: segment_properties_1.timestamp,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendTrack/index.ts"],"names":[],"mappings":";;AAGA,8DAAwH;AACxH,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,iGAAiG;IAC9G,MAAM,EAAE;QACN,YAAY,EAAZ,iCAAY;QACZ,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,UAAU,EAAV,+BAAU;QACV,QAAQ,EAAR,6BAAQ;QACR,UAAU,EAAV,+BAAU;KACX;IACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QACxC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAC7C,MAAM,+CAAsC,CAAA;SAC7C;QACD,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAA;QAE/F,OAAO;YACL,KAAK,EAAE;gBACL;oBACE,MAAM,EAAE,OAAO,EAAE,OAAO;oBACxB,WAAW,EAAE,OAAO,EAAE,YAAY;oBAClC,SAAS,EAAE,OAAO,EAAE,SAAS;oBAC7B,KAAK,EAAE,OAAO,EAAE,UAAU;oBAC1B,YAAY,EAAE;wBAGZ,GAAG,EAAE,KAAK;qBACX;oBACD,UAAU,EAAE;wBACV,GAAG,OAAO,EAAE,UAAU;qBACvB;oBACD,IAAI,EAAE,OAAO;iBACd;aACF;SACF,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment-profiles/sendTrack/index.ts"],"names":[],"mappings":";;AAGA,8DAA0G;AAC1G,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,UAAU,EAAV,+BAAU;QACV,QAAQ,EAAR,6BAAQ;QACR,UAAU,EAAV,+BAAU;KACX;IACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QACxC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAC7C,MAAM,+CAAsC,CAAA;SAC7C;QACD,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAA;QAE/F,OAAO;YACL,KAAK,EAAE;gBACL;oBACE,MAAM,EAAE,OAAO,EAAE,OAAO;oBACxB,WAAW,EAAE,OAAO,EAAE,YAAY;oBAClC,SAAS,EAAE,OAAO,EAAE,SAAS;oBAC7B,KAAK,EAAE,OAAO,EAAE,UAAU;oBAC1B,YAAY,EAAE;wBAGZ,GAAG,EAAE,KAAK;qBACX;oBACD,UAAU,EAAE;wBACV,GAAG,OAAO,EAAE,UAAU;qBACvB;oBACD,IAAI,EAAE,OAAO;iBACd;aACF;SACF,CAAA;IACH,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.248.0-staging-17722aeb7",
4
+ "version": "3.248.1-staging-1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -1,184 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const actions_core_1 = require("@segment/actions-core");
7
- const test_data_1 = require("../../../../lib/test-data");
8
- const index_1 = __importDefault(require("../../index"));
9
- const nock_1 = __importDefault(require("nock"));
10
- const testDestination = actions_core_1.createTestIntegration(index_1.default);
11
- const actionSlug = 'updateUserProfile';
12
- const destinationSlug = 'Braze';
13
- const seedName = `${destinationSlug}#${actionSlug}`;
14
- const receivedAt = '2021-08-03T17:40:04.055Z';
15
- const settings = {
16
- app_id: 'my-app-id',
17
- api_key: 'my-api-key',
18
- endpoint: 'https://rest.iad-01.braze.com'
19
- };
20
- describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => {
21
- it('required fields', async () => {
22
- const action = index_1.default.actions[actionSlug];
23
- const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, true);
24
- nock_1.default(/.*/).persist().get(/.*/).reply(200);
25
- nock_1.default(/.*/).persist().post(/.*/).reply(200);
26
- nock_1.default(/.*/).persist().put(/.*/).reply(200);
27
- const event = actions_core_1.createTestEvent({
28
- properties: eventData
29
- });
30
- const responses = await testDestination.testAction(actionSlug, {
31
- event: event,
32
- mapping: event.properties,
33
- settings: settingsData,
34
- auth: undefined
35
- });
36
- const request = responses[0].request;
37
- const rawBody = await request.text();
38
- try {
39
- const json = JSON.parse(rawBody);
40
- expect(json).toMatchSnapshot();
41
- return;
42
- }
43
- catch (err) {
44
- expect(rawBody).toMatchSnapshot();
45
- }
46
- expect(request.headers).toMatchSnapshot();
47
- });
48
- it('all fields', async () => {
49
- const action = index_1.default.actions[actionSlug];
50
- const [eventData, settingsData] = test_data_1.generateTestData(seedName, index_1.default, action, false);
51
- nock_1.default(/.*/).persist().get(/.*/).reply(200);
52
- nock_1.default(/.*/).persist().post(/.*/).reply(200);
53
- nock_1.default(/.*/).persist().put(/.*/).reply(200);
54
- const event = actions_core_1.createTestEvent({
55
- properties: eventData
56
- });
57
- const responses = await testDestination.testAction(actionSlug, {
58
- event: event,
59
- mapping: event.properties,
60
- settings: settingsData,
61
- auth: undefined
62
- });
63
- const request = responses[0].request;
64
- const rawBody = await request.text();
65
- try {
66
- const json = JSON.parse(rawBody);
67
- expect(json).toMatchSnapshot();
68
- return;
69
- }
70
- catch (err) {
71
- expect(rawBody).toMatchSnapshot();
72
- }
73
- });
74
- it('it should work with batched events', async () => {
75
- nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
76
- const events = [
77
- actions_core_1.createTestEvent({
78
- event: 'Test Event 1',
79
- type: 'track',
80
- receivedAt,
81
- properties: {}
82
- }),
83
- actions_core_1.createTestEvent({
84
- event: 'Test Event 2',
85
- type: 'track',
86
- receivedAt,
87
- properties: {}
88
- })
89
- ];
90
- const responses = await testDestination.testBatchAction(actionSlug, {
91
- events,
92
- useDefaultMappings: true,
93
- mapping: {
94
- external_id: {
95
- '@path': '$.userId'
96
- },
97
- user_alias: {},
98
- braze_id: {
99
- '@path': '$.properties.braze_id'
100
- },
101
- name: {
102
- '@path': '$.event'
103
- },
104
- time: {
105
- '@path': '$.receivedAt'
106
- },
107
- properties: {
108
- '@path': '$.properties'
109
- },
110
- products: {
111
- '@path': '$.properties.products'
112
- },
113
- enable_batching: true,
114
- _update_existing_only: true
115
- },
116
- settings: {
117
- ...settings
118
- }
119
- });
120
- expect(responses.length).toBe(1);
121
- expect(responses[0].status).toBe(200);
122
- expect(responses[0].options.headers).toMatchSnapshot();
123
- expect(responses[0].options.json).toMatchSnapshot();
124
- });
125
- it('it should work with a single batched events', async () => {
126
- nock_1.default('https://rest.iad-01.braze.com').post('/users/track').reply(200, {});
127
- const events = [
128
- actions_core_1.createTestEvent({
129
- event: 'Test Event 1',
130
- type: 'track',
131
- receivedAt,
132
- properties: {
133
- products: [
134
- {
135
- quantity: 1,
136
- product_id: 'Bowflex Treadmill 10',
137
- price: 100
138
- },
139
- {
140
- quantity: 2,
141
- product_id: 'Bowflex Treadmill 20',
142
- price: 200
143
- }
144
- ]
145
- }
146
- })
147
- ];
148
- const responses = await testDestination.testBatchAction(actionSlug, {
149
- events,
150
- useDefaultMappings: true,
151
- mapping: {
152
- external_id: {
153
- '@path': '$.userId'
154
- },
155
- user_alias: {},
156
- braze_id: {
157
- '@path': '$.properties.braze_id'
158
- },
159
- name: {
160
- '@path': '$.event'
161
- },
162
- time: {
163
- '@path': '$.receivedAt'
164
- },
165
- properties: {
166
- '@path': '$.properties'
167
- },
168
- products: {
169
- '@path': '$.properties.products'
170
- },
171
- enable_batching: true,
172
- _update_existing_only: true
173
- },
174
- settings: {
175
- ...settings
176
- }
177
- });
178
- expect(responses.length).toBe(1);
179
- expect(responses[0].status).toBe(200);
180
- expect(responses[0].options.headers).toMatchSnapshot();
181
- expect(responses[0].options.json).toMatchSnapshot();
182
- });
183
- });
184
- //# sourceMappingURL=snapshot.test.js.map
@@ -1 +0,0 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wBACD;4BACE,QAAQ,EAAE,CAAC;4BACX,UAAU,EAAE,sBAAsB;4BAClC,KAAK,EAAE,GAAG;yBACX;qBACF;iBACF;aACF,CAAC;SACH,CAAA;QAED,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC,UAAU,EAAE;YAClE,MAAM;YACN,kBAAkB,EAAE,IAAI;YACxB,OAAO,EAAE;gBACP,WAAW,EAAE;oBACX,OAAO,EAAE,UAAU;iBACpB;gBACD,UAAU,EAAE,EAAE;gBACd,QAAQ,EAAE;oBACR,OAAO,EAAE,uBAAuB;iBACjC;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,SAAS;iBACnB;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,cAAc;iBACxB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,cAAc;iBACxB;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,uBAAuB;iBACjC;gBACD,eAAe,EAAE,IAAI;gBACrB,qBAAqB,EAAE,IAAI;aAC5B;YACD,QAAQ,EAAE;gBACR,GAAG,QAAQ;aACZ;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAA;QACtD,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- export interface Profile {
2
- user_id?: string;
3
- anonymous_id?: string;
4
- email?: string;
5
- traits: Record<string, string>;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Profile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/Profile.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import { InputField } from '@segment/actions-core';
2
- import { RequestClient } from '@segment/actions-core';
3
- import { Logger, StatsClient, DataFeedCache } from '@segment/actions-core/destination-kit';
4
- import type { Settings } from '../generated-types';
5
- import { Profile } from '../Profile';
6
- export declare type ApiLookupConfig = {
7
- id?: string | undefined;
8
- name: string;
9
- url: string;
10
- method: string;
11
- cacheTtl: number;
12
- body?: string | undefined;
13
- headers?: object | undefined;
14
- responseType: string;
15
- };
16
- export declare const getRequestId: ({ method, url, body, headers }: ApiLookupConfig) => string;
17
- export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
18
- export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
19
- export declare const apiLookupActionFields: Record<string, InputField>;
20
- export declare const apiLookupLiquidKey = "lookups";
21
- export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
@@ -1,174 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
4
- const crypto_1 = require("crypto");
5
- const actions_core_1 = require("@segment/actions-core");
6
- const liquidjs_1 = require("liquidjs");
7
- const Liquid = new liquidjs_1.Liquid();
8
- const maxResponseSizeBytes = 1000000;
9
- const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
10
- let renderedUrl;
11
- let renderedBody;
12
- try {
13
- renderedUrl = await Liquid.parseAndRender(url, { profile });
14
- }
15
- catch (error) {
16
- logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
17
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
18
- throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
19
- }
20
- try {
21
- renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
22
- }
23
- catch (error) {
24
- logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
25
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
26
- throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
27
- }
28
- return {
29
- renderedUrl,
30
- renderedBody
31
- };
32
- };
33
- const getRequestId = ({ method, url, body, headers }) => {
34
- const requestHash = crypto_1.createHash('sha256');
35
- requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
36
- const requestId = requestHash.digest('hex');
37
- return requestId;
38
- };
39
- exports.getRequestId = getRequestId;
40
- const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
41
- const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
42
- if (!cachedResponse) {
43
- datafeedTags.push('cache_hit:false');
44
- return;
45
- }
46
- datafeedTags.push('cache_hit:true');
47
- if (responseType === 'json') {
48
- return JSON.parse(cachedResponse);
49
- }
50
- return cachedResponse;
51
- };
52
- exports.getCachedResponse = getCachedResponse;
53
- const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
54
- const { id, method, headers, cacheTtl, name } = apiLookupConfig;
55
- const datafeedTags = [
56
- ...tags,
57
- `datafeed_id:${id}`,
58
- `datafeed_name:${name}`,
59
- `space_id:${settings.spaceId}`,
60
- `cache_ttl_greater_than_0:${cacheTtl > 0}`
61
- ];
62
- try {
63
- const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
64
- const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
65
- if (cacheTtl > 0 && dataFeedCache) {
66
- const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
67
- if (cachedResponse) {
68
- datafeedTags.push('error:false');
69
- return cachedResponse;
70
- }
71
- }
72
- let data;
73
- try {
74
- const res = await request(renderedUrl, {
75
- headers: headers ?? undefined,
76
- timeout: 3000,
77
- method: method,
78
- body: renderedBody,
79
- skipResponseCloning: true
80
- });
81
- data = await res.data;
82
- }
83
- catch (error) {
84
- const respError = error.response;
85
- logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
86
- datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
87
- throw error;
88
- }
89
- const dataString = JSON.stringify(data);
90
- const size = Buffer.byteLength(dataString, 'utf-8');
91
- datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
92
- if (cacheTtl > 0) {
93
- if (size <= maxResponseSizeBytes) {
94
- try {
95
- await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
96
- datafeedTags.push('cache_set:true');
97
- }
98
- catch (err) {
99
- logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
100
- datafeedTags.push('cache_set:false');
101
- datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
102
- throw err;
103
- }
104
- }
105
- else {
106
- datafeedTags.push('cache_set:false');
107
- }
108
- }
109
- return data;
110
- }
111
- catch (error) {
112
- const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
113
- if (!isErrorCapturedInTags) {
114
- datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
115
- }
116
- tags.push('reason:datafeed_failure');
117
- logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
118
- throw error;
119
- }
120
- finally {
121
- statsClient?.incr('datafeed-execution', 1, datafeedTags);
122
- }
123
- };
124
- exports.performApiLookup = performApiLookup;
125
- exports.apiLookupActionFields = {
126
- id: {
127
- label: 'ID',
128
- description: 'The id of the API lookup for use in logging & observability',
129
- type: 'string'
130
- },
131
- name: {
132
- label: 'Name',
133
- description: 'The name of the API lookup referenced in liquid syntax',
134
- type: 'string',
135
- required: true
136
- },
137
- url: {
138
- label: 'URL',
139
- description: 'The URL endpoint to call',
140
- type: 'string',
141
- required: true
142
- },
143
- method: {
144
- label: 'Request Method',
145
- description: 'The request method, e.g. GET/POST/etc.',
146
- type: 'string',
147
- required: true
148
- },
149
- cacheTtl: {
150
- label: 'Cache TTL',
151
- description: 'The cache TTL in ms',
152
- type: 'integer',
153
- required: true
154
- },
155
- body: {
156
- label: 'Request Body',
157
- description: 'The request body for use with POST/PUT/PATCH requests',
158
- type: 'string'
159
- },
160
- headers: {
161
- label: 'Request Headers',
162
- description: 'Headers in JSON to be sent with the request',
163
- type: 'object'
164
- },
165
- responseType: {
166
- label: 'Response Type',
167
- description: 'The response type of the request. Currently only supporting JSON.',
168
- type: 'string',
169
- required: true
170
- }
171
- };
172
- exports.apiLookupLiquidKey = 'lookups';
173
- exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
174
- //# sourceMappingURL=api-lookups.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC,MAAM,kBAAkB,GAAG,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@@ -1,4 +0,0 @@
1
- export interface Payload {
2
- email?: string;
3
- list_id?: string;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const functions_1 = require("../functions");
5
- const properties_1 = require("../properties");
6
- const action = {
7
- title: 'Remove profile from list',
8
- description: 'Remove profile from list',
9
- fields: {
10
- email: { ...properties_1.email },
11
- list_id: { ...properties_1.external_id }
12
- },
13
- perform: async (request, { payload }) => {
14
- const { email, list_id } = payload;
15
- if (!email || !list_id) {
16
- throw new actions_core_1.IntegrationError("Insert the ID of the default list that you'd like to subscribe users", 'Missing required fields', 400);
17
- }
18
- try {
19
- const profileData = await functions_1.getProfile(request, email);
20
- const v = JSON.parse(profileData.content);
21
- if (Object.keys(v).length !== 0) {
22
- console.log(v);
23
- const listData = {
24
- data: [
25
- {
26
- type: 'profile',
27
- id: v.data[0].id
28
- }
29
- ]
30
- };
31
- const list = await functions_1.executeProfileList(request, 'DELETE', listData, list_id);
32
- return list;
33
- }
34
- return;
35
- }
36
- catch (error) {
37
- console.log(error);
38
- throw new Error('An error occurred while processing the request');
39
- }
40
- }
41
- };
42
- exports.default = action;
43
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/klaviyo/removeProfileToList/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E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CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,13 +0,0 @@
1
- export declare enum ApiRegions {
2
- US = "US \uD83C\uDDFA\uD83C\uDDF8",
3
- EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
4
- }
5
- export declare enum StrictMode {
6
- ON = "1",
7
- OFF = "0"
8
- }
9
- export declare function getConcatenatedName(firstName: unknown, lastName: unknown, name: unknown): unknown;
10
- export declare function getApiServerUrl(apiRegion: string | undefined): "https://api-eu.mixpanel.com" | "https://api.mixpanel.com";
11
- export declare function getBrowser(userAgent: string): string;
12
- export declare function getBrowserVersion(userAgent: string): string | undefined;
13
- export declare function cheapGuid(maxlen?: number): string;