@segment/action-destinations 3.310.0 → 3.311.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 (66) hide show
  1. package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +1 -0
  2. package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +1 -0
  3. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +6 -0
  4. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +1 -1
  5. package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +1 -0
  6. package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +1 -0
  7. package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +1 -0
  8. package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +1 -0
  9. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +1 -0
  10. package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
  11. package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
  12. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
  13. package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js +2 -2
  14. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +2 -2
  15. package/dist/destinations/google-enhanced-conversions/uploadClickConversion2/index.js +2 -2
  16. package/dist/destinations/google-enhanced-conversions/userList/index.js +2 -2
  17. package/dist/destinations/google-sheets/googleapis/index.js +2 -0
  18. package/dist/destinations/google-sheets/googleapis/index.js.map +1 -1
  19. package/dist/destinations/hubspot/customEvent/client.d.ts +10 -0
  20. package/dist/destinations/hubspot/customEvent/client.js +38 -0
  21. package/dist/destinations/hubspot/customEvent/client.js.map +1 -0
  22. package/dist/destinations/hubspot/customEvent/common-fields.js +7 -3
  23. package/dist/destinations/hubspot/customEvent/common-fields.js.map +1 -1
  24. package/dist/destinations/hubspot/customEvent/constants.d.ts +4 -0
  25. package/dist/destinations/hubspot/customEvent/constants.js +141 -1
  26. package/dist/destinations/hubspot/customEvent/constants.js.map +1 -1
  27. package/dist/destinations/hubspot/customEvent/dynamic-fields.js +11 -5
  28. package/dist/destinations/hubspot/customEvent/dynamic-fields.js.map +1 -1
  29. package/dist/destinations/hubspot/customEvent/index.d.ts +1 -1
  30. package/dist/destinations/hubspot/customEvent/index.js +54 -16
  31. package/dist/destinations/hubspot/customEvent/index.js.map +1 -1
  32. package/dist/destinations/hubspot/customEvent/types.d.ts +93 -0
  33. package/dist/destinations/hubspot/customEvent/types.js +10 -0
  34. package/dist/destinations/hubspot/customEvent/types.js.map +1 -0
  35. package/dist/destinations/hubspot/customEvent/utils.d.ts +12 -0
  36. package/dist/destinations/hubspot/customEvent/utils.js +278 -0
  37. package/dist/destinations/hubspot/customEvent/utils.js.map +1 -0
  38. package/dist/destinations/hubspot/upsertObject/client.d.ts +11 -0
  39. package/dist/destinations/hubspot/upsertObject/client.js +39 -0
  40. package/dist/destinations/hubspot/upsertObject/client.js.map +1 -0
  41. package/dist/destinations/hubspot/upsertObject/common-fields.js +14 -7
  42. package/dist/destinations/hubspot/upsertObject/common-fields.js.map +1 -1
  43. package/dist/destinations/hubspot/upsertObject/constants.d.ts +1 -0
  44. package/dist/destinations/hubspot/upsertObject/constants.js +2 -1
  45. package/dist/destinations/hubspot/upsertObject/constants.js.map +1 -1
  46. package/dist/destinations/hubspot/upsertObject/dynamic-fields.js.map +1 -1
  47. package/dist/destinations/hubspot/upsertObject/index.js +36 -35
  48. package/dist/destinations/hubspot/upsertObject/index.js.map +1 -1
  49. package/dist/destinations/hubspot/upsertObject/types.d.ts +192 -0
  50. package/dist/destinations/hubspot/upsertObject/types.js +56 -0
  51. package/dist/destinations/hubspot/upsertObject/types.js.map +1 -0
  52. package/dist/destinations/hubspot/upsertObject/utils.d.ts +13 -0
  53. package/dist/destinations/hubspot/upsertObject/utils.js +548 -0
  54. package/dist/destinations/hubspot/upsertObject/utils.js.map +1 -0
  55. package/dist/destinations/linkedin-conversions/index.js +14 -2
  56. package/dist/destinations/linkedin-conversions/index.js.map +1 -1
  57. package/dist/destinations/loops/createOrUpdateContact/generated-types.d.ts +4 -0
  58. package/dist/destinations/loops/createOrUpdateContact/index.js +48 -2
  59. package/dist/destinations/loops/createOrUpdateContact/index.js.map +1 -1
  60. package/package.json +2 -2
  61. package/dist/destinations/hubspot/customEvent/hubspot-api.d.ts +0 -62
  62. package/dist/destinations/hubspot/customEvent/hubspot-api.js +0 -305
  63. package/dist/destinations/hubspot/customEvent/hubspot-api.js.map +0 -1
  64. package/dist/destinations/hubspot/upsertObject/hubspot-api.d.ts +0 -221
  65. package/dist/destinations/hubspot/upsertObject/hubspot-api.js +0 -617
  66. package/dist/destinations/hubspot/upsertObject/hubspot-api.js.map +0 -1
@@ -14,7 +14,7 @@ const action = {
14
14
  },
15
15
  customAttributes: {
16
16
  label: 'Custom Contact Attributes',
17
- description: 'Attributes maintained by your team.',
17
+ description: 'Contact attributes maintained by your team.',
18
18
  type: 'object',
19
19
  required: false,
20
20
  default: { '@path': '$.traits' }
@@ -47,6 +47,40 @@ const action = {
47
47
  required: false,
48
48
  default: { '@path': '$.traits.lastName' }
49
49
  },
50
+ mailingLists: {
51
+ label: 'Mailing Lists',
52
+ description: 'An array of objects containing key-value pairs of mailing list IDs as `listId` and a true/false `subscribed` value determining if the contact should be added to or removed from each list.',
53
+ type: 'object',
54
+ multiple: true,
55
+ required: false,
56
+ properties: {
57
+ listId: {
58
+ label: 'List ID',
59
+ description: 'The ID of the mailing list.',
60
+ type: 'string',
61
+ required: true
62
+ },
63
+ subscribed: {
64
+ label: 'subscribed',
65
+ description: 'true indicates that the user is to be added to the list, false will remove the user from the list.',
66
+ type: 'boolean',
67
+ required: true
68
+ }
69
+ },
70
+ default: {
71
+ '@arrayPath': [
72
+ '$.traits.mailingLists',
73
+ {
74
+ listId: {
75
+ '@path': '$.listId'
76
+ },
77
+ subscribed: {
78
+ '@path': '$.subscribed'
79
+ }
80
+ }
81
+ ]
82
+ }
83
+ },
50
84
  source: {
51
85
  label: 'Source',
52
86
  description: "The contact's source.",
@@ -86,11 +120,23 @@ const action = {
86
120
  },
87
121
  perform: (request, { payload }) => {
88
122
  const { customAttributes, ...rest } = payload;
123
+ const formattedMailingLists = {};
124
+ if (payload.mailingLists) {
125
+ for (const list of Object.values(payload.mailingLists)) {
126
+ if (typeof list === 'object' && 'listId' in list && 'subscribed' in list) {
127
+ formattedMailingLists[list.listId] = list.subscribed;
128
+ }
129
+ }
130
+ }
131
+ if (typeof customAttributes === 'object' && 'mailingLists' in customAttributes) {
132
+ delete customAttributes.mailingLists;
133
+ }
89
134
  return request('https://app.loops.so/api/v1/contacts/update', {
90
135
  method: 'put',
91
136
  json: {
92
137
  ...(typeof customAttributes === 'object' && customAttributes),
93
- ...rest
138
+ ...rest,
139
+ mailingLists: formattedMailingLists
94
140
  }
95
141
  });
96
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/loops/createOrUpdateContact/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,KAAK;SAChB;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,2BAA2B;YAClC,WAAW,EAAE,qCAAqC;YAClD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YAC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IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;QAC7C,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE;gBACJ,GAAG,CAAC,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC;gBAC7D,GAAG,IAAI;aACR;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/loops/createOrUpdateContact/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,KAAK;SAChB;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,2BAA2B;YAClC,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE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AA;SACrC;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE;gBACJ,GAAG,CAAC,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC;gBAC7D,GAAG,IAAI;gBACP,YAAY,EAAE,qBAAqB;aACpC;SACF,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.310.0",
4
+ "version": "3.311.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -87,5 +87,5 @@
87
87
  "__tests__/__helpers__/"
88
88
  ]
89
89
  },
90
- "gitHead": "22db090c387803c5431711bfb62c866e3b594c3a"
90
+ "gitHead": "84ce49918117cca92e2feb2d1cc7b8d6406ccce0"
91
91
  }
@@ -1,62 +0,0 @@
1
- import { RequestClient } from '@segment/actions-core';
2
- import type { Payload } from './generated-types';
3
- export declare type SyncMode = 'upsert' | 'add' | 'update';
4
- declare type StringFormat = 'date' | 'datetime' | 'string';
5
- declare type SegmentPropertyType = 'number' | 'object' | 'boolean' | 'string';
6
- interface SegmentProperty {
7
- type: SegmentPropertyType;
8
- stringFormat?: StringFormat;
9
- }
10
- declare type SchemaMatch = 'full_match' | 'properties_missing' | 'no_match' | 'mismatch';
11
- interface SchemaDiff {
12
- match: SchemaMatch;
13
- fullyQualifiedName?: string;
14
- name?: string;
15
- missingProperties: {
16
- [key: string]: SegmentProperty;
17
- };
18
- }
19
- interface SegmentEventSchema {
20
- eventName: string;
21
- properties: {
22
- [key: string]: SegmentProperty;
23
- };
24
- primaryObject: string;
25
- }
26
- declare type HubspotPropertyType = 'string' | 'number' | 'enumeration' | 'datetime';
27
- interface PropertyRequestJSON {
28
- name: string;
29
- label: string;
30
- type: HubspotPropertyType;
31
- description: string;
32
- options?: Array<{
33
- label: string;
34
- value: boolean;
35
- description: string;
36
- hidden: boolean;
37
- displayOrder: number;
38
- }>;
39
- }
40
- export declare class HubspotClient {
41
- request: RequestClient;
42
- syncMode: SyncMode;
43
- constructor(request: RequestClient, syncMode: SyncMode);
44
- stringFormat(str: string): StringFormat;
45
- sanitizeEventName(str: string): string;
46
- sanitizePropertyName(str: string): string;
47
- sanitizeProperties(properties: {
48
- [k: string]: unknown;
49
- }): {
50
- [k: string]: string | number | boolean;
51
- };
52
- propertyBody(eventName: string, type: SegmentPropertyType, name: string, stringFormat?: StringFormat): PropertyRequestJSON;
53
- segmentSchema(payload: Payload): SegmentEventSchema;
54
- compareSchemaToCache(schema: SegmentEventSchema): Promise<SchemaDiff>;
55
- compareSchemaToHubspot(schema: SegmentEventSchema): Promise<SchemaDiff>;
56
- saveSchemaToCache(fullyQualifiedName: string, name: string, schema: SegmentEventSchema): Promise<void>;
57
- sendEvent(fullyQualifiedName: string, payload: Payload): Promise<import("@segment/actions-core/src").ModifiedResponse<unknown>>;
58
- send(payload: Payload): Promise<import("@segment/actions-core/src").ModifiedResponse<unknown>>;
59
- createHubspotSchema(schema: SegmentEventSchema): Promise<SchemaDiff>;
60
- updateHubspotSchema(fullyQualifiedName: string, schemaDiff: SchemaDiff): Promise<void>;
61
- }
62
- export {};
@@ -1,305 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubspotClient = void 0;
4
- const actions_core_1 = require("@segment/actions-core");
5
- const properties_1 = require("../properties");
6
- class HubspotClient {
7
- constructor(request, syncMode) {
8
- this.request = request;
9
- this.syncMode = syncMode;
10
- }
11
- stringFormat(str) {
12
- const date = new Date(str);
13
- if (isNaN(date.getTime())) {
14
- return 'string';
15
- }
16
- const year = date.getUTCFullYear();
17
- const month = date.getUTCMonth();
18
- const day = date.getUTCDate();
19
- const hours = date.getUTCHours();
20
- const minutes = date.getUTCMinutes();
21
- const seconds = date.getUTCSeconds();
22
- const milliseconds = date.getUTCMilliseconds();
23
- if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) {
24
- const reconstructedDate = new Date(Date.UTC(year, month, day));
25
- if (reconstructedDate.getTime() === date.getTime()) {
26
- return 'date';
27
- }
28
- else {
29
- return 'datetime';
30
- }
31
- }
32
- return 'datetime';
33
- }
34
- sanitizeEventName(str) {
35
- return str.toLowerCase().replace(/[^a-z0-9_-]/g, '_');
36
- }
37
- sanitizePropertyName(str) {
38
- return str.toLowerCase().replace(/[^a-z0-9_]/g, '_');
39
- }
40
- sanitizeProperties(properties) {
41
- const result = {};
42
- Object.keys(properties).forEach((key) => {
43
- const value = properties[key];
44
- const propName = this.sanitizePropertyName(key);
45
- if (!/^[a-z]/.test(propName)) {
46
- throw new actions_core_1.PayloadValidationError(`Property ${key} in event has an invalid name. Property names must start with a letter.`);
47
- }
48
- result[propName] =
49
- typeof value === 'object' && value !== null ? JSON.stringify(value) : value;
50
- });
51
- return result;
52
- }
53
- propertyBody(eventName, type, name, stringFormat) {
54
- switch (type) {
55
- case 'number':
56
- return {
57
- name: name,
58
- label: name,
59
- type: 'number',
60
- description: `${name} - (created by Segment)`
61
- };
62
- case 'object':
63
- return {
64
- name: name,
65
- label: name,
66
- type: 'string',
67
- description: `${name} - (created by Segment)`
68
- };
69
- case 'boolean':
70
- return {
71
- name: name,
72
- label: name,
73
- type: 'enumeration',
74
- description: `${name} - (created by Segment)`,
75
- options: [
76
- {
77
- label: 'true',
78
- value: true,
79
- hidden: false,
80
- description: 'True',
81
- displayOrder: 1
82
- },
83
- {
84
- label: 'false',
85
- value: false,
86
- hidden: false,
87
- description: 'False',
88
- displayOrder: 2
89
- }
90
- ]
91
- };
92
- case 'string':
93
- switch (stringFormat) {
94
- case 'string':
95
- return {
96
- name: name,
97
- label: name,
98
- type: 'string',
99
- description: `${name} - (created by Segment)`
100
- };
101
- case 'date':
102
- case 'datetime':
103
- return {
104
- name: name,
105
- label: name,
106
- type: 'datetime',
107
- description: `${name} - (created by Segment)`
108
- };
109
- case undefined:
110
- default:
111
- throw new actions_core_1.PayloadValidationError(`Property ${name} in event ${eventName} has an unsupported type: ${type}`);
112
- }
113
- default:
114
- throw new actions_core_1.PayloadValidationError(`Property ${name} in event ${eventName} has an unsupported type: ${type}`);
115
- }
116
- }
117
- segmentSchema(payload) {
118
- const { event_name, properties } = payload;
119
- const sanitizedEventName = this.sanitizeEventName(event_name);
120
- const props = {};
121
- if (properties) {
122
- Object.entries(properties).forEach(([property, value]) => {
123
- if (value !== null) {
124
- props[property] = {
125
- type: typeof value,
126
- stringFormat: typeof value === 'string' ? this.stringFormat(value) : undefined
127
- };
128
- }
129
- });
130
- }
131
- return { eventName: sanitizedEventName, primaryObject: payload.record_details.object_type, properties: props };
132
- }
133
- async compareSchemaToCache(schema) {
134
- let data = JSON.stringify(`${schema}`);
135
- data = data.replace(data, '');
136
- console.log(`compared schema to cache: ${data}`);
137
- const schemaDiff = {
138
- match: 'no_match',
139
- missingProperties: {}
140
- };
141
- return Promise.resolve(schemaDiff);
142
- }
143
- async compareSchemaToHubspot(schema) {
144
- const mismatchSchemaDiff = { match: 'mismatch', missingProperties: {} };
145
- try {
146
- const url = `${properties_1.HUBSPOT_BASE_URL}/events/v3/event-definitions/${schema.eventName}/?includeProperties=true`;
147
- const response = await this.request(url, {
148
- method: 'GET',
149
- skipResponseCloning: true
150
- });
151
- const { fullyQualifiedName, name, properties: hsProperties, archived } = response.data;
152
- if (archived) {
153
- return mismatchSchemaDiff;
154
- }
155
- const schemaDiff = { missingProperties: {} };
156
- for (const propName in schema.properties) {
157
- const matchedProperty = hsProperties.find((hsProp) => hsProp.name === propName);
158
- if (matchedProperty?.archived === true) {
159
- return mismatchSchemaDiff;
160
- }
161
- const prop = schema.properties[propName];
162
- if ((['object', 'string', 'boolean'].includes(prop.type) && matchedProperty?.type === 'number') ||
163
- (['datetime', 'string', 'enumeration'].includes(matchedProperty?.type) && prop.type === 'number')) {
164
- return mismatchSchemaDiff;
165
- }
166
- if (!matchedProperty) {
167
- schemaDiff.missingProperties[propName] = schema.properties[propName];
168
- }
169
- }
170
- schemaDiff.match = Object.keys(schemaDiff.missingProperties).length === 0 ? 'full_match' : 'properties_missing';
171
- schemaDiff.fullyQualifiedName = fullyQualifiedName;
172
- schemaDiff.name = name;
173
- return schemaDiff;
174
- }
175
- catch {
176
- return { match: 'no_match', missingProperties: {} };
177
- }
178
- }
179
- async saveSchemaToCache(fullyQualifiedName, name, schema) {
180
- let data = JSON.stringify(`${fullyQualifiedName} ${name} ${schema}`);
181
- data = data.replace(data, '');
182
- console.log(`saved schema to cache: ${data}`);
183
- return;
184
- }
185
- async sendEvent(fullyQualifiedName, payload) {
186
- const { record_details, properties, occurred_at: occurredAt } = payload;
187
- const eventName = fullyQualifiedName;
188
- const url = `${properties_1.HUBSPOT_BASE_URL}/events/v3/send`;
189
- const json = {
190
- eventName,
191
- objectId: record_details.object_id ?? undefined,
192
- email: record_details.email ?? undefined,
193
- utk: record_details.utk ?? undefined,
194
- occurredAt,
195
- properties: properties ? this.sanitizeProperties(properties) : undefined
196
- };
197
- return this.request(url, {
198
- method: 'POST',
199
- json
200
- });
201
- }
202
- async send(payload) {
203
- payload.properties = this.sanitizeProperties(payload.properties ?? {});
204
- const schema = this.segmentSchema(payload);
205
- const cacheSchemaDiff = await this.compareSchemaToCache(schema);
206
- switch (cacheSchemaDiff.match) {
207
- case 'full_match':
208
- return await this.sendEvent(cacheSchemaDiff?.fullyQualifiedName, payload);
209
- case 'mismatch':
210
- throw new actions_core_1.IntegrationError('Cache schema mismatch.', 'CACHE_SCHEMA_MISMATCH', 400);
211
- case 'no_match':
212
- case 'properties_missing': {
213
- const hubspotSchemaDiff = await this.compareSchemaToHubspot(schema);
214
- switch (hubspotSchemaDiff.match) {
215
- case 'full_match': {
216
- const fullyQualifiedName = hubspotSchemaDiff?.fullyQualifiedName;
217
- const name = hubspotSchemaDiff?.name;
218
- await this.saveSchemaToCache(fullyQualifiedName, name, schema);
219
- return await this.sendEvent(fullyQualifiedName, payload);
220
- }
221
- case 'mismatch':
222
- throw new actions_core_1.IntegrationError('Hubspot schema mismatch.', 'HUBSPOT_SCHEMA_MISMATCH', 400);
223
- case 'no_match': {
224
- if (this.syncMode === 'update') {
225
- throw new actions_core_1.IntegrationError(`The 'Sync Mode' setting is set to 'update' which is stopping Segment from creating a new Custom Event Schema in the HubSpot`, 'HUBSPOT_SCHEMA_MISSING', 400);
226
- }
227
- const schemaDiff = await this.createHubspotSchema(schema);
228
- const fullyQualifiedName = schemaDiff?.fullyQualifiedName;
229
- const name = schemaDiff?.name;
230
- await this.saveSchemaToCache(fullyQualifiedName, name, schema);
231
- return await this.sendEvent(fullyQualifiedName, payload);
232
- }
233
- case 'properties_missing': {
234
- if (this.syncMode === 'add') {
235
- throw new actions_core_1.IntegrationError(`The 'Sync Mode' setting is set to 'add' which is stopping Segment from creating a new properties on the Event Schema in the HubSpot`, 'HUBSPOT_SCHEMA_PROPERTIES_MISSING', 400);
236
- }
237
- const fullyQualifiedName = hubspotSchemaDiff?.fullyQualifiedName;
238
- const name = hubspotSchemaDiff?.name;
239
- await this.updateHubspotSchema(fullyQualifiedName, hubspotSchemaDiff);
240
- await this.saveSchemaToCache(fullyQualifiedName, name, schema);
241
- return await this.sendEvent(fullyQualifiedName, payload);
242
- }
243
- }
244
- }
245
- }
246
- }
247
- async createHubspotSchema(schema) {
248
- const json = {
249
- label: schema.eventName,
250
- name: schema.eventName,
251
- description: `${schema.eventName} - (created by Segment)`,
252
- primaryObject: schema.primaryObject,
253
- propertyDefinitions: Object.entries(schema.properties).map(([name, { type, stringFormat }]) => {
254
- return this.propertyBody(schema.eventName, type, name, stringFormat);
255
- })
256
- };
257
- try {
258
- const response = await this.request(`${properties_1.HUBSPOT_BASE_URL}/events/v3/event-definitions`, {
259
- method: 'POST',
260
- json
261
- });
262
- return {
263
- match: 'full_match',
264
- fullyQualifiedName: response.data.fullyQualifiedName,
265
- name: response.data.name
266
- };
267
- }
268
- catch (error) {
269
- const responseError = error;
270
- if (responseError.response.data.category === 'OBJECT_ALREADY_EXISTS') {
271
- throw new actions_core_1.RetryableError();
272
- }
273
- throw new actions_core_1.IntegrationError(`Error creating schema in HubSpot. ${responseError.response.data.message}`, 'HUBSPOT_CREATE_SCHEMA_ERROR', 400);
274
- }
275
- }
276
- async updateHubspotSchema(fullyQualifiedName, schemaDiff) {
277
- const requests = [];
278
- try {
279
- Object.keys(schemaDiff.missingProperties).forEach((propName) => {
280
- const { type, stringFormat } = schemaDiff.missingProperties[propName];
281
- const json = this.propertyBody(schemaDiff?.fullyQualifiedName, type, propName, stringFormat);
282
- const url = `${properties_1.HUBSPOT_BASE_URL}/events/v3/event-definitions/${fullyQualifiedName}/property`;
283
- requests.push(this.request(url, {
284
- method: 'POST',
285
- json
286
- }));
287
- });
288
- const responses = await Promise.allSettled(requests);
289
- for (const response of responses) {
290
- if (response.status === 'rejected') {
291
- const error = response.reason;
292
- if (error.data.propertiesErrorCode !== 'PROPERTY_EXISTS') {
293
- throw new actions_core_1.IntegrationError(`Error updating schema in HubSpot. ${error.data.message || ''} ${error.data.propertiesErrorCode || ''}`, 'HUBSPOT_UPDATE_SCHEMA_ERROR', 400);
294
- }
295
- }
296
- }
297
- }
298
- catch (error) {
299
- const responseError = error;
300
- throw new actions_core_1.IntegrationError(`Error updating schema in HubSpot. ${responseError.code}`, `${responseError.code}`, 400);
301
- }
302
- }
303
- }
304
- exports.HubspotClient = HubspotClient;
305
- //# sourceMappingURL=hubspot-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubspot-api.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/customEvent/hubspot-api.ts"],"names":[],"mappings":";;;AAAA,wDAA+G;AAE/G,8CAAgD;AA8ChD,MAAa,aAAa;IAIxB,YAAY,OAAsB,EAAE,QAAkB;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA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