@automate.ax/integration-contracts 0.122.3 → 0.123.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.
- package/dist/hubspot/events.d.ts +889 -1849
- package/dist/hubspot/events.js +18 -25
- package/package.json +2 -2
- package/src/hubspot/events.ts +18 -34
package/dist/hubspot/events.js
CHANGED
|
@@ -6,8 +6,8 @@ export const HUBSPOT_EVENT_ACTION_SCHEMA = z.enum([
|
|
|
6
6
|
"created",
|
|
7
7
|
"deleted",
|
|
8
8
|
"merged",
|
|
9
|
-
"propertyChanged",
|
|
10
9
|
"restored",
|
|
10
|
+
"updated",
|
|
11
11
|
]);
|
|
12
12
|
export const HUBSPOT_EVENT_OBJECT_SCHEMA = z.enum([
|
|
13
13
|
"company",
|
|
@@ -16,54 +16,47 @@ export const HUBSPOT_EVENT_OBJECT_SCHEMA = z.enum([
|
|
|
16
16
|
"ticket",
|
|
17
17
|
]);
|
|
18
18
|
const HUBSPOT_COMMON_EVENT_FIELDS = {
|
|
19
|
-
|
|
20
|
-
attemptNumber: z.number().int().nonnegative(),
|
|
21
|
-
changeSource: z.string().optional(),
|
|
22
|
-
eventId: z.number().int(),
|
|
19
|
+
journalOffset: z.string(),
|
|
23
20
|
objectId: z.string(),
|
|
24
21
|
objectType: HUBSPOT_EVENT_OBJECT_SCHEMA,
|
|
25
22
|
occurredAt: z.date(),
|
|
26
23
|
portalId: z.number().int().positive(),
|
|
27
|
-
|
|
28
|
-
subscriptionId: z.number().int().positive(),
|
|
24
|
+
publishedAt: z.date().optional(),
|
|
29
25
|
};
|
|
30
26
|
const HUBSPOT_ASSOCIATION_EVENT_FIELDS = {
|
|
31
|
-
associationCategory: z.string()
|
|
32
|
-
|
|
33
|
-
associationTypeId: z.number().int().positive().optional(),
|
|
27
|
+
associationCategory: z.string(),
|
|
28
|
+
associationTypeId: z.number().int().positive(),
|
|
34
29
|
fromObjectId: z.string(),
|
|
35
|
-
fromObjectTypeId: z.string()
|
|
36
|
-
|
|
30
|
+
fromObjectTypeId: z.string(),
|
|
31
|
+
isPrimary: z.boolean(),
|
|
37
32
|
toObjectId: z.string(),
|
|
38
|
-
toObjectTypeId: z.string()
|
|
33
|
+
toObjectTypeId: z.string(),
|
|
39
34
|
};
|
|
40
35
|
export const HUBSPOT_CRM_EVENT_SCHEMA = z.discriminatedUnion("action", [
|
|
41
36
|
z.object({
|
|
42
37
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
43
38
|
...HUBSPOT_ASSOCIATION_EVENT_FIELDS,
|
|
44
39
|
action: z.literal("associationAdded"),
|
|
45
|
-
associationRemoved: z.literal(false),
|
|
46
40
|
}),
|
|
47
41
|
z.object({
|
|
48
42
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
49
43
|
...HUBSPOT_ASSOCIATION_EVENT_FIELDS,
|
|
50
44
|
action: z.literal("associationRemoved"),
|
|
51
|
-
associationRemoved: z.literal(true),
|
|
52
45
|
}),
|
|
53
46
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("created") }),
|
|
54
47
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("deleted") }),
|
|
55
48
|
z.object({
|
|
56
49
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
57
50
|
action: z.literal("merged"),
|
|
58
|
-
mergedObjectIds: z.string().array().min(1),
|
|
59
|
-
newObjectId: z.string(),
|
|
51
|
+
mergedObjectIds: z.string().array().min(1).optional(),
|
|
52
|
+
newObjectId: z.string().optional(),
|
|
60
53
|
numberOfPropertiesMoved: z.number().int().nonnegative().optional(),
|
|
54
|
+
primaryObjectId: z.string().optional(),
|
|
61
55
|
}),
|
|
62
56
|
z.object({
|
|
63
57
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
64
|
-
action: z.literal("
|
|
65
|
-
|
|
66
|
-
propertyValue: z.string(),
|
|
58
|
+
action: z.literal("updated"),
|
|
59
|
+
propertyChanges: z.record(z.string(), z.string().nullable()),
|
|
67
60
|
}),
|
|
68
61
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("restored") }),
|
|
69
62
|
]);
|
|
@@ -74,15 +67,15 @@ export const hubspotTriggerContracts = {
|
|
|
74
67
|
"hubspot.company.created": semanticContract("company", "created"),
|
|
75
68
|
"hubspot.company.deleted": semanticContract("company", "deleted"),
|
|
76
69
|
"hubspot.company.merged": semanticContract("company", "merged"),
|
|
77
|
-
"hubspot.company.propertyChanged": semanticContract("company", "propertyChanged"),
|
|
78
70
|
"hubspot.company.restored": semanticContract("company", "restored"),
|
|
71
|
+
"hubspot.company.updated": semanticContract("company", "updated"),
|
|
79
72
|
"hubspot.contact.associationAdded": semanticContract("contact", "associationAdded"),
|
|
80
73
|
"hubspot.contact.associationRemoved": semanticContract("contact", "associationRemoved"),
|
|
81
74
|
"hubspot.contact.created": semanticContract("contact", "created"),
|
|
82
75
|
"hubspot.contact.deleted": semanticContract("contact", "deleted"),
|
|
83
76
|
"hubspot.contact.merged": semanticContract("contact", "merged"),
|
|
84
|
-
"hubspot.contact.propertyChanged": semanticContract("contact", "propertyChanged"),
|
|
85
77
|
"hubspot.contact.restored": semanticContract("contact", "restored"),
|
|
78
|
+
"hubspot.contact.updated": semanticContract("contact", "updated"),
|
|
86
79
|
"hubspot.crm.event": {
|
|
87
80
|
configSchema: HUBSPOT_TRIGGER_CONFIG_SCHEMA,
|
|
88
81
|
eventSchema: HUBSPOT_CRM_EVENT_SCHEMA,
|
|
@@ -92,15 +85,15 @@ export const hubspotTriggerContracts = {
|
|
|
92
85
|
"hubspot.deal.created": semanticContract("deal", "created"),
|
|
93
86
|
"hubspot.deal.deleted": semanticContract("deal", "deleted"),
|
|
94
87
|
"hubspot.deal.merged": semanticContract("deal", "merged"),
|
|
95
|
-
"hubspot.deal.propertyChanged": semanticContract("deal", "propertyChanged"),
|
|
96
88
|
"hubspot.deal.restored": semanticContract("deal", "restored"),
|
|
89
|
+
"hubspot.deal.updated": semanticContract("deal", "updated"),
|
|
97
90
|
"hubspot.ticket.associationAdded": semanticContract("ticket", "associationAdded"),
|
|
98
91
|
"hubspot.ticket.associationRemoved": semanticContract("ticket", "associationRemoved"),
|
|
99
92
|
"hubspot.ticket.created": semanticContract("ticket", "created"),
|
|
100
93
|
"hubspot.ticket.deleted": semanticContract("ticket", "deleted"),
|
|
101
94
|
"hubspot.ticket.merged": semanticContract("ticket", "merged"),
|
|
102
|
-
"hubspot.ticket.propertyChanged": semanticContract("ticket", "propertyChanged"),
|
|
103
95
|
"hubspot.ticket.restored": semanticContract("ticket", "restored"),
|
|
96
|
+
"hubspot.ticket.updated": semanticContract("ticket", "updated"),
|
|
104
97
|
};
|
|
105
98
|
/**
|
|
106
99
|
* Builds one semantic HubSpot lifecycle contract.
|
|
@@ -118,7 +111,7 @@ function semanticContract(objectType, action) {
|
|
|
118
111
|
};
|
|
119
112
|
}
|
|
120
113
|
/**
|
|
121
|
-
* Returns broad and semantic event types for one normalized
|
|
114
|
+
* Returns broad and semantic event types for one normalized Journal event.
|
|
122
115
|
*
|
|
123
116
|
* @param event - Normalized HubSpot CRM event.
|
|
124
117
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.123.0",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@automate.ax/codec": "0.
|
|
58
|
+
"@automate.ax/codec": "0.123.0",
|
|
59
59
|
"@cfworker/json-schema": "^4.1.1",
|
|
60
60
|
"@googleapis/calendar": "^15.0.0",
|
|
61
61
|
"@googleapis/forms": "^6.0.1",
|
package/src/hubspot/events.ts
CHANGED
|
@@ -8,8 +8,8 @@ export const HUBSPOT_EVENT_ACTION_SCHEMA = z.enum([
|
|
|
8
8
|
"created",
|
|
9
9
|
"deleted",
|
|
10
10
|
"merged",
|
|
11
|
-
"propertyChanged",
|
|
12
11
|
"restored",
|
|
12
|
+
"updated",
|
|
13
13
|
])
|
|
14
14
|
|
|
15
15
|
export const HUBSPOT_EVENT_OBJECT_SCHEMA = z.enum([
|
|
@@ -20,26 +20,21 @@ export const HUBSPOT_EVENT_OBJECT_SCHEMA = z.enum([
|
|
|
20
20
|
])
|
|
21
21
|
|
|
22
22
|
const HUBSPOT_COMMON_EVENT_FIELDS = {
|
|
23
|
-
|
|
24
|
-
attemptNumber: z.number().int().nonnegative(),
|
|
25
|
-
changeSource: z.string().optional(),
|
|
26
|
-
eventId: z.number().int(),
|
|
23
|
+
journalOffset: z.string(),
|
|
27
24
|
objectId: z.string(),
|
|
28
25
|
objectType: HUBSPOT_EVENT_OBJECT_SCHEMA,
|
|
29
26
|
occurredAt: z.date(),
|
|
30
27
|
portalId: z.number().int().positive(),
|
|
31
|
-
|
|
32
|
-
subscriptionId: z.number().int().positive(),
|
|
28
|
+
publishedAt: z.date().optional(),
|
|
33
29
|
}
|
|
34
30
|
const HUBSPOT_ASSOCIATION_EVENT_FIELDS = {
|
|
35
|
-
associationCategory: z.string()
|
|
36
|
-
|
|
37
|
-
associationTypeId: z.number().int().positive().optional(),
|
|
31
|
+
associationCategory: z.string(),
|
|
32
|
+
associationTypeId: z.number().int().positive(),
|
|
38
33
|
fromObjectId: z.string(),
|
|
39
|
-
fromObjectTypeId: z.string()
|
|
40
|
-
|
|
34
|
+
fromObjectTypeId: z.string(),
|
|
35
|
+
isPrimary: z.boolean(),
|
|
41
36
|
toObjectId: z.string(),
|
|
42
|
-
toObjectTypeId: z.string()
|
|
37
|
+
toObjectTypeId: z.string(),
|
|
43
38
|
}
|
|
44
39
|
|
|
45
40
|
export const HUBSPOT_CRM_EVENT_SCHEMA = z.discriminatedUnion("action", [
|
|
@@ -47,28 +42,26 @@ export const HUBSPOT_CRM_EVENT_SCHEMA = z.discriminatedUnion("action", [
|
|
|
47
42
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
48
43
|
...HUBSPOT_ASSOCIATION_EVENT_FIELDS,
|
|
49
44
|
action: z.literal("associationAdded"),
|
|
50
|
-
associationRemoved: z.literal(false),
|
|
51
45
|
}),
|
|
52
46
|
z.object({
|
|
53
47
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
54
48
|
...HUBSPOT_ASSOCIATION_EVENT_FIELDS,
|
|
55
49
|
action: z.literal("associationRemoved"),
|
|
56
|
-
associationRemoved: z.literal(true),
|
|
57
50
|
}),
|
|
58
51
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("created") }),
|
|
59
52
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("deleted") }),
|
|
60
53
|
z.object({
|
|
61
54
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
62
55
|
action: z.literal("merged"),
|
|
63
|
-
mergedObjectIds: z.string().array().min(1),
|
|
64
|
-
newObjectId: z.string(),
|
|
56
|
+
mergedObjectIds: z.string().array().min(1).optional(),
|
|
57
|
+
newObjectId: z.string().optional(),
|
|
65
58
|
numberOfPropertiesMoved: z.number().int().nonnegative().optional(),
|
|
59
|
+
primaryObjectId: z.string().optional(),
|
|
66
60
|
}),
|
|
67
61
|
z.object({
|
|
68
62
|
...HUBSPOT_COMMON_EVENT_FIELDS,
|
|
69
|
-
action: z.literal("
|
|
70
|
-
|
|
71
|
-
propertyValue: z.string(),
|
|
63
|
+
action: z.literal("updated"),
|
|
64
|
+
propertyChanges: z.record(z.string(), z.string().nullable()),
|
|
72
65
|
}),
|
|
73
66
|
z.object({ ...HUBSPOT_COMMON_EVENT_FIELDS, action: z.literal("restored") }),
|
|
74
67
|
])
|
|
@@ -106,11 +99,8 @@ export const hubspotTriggerContracts = {
|
|
|
106
99
|
"hubspot.company.created": semanticContract("company", "created"),
|
|
107
100
|
"hubspot.company.deleted": semanticContract("company", "deleted"),
|
|
108
101
|
"hubspot.company.merged": semanticContract("company", "merged"),
|
|
109
|
-
"hubspot.company.propertyChanged": semanticContract(
|
|
110
|
-
"company",
|
|
111
|
-
"propertyChanged",
|
|
112
|
-
),
|
|
113
102
|
"hubspot.company.restored": semanticContract("company", "restored"),
|
|
103
|
+
"hubspot.company.updated": semanticContract("company", "updated"),
|
|
114
104
|
"hubspot.contact.associationAdded": semanticContract(
|
|
115
105
|
"contact",
|
|
116
106
|
"associationAdded",
|
|
@@ -122,11 +112,8 @@ export const hubspotTriggerContracts = {
|
|
|
122
112
|
"hubspot.contact.created": semanticContract("contact", "created"),
|
|
123
113
|
"hubspot.contact.deleted": semanticContract("contact", "deleted"),
|
|
124
114
|
"hubspot.contact.merged": semanticContract("contact", "merged"),
|
|
125
|
-
"hubspot.contact.propertyChanged": semanticContract(
|
|
126
|
-
"contact",
|
|
127
|
-
"propertyChanged",
|
|
128
|
-
),
|
|
129
115
|
"hubspot.contact.restored": semanticContract("contact", "restored"),
|
|
116
|
+
"hubspot.contact.updated": semanticContract("contact", "updated"),
|
|
130
117
|
"hubspot.crm.event": {
|
|
131
118
|
configSchema: HUBSPOT_TRIGGER_CONFIG_SCHEMA,
|
|
132
119
|
eventSchema: HUBSPOT_CRM_EVENT_SCHEMA,
|
|
@@ -139,8 +126,8 @@ export const hubspotTriggerContracts = {
|
|
|
139
126
|
"hubspot.deal.created": semanticContract("deal", "created"),
|
|
140
127
|
"hubspot.deal.deleted": semanticContract("deal", "deleted"),
|
|
141
128
|
"hubspot.deal.merged": semanticContract("deal", "merged"),
|
|
142
|
-
"hubspot.deal.propertyChanged": semanticContract("deal", "propertyChanged"),
|
|
143
129
|
"hubspot.deal.restored": semanticContract("deal", "restored"),
|
|
130
|
+
"hubspot.deal.updated": semanticContract("deal", "updated"),
|
|
144
131
|
"hubspot.ticket.associationAdded": semanticContract(
|
|
145
132
|
"ticket",
|
|
146
133
|
"associationAdded",
|
|
@@ -152,11 +139,8 @@ export const hubspotTriggerContracts = {
|
|
|
152
139
|
"hubspot.ticket.created": semanticContract("ticket", "created"),
|
|
153
140
|
"hubspot.ticket.deleted": semanticContract("ticket", "deleted"),
|
|
154
141
|
"hubspot.ticket.merged": semanticContract("ticket", "merged"),
|
|
155
|
-
"hubspot.ticket.propertyChanged": semanticContract(
|
|
156
|
-
"ticket",
|
|
157
|
-
"propertyChanged",
|
|
158
|
-
),
|
|
159
142
|
"hubspot.ticket.restored": semanticContract("ticket", "restored"),
|
|
143
|
+
"hubspot.ticket.updated": semanticContract("ticket", "updated"),
|
|
160
144
|
} satisfies HubSpotTriggerContracts
|
|
161
145
|
|
|
162
146
|
/**
|
|
@@ -181,7 +165,7 @@ function semanticContract<
|
|
|
181
165
|
}
|
|
182
166
|
|
|
183
167
|
/**
|
|
184
|
-
* Returns broad and semantic event types for one normalized
|
|
168
|
+
* Returns broad and semantic event types for one normalized Journal event.
|
|
185
169
|
*
|
|
186
170
|
* @param event - Normalized HubSpot CRM event.
|
|
187
171
|
*/
|