@segment/action-destinations 3.227.4-staging.0 → 3.227.5-staging.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 (38) hide show
  1. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
  2. package/dist/destinations/klaviyo/generated-types.d.ts +0 -4
  3. package/dist/destinations/klaviyo/index.d.ts +2 -2
  4. package/dist/destinations/klaviyo/index.js +3 -20
  5. package/dist/destinations/klaviyo/index.js.map +1 -1
  6. package/dist/destinations/marketo-static-lists/addToList/generated-types.d.ts +5 -0
  7. package/dist/destinations/marketo-static-lists/addToList/index.js +16 -4
  8. package/dist/destinations/marketo-static-lists/addToList/index.js.map +1 -1
  9. package/dist/destinations/marketo-static-lists/constants.d.ts +41 -2
  10. package/dist/destinations/marketo-static-lists/constants.js +11 -2
  11. package/dist/destinations/marketo-static-lists/constants.js.map +1 -1
  12. package/dist/destinations/marketo-static-lists/functions.d.ts +7 -0
  13. package/dist/destinations/marketo-static-lists/functions.js +71 -0
  14. package/dist/destinations/marketo-static-lists/functions.js.map +1 -0
  15. package/dist/destinations/marketo-static-lists/index.js +38 -22
  16. package/dist/destinations/marketo-static-lists/index.js.map +1 -1
  17. package/dist/destinations/marketo-static-lists/properties.d.ts +6 -0
  18. package/dist/destinations/marketo-static-lists/properties.js +49 -0
  19. package/dist/destinations/marketo-static-lists/properties.js.map +1 -0
  20. package/dist/destinations/marketo-static-lists/removeFromList/generated-types.d.ts +5 -0
  21. package/dist/destinations/marketo-static-lists/removeFromList/index.js +17 -5
  22. package/dist/destinations/marketo-static-lists/removeFromList/index.js.map +1 -1
  23. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
  24. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
  25. package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
  26. package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
  27. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
  28. package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
  29. package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
  30. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
  31. package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
  32. package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
  33. package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
  34. package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
  35. package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
  36. package/dist/destinations/yahoo-audiences/utils.js +30 -0
  37. package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
  38. package/package.json +1 -1
@@ -9,7 +9,7 @@ export declare const dateStringToFuzzyDate: (dateString: string | number) => fal
9
9
  y: string;
10
10
  };
11
11
  export declare const augmentFieldsWithConstituentFields: (fields: Record<string, InputField>) => Record<string, InputField>;
12
- export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Address> | Partial<OnlinePresence> | Partial<Phone> | Partial<Constituent>)[];
12
+ export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Constituent> | Partial<Address> | Partial<OnlinePresence> | Partial<Phone>)[];
13
13
  export declare const buildConstituentPayloadFromPayload: (payload: StringIndexedObject) => Partial<CreateOrUpdateIndividualConstituentPayload>;
14
14
  export declare const buildGiftDataFromPayload: (constituentId: string, payload: CreateGiftPayload) => Partial<Gift>;
15
15
  export declare const buildConstituentActionDataFromPayload: (constituentId: string, payload: CreateConstituentAction) => Partial<ConstituentAction>;
@@ -1,7 +1,3 @@
1
1
  export interface Settings {
2
2
  api_key: string;
3
3
  }
4
- export interface AudienceSettings {
5
- list_name: string;
6
- api_key: string;
7
- }
@@ -1,4 +1,4 @@
1
1
  import { AudienceDestinationDefinition } from '@segment/actions-core';
2
- import type { Settings, AudienceSettings } from './generated-types';
3
- declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: AudienceDestinationDefinition<Settings>;
4
4
  export default destination;
@@ -57,20 +57,7 @@ const destination = {
57
57
  }
58
58
  };
59
59
  },
60
- audienceFields: {
61
- list_name: {
62
- type: 'string',
63
- label: 'A List Name is required by the destination',
64
- description: 'A List Name is required by the destination',
65
- required: true
66
- },
67
- api_key: {
68
- type: 'string',
69
- label: 'A Api Key is required by the destination',
70
- description: 'A Api Key is required by the destination',
71
- required: true
72
- }
73
- },
60
+ audienceFields: {},
74
61
  audienceConfig: {
75
62
  mode: {
76
63
  type: 'synced',
@@ -78,17 +65,13 @@ const destination = {
78
65
  },
79
66
  async createAudience(request, createAudienceInput) {
80
67
  const audienceName = createAudienceInput.audienceName;
81
- const listName = createAudienceInput.audienceSettings?.list_name;
82
- const apiKey = createAudienceInput.audienceSettings?.api_key;
68
+ const apiKey = createAudienceInput.settings?.api_key;
83
69
  if (!audienceName) {
84
70
  throw new actions_core_1.IntegrationError('Missing audience name value', 'MISSING_REQUIRED_FIELD', 400);
85
71
  }
86
72
  if (!apiKey) {
87
73
  throw new actions_core_1.IntegrationError('Missing Api Key value', 'MISSING_REQUIRED_FIELD', 400);
88
74
  }
89
- if (!listName) {
90
- throw new actions_core_1.IntegrationError('Missing List Name value', 'MISSING_REQUIRED_FIELD', 400);
91
- }
92
75
  const response = await request(`${config_1.API_URL}/lists`, {
93
76
  method: 'POST',
94
77
  headers: {
@@ -98,7 +81,7 @@ const destination = {
98
81
  'Content-Type': 'application/x-www-form-urlencoded'
99
82
  },
100
83
  json: {
101
- data: { type: 'list', attributes: { name: createAudienceInput.audienceSettings?.list_name } }
84
+ data: { type: 'list', attributes: { name: audienceName } }
102
85
  }
103
86
  });
104
87
  const r = await response.json();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klavi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KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAAuF;AAGvF,qCAAiD;AACjD,oEAA2C;AAC3C,0EAAiD;AACjD,gFAAuD;AACvD,8DAAqC;AACrC,sEAA6C;AAE7C,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,wGAAwG;gBACrH,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,GAAG,gBAAO,YAAY,EAAE;gBACrC,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;QACJ,CAAC;KACF;IAED,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACvC,OAAO,OAAO,CAAC,GAAG,gBAAO,8BAA8B,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,2BAA2B;oBACjC,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,IAAI,EAAE;gCACJ,IAAI,EAAE,SAAS;gCACf,EAAE,EAAE,OAAO,CAAC,MAAM;6BACnB;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,mBAAmB,QAAQ,CAAC,OAAO,EAAE;gBACpD,MAAM,EAAE,kBAAkB;gBAC1B,QAAQ,EAAE,sBAA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;YAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,gBAAO,UAAU,MAAM,EAAE,EAAE;gBAC3D,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,aAAa,EAAE,mBAAmB,MAAM,EAAE;oBAC1C,MAAM,EAAE,kBAAkB;oBAC1B,QAAQ,EAAE,sBAAa;oBACvB,cAAc,EAAE,mCAAmC;iBACpD;aACF,CAAC,CAAA;YAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3B,MAAM,IAAI,+BAAgB,CAAC,4CAA4C,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;aAClG;YACD,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA;YAE5B,IAAI,UAAU,KAAK,gBAAgB,CAAC,UAAU,EAAE;gBAC9C,MAAM,IAAI,+BAAgB,CACxB,kGAAkG,EAClG,sBAAsB,EACtB,GAAG,CACJ,CAAA;aACF;YAED,OAAO;gBACL,UAAU;aACX,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,gBAAgB,EAAhB,0BAAgB;QAChB,mBAAmB,EAAnB,6BAAmB;QACnB,UAAU,EAAV,oBAAU;QACV,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,2 +1,7 @@
1
1
  export interface Payload {
2
+ external_id: string;
3
+ email: string;
4
+ enable_batching: boolean;
5
+ batch_size: number;
6
+ event_name: string;
2
7
  }
@@ -1,11 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const properties_1 = require("../properties");
4
+ const functions_1 = require("../functions");
3
5
  const action = {
4
6
  title: 'Add to List',
5
- description: 'Add users into a list',
6
- fields: {},
7
- perform: () => {
8
- return;
7
+ description: 'Add users from an Engage Audience to a list in Marketo.',
8
+ defaultSubscription: 'event = "Audience Entered"',
9
+ fields: {
10
+ external_id: { ...properties_1.external_id },
11
+ email: { ...properties_1.email },
12
+ enable_batching: { ...properties_1.enable_batching },
13
+ batch_size: { ...properties_1.batch_size },
14
+ event_name: { ...properties_1.event_name }
15
+ },
16
+ perform: async (request, { settings, payload }) => {
17
+ return functions_1.addToList(request, settings, [payload]);
18
+ },
19
+ performBatch: async (request, { settings, payload }) => {
20
+ return functions_1.addToList(request, settings, payload);
9
21
  }
10
22
  };
11
23
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/marketo-static-lists/addToList/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,uBAAuB;IACpC,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,GAAG,EAAE;QACZ,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/marketo-static-lists/addToList/index.ts"],"names":[],"mappings":";;AAGA,8CAA2F;AAC3F,4CAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,yDAAyD;IACtE,mBAAmB,EAAE,4BAA4B;IACjD,MAAM,EAAE;QACN,WAAW,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC/B,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;QACvC,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;KAC9B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,qBAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAChD,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,OAAO,qBAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,9 +1,17 @@
1
- import { RequestClient } from '@segment/actions-core/*';
1
+ import { RequestClient } from '@segment/actions-core';
2
2
  import { Settings } from './generated-types';
3
+ export declare const GET_FOLDER_ENDPOINT: string;
4
+ export declare const CREATE_LIST_ENDPOINT: string;
5
+ export declare const GET_LIST_ENDPOINT: string;
6
+ export declare const BULK_IMPORT_ENDPOINT: string;
7
+ export declare const GET_LEADS_ENDPOINT: string;
8
+ export declare const REMOVE_USERS_ENDPOINT: string;
9
+ export declare const CSV_LIMIT = 10000000;
3
10
  export interface RefreshTokenResponse {
4
11
  access_token: string;
5
12
  }
6
- export interface MarketoResonse {
13
+ interface MarketoResponse {
14
+ requestId: string;
7
15
  success: boolean;
8
16
  errors: [
9
17
  {
@@ -11,6 +19,8 @@ export interface MarketoResonse {
11
19
  message: string;
12
20
  }
13
21
  ];
22
+ }
23
+ export interface MarketoListResponse extends MarketoResponse {
14
24
  result: [
15
25
  {
16
26
  name: string;
@@ -18,4 +28,33 @@ export interface MarketoResonse {
18
28
  }
19
29
  ];
20
30
  }
31
+ export interface MarketoBulkImportResponse extends MarketoResponse {
32
+ result: [
33
+ {
34
+ batchId: number;
35
+ importId: string;
36
+ status: string;
37
+ }
38
+ ];
39
+ }
40
+ export interface MarketoGetLeadsResponse extends MarketoResponse {
41
+ result: [MarketoLeads];
42
+ }
43
+ export interface MarketoDeleteLeadsResponse extends MarketoResponse {
44
+ result: [
45
+ {
46
+ id: number;
47
+ status: string;
48
+ }
49
+ ];
50
+ }
51
+ export interface MarketoLeads {
52
+ id: number;
53
+ firstName: string;
54
+ lastName: string;
55
+ email: string;
56
+ updatedAt: string;
57
+ createdAt: string;
58
+ }
21
59
  export declare function getAccessToken(request: RequestClient, settings: Settings): Promise<string>;
60
+ export {};
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccessToken = void 0;
3
+ exports.getAccessToken = exports.CSV_LIMIT = exports.REMOVE_USERS_ENDPOINT = exports.GET_LEADS_ENDPOINT = exports.BULK_IMPORT_ENDPOINT = exports.GET_LIST_ENDPOINT = exports.CREATE_LIST_ENDPOINT = exports.GET_FOLDER_ENDPOINT = void 0;
4
+ const API_VERSION = 'v1';
5
+ const OAUTH_ENDPOINT = 'identity/oauth/token';
6
+ exports.GET_FOLDER_ENDPOINT = `/rest/asset/${API_VERSION}/folder/byName.json?name=folderName`;
7
+ exports.CREATE_LIST_ENDPOINT = `/rest/asset/${API_VERSION}/staticLists.json?folder=folderId&name=listName`;
8
+ exports.GET_LIST_ENDPOINT = `/rest/asset/${API_VERSION}/staticList/listId.json`;
9
+ exports.BULK_IMPORT_ENDPOINT = `/bulk/${API_VERSION}/leads.json?format=csv&listId=externalId`;
10
+ exports.GET_LEADS_ENDPOINT = `/rest/${API_VERSION}/leads.json?filterType=email&filterValues=emailsToFilter`;
11
+ exports.REMOVE_USERS_ENDPOINT = `/rest/${API_VERSION}/lists/listId/leads.json?id=idsToDelete`;
12
+ exports.CSV_LIMIT = 10000000;
4
13
  async function getAccessToken(request, settings) {
5
- const res = await request(`${settings.api_endpoint}/identity/oauth/token`, {
14
+ const res = await request(`${settings.api_endpoint}/${OAUTH_ENDPOINT}`, {
6
15
  method: 'POST',
7
16
  body: new URLSearchParams({
8
17
  client_id: settings.client_id,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/constants.ts"],"names":[],"mappings":";;;AAuBO,KAAK,UAAU,cAAc,CAAC,OAAsB,EAAE,QAAkB;IAC7E,MAAM,GAA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AA;AAC9B,CAAC;AAXD,wCAWC"}
@@ -0,0 +1,7 @@
1
+ import { RequestClient } from '@segment/actions-core';
2
+ import { Settings } from './generated-types';
3
+ import { Payload as AddToListPayload } from './addToList/generated-types';
4
+ import { Payload as RemoveFromListPayload } from './removeFromList/generated-types';
5
+ import { MarketoBulkImportResponse, MarketoDeleteLeadsResponse } from './constants';
6
+ export declare function addToList(request: RequestClient, settings: Settings, payloads: AddToListPayload[]): Promise<MarketoBulkImportResponse>;
7
+ export declare function removeFromList(request: RequestClient, settings: Settings, payloads: RemoveFromListPayload[]): Promise<MarketoDeleteLeadsResponse>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeFromList = exports.addToList = void 0;
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const constants_1 = require("./constants");
6
+ async function addToList(request, settings, payloads) {
7
+ const csvData = extractCSV(payloads);
8
+ const csvSize = Buffer.byteLength(csvData, 'utf8');
9
+ if (csvSize > constants_1.CSV_LIMIT) {
10
+ throw new actions_core_1.IntegrationError(`CSV data size exceeds limit of ${constants_1.CSV_LIMIT} bytes`, 'INVALID_REQUEST_DATA', 400);
11
+ }
12
+ const url = settings.api_endpoint + constants_1.BULK_IMPORT_ENDPOINT.replace('externalId', payloads[0].external_id);
13
+ const response = await request(url, {
14
+ method: 'POST',
15
+ headers: {
16
+ 'Content-Type': 'multipart/form-data; boundary=--SEGMENT-DATA--'
17
+ },
18
+ body: createFormData(csvData)
19
+ });
20
+ if (!response.data.success) {
21
+ throw new actions_core_1.IntegrationError(response.data.errors[0].message, 'INVALID_RESPONSE', 400);
22
+ }
23
+ return response.data;
24
+ }
25
+ exports.addToList = addToList;
26
+ async function removeFromList(request, settings, payloads) {
27
+ const emailsToRemove = extractEmails(payloads);
28
+ const getLeadsUrl = settings.api_endpoint + constants_1.GET_LEADS_ENDPOINT.replace('emailsToFilter', encodeURIComponent(emailsToRemove));
29
+ const getLeadsResponse = await request(getLeadsUrl, {
30
+ method: 'GET',
31
+ headers: {
32
+ 'Content-Type': 'application/json'
33
+ }
34
+ });
35
+ if (!getLeadsResponse.data.success) {
36
+ throw new actions_core_1.IntegrationError(getLeadsResponse.data.errors[0].message, 'INVALID_RESPONSE', 400);
37
+ }
38
+ const leadIds = extractLeadIds(getLeadsResponse.data.result);
39
+ const deleteLeadsUrl = settings.api_endpoint +
40
+ constants_1.REMOVE_USERS_ENDPOINT.replace('listId', payloads[0].external_id).replace('idsToDelete', leadIds);
41
+ const deleteLeadsResponse = await request(deleteLeadsUrl, {
42
+ method: 'DELETE',
43
+ headers: {
44
+ 'Content-Type': 'application/json'
45
+ }
46
+ });
47
+ if (!deleteLeadsResponse.data.success) {
48
+ throw new actions_core_1.IntegrationError(getLeadsResponse.data.errors[0].message, 'INVALID_RESPONSE', 400);
49
+ }
50
+ return deleteLeadsResponse.data;
51
+ }
52
+ exports.removeFromList = removeFromList;
53
+ function extractCSV(payloads) {
54
+ const header = 'Email\n';
55
+ const csvData = payloads.map((payload) => `${payload.email}`).join('\n');
56
+ return header + csvData;
57
+ }
58
+ function createFormData(csvData) {
59
+ const boundary = '--SEGMENT-DATA--';
60
+ const formData = `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="leads.csv"\r\nContent-Type: text/csv\r\n\r\n${csvData}\r\n--${boundary}--\r\n`;
61
+ return formData;
62
+ }
63
+ function extractEmails(payloads) {
64
+ const emails = payloads.map((payload) => `${payload.email}`).join(',');
65
+ return emails;
66
+ }
67
+ function extractLeadIds(leads) {
68
+ const ids = leads.map((lead) => `${lead.id}`).join(',');
69
+ return ids;
70
+ }
71
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/functions.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AAIvE,2CASoB;AAEb,KAAK,UAAU,SAAS,CAAC,OAAsB,EAAE,QAAkB,EAAE,QAA4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nC,MAAM,QAAQ,GAAG,KAAK,QAAQ,0GAA0G,OAAO,SAAS,QAAQ,QAAQ,CAAA;IACxK,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,QAA4B;IACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACtE,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,cAAc,CAAC,KAAqB;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -57,53 +57,69 @@ const destination = {
57
57
  full_audience_sync: false
58
58
  },
59
59
  async createAudience(request, createAudienceInput) {
60
- const audience_name = createAudienceInput.audienceName;
60
+ const audienceName = createAudienceInput.audienceName;
61
61
  const folder = createAudienceInput.settings.folder_name;
62
62
  const endpoint = createAudienceInput.settings.api_endpoint;
63
63
  const statsClient = createAudienceInput?.statsContext?.statsClient;
64
64
  const statsTags = createAudienceInput?.statsContext?.tags;
65
- const get_folder_response = await request(`${endpoint}/rest/asset/v1/folder/byName.json?name=${encodeURIComponent(folder)}`, {
66
- method: 'GET'
65
+ if (!audienceName) {
66
+ throw new actions_core_1.IntegrationError('Missing audience name value', 'MISSING_REQUIRED_FIELD', 400);
67
+ }
68
+ const accessToken = await constants_1.getAccessToken(request, createAudienceInput.settings);
69
+ const getFolderUrl = endpoint + constants_1.GET_FOLDER_ENDPOINT.replace('folderName', encodeURIComponent(folder));
70
+ const getFolderResponse = await request(getFolderUrl, {
71
+ method: 'GET',
72
+ headers: {
73
+ authorization: `Bearer ${accessToken}`
74
+ }
67
75
  });
68
- if (!get_folder_response.data.success && get_folder_response.data.errors) {
76
+ if (!getFolderResponse.data.success && getFolderResponse.data.errors) {
69
77
  statsClient?.incr('createAudience.error', 1, statsTags);
70
- throw new actions_core_1.IntegrationError(`${get_folder_response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
78
+ throw new actions_core_1.IntegrationError(`${getFolderResponse.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
71
79
  }
72
- if (!get_folder_response.data.result) {
80
+ if (!getFolderResponse.data.result) {
73
81
  statsClient?.incr('createAudience.error', 1, statsTags);
74
82
  throw new actions_core_1.IntegrationError(`A folder with the name ${folder} not found`, 'INVALID_REQUEST_DATA', 400);
75
83
  }
76
- const folder_id = get_folder_response.data.result[0].id;
77
- const create_list_response = await request(`${endpoint}/rest/asset/v1/staticLists.json?folder=${folder_id}&name=${encodeURIComponent(audience_name)}`, {
78
- method: 'POST'
84
+ const folderId = getFolderResponse.data.result[0].id.toString();
85
+ const createListUrl = endpoint +
86
+ constants_1.CREATE_LIST_ENDPOINT.replace('folderId', folderId).replace('listName', encodeURIComponent(audienceName));
87
+ const createListResponse = await request(createListUrl, {
88
+ method: 'POST',
89
+ headers: {
90
+ authorization: `Bearer ${accessToken}`
91
+ }
79
92
  });
80
- if (!create_list_response.data.success && create_list_response.data.errors) {
93
+ if (!createListResponse.data.success && createListResponse.data.errors) {
81
94
  statsClient?.incr('createAudience.error', 1, statsTags);
82
- throw new actions_core_1.IntegrationError(`${create_list_response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
83
- }
84
- const external_id = create_list_response.data.result[0].id.toString();
85
- if (external_id) {
86
- statsClient?.incr('createAudience.success', 1, statsTags);
95
+ throw new actions_core_1.IntegrationError(`${createListResponse.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
87
96
  }
97
+ const externalId = createListResponse.data.result[0].id.toString();
98
+ statsClient?.incr('createAudience.success', 1, statsTags);
88
99
  return {
89
- externalId: external_id
100
+ externalId: externalId
90
101
  };
91
102
  },
92
103
  async getAudience(request, getAudienceInput) {
93
104
  const endpoint = getAudienceInput.settings.api_endpoint;
94
- const list_id = getAudienceInput.externalId;
105
+ const listId = getAudienceInput.externalId;
95
106
  const statsClient = getAudienceInput?.statsContext?.statsClient;
96
107
  const statsTags = getAudienceInput?.statsContext?.tags;
97
- const response = await request(`${endpoint}/rest/asset/v1/staticList/${list_id}.json`, {
98
- method: 'GET'
108
+ const accessToken = await constants_1.getAccessToken(request, getAudienceInput.settings);
109
+ const getListUrl = endpoint + constants_1.GET_LIST_ENDPOINT.replace('listId', listId);
110
+ const getListResponse = await request(getListUrl, {
111
+ method: 'GET',
112
+ headers: {
113
+ authorization: `Bearer ${accessToken}`
114
+ }
99
115
  });
100
- if (!response.data.success && response.data.errors) {
116
+ if (!getListResponse.data.success && getListResponse.data.errors) {
101
117
  statsClient?.incr('getAudience.error', 1, statsTags);
102
- throw new actions_core_1.IntegrationError(`${response.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
118
+ throw new actions_core_1.IntegrationError(`${getListResponse.data.errors[0].message}`, 'INVALID_RESPONSE', 400);
103
119
  }
104
120
  statsClient?.incr('getAudience.success', 1, statsTags);
105
121
  return {
106
- externalId: list_id
122
+ externalId: listId
107
123
  };
108
124
  }
109
125
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAGxD,4DAAmC;AACnC,sEAA6C;AAC7C,2CAA4D;AAE5D,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,kCAAkC;gBAC/C,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;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"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAGxD,4DAAmC;AACnC,sEAA6C;AAC7C,2CAMoB;AAEpB,MAAM,WAAW,GAA4C;IAC3D,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,kCAAkC;gBAC/C,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,sCAAsC;gBACnD,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;YACD,YAAY,EAAE;gBACZ,KAAK,EAAE,cAAc;gBACrB,WAAW,EAAE,wFAAwF;gBACrG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,qDAAqD;gBAClE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAA;QACjE,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,cAAc,EAAE;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,kBAAkB,EAAE,K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,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,YAAY,CAAA;YACvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAA;YAC1C,MAAM,WAAW,GAAG,gBAAgB,EAAE,YAAY,EAAE,WAAW,CAAA;YAC/D,MAAM,SAAS,GAAG,gBAAgB,EAAE,YAAY,EAAE,IAAI,CAAA;YAGtD,MAAM,WAAW,GAAG,MAAM,0BAAc,CAAC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;YAE5E,MAAM,UAAU,GAAG,QAAQ,GAAG,6BAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAEzE,MAAM,eAAe,GAAG,MAAM,OAAO,CAAsB,UAAU,EAAE;gBACrE,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,WAAW,EAAE;iBACvC;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChE,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;gBACpD,MAAM,IAAI,+BAAgB,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;aACjG;YAED,WAAW,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;YAEtD,OAAO;gBACL,UAAU,EAAE,MAAM;aACnB,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;QACT,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { InputField } from '@segment/actions-core/destination-kit/types';
2
+ export declare const external_id: InputField;
3
+ export declare const email: InputField;
4
+ export declare const enable_batching: InputField;
5
+ export declare const batch_size: InputField;
6
+ export declare const event_name: InputField;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.event_name = exports.batch_size = exports.enable_batching = exports.email = exports.external_id = void 0;
4
+ exports.external_id = {
5
+ label: 'External ID',
6
+ description: 'The ID of the Static List that users will be synced to.',
7
+ type: 'string',
8
+ default: {
9
+ '@path': '$.context.personas.external_audience_id'
10
+ },
11
+ unsafe_hidden: true,
12
+ required: true
13
+ };
14
+ exports.email = {
15
+ label: 'Email',
16
+ description: `The user's email address to send to Marketo.`,
17
+ type: 'string',
18
+ default: {
19
+ '@path': '$.context.traits.email'
20
+ },
21
+ readOnly: true,
22
+ required: true
23
+ };
24
+ exports.enable_batching = {
25
+ label: 'Enable Batching',
26
+ description: 'Enable batching of requests.',
27
+ type: 'boolean',
28
+ default: true,
29
+ unsafe_hidden: true,
30
+ required: true
31
+ };
32
+ exports.batch_size = {
33
+ label: 'Batch Size',
34
+ description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
35
+ type: 'number',
36
+ default: 300000,
37
+ required: true
38
+ };
39
+ exports.event_name = {
40
+ label: 'Event Name',
41
+ description: 'The name of the current Segment event.',
42
+ type: 'string',
43
+ default: {
44
+ '@path': '$.event'
45
+ },
46
+ readOnly: true,
47
+ required: true
48
+ };
49
+ //# sourceMappingURL=properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/marketo-static-lists/properties.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,yDAAyD;IACtE,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,8CAA8C;IAC3D,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,wBAAwB;KAClC;IACD,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,8BAA8B;IAC3C,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM;IAEf,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,wCAAwC;IACrD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,SAAS;KACnB;IACD,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;CACf,CAAA"}
@@ -1,2 +1,7 @@
1
1
  export interface Payload {
2
+ external_id: string;
3
+ email: string;
4
+ enable_batching: boolean;
5
+ batch_size: number;
6
+ event_name: string;
2
7
  }
@@ -1,11 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const properties_1 = require("../properties");
4
+ const functions_1 = require("../functions");
3
5
  const action = {
4
- title: 'Remove from List',
5
- description: 'Remove users from a list',
6
- fields: {},
7
- perform: () => {
8
- return;
6
+ title: 'Remove From List',
7
+ description: 'Remove users from a list in Marketo.',
8
+ defaultSubscription: 'event = "Audience Exited"',
9
+ fields: {
10
+ external_id: { ...properties_1.external_id },
11
+ email: { ...properties_1.email },
12
+ enable_batching: { ...properties_1.enable_batching },
13
+ batch_size: { ...properties_1.batch_size },
14
+ event_name: { ...properties_1.event_name }
15
+ },
16
+ perform: async (request, { settings, payload }) => {
17
+ return functions_1.removeFromList(request, settings, [payload]);
18
+ },
19
+ performBatch: async (request, { settings, payload }) => {
20
+ return functions_1.removeFromList(request, settings, payload);
9
21
  }
10
22
  };
11
23
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/marketo-static-lists/removeFromList/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,GAAG,EAAE;QACZ,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/marketo-static-lists/removeFromList/index.ts"],"names":[],"mappings":";;AAGA,8CAA2F;AAC3F,4CAA6C;AAE7C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,sCAAsC;IACnD,mBAAmB,EAAE,2BAA2B;IAChD,MAAM,EAAE;QACN,WAAW,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC/B,KAAK,EAAE,EAAE,GAAG,kBAAK,EAAE;QACnB,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;QACvC,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;KAC9B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,0BAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACrD,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,OAAO,0BAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ export interface Payload {
2
+ engage_space_id: string;
3
+ customer_desc?: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_tax_1 = require("../utils-tax");
4
+ const utils_tax_2 = require("../utils-tax");
5
+ const action = {
6
+ title: 'Create top-level CUSTOMER node in Yahoo taxonomy',
7
+ defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
8
+ description: '',
9
+ fields: {
10
+ engage_space_id: {
11
+ label: 'Engage Space Id',
12
+ description: 'Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy',
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ customer_desc: {
17
+ label: 'Customer Description',
18
+ description: 'Provide a description for the Customer node in Yahoo taxonomy. This must be less then 1000 characters',
19
+ type: 'string',
20
+ required: false
21
+ }
22
+ },
23
+ perform: async (request, { settings, payload }) => {
24
+ const tx_creds = {
25
+ tx_client_key: settings.taxonomy_client_key,
26
+ tx_client_secret: settings.taxonomy_client_secret
27
+ };
28
+ const taxonomy_payload = utils_tax_1.gen_customer_taxonomy_payload(settings, payload);
29
+ return await utils_tax_2.update_taxonomy('', tx_creds, request, taxonomy_payload);
30
+ }
31
+ };
32
+ exports.default = action;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/index.ts"],"names":[],"mappings":";;AAGA,4CAA4D;AAC5D,4CAA8C;AAE9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kDAAkD;IACzD,mBAAmB,EAAE,0DAA0D;IAC/E,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mJAAmJ;YACrJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,uGAAuG;YACzG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QACD,MAAM,gBAAgB,GAAG,yCAA6B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACzE,OAAO,MAAM,2BAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface Payload {
2
+ segment_audience_key: string;
3
+ segment_audience_id: string;
4
+ engage_space_id?: string;
5
+ customer_desc?: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createSegment/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_tax_1 = require("../utils-tax");
4
+ const utils_tax_2 = require("../utils-tax");
5
+ const action = {
6
+ title: 'Create SEGMENT sub-node in Yahoo taxonomy',
7
+ description: 'Use this action to generate SEGMENT sub-node within CUSTOMER node in Yahoo taxonomy',
8
+ defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
9
+ fields: {
10
+ segment_audience_key: {
11
+ label: 'Audience Key',
12
+ description: 'Provide audience key. This maps to the "Name" of the Segment node in Yahoo taxonomy',
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ segment_audience_id: {
17
+ label: 'Audience Id',
18
+ description: 'Provide audience Id (aud_...) from audience URL in Segment Engage. This maps to the "Id" of the Segment node in Yahoo taxonomy',
19
+ type: 'string',
20
+ required: true
21
+ },
22
+ engage_space_id: {
23
+ label: 'Engage Space Id',
24
+ description: 'Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy and specifies the parent node for your Segment node in Yahoo taxonomy',
25
+ type: 'string',
26
+ required: false
27
+ },
28
+ customer_desc: {
29
+ label: 'Space Description',
30
+ description: 'Provide the description for Segment node in Yahoo taxonomy. This must be less then 1000 characters',
31
+ type: 'string',
32
+ required: false
33
+ }
34
+ },
35
+ perform: async (request, { payload, settings }) => {
36
+ const tx_creds = {
37
+ tx_client_key: settings.taxonomy_client_key,
38
+ tx_client_secret: settings.taxonomy_client_secret
39
+ };
40
+ const body_form_data = utils_tax_1.gen_segment_subtaxonomy_payload(payload);
41
+ return await utils_tax_2.update_taxonomy(String(payload.engage_space_id), tx_creds, request, body_form_data);
42
+ }
43
+ };
44
+ exports.default = action;
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createSegment/index.ts"],"names":[],"mappings":";;AAIA,4CAA8D;AAC9D,4CAA8C;AAG9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,2CAA2C;IAClD,WAAW,EAAE,qFAAqF;IAClG,mBAAmB,EAAE,0DAA0D;IAE/E,MAAM,EAAE;QACN,oBAAoB,EAAE;YACpB,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,qFAAqF;YAClG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,gIAAgI;YAClI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,yNAAyN;YAC3N,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,oGAAoG;YACjH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QAED,MAAM,cAAc,GAAG,2CAA+B,CAAC,OAAO,CAAC,CAAA;QAC/D,OAAO,MAAM,2BAAe,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;IAClG,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { RequestClient } from '@segment/actions-core';
2
+ import { CredsObj } from './types';
3
+ export declare function gen_random_id(length: number): string;
4
+ export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update_taxonomy = exports.gen_random_id = void 0;
4
+ const utils_tax_1 = require("./utils-tax");
5
+ function gen_random_id(length) {
6
+ const pattern = 'abcdefghijklmnopqrstuvwxyz123456789';
7
+ const result = [];
8
+ for (let i = 0; i < length; i++) {
9
+ result.push(pattern[Math.floor(Math.random() * pattern.length)]);
10
+ }
11
+ return result.join('');
12
+ }
13
+ exports.gen_random_id = gen_random_id;
14
+ async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
15
+ const tx_client_secret = tx_creds.tx_client_key;
16
+ const tx_client_key = tx_creds.tx_client_secret;
17
+ const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
18
+ const oauth1_auth_string = utils_tax_1.gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
19
+ const add_segment_node = await request(url, {
20
+ method: 'PUT',
21
+ body: body_form_data,
22
+ headers: {
23
+ Authorization: oauth1_auth_string,
24
+ 'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
25
+ }
26
+ });
27
+ return await add_segment_node.json();
28
+ }
29
+ exports.update_taxonomy = update_taxonomy;
30
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils.ts"],"names":[],"mappings":";;;AAEA,2CAAkD;AAQlD,SAAgB,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,qCAAqC,CAAA;IACrD,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACjE;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAPD,sCAOC;AAEM,KAAK,UAAU,eAAe,CACnC,eAAuB,EACvB,QAAkB,EAClB,OAAsB,EACtB,cAAsB;IAEtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAA;IAC/C,MAAM,GAAG,GAAG,iDAAiD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IACtH,MAAM,kBAAkB,GAAG,gCAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAE5F,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,aAAa,EAAE,kBAAkB;YACjC,cAAc,EAAE,4CAA4C;SAC7D;KACF,CAAC,CAAA;IAEF,OAAO,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAA;AACtC,CAAC;AArBD,0CAqBC"}
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.227.4-staging.0",
4
+ "version": "3.227.5-staging.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",