@segment/action-destinations 3.112.1-alpha.6 → 3.112.1-alpha.8
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.
- package/dist/destinations/hubspot/errors.d.ts +2 -2
- package/dist/destinations/hubspot/errors.js +3 -3
- package/dist/destinations/hubspot/errors.js.map +1 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +1 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertCompany/index.js +1 -1
- package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertContact/index.js +3 -3
- package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +37 -9
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/destinations/hubspot/testHelper.d.ts +0 -7
- package/dist/destinations/hubspot/testHelper.js +0 -24
- package/dist/destinations/hubspot/testHelper.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntegrationError, RetryableError, HTTPError } from '@segment/actions-core';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class HubSpotError extends HTTPError {
|
|
3
3
|
response: Response & {
|
|
4
4
|
data: {
|
|
5
5
|
status: string;
|
|
@@ -14,4 +14,4 @@ export declare const CompanySearchThrowableError: IntegrationError;
|
|
|
14
14
|
export declare const RestrictedPropertyThrowableError: IntegrationError;
|
|
15
15
|
export declare const MultipleCompaniesInSearchResultThrowableError: IntegrationError;
|
|
16
16
|
export declare const SegmentUniqueIdentifierMissingRetryableError: RetryableError;
|
|
17
|
-
export declare function isSegmentUniqueIdentifierPropertyError(error:
|
|
17
|
+
export declare function isSegmentUniqueIdentifierPropertyError(error: HubSpotError, segmentUniqueIdentifierProperty: string): boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSegmentUniqueIdentifierPropertyError = exports.SegmentUniqueIdentifierMissingRetryableError = exports.MultipleCompaniesInSearchResultThrowableError = exports.RestrictedPropertyThrowableError = exports.CompanySearchThrowableError = exports.MissingIdentityCallThrowableError = exports.
|
|
3
|
+
exports.isSegmentUniqueIdentifierPropertyError = exports.SegmentUniqueIdentifierMissingRetryableError = exports.MultipleCompaniesInSearchResultThrowableError = exports.RestrictedPropertyThrowableError = exports.CompanySearchThrowableError = exports.MissingIdentityCallThrowableError = exports.HubSpotError = void 0;
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const properties_1 = require("./properties");
|
|
6
|
-
class
|
|
6
|
+
class HubSpotError extends actions_core_1.HTTPError {
|
|
7
7
|
}
|
|
8
|
-
exports.
|
|
8
|
+
exports.HubSpotError = HubSpotError;
|
|
9
9
|
exports.MissingIdentityCallThrowableError = new actions_core_1.IntegrationError('Identify (Upsert Contact) must be called before Group (Upsert Company) for the HubSpot Cloud (Actions) destination.', 'Missing Identity Call', 400);
|
|
10
10
|
exports.CompanySearchThrowableError = new actions_core_1.IntegrationError('HubSpot returned 400 error while performing a company search. Please check if ’Company Search Fields’ contains valid properties defined in HubSpot.', 'Company Search Failed', 400);
|
|
11
11
|
exports.RestrictedPropertyThrowableError = new actions_core_1.IntegrationError(`Segment uses ’${properties_1.SEGMENT_UNIQUE_IDENTIFIER}’ property internally to map Segment Groups to HubSpot Companies. This property shouldn’t be defined explicitly.`, 'Payload Validation Failed', 400);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/errors.ts"],"names":[],"mappings":";;;AAAA,wDAAmF;AACnF,6CAAwD;AAExD,MAAa,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/errors.ts"],"names":[],"mappings":";;;AAAA,wDA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properties',
|
|
48
|
-
description: 'Default or custom properties that describe the event. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/analytics-tools/create-custom-behavioral-events#add-and-manage-event-properties).',
|
|
48
|
+
description: 'Default or custom properties that describe the event. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/analytics-tools/create-custom-behavioral-events#add-and-manage-event-properties).',
|
|
49
49
|
type: 'object',
|
|
50
50
|
defaultObjectUI: 'keyvalue:only'
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/sendCustomBehavioralEvent/index.ts"],"names":[],"mappings":";;AAEA,8CAAgD;AAYhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,gRAAgR;YAClR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,sFAAsF;YACnG,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,kHAAkH;YACpH,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,GAAG,EAAE;YACH,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,qLAAqL;YACvL,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/sendCustomBehavioralEvent/index.ts"],"names":[],"mappings":";;AAEA,8CAAgD;AAYhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,gRAAgR;YAClR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,sFAAsF;YACnG,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,kHAAkH;YACpH,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,GAAG,EAAE;YACH,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,qLAAqL;YACvL,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,gYAAgY;YAClY,IAAI,EAAE,QAAQ;YACd,eAAe,EAAE,eAAe;SACjC;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,KAAK,GAA0B;YACnC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAA;QACD,OAAO,OAAO,CAAC,GAAG,6BAAgB,iBAAiB,EAAE;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -143,7 +143,7 @@ const action = {
|
|
|
143
143
|
},
|
|
144
144
|
properties: {
|
|
145
145
|
label: 'Other Properties',
|
|
146
|
-
description: `Any other default or custom company properties. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties). Important:
|
|
146
|
+
description: `Any other default or custom company properties. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties). Important: Do not use ’${properties_1.SEGMENT_UNIQUE_IDENTIFIER}’ here as it is an internal property and will result in an an error.`,
|
|
147
147
|
type: 'object',
|
|
148
148
|
defaultObjectUI: 'keyvalue:only',
|
|
149
149
|
allowNull: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot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O,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,sDAAsD;YACnE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,4CAA4C;YACzD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,4PAA4P;YAC9P,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCompany/index.ts"],"names":[],"mappings":";;AAGA,8CAA6F;AAC7F,sCAQkB;AAElB,IAAK,2BAcJ;AAdD,WAAK,2BAA2B;IAC9B,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,kDAAmB,CAAA;IACnB,wCAAS,CAAA;IACT,gDAAiB,CAAA;IACjB,4DAA6B,CAAA;IAC7B,oEAAqC,CAAA;IACrC,gEAAiC,CAAA;IACjC,wEAAyC,CAAA;AAC3C,CAAC,EAdI,2BAA2B,KAA3B,2BAA2B,QAc/B;AAkFD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,oCAAoC,sCAAyB,eAAe;YACzF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YAC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E;QACV,MAAM,KAAK,GAAG,CAAiB,CAAA;QAC/B,IAAI,+CAAsC,CAAC,KAAK,EAAE,sCAAyB,CAAC,EAAE;YAI5E,IAAI;gBAEF,MAAM,qCAAqC,CAAC,OAAO,CAAC,CAAA;aACrD;YAAC,OAAO,CAAC,EAAE;gBAGV,IAAK,CAAe,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE;oBAC9C,MAAM,CAAC,CAAA;iBACR;aACF;YAGD,MAAM,qBAAqB,GAAG,MAAM,qBAAqB,EAAE,CAAA;YAC3D,OAAO,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAA;SACrC;aAAM;YACL,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const properties_1 = require("../properties");
|
|
5
4
|
const action = {
|
|
6
5
|
title: 'Upsert Contact',
|
|
@@ -117,7 +116,7 @@ const action = {
|
|
|
117
116
|
properties: {
|
|
118
117
|
label: 'Other properties',
|
|
119
118
|
type: 'object',
|
|
120
|
-
description: 'Any other default or custom contact properties. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
|
|
119
|
+
description: 'Any other default or custom contact properties. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
|
|
121
120
|
defaultObjectUI: 'keyvalue:only'
|
|
122
121
|
}
|
|
123
122
|
},
|
|
@@ -133,6 +132,7 @@ const action = {
|
|
|
133
132
|
country: payload.country,
|
|
134
133
|
zip: payload.zip,
|
|
135
134
|
email: payload.email,
|
|
135
|
+
website: payload.website,
|
|
136
136
|
lifecyclestage: payload.lifecyclestage?.toLowerCase(),
|
|
137
137
|
...payload.properties
|
|
138
138
|
};
|
|
@@ -150,7 +150,7 @@ const action = {
|
|
|
150
150
|
return response;
|
|
151
151
|
}
|
|
152
152
|
catch (ex) {
|
|
153
|
-
if (ex
|
|
153
|
+
if (ex?.response.status == 404) {
|
|
154
154
|
const result = await createContact(request, contactProperties);
|
|
155
155
|
transactionContext?.setTransaction('contact_id', result.data.id);
|
|
156
156
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertContact/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertContact/index.ts"],"names":[],"mappings":";;AAIA,8CAAgD;AAOhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2NAA2N;YAC7N,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wBAAwB;YACrC,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAkB;aAC5B;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,qBAAqB,EA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,GAAG,6BAAgB,4BAA4B,KAAK,mBAAmB,EAAE;QACvG,MAAM,EAAE,OAAO;QACf,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,GAAG,UAAU;aACd;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
3
|
const properties_1 = require("../properties");
|
|
5
|
-
const hubspotDefinedObjects = ['deals', 'tickets'];
|
|
6
|
-
const customObjectExpression = new RegExp('^[a-zA-Z0-9]+_[a-zA-Z][a-zA-Z0-9_-]+$');
|
|
7
4
|
const action = {
|
|
8
5
|
title: 'Create Custom Object Record',
|
|
9
6
|
description: 'Create records in any HubSpot standard or custom object.',
|
|
10
7
|
fields: {
|
|
11
8
|
objectType: {
|
|
12
9
|
label: 'Object Type',
|
|
13
|
-
description: 'The CRM object schema to use for creating a record. This can be a standard object (i.e. tickets, deals) or ***fullyQualifiedName*** of a custom object. Schema for the Custom Objects must be predefined in HubSpot. More information on Custom Objects and *fullyQualifiedName* in [HubSpot documentation](https://developers.hubspot.com/docs/
|
|
10
|
+
description: 'The CRM object schema to use for creating a record. This can be a standard object (i.e. tickets, deals) or ***fullyQualifiedName*** of a custom object. Schema for the Custom Objects must be predefined in HubSpot. More information on Custom Objects and *fullyQualifiedName* in [HubSpot documentation](https://developers.hubspot.com/docs/api/crm/crm-custom-objects#retrieve-existing-custom-objects).',
|
|
14
11
|
type: 'string',
|
|
15
|
-
required: true
|
|
12
|
+
required: true,
|
|
13
|
+
dynamic: true
|
|
16
14
|
},
|
|
17
15
|
properties: {
|
|
18
16
|
label: 'Properties',
|
|
19
|
-
description: 'Properties to send to HubSpot. Please make sure to include the object’s required properties. Any custom properties must be predefined in HubSpot. More information in [HubSpot documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
|
|
17
|
+
description: 'Properties to send to HubSpot. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Please make sure to include the object’s required properties. Any custom properties must be predefined in HubSpot. More information in [HubSpot documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
|
|
20
18
|
type: 'object',
|
|
21
19
|
required: true,
|
|
22
20
|
defaultObjectUI: 'keyvalue:only',
|
|
23
21
|
allowNull: false
|
|
24
22
|
}
|
|
25
23
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
dynamicFields: {
|
|
25
|
+
objectType: async (request, _) => {
|
|
26
|
+
return getCustomObjects(request);
|
|
29
27
|
}
|
|
28
|
+
},
|
|
29
|
+
perform: async (request, { payload }) => {
|
|
30
30
|
return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/${payload.objectType}`, {
|
|
31
31
|
method: 'POST',
|
|
32
32
|
json: {
|
|
@@ -35,5 +35,33 @@ const action = {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
async function getCustomObjects(request) {
|
|
39
|
+
const defaultChoices = [
|
|
40
|
+
{ value: 'deals', label: 'Deals' },
|
|
41
|
+
{ value: 'tickets', label: 'Tickets' }
|
|
42
|
+
];
|
|
43
|
+
try {
|
|
44
|
+
const response = await request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/schemas?archived=false`, {
|
|
45
|
+
method: 'GET',
|
|
46
|
+
skipResponseCloning: true
|
|
47
|
+
});
|
|
48
|
+
const choices = response.data.results.map((schema) => ({
|
|
49
|
+
label: schema.labels.plural,
|
|
50
|
+
value: schema.fullyQualifiedName
|
|
51
|
+
}));
|
|
52
|
+
return {
|
|
53
|
+
choices: [...choices, ...defaultChoices]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return {
|
|
58
|
+
choices: [],
|
|
59
|
+
error: {
|
|
60
|
+
message: err?.response?.data?.message ?? 'Unknown error',
|
|
61
|
+
code: err?.response?.data?.category ?? 'Unknown code'
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
38
66
|
exports.default = action;
|
|
39
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCustomObjectRecord/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCustomObjectRecord/index.ts"],"names":[],"mappings":";;AAIA,8CAAgD;AAchD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,6BAA6B;IACpC,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,+YAA+Y;YACjZ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,gcAAgc;YAClc,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,eAAe;YAChC,SAAS,EAAE,KAAK;SACjB;KACF;IACD,aAAa,EAAE;QACb,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;YAC/B,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAClC,CAAC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,OAAO,CAAC,GAAG,6BAAgB,mBAAmB,OAAO,CAAC,UAAU,EAAE,EAAE;YACzE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;aACtC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAEpD,MAAM,cAAc,GAAG;QACrB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAClC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;KACvC,CAAA;IAED,IAAI;QAGF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAqB,GAAG,6BAAgB,gCAAgC,EAAE;YACtG,MAAM,EAAE,KAAK;YACb,mBAAmB,EAAE,IAAI;SAC1B,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;YAC3B,KAAK,EAAE,MAAM,CAAC,kBAAkB;SACjC,CAAC,CAAC,CAAA;QACH,OAAO;YACL,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,cAAc,CAAC;SACzC,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO;YACL,OAAO,EAAE,EAAE;YACX,KAAK,EAAE;gBACL,OAAO,EAAG,GAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,eAAe;gBAC1E,IAAI,EAAG,GAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,cAAc;aACxE;SACF,CAAA;KACF;AACH,CAAC;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.112.1-alpha.
|
|
4
|
+
"version": "3.112.1-alpha.8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateValidHubSpotCustomObjectName = void 0;
|
|
4
|
-
const generateHash = (seed) => {
|
|
5
|
-
let i, chr, hash;
|
|
6
|
-
hash = 0;
|
|
7
|
-
if (seed.length === 0)
|
|
8
|
-
return hash;
|
|
9
|
-
for (i = 0; i < seed.length; i++) {
|
|
10
|
-
chr = seed.charCodeAt(i);
|
|
11
|
-
hash = (hash << 5) - hash + chr;
|
|
12
|
-
hash |= 0;
|
|
13
|
-
}
|
|
14
|
-
return Math.abs(hash);
|
|
15
|
-
};
|
|
16
|
-
const generateValidHubSpotCustomObjectName = (seed) => {
|
|
17
|
-
const hash = generateHash(seed);
|
|
18
|
-
return {
|
|
19
|
-
objectType: `p${hash}_Obj${hash}`,
|
|
20
|
-
properties: { testProperty: `testValue-${hash}` }
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
exports.generateValidHubSpotCustomObjectName = generateValidHubSpotCustomObjectName;
|
|
24
|
-
//# sourceMappingURL=testHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testHelper.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/testHelper.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAA;IAChB,IAAI,GAAG,CAAC,CAAA;IAER,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;QAC/B,IAAI,IAAI,CAAC,CAAA;KACV;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO;QACL,UAAU,EAAE,IAAI,IAAI,OAAO,IAAI,EAAE;QACjC,UAAU,EAAE,EAAE,YAAY,EAAE,aAAa,IAAI,EAAE,EAAE;KAClD,CAAA;AACH,CAAC,CAAA;AACQ,oFAAoC"}
|