@dma-sdk/hubspot 1.0.5 → 1.0.7

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 (65) hide show
  1. package/coverage/clover.xml +2 -2
  2. package/coverage/lcov-report/index.html +1 -1
  3. package/dist/constants/api-path.js +1 -0
  4. package/dist/constants/api-path.js.map +1 -0
  5. package/dist/constants/api.js +10 -0
  6. package/dist/constants/api.js.map +1 -0
  7. package/dist/constants/data-types.js +1 -0
  8. package/dist/constants/data-types.js.map +1 -0
  9. package/dist/constants/data.js +27 -0
  10. package/dist/constants/data.js.map +1 -0
  11. package/dist/constants/events.js +13 -0
  12. package/dist/constants/events.js.map +1 -0
  13. package/dist/constants/object-types.js +1 -0
  14. package/dist/constants/object-types.js.map +1 -0
  15. package/dist/constants/objects.js +15 -0
  16. package/dist/constants/objects.js.map +1 -0
  17. package/dist/exceptions/conversion-error.js +1 -0
  18. package/dist/exceptions/conversion-error.js.map +1 -0
  19. package/dist/index.js +4 -2
  20. package/dist/index.js.map +1 -0
  21. package/dist/interfaces/hubspot-type-converter.js +1 -0
  22. package/dist/interfaces/hubspot-type-converter.js.map +1 -0
  23. package/dist/interfaces/input/subscriptions.js +1 -0
  24. package/dist/interfaces/input/subscriptions.js.map +1 -0
  25. package/dist/interfaces/output/subscriptions.js +1 -0
  26. package/dist/interfaces/output/subscriptions.js.map +1 -0
  27. package/dist/interfaces/token.js +1 -0
  28. package/dist/interfaces/token.js.map +1 -0
  29. package/dist/interfaces/user.js +1 -0
  30. package/dist/interfaces/user.js.map +1 -0
  31. package/dist/services/hubspot-service.js +14 -9
  32. package/dist/services/hubspot-service.js.map +1 -0
  33. package/dist/types/auth/hs-signature-data.js +1 -0
  34. package/dist/types/auth/hs-signature-data.js.map +1 -0
  35. package/dist/types/object/contact.js +1 -0
  36. package/dist/types/object/contact.js.map +1 -0
  37. package/dist/utils/type-converter.js +5 -4
  38. package/dist/utils/type-converter.js.map +1 -0
  39. package/jest.config.js +9 -9
  40. package/lib/constants/events.ts +9 -0
  41. package/lib/constants/objects.ts +11 -0
  42. package/lib/index.ts +3 -2
  43. package/lib/interfaces/input/subscriptions.ts +1 -1
  44. package/lib/services/hubspot-service.ts +8 -4
  45. package/lib/utils/type-converter.ts +1 -1
  46. package/package.json +5 -5
  47. package/tsconfig.json +14 -8
  48. package/tsconfig.test.json +7 -0
  49. package/dist/constants/api-path.d.ts +0 -6
  50. package/dist/constants/data-types.d.ts +0 -23
  51. package/dist/constants/object-types.d.ts +0 -1
  52. package/dist/exceptions/conversion-error.d.ts +0 -3
  53. package/dist/index.d.ts +0 -7
  54. package/dist/interfaces/hubspot-type-converter.d.ts +0 -3
  55. package/dist/interfaces/input/subscriptions.d.ts +0 -9
  56. package/dist/interfaces/output/subscriptions.d.ts +0 -8
  57. package/dist/interfaces/token.d.ts +0 -8
  58. package/dist/interfaces/user.d.ts +0 -29
  59. package/dist/services/hubspot-service.d.ts +0 -93
  60. package/dist/types/auth/hs-signature-data.d.ts +0 -11
  61. package/dist/types/object/contact.d.ts +0 -19
  62. package/dist/utils/type-converter.d.ts +0 -2
  63. package/lib/constants/object-types.ts +0 -1
  64. /package/lib/constants/{api-path.ts → api.ts} +0 -0
  65. /package/lib/constants/{data-types.ts → data.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1768926672269" clover="3.2.0">
3
- <project timestamp="1768926672269" name="All files">
2
+ <coverage generated="1769010957935" clover="3.2.0">
3
+ <project timestamp="1769010957935" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2026-01-20T16:31:12.265Z
89
+ at 2026-01-21T15:55:57.931Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -7,3 +7,4 @@ exports.ApiMethods = {
7
7
  createObjectProperties: (objectType) => '/crm/v3/properties/{objectType}/batch/create'.replace('{objectType}', objectType),
8
8
  subscriptions: (appId) => '/webhooks/v3/{appId}/subscriptions'.replace('{appId}', appId),
9
9
  };
10
+ //# sourceMappingURL=api-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-path.js","sourceRoot":"","sources":["../../lib/constants/api-path.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,kBAAkB,EAAE,yBAAyB;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,sBAAsB,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,8CAA8C,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC;IAClI,aAAa,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,oCAAoC,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;CACnG,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiMethods = void 0;
4
+ exports.ApiMethods = {
5
+ getUserInfoByToken: '/oauth/v1/access-tokens',
6
+ refreshToken: '/oauth/v1/token',
7
+ createObjectProperties: (objectType) => '/crm/v3/properties/{objectType}/batch/create'.replace('{objectType}', objectType),
8
+ subscriptions: (appId) => '/webhooks/v3/{appId}/subscriptions'.replace('{appId}', appId),
9
+ };
10
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../lib/constants/api.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,kBAAkB,EAAE,yBAAyB;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,sBAAsB,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,8CAA8C,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC;IAClI,aAAa,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,oCAAoC,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;CACnG,CAAA"}
@@ -24,3 +24,4 @@ exports.HsDataTypes = {
24
24
  ip_address: "ip_address",
25
25
  video: "video"
26
26
  };
27
+ //# sourceMappingURL=data-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-types.js","sourceRoot":"","sources":["../../lib/constants/data-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACvB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,aAAa;IAC5B,eAAe,EAAE,aAAa;IAC9B,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,sBAAsB;IACnC,YAAY,EAAE,cAAc;IAC5B,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;CACjB,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HsDataTypes = void 0;
4
+ exports.HsDataTypes = {
5
+ string: "string",
6
+ number: "number",
7
+ boolean: "bool",
8
+ date: "date",
9
+ datetime: "datetime",
10
+ single_select: "enumeration",
11
+ multiple_select: "enumeration",
12
+ checkbox: "bool",
13
+ calculation: "calculation_equation",
14
+ phone_number: "phone_number",
15
+ user: "hubspot_user",
16
+ file: "file",
17
+ score: "score",
18
+ currency: "currency",
19
+ rich_text: "rich_text",
20
+ owner: "owner",
21
+ location: "location",
22
+ json: "json",
23
+ percentage: "number",
24
+ ip_address: "ip_address",
25
+ video: "video"
26
+ };
27
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../lib/constants/data.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACvB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,aAAa;IAC5B,eAAe,EAAE,aAAa;IAC9B,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,sBAAsB;IACnC,YAAY,EAAE,cAAc;IAC5B,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;CACjB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HsEventTypes = void 0;
4
+ exports.HsEventTypes = {
5
+ creation: "creation",
6
+ deletion: "deletion",
7
+ propertyChange: "propertyChange",
8
+ associationChange: "associationChange",
9
+ merge: "merge",
10
+ restore: "restore",
11
+ newMessage: "newMessage"
12
+ };
13
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../lib/constants/events.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IACxB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;CAC3B,CAAA"}
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HsObjectTypes = void 0;
4
4
  exports.HsObjectTypes = {};
5
+ //# sourceMappingURL=object-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-types.js","sourceRoot":"","sources":["../../lib/constants/object-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HsObjectTypes = void 0;
4
+ exports.HsObjectTypes = {
5
+ contact: "contact",
6
+ ticket: "ticket",
7
+ product: "product",
8
+ line_item: "line_item",
9
+ object: "object",
10
+ conversation: "conversation",
11
+ deal: "deal",
12
+ company: "company",
13
+ event: "event"
14
+ };
15
+ //# sourceMappingURL=objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.js","sourceRoot":"","sources":["../../lib/constants/objects.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;IAC5B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACjB,CAAA"}
@@ -8,3 +8,4 @@ class ConversionError extends Error {
8
8
  }
9
9
  }
10
10
  exports.ConversionError = ConversionError;
11
+ //# sourceMappingURL=conversion-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-error.js","sourceRoot":"","sources":["../../lib/exceptions/conversion-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;IACtC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAClC,CAAC;CACJ;AALD,0CAKC"}
package/dist/index.js CHANGED
@@ -15,9 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./services/hubspot-service"), exports);
18
- __exportStar(require("./constants/data-types"), exports);
19
- __exportStar(require("./constants/object-types"), exports);
18
+ __exportStar(require("./constants/data"), exports);
19
+ __exportStar(require("./constants/objects"), exports);
20
+ __exportStar(require("./constants/events"), exports);
20
21
  __exportStar(require("./interfaces/input/subscriptions"), exports);
21
22
  __exportStar(require("./interfaces/output/subscriptions"), exports);
22
23
  __exportStar(require("./types/auth/hs-signature-data"), exports);
23
24
  __exportStar(require("./exceptions/conversion-error"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,mDAAiC;AACjC,sDAAoC;AACpC,qDAAmC;AACnC,mEAAiD;AACjD,oEAAkD;AAClD,iEAA+C;AAC/C,gEAA8C"}
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  ;
4
+ //# sourceMappingURL=hubspot-type-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubspot-type-converter.js","sourceRoot":"","sources":["../../lib/interfaces/hubspot-type-converter.ts"],"names":[],"mappings":";;AAGC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../lib/interfaces/input/subscriptions.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../lib/interfaces/output/subscriptions.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.js","sourceRoot":"","sources":["../../lib/interfaces/token.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../lib/interfaces/user.ts"],"names":[],"mappings":""}
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HubspotService = void 0;
4
4
  const api_client_1 = require("@hubspot/api-client");
5
5
  const type_converter_1 = require("../utils/type-converter");
6
- const data_types_1 = require("../constants/data-types");
6
+ const data_1 = require("../constants/data");
7
7
  const api_client_2 = require("@hubspot/api-client");
8
- const fetch_1 = require("@dma-sdk/utils/lib/fetch");
9
- const api_path_1 = require("../constants/api-path");
8
+ const utils_1 = require("@dma-sdk/utils");
9
+ const api_1 = require("../constants/api");
10
10
  // Per ogni metodo che viene creato, è fondamentale che
11
11
  // il client venga inizializzato con il token di accesso o l'api key
12
12
  // altrimenti non funzionerà correttamente.
@@ -25,7 +25,7 @@ class HubspotService {
25
25
  async getUserInfoByToken(accessToken) {
26
26
  const response = await this.client.apiRequest({
27
27
  method: 'GET',
28
- path: `${api_path_1.ApiMethods.getUserInfoByToken}/${accessToken}`,
28
+ path: `${api_1.ApiMethods.getUserInfoByToken}/${accessToken}`,
29
29
  });
30
30
  const jsonBody = await response.json();
31
31
  const userAttributes = {
@@ -143,7 +143,7 @@ class HubspotService {
143
143
  inputs: properties
144
144
  })
145
145
  };
146
- const response = await this.fetchApi(api_path_1.ApiMethods.createObjectProperties(objectType), options);
146
+ const response = await this.fetchApi(api_1.ApiMethods.createObjectProperties(objectType), options);
147
147
  return await response.json();
148
148
  }
149
149
  async createPropertyGroup(objectType, group, accessToken) {
@@ -172,13 +172,17 @@ class HubspotService {
172
172
  headers: {
173
173
  'Content-Type': 'application/json'
174
174
  },
175
- body: JSON.stringify(event)
175
+ body: JSON.stringify({
176
+ active: event.active,
177
+ eventType: `${event.objectType}.${event.eventType}`,
178
+ propertyName: event.propertyName
179
+ })
176
180
  };
177
- const response = await this.fetchApi(api_path_1.ApiMethods.subscriptions(appId), options, { hapikey: devApiKey });
181
+ const response = await this.fetchApi(api_1.ApiMethods.subscriptions(appId), options, { hapikey: devApiKey });
178
182
  return await response.json();
179
183
  }
180
184
  async fetchApi(endpoint, options, queryParams) {
181
- return await (0, fetch_1.fetchApi)(HubspotService.HS_BASE_URL, endpoint, options, queryParams);
185
+ return await (0, utils_1.fetchApi)(HubspotService.HS_BASE_URL, endpoint, options, queryParams);
182
186
  }
183
187
  }
184
188
  exports.HubspotService = HubspotService;
@@ -187,4 +191,5 @@ HubspotService.hubspotObjectType = {
187
191
  contacts: 'contacts',
188
192
  notes: 'notes',
189
193
  };
190
- HubspotService.hubspotPropertyTypes = data_types_1.HsDataTypes;
194
+ HubspotService.hubspotPropertyTypes = data_1.HsDataTypes;
195
+ //# sourceMappingURL=hubspot-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubspot-service.js","sourceRoot":"","sources":["../../lib/services/hubspot-service.ts"],"names":[],"mappings":";;;AAAA,oDAA6D;AAO7D,4DAAuD;AAEvD,4CAA+C;AAC/C,oDAA+C;AAI/C,0CAAyC;AACzC,0CAA6C;AAI7C,uDAAuD;AACvD,oEAAoE;AACpE,2CAA2C;AAE3C,MAA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AC,UAGpC;QACG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,YAAY,CAAA;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QAEtC,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,SAAS,EAAE,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,EAAE;gBACnD,YAAY,EAAE,KAAK,CAAC,YAAY;aACnC,CAAC;SACL,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAChC,gBAAU,CAAC,aAAa,CAAC,KAAK,CAAC,EAC/B,OAAO,EACP,EAAE,OAAO,EAAE,SAAS,EAAE,CACzB,CAAA;QAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAChC,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,OAAW,EAAE,WAAgB;QAClE,OAAO,MAAM,IAAA,gBAAQ,EAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IACrF,CAAC;;AAnTL,wCAoTC;AAnTiB,0BAAW,GAAG,wBAAwB,CAAA;AAC7B,gCAAiB,GAAG;IACvC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACjB,CAAA;AACsB,mCAAoB,GAAG,kBAAW,CAAA"}
@@ -11,3 +11,4 @@ exports.hubspotSignatureDataSchema = zod_1.z.object({
11
11
  body: zod_1.z.string(),
12
12
  qs: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
13
13
  });
14
+ //# sourceMappingURL=hs-signature-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hs-signature-data.js","sourceRoot":"","sources":["../../../lib/types/auth/hs-signature-data.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE;IAC5B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAA"}
@@ -19,3 +19,4 @@ exports.contactWithPropsTypeSchema = exports.contactSchema
19
19
  .omit({
20
20
  properties: true
21
21
  });
22
+ //# sourceMappingURL=contact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact.js","sourceRoot":"","sources":["../../../lib/types/object/contact.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE;IACnB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC;IACzC,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAGU,QAAA,0BAA0B,GAAG,qBAAa;KAClD,MAAM,CAAC;IACJ,mBAAmB,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC;QAC/C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/B,CAAC,CAAC;CACN,CAAC;KACD,IAAI,CAAC;IACF,UAAU,EAAE,IAAI;CACnB,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.typeConverter = void 0;
4
- const data_types_1 = require("../constants/data-types");
4
+ const data_1 = require("../constants/data");
5
5
  const conversion_error_1 = require("../exceptions/conversion-error");
6
6
  exports.typeConverter = {
7
- [data_types_1.HsDataTypes.date]: (data) => {
7
+ [data_1.HsDataTypes.date]: (data) => {
8
8
  if (typeof data !== "string") {
9
9
  throw new conversion_error_1.ConversionError(`Invalid date value type: ${typeof data}`);
10
10
  }
@@ -14,7 +14,7 @@ exports.typeConverter = {
14
14
  }
15
15
  return timestamp;
16
16
  },
17
- [data_types_1.HsDataTypes.datetime]: (data) => {
17
+ [data_1.HsDataTypes.datetime]: (data) => {
18
18
  if (typeof data !== "string") {
19
19
  throw new conversion_error_1.ConversionError(`Invalid datetime value type: ${typeof data}`);
20
20
  }
@@ -24,10 +24,11 @@ exports.typeConverter = {
24
24
  }
25
25
  return timestamp;
26
26
  },
27
- [data_types_1.HsDataTypes.number]: (data) => {
27
+ [data_1.HsDataTypes.number]: (data) => {
28
28
  if (Number.isNaN(data)) {
29
29
  throw new conversion_error_1.ConversionError(`Invalid number value type: ${typeof data}`);
30
30
  }
31
31
  return parseFloat(data.toString());
32
32
  }
33
33
  };
34
+ //# sourceMappingURL=type-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-converter.js","sourceRoot":"","sources":["../../lib/utils/type-converter.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAEhD,qEAAiE;AAEpD,QAAA,aAAa,GAAyB;IAC/C,CAAC,kBAAW,CAAC,IAAI,CAAC,EACd,CAAC,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31 +2,31 @@ module.exports = {
2
2
  preset: 'ts-jest',
3
3
  globals: {
4
4
  'ts-jest': {
5
- tsconfig: 'tsconfig.json'
5
+ tsconfig: 'tsconfig.test.json'
6
6
  },
7
7
  },
8
8
  moduleNameMapper: {
9
- '^@/(.*)$': '<rootDir>/src/$1',
9
+ '^@/(.*)$': '<rootDir>/lib/$1',
10
10
  '^@test/(.*)$': '<rootDir>/__test__/$1',
11
11
  },
12
12
  testEnvironment: 'node',
13
13
  transform: {
14
14
  '^.+\\.ts?$': 'ts-jest',
15
15
  },
16
- setupFiles: ['<rootDir>/__tests__/.jest/setEnvVars.js'],
16
+ setupFiles: ['<rootDir>/__tests__/.jest/set-env-vars.js'],
17
17
  transformIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/mock/'],
18
18
  testPathIgnorePatterns: [
19
19
  '<rootDir>/mock/',
20
20
  "<rootDir>/dist/",
21
- "<rootDir>/src/",
21
+ "<rootDir>/lib/",
22
22
  "<rootDir>/__tests__/utils/mockers"
23
23
  ],
24
24
  coveragePathIgnorePatterns: [
25
- "<rootDir>/src/exceptions/",
26
- "<rootDir>/src/types/",
27
- "<rootDir>/src/constants/",
28
- "<rootDir>/src/interfaces/",
29
- "<rootDir>/src/index.ts",
25
+ "<rootDir>/lib/exceptions/",
26
+ "<rootDir>/lib/types/",
27
+ "<rootDir>/lib/constants/",
28
+ "<rootDir>/lib/interfaces/",
29
+ "<rootDir>/lib/index.ts",
30
30
  "<rootDir>/dist/",
31
31
  ]
32
32
  }
@@ -0,0 +1,9 @@
1
+ export const HsEventTypes = {
2
+ creation: "creation",
3
+ deletion: "deletion",
4
+ propertyChange: "propertyChange",
5
+ associationChange: "associationChange",
6
+ merge: "merge",
7
+ restore: "restore",
8
+ newMessage: "newMessage"
9
+ }
@@ -0,0 +1,11 @@
1
+ export const HsObjectTypes = {
2
+ contact: "contact",
3
+ ticket: "ticket",
4
+ product: "product",
5
+ line_item: "line_item",
6
+ object: "object",
7
+ conversation: "conversation",
8
+ deal: "deal",
9
+ company: "company",
10
+ event: "event"
11
+ }
package/lib/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './services/hubspot-service';
2
- export * from './constants/data-types';
3
- export * from './constants/object-types';
2
+ export * from './constants/data';
3
+ export * from './constants/objects';
4
+ export * from './constants/events';
4
5
  export * from './interfaces/input/subscriptions';
5
6
  export * from './interfaces/output/subscriptions';
6
7
  export * from './types/auth/hs-signature-data';
@@ -4,6 +4,6 @@ export interface CreateSubscriptionInput {
4
4
  objectType: string,
5
5
  eventType: string,
6
6
  propertyName?: string,
7
- activate: boolean
7
+ active: boolean
8
8
  }
9
9
  }
@@ -7,13 +7,13 @@ import { LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/ass
7
7
  import { TokenResponseIF } from '@hubspot/api-client/lib/codegen/oauth'
8
8
  import { typeConverter } from '../utils/type-converter'
9
9
  import { HubspotTypeConverter } from '../interfaces/hubspot-type-converter'
10
- import { HsDataTypes } from '../constants/data-types'
10
+ import { HsDataTypes } from '../constants/data'
11
11
  import { Signature } from '@hubspot/api-client'
12
12
  import { TokenResponse } from '../interfaces/token'
13
13
  import { CollectionResponsePropertyNoPaging, PropertyCreate, PropertyGroup, PropertyGroupCreate } from '@hubspot/api-client/lib/codegen/crm/properties'
14
14
  import { HubspotSignatureData } from '../types/auth/hs-signature-data'
15
- import { fetchApi } from '@dma-sdk/utils/lib/fetch'
16
- import { ApiMethods } from '../constants/api-path'
15
+ import { fetchApi } from '@dma-sdk/utils'
16
+ import { ApiMethods } from '../constants/api'
17
17
  import { CreateSubscriptionInput } from '../interfaces/input/subscriptions'
18
18
  import { CreateSubscriptionOutput } from '../interfaces/output/subscriptions'
19
19
 
@@ -310,7 +310,11 @@ export class HubspotService {
310
310
  headers: {
311
311
  'Content-Type': 'application/json'
312
312
  },
313
- body: JSON.stringify(event)
313
+ body: JSON.stringify({
314
+ active: event.active,
315
+ eventType: `${event.objectType}.${event.eventType}`,
316
+ propertyName: event.propertyName
317
+ })
314
318
  };
315
319
 
316
320
  const response = await this.fetchApi(
@@ -1,4 +1,4 @@
1
- import { HsDataTypes } from "../constants/data-types";
1
+ import { HsDataTypes } from "../constants/data";
2
2
  import { HubspotTypeConverter } from "../interfaces/hubspot-type-converter";
3
3
  import { ConversionError } from "../exceptions/conversion-error";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dma-sdk/hubspot",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "DMA SDK – Hubspot service",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,12 +12,12 @@
12
12
  "dependencies": {
13
13
  "@dma-sdk/utils": "^1.0.4",
14
14
  "@hubspot/api-client": "^13.4.0",
15
- "jest": "^30.2.0",
16
- "ts-jest": "^29.4.6",
17
15
  "zod": "^4.3.5"
18
16
  },
19
17
  "devDependencies": {
20
- "@types/jest": "^30.0.0",
21
- "typescript": "^5.2.0"
18
+ "typescript": "^5.2.0",
19
+ "ts-jest": "^29.2.5",
20
+ "jest": "^29.7.0",
21
+ "@types/jest": "^29.5.13"
22
22
  }
23
23
  }
package/tsconfig.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "CommonJS",
5
- "declaration": true,
6
- "outDir": "dist",
7
- "rootDir": "lib",
8
- "strict": true,
9
- "esModuleInterop": true
3
+ "module": "Node16",
4
+ "esModuleInterop": true,
5
+ "target": "es2021",
6
+ "moduleResolution": "node16",
7
+ "sourceMap": true,
8
+ "outDir": "dist",
9
+ "rootDir": "lib",
10
+ "resolveJsonModule": true,
11
+ "experimentalDecorators": true,
12
+ "emitDecoratorMetadata": true,
13
+ "strict": true,
14
+ "strictPropertyInitialization": false
10
15
  },
11
- "include": [ "lib" ]
16
+ "exclude": ["node_modules", "__tests__", "prisma"],
17
+ "include": ["lib"]
12
18
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["jest", "node"]
5
+ },
6
+ "include": [ "__tests__/**/*.ts" ]
7
+ }
@@ -1,6 +0,0 @@
1
- export declare const ApiMethods: {
2
- getUserInfoByToken: string;
3
- refreshToken: string;
4
- createObjectProperties: (objectType: string) => string;
5
- subscriptions: (appId: string) => string;
6
- };
@@ -1,23 +0,0 @@
1
- export declare const HsDataTypes: {
2
- string: string;
3
- number: string;
4
- boolean: string;
5
- date: string;
6
- datetime: string;
7
- single_select: string;
8
- multiple_select: string;
9
- checkbox: string;
10
- calculation: string;
11
- phone_number: string;
12
- user: string;
13
- file: string;
14
- score: string;
15
- currency: string;
16
- rich_text: string;
17
- owner: string;
18
- location: string;
19
- json: string;
20
- percentage: string;
21
- ip_address: string;
22
- video: string;
23
- };
@@ -1 +0,0 @@
1
- export declare const HsObjectTypes: {};
@@ -1,3 +0,0 @@
1
- export declare class ConversionError extends Error {
2
- constructor(message: string);
3
- }
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './services/hubspot-service';
2
- export * from './constants/data-types';
3
- export * from './constants/object-types';
4
- export * from './interfaces/input/subscriptions';
5
- export * from './interfaces/output/subscriptions';
6
- export * from './types/auth/hs-signature-data';
7
- export * from './exceptions/conversion-error';
@@ -1,3 +0,0 @@
1
- export interface HubspotTypeConverter {
2
- [key: string]: (data: any) => any;
3
- }
@@ -1,9 +0,0 @@
1
- export interface CreateSubscriptionInput {
2
- appId: string;
3
- event: {
4
- objectType: string;
5
- eventType: string;
6
- propertyName?: string;
7
- activate: boolean;
8
- };
9
- }
@@ -1,8 +0,0 @@
1
- export interface CreateSubscriptionOutput {
2
- active: boolean;
3
- createdAt: number;
4
- eventType: string;
5
- id: string;
6
- propertyName: string;
7
- updatedAt: string;
8
- }
@@ -1,8 +0,0 @@
1
- export interface TokenResponse {
2
- accessToken: string;
3
- expiresIn: number;
4
- hubId?: string;
5
- refreshToken: string;
6
- scopes?: string;
7
- tokenType: string;
8
- }
@@ -1,29 +0,0 @@
1
- export interface HubspotUser {
2
- token: string;
3
- user: string;
4
- hubDomain: string;
5
- scopes: string[];
6
- hubId: string;
7
- appId: number;
8
- expiresIn: number;
9
- userId: number;
10
- tokenType: string;
11
- signedAccessToken: string;
12
- }
13
- export interface HubspotFetchUser {
14
- hubId: string;
15
- email: string;
16
- userId: number;
17
- }
18
- export interface ContextHubspotUser {
19
- token: string;
20
- user: string;
21
- hubDomain: string;
22
- scopes: string[];
23
- hubId: string;
24
- appId: number;
25
- expiresIn: number;
26
- userId: number;
27
- tokenType: string;
28
- signedAccessToken: string;
29
- }
@@ -1,93 +0,0 @@
1
- import { HubspotUser } from '../interfaces/user';
2
- import { Configuration, Filter } from '@hubspot/api-client/lib/codegen/crm/objects';
3
- import { SimplePublicObjectInputForCreate } from '@hubspot/api-client/lib/codegen/crm/objects/taxes/models/all';
4
- import { SimplePublicObject } from '@hubspot/api-client/lib/codegen/crm/objects/tasks/models/all';
5
- import { LabelsBetweenObjectPair } from '@hubspot/api-client/lib/codegen/crm/associations/v4';
6
- import { TokenResponseIF } from '@hubspot/api-client/lib/codegen/oauth';
7
- import { TokenResponse } from '../interfaces/token';
8
- import { CollectionResponsePropertyNoPaging, PropertyCreate, PropertyGroup, PropertyGroupCreate } from '@hubspot/api-client/lib/codegen/crm/properties';
9
- import { HubspotSignatureData } from '../types/auth/hs-signature-data';
10
- import { CreateSubscriptionInput } from '../interfaces/input/subscriptions';
11
- import { CreateSubscriptionOutput } from '../interfaces/output/subscriptions';
12
- export declare class HubspotService {
13
- static HS_BASE_URL: string;
14
- static readonly hubspotObjectType: {
15
- contacts: string;
16
- notes: string;
17
- };
18
- static readonly hubspotPropertyTypes: {
19
- string: string;
20
- number: string;
21
- boolean: string;
22
- date: string;
23
- datetime: string;
24
- single_select: string;
25
- multiple_select: string;
26
- checkbox: string;
27
- calculation: string;
28
- phone_number: string;
29
- user: string;
30
- file: string;
31
- score: string;
32
- currency: string;
33
- rich_text: string;
34
- owner: string;
35
- location: string;
36
- json: string;
37
- percentage: string;
38
- ip_address: string;
39
- video: string;
40
- };
41
- private client;
42
- private hsRedirectUriOauth;
43
- private hsClientId;
44
- private hsClientSecret;
45
- private typeConvert;
46
- constructor(hsRedirectUriOauth: string, hsClientId: string, hsClientSecret: string);
47
- exchangeCodeForTokens(params: {
48
- code: string;
49
- }): Promise<TokenResponseIF>;
50
- getUserInfoByToken(accessToken: string): Promise<HubspotUser>;
51
- verifyFetchReqSignature(params: {
52
- version: string;
53
- data: HubspotSignatureData;
54
- }): Promise<boolean>;
55
- refreshAccessToken(refreshToken: string): Promise<TokenResponse>;
56
- listObjectProperties(params: {
57
- objectType: string;
58
- types?: string[];
59
- accessToken?: string;
60
- }): Promise<CollectionResponsePropertyNoPaging>;
61
- listObjects(objectType: string, filters: Filter[], accessToken: string): Promise<SimplePublicObject[] | null>;
62
- createObject(objectType: string, properties: SimplePublicObjectInputForCreate, accessToken: string): Promise<SimplePublicObject | {
63
- id: string;
64
- }>;
65
- getObject(objectType: string, objectId: string, accessToken: string): Promise<SimplePublicObject>;
66
- getObjectProps(objectType: string, objectId: string, props: string[], // nome delle props da restituire
67
- accessToken: string): Promise<SimplePublicObject>;
68
- getObjectWithPropsType(objectType: string, objectId: string, accessToken: string, types?: string[]): Promise<SimplePublicObject & {
69
- propertiesWithTypes: {
70
- [key: string]: {
71
- type: string;
72
- label: string;
73
- value: string | null;
74
- };
75
- };
76
- }>;
77
- updateObject(objectType: string, objectId: string, properties: {
78
- [key: string]: string;
79
- }, accessToken: string, options?: Configuration): Promise<SimplePublicObject>;
80
- associateObjects(objectTypeFirst: string, objectTypeSecond: string, objectIdFirst: string, objectIdSecond: string, accessToken: string): Promise<LabelsBetweenObjectPair>;
81
- createObjectProperties(objectType: string, properties: PropertyCreate[], accessToken: string): Promise<any>;
82
- createPropertyGroup(objectType: string, group: PropertyGroupCreate, accessToken: string): Promise<PropertyGroup>;
83
- convertPropertyValues(properties: {
84
- [key: string]: any;
85
- }, convertionMap: {
86
- [propertyName: string]: PropertyCreate;
87
- }): Record<string, any>;
88
- createEventSubscription(properties: {
89
- commandInput: CreateSubscriptionInput;
90
- devApiKey: string;
91
- }): Promise<CreateSubscriptionOutput>;
92
- private fetchApi;
93
- }
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const hubspotSignatureDataSchema: z.ZodObject<{
3
- signature: z.ZodString;
4
- timestamp: z.ZodCoercedNumber<unknown>;
5
- domainName: z.ZodString;
6
- path: z.ZodString;
7
- httpMethod: z.ZodString;
8
- body: z.ZodString;
9
- qs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10
- }, z.core.$strip>;
11
- export type HubspotSignatureData = z.infer<typeof hubspotSignatureDataSchema>;
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const contactSchema: z.ZodObject<{
3
- createdAt: z.ZodDate;
4
- id: z.ZodString;
5
- properties: z.ZodRecord<z.ZodString, z.ZodAny>;
6
- updatedAt: z.ZodOptional<z.ZodDate>;
7
- }, z.core.$strip>;
8
- export declare const contactWithPropsTypeSchema: z.ZodObject<{
9
- id: z.ZodString;
10
- propertiesWithTypes: z.ZodRecord<z.ZodString, z.ZodObject<{
11
- type: z.ZodString;
12
- label: z.ZodString;
13
- value: z.ZodNullable<z.ZodString>;
14
- }, z.core.$strip>>;
15
- createdAt: z.ZodDate;
16
- updatedAt: z.ZodOptional<z.ZodDate>;
17
- }, z.core.$strip>;
18
- export type ContactGet = z.infer<typeof contactSchema>;
19
- export type ContactWithPropsTypeGet = z.infer<typeof contactWithPropsTypeSchema>;
@@ -1,2 +0,0 @@
1
- import { HubspotTypeConverter } from "../interfaces/hubspot-type-converter";
2
- export declare const typeConverter: HubspotTypeConverter;
@@ -1 +0,0 @@
1
- export const HsObjectTypes = {}
File without changes
File without changes