@dma-sdk/hubspot 1.0.14 → 1.0.16

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.
@@ -4,5 +4,5 @@ export interface AssociateObjectInput {
4
4
  objectTypeSecond: string;
5
5
  objectIdFirst: string;
6
6
  objectIdSecond: string;
7
- options: AssociationSpec[];
7
+ options?: AssociationSpec[];
8
8
  }
@@ -123,7 +123,7 @@ class HubspotService {
123
123
  async associateObjects(commandInput, accessToken) {
124
124
  this.client.setAccessToken(accessToken);
125
125
  const { objectTypeFirst, objectTypeSecond, objectIdFirst, objectIdSecond, options } = commandInput;
126
- const response = await this.client.crm.associations.v4.basicApi.create(objectTypeFirst, objectIdFirst, objectTypeSecond, objectIdSecond, options);
126
+ const response = await this.client.crm.associations.v4.basicApi.create(objectTypeFirst, objectIdFirst, objectTypeSecond, objectIdSecond, options || []);
127
127
  return response;
128
128
  }
129
129
  async createObjectProperties(objectType, properties, accessToken) {
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ export declare const subscriptionEventSchema: z.ZodObject<{
3
+ eventId: z.ZodNumber;
4
+ subscriptionId: z.ZodOptional<z.ZodNumber>;
5
+ portalId: z.ZodOptional<z.ZodNumber>;
6
+ appId: z.ZodNumber;
7
+ occurredAt: z.ZodOptional<z.ZodNumber>;
8
+ subscriptionType: z.ZodString;
9
+ attemptNumber: z.ZodOptional<z.ZodNumber>;
10
+ objectId: z.ZodNumber;
11
+ propertyName: z.ZodOptional<z.ZodString>;
12
+ propertyValue: z.ZodOptional<z.ZodString>;
13
+ changeSource: z.ZodOptional<z.ZodString>;
14
+ changeFlag: z.ZodOptional<z.ZodString>;
15
+ sourceId: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ export declare const subscriptionEventListSchema: z.ZodArray<z.ZodObject<{
18
+ eventId: z.ZodNumber;
19
+ subscriptionId: z.ZodOptional<z.ZodNumber>;
20
+ portalId: z.ZodOptional<z.ZodNumber>;
21
+ appId: z.ZodNumber;
22
+ occurredAt: z.ZodOptional<z.ZodNumber>;
23
+ subscriptionType: z.ZodString;
24
+ attemptNumber: z.ZodOptional<z.ZodNumber>;
25
+ objectId: z.ZodNumber;
26
+ propertyName: z.ZodOptional<z.ZodString>;
27
+ propertyValue: z.ZodOptional<z.ZodString>;
28
+ changeSource: z.ZodOptional<z.ZodString>;
29
+ changeFlag: z.ZodOptional<z.ZodString>;
30
+ sourceId: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>;
32
+ export type SubscriptionEvent = z.infer<typeof subscriptionEventSchema>;
33
+ export type SubscriptionEventList = z.infer<typeof subscriptionEventListSchema>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscriptionEventListSchema = exports.subscriptionEventSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.subscriptionEventSchema = zod_1.z.object({
6
+ eventId: zod_1.z.number(),
7
+ subscriptionId: zod_1.z.number().optional(),
8
+ portalId: zod_1.z.number().optional(),
9
+ appId: zod_1.z.number(),
10
+ occurredAt: zod_1.z.number().optional(),
11
+ subscriptionType: zod_1.z.string(),
12
+ attemptNumber: zod_1.z.number().optional(),
13
+ objectId: zod_1.z.number(),
14
+ propertyName: zod_1.z.string().optional(),
15
+ propertyValue: zod_1.z.string().optional(),
16
+ changeSource: zod_1.z.string().optional(),
17
+ changeFlag: zod_1.z.string().optional(),
18
+ sourceId: zod_1.z.string().optional(),
19
+ });
20
+ exports.subscriptionEventListSchema = zod_1.z.array(exports.subscriptionEventSchema);
@@ -21,7 +21,7 @@ AuthUtils.extractHubSpotSignatureComponentsFromEvent = (params) => {
21
21
  qs: qs || {},
22
22
  body: body ?? '',
23
23
  };
24
- return utils_1.ValidationUtils.parse(input, hs_signature_data_1.hubspotSignatureDataSchema);
24
+ return utils_1.ValidationUtils.parseData(input, hs_signature_data_1.hubspotSignatureDataSchema);
25
25
  };
26
26
  AuthUtils.isHubSpotSignatureValid = async (params) => {
27
27
  try {
@@ -5,5 +5,5 @@ export interface AssociateObjectInput {
5
5
  objectTypeSecond: string,
6
6
  objectIdFirst: string,
7
7
  objectIdSecond: string,
8
- options: AssociationSpec[]
8
+ options?: AssociationSpec[]
9
9
  }
@@ -238,7 +238,7 @@ export class HubspotService {
238
238
  objectIdFirst,
239
239
  objectTypeSecond,
240
240
  objectIdSecond,
241
- options
241
+ options || []
242
242
  )
243
243
 
244
244
  return response
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+
3
+ export const subscriptionEventSchema = z.object({
4
+ eventId: z.number(),
5
+ subscriptionId: z.number().optional(),
6
+ portalId: z.number().optional(),
7
+ appId: z.number(),
8
+ occurredAt: z.number().optional(),
9
+ subscriptionType: z.string(),
10
+ attemptNumber: z.number().optional(),
11
+ objectId: z.number(),
12
+ propertyName: z.string().optional(),
13
+ propertyValue: z.string().optional(),
14
+ changeSource: z.string().optional(),
15
+ changeFlag: z.string().optional(),
16
+ sourceId: z.string().optional(),
17
+ });
18
+
19
+ export const subscriptionEventListSchema = z.array(subscriptionEventSchema);
20
+
21
+ export type SubscriptionEvent = z.infer<typeof subscriptionEventSchema>;
22
+ export type SubscriptionEventList = z.infer<typeof subscriptionEventListSchema>;
package/lib/utils/auth.ts CHANGED
@@ -26,7 +26,7 @@ export class AuthUtils {
26
26
  body: body ?? '',
27
27
  }
28
28
 
29
- return ValidationUtils.parse<HubspotSignatureData>(input, hubspotSignatureDataSchema)
29
+ return ValidationUtils.parseData(input, hubspotSignatureDataSchema)
30
30
  }
31
31
 
32
32
  static isHubSpotSignatureValid = async (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dma-sdk/hubspot",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "DMA SDK – Hubspot service",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,9 +10,9 @@
10
10
  "test": "node_modules/jest/bin/jest.js --runInBand --forceExit --coverage --detectOpenHandles --coverageProvider v8 --collectCoverageFrom=src/**/*.{ts,js} --config='./jest.config.js' __tests__"
11
11
  },
12
12
  "dependencies": {
13
- "@dma-sdk/utils": "^1.0.6",
13
+ "@dma-sdk/utils": "^1.0.8",
14
14
  "@hubspot/api-client": "^13.4.0",
15
- "zod": "^4.3.5"
15
+ "zod": "^4.3.6"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/jest": "^29.5.13",