@frogbotai/piece-hubspot 0.0.0-stage → 0.41.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/LICENSE +21 -0
- package/README.md +146 -2
- package/dist/actions/associations.d.ts +161 -0
- package/dist/actions/associations.d.ts.map +1 -0
- package/dist/actions/associations.js +192 -0
- package/dist/actions/associations.js.map +1 -0
- package/dist/actions/createOrUpdateContact.d.ts +36 -0
- package/dist/actions/createOrUpdateContact.d.ts.map +1 -0
- package/dist/actions/createOrUpdateContact.js +65 -0
- package/dist/actions/createOrUpdateContact.js.map +1 -0
- package/dist/actions/crm.d.ts +1042 -0
- package/dist/actions/crm.d.ts.map +1 -0
- package/dist/actions/crm.js +266 -0
- package/dist/actions/crm.js.map +1 -0
- package/dist/actions/crud.d.ts +180 -0
- package/dist/actions/crud.d.ts.map +1 -0
- package/dist/actions/crud.js +203 -0
- package/dist/actions/crud.js.map +1 -0
- package/dist/actions/customApiCall.d.ts +6 -0
- package/dist/actions/customApiCall.d.ts.map +1 -0
- package/dist/actions/customApiCall.js +10 -0
- package/dist/actions/customApiCall.js.map +1 -0
- package/dist/actions/lists.d.ts +42 -0
- package/dist/actions/lists.d.ts.map +1 -0
- package/dist/actions/lists.js +108 -0
- package/dist/actions/lists.js.map +1 -0
- package/dist/actions/lookups.d.ts +110 -0
- package/dist/actions/lookups.d.ts.map +1 -0
- package/dist/actions/lookups.js +71 -0
- package/dist/actions/lookups.js.map +1 -0
- package/dist/actions/marketing.d.ts +45 -0
- package/dist/actions/marketing.d.ts.map +1 -0
- package/dist/actions/marketing.js +75 -0
- package/dist/actions/marketing.js.map +1 -0
- package/dist/actions/options.d.ts +38 -0
- package/dist/actions/options.d.ts.map +1 -0
- package/dist/actions/options.js +229 -0
- package/dist/actions/options.js.map +1 -0
- package/dist/actions/reads.d.ts +351 -0
- package/dist/actions/reads.d.ts.map +1 -0
- package/dist/actions/reads.js +253 -0
- package/dist/actions/reads.js.map +1 -0
- package/dist/actions/uploadFile.d.ts +47 -0
- package/dist/actions/uploadFile.d.ts.map +1 -0
- package/dist/actions/uploadFile.js +66 -0
- package/dist/actions/uploadFile.js.map +1 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +115 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/define.d.ts +76 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +4 -0
- package/dist/define.js.map +1 -0
- package/dist/files.d.ts +13 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +55 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +3463 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/dist/objects.d.ts +57 -0
- package/dist/objects.d.ts.map +1 -0
- package/dist/objects.js +194 -0
- package/dist/objects.js.map +1 -0
- package/dist/pagination.d.ts +41 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +29 -0
- package/dist/pagination.js.map +1 -0
- package/dist/records.d.ts +99 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +106 -0
- package/dist/records.js.map +1 -0
- package/dist/triggers/marketing.d.ts +167 -0
- package/dist/triggers/marketing.d.ts.map +1 -0
- package/dist/triggers/marketing.js +227 -0
- package/dist/triggers/marketing.js.map +1 -0
- package/dist/triggers/newContactInList.d.ts +75 -0
- package/dist/triggers/newContactInList.d.ts.map +1 -0
- package/dist/triggers/newContactInList.js +78 -0
- package/dist/triggers/newContactInList.js.map +1 -0
- package/dist/triggers/newEngagement.d.ts +91 -0
- package/dist/triggers/newEngagement.d.ts.map +1 -0
- package/dist/triggers/newEngagement.js +125 -0
- package/dist/triggers/newEngagement.js.map +1 -0
- package/dist/triggers/poll.d.ts +94 -0
- package/dist/triggers/poll.d.ts.map +1 -0
- package/dist/triggers/poll.js +141 -0
- package/dist/triggers/poll.js.map +1 -0
- package/dist/triggers/records.d.ts +1234 -0
- package/dist/triggers/records.d.ts.map +1 -0
- package/dist/triggers/records.js +249 -0
- package/dist/triggers/records.js.map +1 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FrogBot
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@frogbotai/piece-hubspot`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Import a whole HubSpot account (contacts, companies, deals, tickets, activities, owners, pipelines, lists and the associations between them), create, update and find CRM records, and poll HubSpot for changes, with a service key or HubSpot sign-in.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createHubSpot } from '@frogbotai/piece-hubspot';
|
|
9
|
+
|
|
10
|
+
// An app-wide service key (or an existing private-app token).
|
|
11
|
+
export const hubspot = createHubSpot({ auth: { accessToken: process.env.HUBSPOT_TOKEN! } });
|
|
12
|
+
|
|
13
|
+
// Or each person signs in with HubSpot.
|
|
14
|
+
export const hubspotForUsers = createHubSpot({
|
|
15
|
+
oauth: {
|
|
16
|
+
clientId: process.env.HUBSPOT_CLIENT_ID!,
|
|
17
|
+
clientSecret: process.env.HUBSPOT_CLIENT_SECRET!,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Both can be set at once: a user's own linked account is used when there is one, and the factory `auth` otherwise.
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
### Service key
|
|
27
|
+
|
|
28
|
+
HubSpot no longer lets you create private apps, so use a service key for an app-wide credential. Existing private-app tokens still work the same way.
|
|
29
|
+
|
|
30
|
+
1. In HubSpot, go to **Development**, then **Keys** > **Service keys**, and click **Create service key**.
|
|
31
|
+
2. Add the scopes for what the app does: the read scopes below for the import, plus the write scopes for the actions you use.
|
|
32
|
+
3. Copy the key into `auth.accessToken`.
|
|
33
|
+
|
|
34
|
+
### OAuth app
|
|
35
|
+
|
|
36
|
+
Create a HubSpot app with the redirect URL FrogBot shows for the piece. The app's scopes must match what sign-in asks for, or HubSpot refuses it:
|
|
37
|
+
|
|
38
|
+
- Always requested: `crm.objects.contacts.read`.
|
|
39
|
+
- Requested by default: `crm.objects.companies.read`, `crm.objects.deals.read`, `crm.objects.tickets.read`, `crm.objects.owners.read`, `crm.lists.read`, `crm.schemas.contacts.read`, `crm.schemas.companies.read`, `crm.schemas.deals.read`, `crm.schemas.custom.read`.
|
|
40
|
+
- Available through `scopes`: the matching `.write` scopes, `crm.objects.line_items.read|write`, `crm.objects.custom.read|write`, `crm.lists.write`, `e-commerce` (products), `sales-email-read` (email bodies), `files`, `forms`, `automation` and `communication_preferences.read_write`.
|
|
41
|
+
|
|
42
|
+
Sign-in exchanges the code at `https://api.hubapi.com/oauth/v3/token` with the client credentials in the form body, and core refreshes the token when it expires. The linked account is named by the user's email (from their owner record) and the portal ID.
|
|
43
|
+
|
|
44
|
+
## Rate limits
|
|
45
|
+
|
|
46
|
+
A service key or private app gets 100–190 requests per 10 seconds and 250,000–1,000,000 a day, by the account's tier; OAuth apps have their own limits. Search allows 5 requests per second and stops at 10,000 results. A `429` is retried after `Retry-After`, or 10 seconds without one, up to 3 times, then thrown as a `HubSpotError` with HubSpot's `message` and `category`. A daily-limit `429` therefore fails after about 30 seconds.
|
|
47
|
+
|
|
48
|
+
## Import reads
|
|
49
|
+
|
|
50
|
+
FrogBot additions for moving a whole account. They don't use search, so they have no 10,000-result limit. Paged reads take `limit` (1–100, default 100) and `cursor`, and return `{ results, nextCursor }`; pass `nextCursor` back as `cursor` until it is `null`.
|
|
51
|
+
|
|
52
|
+
| Action | Reads |
|
|
53
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| `listRecords` | One object's records: `contacts`, `companies`, `deals`, `tickets`, `notes`, `emails`, `calls`, `meetings`, `tasks`, `line_items`, `products` or a custom type ID (`2-…`). Takes `properties` and `associations`. |
|
|
55
|
+
| `listAssociations` | Up to 1,000 records' associations to one object type, with labels. Each record has its own `nextCursor`; pass it back in `cursors`, keyed by record ID. |
|
|
56
|
+
| `listLists` | Lists (segments), by name or object type. |
|
|
57
|
+
| `listListMembers` | A list's record IDs. |
|
|
58
|
+
| `listOwners` | Owners, active or archived. |
|
|
59
|
+
| `listPipelines` | Every deal or ticket pipeline with its stages (unpaged). |
|
|
60
|
+
| `listProperties` | Every property of an object, with types and options (unpaged). |
|
|
61
|
+
|
|
62
|
+
## Actions
|
|
63
|
+
|
|
64
|
+
Every upstream action, as ported, moved or dropped. `get*`, `find*` and `list*` actions are idempotent.
|
|
65
|
+
|
|
66
|
+
| Upstream action slug | Native action | Notes |
|
|
67
|
+
| ---------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| `create-contact` | `createContact` | Creates, then reads the contact back with its default and requested properties, as upstream does. |
|
|
69
|
+
| `update-contact` | `updateContact` | Empty multi-select arrays are skipped. |
|
|
70
|
+
| `get-contact` | `getContact` | |
|
|
71
|
+
| `find-contact` | `findContact` | One or two equality filters, up to 200 results. Use `listRecords` to read every record. |
|
|
72
|
+
| `create-or-update-contact` | `createOrUpdateContact` | Upserts on email. |
|
|
73
|
+
| `create-company` | `createCompany` | |
|
|
74
|
+
| `update-company` | `updateCompany` | |
|
|
75
|
+
| `get-company` | `getCompany` | |
|
|
76
|
+
| `find-company` | `findCompany` | |
|
|
77
|
+
| `create-deal` | `createDeal` | `dealname`, `pipelineId` and `pipelineStageId`, with dropdowns. |
|
|
78
|
+
| `update-deal` | `updateDeal` | |
|
|
79
|
+
| `get-deal` | `getDeal` | |
|
|
80
|
+
| `find-deal` | `findDeal` | |
|
|
81
|
+
| `create-ticket` | `createTicket` | `ticketName`, `pipelineId` and `pipelineStageId`. |
|
|
82
|
+
| `update-ticket` | `updateTicket` | |
|
|
83
|
+
| `get-ticket` | `getTicket` | |
|
|
84
|
+
| `find-ticket` | `findTicket` | |
|
|
85
|
+
| `create-line-item` | `createLineItem` | `productId`, with a product dropdown. |
|
|
86
|
+
| `update-line-item` | `updateLineItem` | |
|
|
87
|
+
| `get-line-item` | `getLineItem` | |
|
|
88
|
+
| `find-line-item` | `findLineItem` | |
|
|
89
|
+
| `create-product` | `createProduct` | |
|
|
90
|
+
| `update-product` | `updateProduct` | |
|
|
91
|
+
| `get-product` | `getProduct` | |
|
|
92
|
+
| `find-product` | `findProduct` | |
|
|
93
|
+
| `create-custome-object` | `createCustomObject` | `customObjectType` is the type ID (`2-…`), with a dropdown. |
|
|
94
|
+
| `update-custome-object` | `updateCustomObject` | |
|
|
95
|
+
| `get-custom-object` | `getCustomObject` | |
|
|
96
|
+
| `find-custom-object` | `findCustomObject` | |
|
|
97
|
+
| `create-associations` | `createAssociations` | Batches of 100 to the v4 batch create. |
|
|
98
|
+
| `remove-associations` | `removeAssociations` | Archives one association type (label). |
|
|
99
|
+
| `find-associations` | `findAssociations` | Every page, with labels. |
|
|
100
|
+
| `add_contact_to_list` | `addContactToList` | Moved from the shut-down v1 lists API to `/crm/v3/lists/{listId}/memberships/add`; the contact is found by email first. |
|
|
101
|
+
| `remove-contact-from-list` | `removeContactFromList` | Moved to `/crm/v3/lists/{listId}/memberships/remove`. |
|
|
102
|
+
| `get-owner-by-email` | `getOwnerByEmail` | Returns the owner or `null`, not upstream's page. |
|
|
103
|
+
| `get-owner-by-id` | `getOwnerById` | |
|
|
104
|
+
| `get-pipeline-stage-details` | `getPipelineStageDetails` | `objectType` is `deals` or `tickets`. |
|
|
105
|
+
| `upload-file` | `uploadFile` | Uploads a FrogBot file; `file` is `{ fileId, name? }`. |
|
|
106
|
+
| `add-contact-to-workflow` | `addContactToWorkflow` | Keeps the v2 enrollment endpoint, which v4 workflows have no replacement for; the dropdown reads v3 workflows. |
|
|
107
|
+
| `remove-email-subscription` | `removeEmailSubscription` | Moved from v1 subscriptions to the v4 communication preferences unsubscribe-all. |
|
|
108
|
+
| custom API call | `customApiCall` | Paths under `https://api.hubapi.com`, with the connected credential. |
|
|
109
|
+
| `create-blog-post` | Dropped | Website (CMS) tool, outside the CRM (397 D1). Use `customApiCall` with `POST /cms/v3/blogs/posts`. |
|
|
110
|
+
| `create-page` | Dropped | Use `customApiCall` with `POST /cms/v3/pages/site-pages` or `/landing-pages`. |
|
|
111
|
+
| `get-page` | Dropped | Use `customApiCall` with `GET /cms/v3/pages/site-pages/{id}`. |
|
|
112
|
+
| `delete-page` | Dropped | Use `customApiCall` with `DELETE /cms/v3/pages/site-pages/{id}`. |
|
|
113
|
+
|
|
114
|
+
## Triggers
|
|
115
|
+
|
|
116
|
+
All upstream triggers poll, and so do these, every 5 minutes. They run once core can run polling triggers (ticket 388); until then, mounting one fails as core does today. Triggers run with the app-wide credential, the factory `auth`, not a user's linked account, so set `auth` to use them.
|
|
117
|
+
|
|
118
|
+
The first poll emits nothing and starts the cursor at now. Each later poll looks back 5 minutes past the previous one for HubSpot's search index lag and skips what it already emitted. A search burst over 10,000 results is continued by the next poll.
|
|
119
|
+
|
|
120
|
+
| Upstream trigger slug | Native trigger | Type | Notes |
|
|
121
|
+
| ----------------------------------- | ------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `new-contact` | `newContact` | `polling` | By `createdate`. |
|
|
123
|
+
| `new-or-updated-contact` | `newOrUpdatedContact` | `polling` | By `lastmodifieddate`. |
|
|
124
|
+
| `new-contact-property-change` | `newContactPropertyChange` | `polling` | Records changed since the last poll whose `propertyName` history has a newer entry. |
|
|
125
|
+
| `new-contact-in-list` | `newContactInList` | `polling` | Pages the list in join order each poll, up to 10,000 members. |
|
|
126
|
+
| `new-company` | `newCompany` | `polling` | |
|
|
127
|
+
| `new-or-updated-company` | `newOrUpdatedCompany` | `polling` | |
|
|
128
|
+
| `new-company-property-change` | `newCompanyPropertyChange` | `polling` | |
|
|
129
|
+
| `new-deal` | `newDeal` | `polling` | |
|
|
130
|
+
| `new-deal-property-change` | `newDealPropertyChange` | `polling` | |
|
|
131
|
+
| `deal-stage-updated` | `dealStageUpdated` | `polling` | Deals entering the chosen pipeline stage, by `hs_v2_date_entered_current_stage`. |
|
|
132
|
+
| `new-ticket` | `newTicket` | `polling` | |
|
|
133
|
+
| `new-ticket-property-change` | `newTicketPropertyChange` | `polling` | |
|
|
134
|
+
| `new-line-item` | `newLineItem` | `polling` | |
|
|
135
|
+
| `new-or-updated-line-item` | `newOrUpdatedLineItem` | `polling` | |
|
|
136
|
+
| `new-product` | `newProduct` | `polling` | |
|
|
137
|
+
| `new-or-updated-product` | `newOrUpdatedProduct` | `polling` | |
|
|
138
|
+
| `new-task` | `newTask` | `polling` | |
|
|
139
|
+
| `new-custom-object` | `newCustomObject` | `polling` | |
|
|
140
|
+
| `new-custom-object-property-change` | `newCustomObjectPropertyChange` | `polling` | |
|
|
141
|
+
| `new-engagement` | `newEngagement` | `polling` | Rebuilt on the v3 notes, emails, calls, meetings and tasks objects; v1 engagements are retiring. Emits `{ type, record }`. |
|
|
142
|
+
| `new-form-submission` | `newFormSubmission` | `polling` | v1 submissions, newest first; field labels now come from `/marketing/v3/forms/{formId}`. |
|
|
143
|
+
| `new-email-event` | `newEmailEvent` | `polling` | v1 email events between the last poll and now. |
|
|
144
|
+
| `new-email-subscriptions-timeline` | `newEmailSubscriptionsTimeline` | `polling` | v1 subscriptions timeline. |
|
|
145
|
+
| `new-blog-article` | Dropped | — | Website (CMS) tool (397 D1). Poll `customApiCall` with `GET /cms/v3/blogs/posts`. |
|
|
146
|
+
|
|
147
|
+
Webhook triggers are left out: HubSpot app webhooks are configured statically in the app, and service keys can't receive them.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createAssociations: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
fromObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
4
|
+
contacts: "contacts";
|
|
5
|
+
companies: "companies";
|
|
6
|
+
deals: "deals";
|
|
7
|
+
tickets: "tickets";
|
|
8
|
+
notes: "notes";
|
|
9
|
+
emails: "emails";
|
|
10
|
+
calls: "calls";
|
|
11
|
+
meetings: "meetings";
|
|
12
|
+
tasks: "tasks";
|
|
13
|
+
line_items: "line_items";
|
|
14
|
+
products: "products";
|
|
15
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
16
|
+
fromObjectId: z.ZodString;
|
|
17
|
+
toObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
18
|
+
contacts: "contacts";
|
|
19
|
+
companies: "companies";
|
|
20
|
+
deals: "deals";
|
|
21
|
+
tickets: "tickets";
|
|
22
|
+
notes: "notes";
|
|
23
|
+
emails: "emails";
|
|
24
|
+
calls: "calls";
|
|
25
|
+
meetings: "meetings";
|
|
26
|
+
tasks: "tasks";
|
|
27
|
+
line_items: "line_items";
|
|
28
|
+
products: "products";
|
|
29
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
30
|
+
associationType: z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>;
|
|
31
|
+
toObjectIds: z.ZodArray<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
totalAssociations: z.ZodNumber;
|
|
34
|
+
batchCount: z.ZodNumber;
|
|
35
|
+
results: z.ZodArray<z.ZodObject<{
|
|
36
|
+
fromObjectId: z.ZodCoercedString<unknown>;
|
|
37
|
+
toObjectId: z.ZodCoercedString<unknown>;
|
|
38
|
+
labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
41
|
+
message: z.ZodString;
|
|
42
|
+
category: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
45
|
+
json: (request: import("../client.js").HubSpotRequest) => Promise<unknown>;
|
|
46
|
+
request: <T>(schema: z.ZodType<T>, options: import("../client.js").HubSpotRequest) => Promise<T>;
|
|
47
|
+
authorize(headers: Headers): void;
|
|
48
|
+
}, {
|
|
49
|
+
totalAssociations: number;
|
|
50
|
+
batchCount: number;
|
|
51
|
+
results: {
|
|
52
|
+
fromObjectId: string;
|
|
53
|
+
toObjectId: string;
|
|
54
|
+
labels: string[];
|
|
55
|
+
}[];
|
|
56
|
+
errors: {
|
|
57
|
+
message: string;
|
|
58
|
+
category?: string | undefined;
|
|
59
|
+
}[];
|
|
60
|
+
}> & {
|
|
61
|
+
slug: "createAssociations";
|
|
62
|
+
};
|
|
63
|
+
export declare const removeAssociations: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
64
|
+
fromObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
65
|
+
contacts: "contacts";
|
|
66
|
+
companies: "companies";
|
|
67
|
+
deals: "deals";
|
|
68
|
+
tickets: "tickets";
|
|
69
|
+
notes: "notes";
|
|
70
|
+
emails: "emails";
|
|
71
|
+
calls: "calls";
|
|
72
|
+
meetings: "meetings";
|
|
73
|
+
tasks: "tasks";
|
|
74
|
+
line_items: "line_items";
|
|
75
|
+
products: "products";
|
|
76
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
77
|
+
fromObjectId: z.ZodString;
|
|
78
|
+
toObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
79
|
+
contacts: "contacts";
|
|
80
|
+
companies: "companies";
|
|
81
|
+
deals: "deals";
|
|
82
|
+
tickets: "tickets";
|
|
83
|
+
notes: "notes";
|
|
84
|
+
emails: "emails";
|
|
85
|
+
calls: "calls";
|
|
86
|
+
meetings: "meetings";
|
|
87
|
+
tasks: "tasks";
|
|
88
|
+
line_items: "line_items";
|
|
89
|
+
products: "products";
|
|
90
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
91
|
+
associationType: z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>;
|
|
92
|
+
toObjectIds: z.ZodArray<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
success: z.ZodLiteral<true>;
|
|
95
|
+
totalAssociations: z.ZodNumber;
|
|
96
|
+
batchCount: z.ZodNumber;
|
|
97
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
98
|
+
json: (request: import("../client.js").HubSpotRequest) => Promise<unknown>;
|
|
99
|
+
request: <T>(schema: z.ZodType<T>, options: import("../client.js").HubSpotRequest) => Promise<T>;
|
|
100
|
+
authorize(headers: Headers): void;
|
|
101
|
+
}, {
|
|
102
|
+
success: true;
|
|
103
|
+
totalAssociations: number;
|
|
104
|
+
batchCount: number;
|
|
105
|
+
}> & {
|
|
106
|
+
slug: "removeAssociations";
|
|
107
|
+
};
|
|
108
|
+
export declare const findAssociations: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
109
|
+
fromObjectId: z.ZodString;
|
|
110
|
+
fromObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
111
|
+
contacts: "contacts";
|
|
112
|
+
companies: "companies";
|
|
113
|
+
deals: "deals";
|
|
114
|
+
tickets: "tickets";
|
|
115
|
+
notes: "notes";
|
|
116
|
+
emails: "emails";
|
|
117
|
+
calls: "calls";
|
|
118
|
+
meetings: "meetings";
|
|
119
|
+
tasks: "tasks";
|
|
120
|
+
line_items: "line_items";
|
|
121
|
+
products: "products";
|
|
122
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
123
|
+
toObjectType: z.ZodUnion<readonly [z.ZodEnum<{
|
|
124
|
+
contacts: "contacts";
|
|
125
|
+
companies: "companies";
|
|
126
|
+
deals: "deals";
|
|
127
|
+
tickets: "tickets";
|
|
128
|
+
notes: "notes";
|
|
129
|
+
emails: "emails";
|
|
130
|
+
calls: "calls";
|
|
131
|
+
meetings: "meetings";
|
|
132
|
+
tasks: "tasks";
|
|
133
|
+
line_items: "line_items";
|
|
134
|
+
products: "products";
|
|
135
|
+
}>, z.ZodTemplateLiteral<`2-${number}`>]>;
|
|
136
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
137
|
+
results: z.ZodArray<z.ZodObject<{
|
|
138
|
+
toObjectId: z.ZodCoercedString<unknown>;
|
|
139
|
+
associationTypes: z.ZodArray<z.ZodObject<{
|
|
140
|
+
category: z.ZodString;
|
|
141
|
+
typeId: z.ZodNumber;
|
|
142
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
146
|
+
json: (request: import("../client.js").HubSpotRequest) => Promise<unknown>;
|
|
147
|
+
request: <T>(schema: z.ZodType<T>, options: import("../client.js").HubSpotRequest) => Promise<T>;
|
|
148
|
+
authorize(headers: Headers): void;
|
|
149
|
+
}, {
|
|
150
|
+
results: {
|
|
151
|
+
toObjectId: string;
|
|
152
|
+
associationTypes: {
|
|
153
|
+
category: string;
|
|
154
|
+
typeId: number;
|
|
155
|
+
label?: string | null | undefined;
|
|
156
|
+
}[];
|
|
157
|
+
}[];
|
|
158
|
+
}> & {
|
|
159
|
+
slug: "findAssociations";
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=associations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"associations.d.ts","sourceRoot":"","sources":["../../src/actions/associations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmFxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B7B,CAAC;AASH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B3B,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { signal } from '../client.js';
|
|
3
|
+
import { objectType, recordId } from '../config.js';
|
|
4
|
+
import { defineAction } from '../define.js';
|
|
5
|
+
import { associationLabel } from '../records.js';
|
|
6
|
+
import { associationTypeOptions, objectTypeOptions, toRecordOptions } from './options.js';
|
|
7
|
+
const batchSize = 100;
|
|
8
|
+
const typeId = z.union([
|
|
9
|
+
z.number().int(),
|
|
10
|
+
z.string().regex(/^\d+$/).transform(Number)
|
|
11
|
+
]).meta({
|
|
12
|
+
label: 'Type of the association',
|
|
13
|
+
description: 'The association type ID.'
|
|
14
|
+
});
|
|
15
|
+
const shape = {
|
|
16
|
+
fromObjectType: objectType.meta({
|
|
17
|
+
label: 'From object type'
|
|
18
|
+
}),
|
|
19
|
+
fromObjectId: recordId('From object ID'),
|
|
20
|
+
toObjectType: objectType.meta({
|
|
21
|
+
label: 'To object type'
|
|
22
|
+
}),
|
|
23
|
+
associationType: typeId,
|
|
24
|
+
toObjectIds: z.array(recordId('To object ID')).min(1).meta({
|
|
25
|
+
label: 'To object IDs'
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
const options = {
|
|
29
|
+
fromObjectType: objectTypeOptions,
|
|
30
|
+
toObjectType: objectTypeOptions,
|
|
31
|
+
associationType: associationTypeOptions,
|
|
32
|
+
toObjectIds: toRecordOptions
|
|
33
|
+
};
|
|
34
|
+
const labels = z.object({
|
|
35
|
+
results: z.array(associationLabel)
|
|
36
|
+
});
|
|
37
|
+
const batchError = z.object({
|
|
38
|
+
message: z.string(),
|
|
39
|
+
category: z.string().optional()
|
|
40
|
+
});
|
|
41
|
+
const batchErrors = z.array(batchError).optional().default([]);
|
|
42
|
+
async function category(client, input, abort) {
|
|
43
|
+
const found = await client.request(labels, {
|
|
44
|
+
path: `/crm/associations/v4/${input.fromObjectType}/${input.toObjectType}/labels`,
|
|
45
|
+
signal: abort
|
|
46
|
+
});
|
|
47
|
+
const type = found.results.find((label)=>label.typeId === input.associationType);
|
|
48
|
+
if (!type) {
|
|
49
|
+
throw new Error(`Association type ${input.associationType} not found for ${input.fromObjectType} to ${input.toObjectType}.`);
|
|
50
|
+
}
|
|
51
|
+
return type.category;
|
|
52
|
+
}
|
|
53
|
+
function batches(input, associationCategory) {
|
|
54
|
+
const inputs = input.toObjectIds.map((id)=>({
|
|
55
|
+
from: {
|
|
56
|
+
id: input.fromObjectId
|
|
57
|
+
},
|
|
58
|
+
to: {
|
|
59
|
+
id
|
|
60
|
+
},
|
|
61
|
+
types: [
|
|
62
|
+
{
|
|
63
|
+
associationCategory,
|
|
64
|
+
associationTypeId: input.associationType
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}));
|
|
68
|
+
return Array.from({
|
|
69
|
+
length: Math.ceil(inputs.length / batchSize)
|
|
70
|
+
}, (_, index)=>inputs.slice(index * batchSize, (index + 1) * batchSize));
|
|
71
|
+
}
|
|
72
|
+
const createdAssociation = z.object({
|
|
73
|
+
fromObjectId: z.coerce.string(),
|
|
74
|
+
toObjectId: z.coerce.string(),
|
|
75
|
+
labels: z.array(z.string()).optional().default([])
|
|
76
|
+
});
|
|
77
|
+
const created = z.object({
|
|
78
|
+
results: z.array(createdAssociation).optional().default([]),
|
|
79
|
+
errors: batchErrors
|
|
80
|
+
});
|
|
81
|
+
export const createAssociations = defineAction({
|
|
82
|
+
slug: 'createAssociations',
|
|
83
|
+
description: 'Associate one record with up to many records of another object type, with an association type (label).',
|
|
84
|
+
input: z.object(shape),
|
|
85
|
+
output: z.object({
|
|
86
|
+
totalAssociations: z.number(),
|
|
87
|
+
batchCount: z.number(),
|
|
88
|
+
results: z.array(createdAssociation),
|
|
89
|
+
errors: z.array(batchError)
|
|
90
|
+
}),
|
|
91
|
+
idempotent: false,
|
|
92
|
+
options,
|
|
93
|
+
async run ({ client, input, req }) {
|
|
94
|
+
const chunks = batches(input, await category(client, input, signal(req)));
|
|
95
|
+
const responses = [];
|
|
96
|
+
for (const inputs of chunks){
|
|
97
|
+
responses.push(await client.request(created, {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
path: `/crm/v4/associations/${input.fromObjectType}/${input.toObjectType}/batch/create`,
|
|
100
|
+
body: {
|
|
101
|
+
inputs
|
|
102
|
+
},
|
|
103
|
+
signal: signal(req)
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
totalAssociations: input.toObjectIds.length,
|
|
108
|
+
batchCount: chunks.length,
|
|
109
|
+
results: responses.flatMap((response)=>response.results),
|
|
110
|
+
errors: responses.flatMap((response)=>response.errors)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export const removeAssociations = defineAction({
|
|
115
|
+
slug: 'removeAssociations',
|
|
116
|
+
description: 'Remove one association type (label) between a record and records of another object type. Removing the unlabeled type removes every label.',
|
|
117
|
+
input: z.object(shape),
|
|
118
|
+
output: z.object({
|
|
119
|
+
success: z.literal(true),
|
|
120
|
+
totalAssociations: z.number(),
|
|
121
|
+
batchCount: z.number()
|
|
122
|
+
}),
|
|
123
|
+
idempotent: false,
|
|
124
|
+
options,
|
|
125
|
+
async run ({ client, input, req }) {
|
|
126
|
+
const chunks = batches(input, await category(client, input, signal(req)));
|
|
127
|
+
for (const inputs of chunks){
|
|
128
|
+
await client.json({
|
|
129
|
+
method: 'POST',
|
|
130
|
+
path: `/crm/v4/associations/${input.fromObjectType}/${input.toObjectType}/batch/labels/archive`,
|
|
131
|
+
body: {
|
|
132
|
+
inputs
|
|
133
|
+
},
|
|
134
|
+
signal: signal(req)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
totalAssociations: input.toObjectIds.length,
|
|
140
|
+
batchCount: chunks.length
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const associationsPage = z.object({
|
|
145
|
+
results: z.array(z.object({
|
|
146
|
+
toObjectId: z.coerce.string(),
|
|
147
|
+
associationTypes: z.array(associationLabel)
|
|
148
|
+
})),
|
|
149
|
+
paging: z.object({
|
|
150
|
+
next: z.object({
|
|
151
|
+
after: z.string()
|
|
152
|
+
}).optional()
|
|
153
|
+
}).optional()
|
|
154
|
+
});
|
|
155
|
+
export const findAssociations = defineAction({
|
|
156
|
+
slug: 'findAssociations',
|
|
157
|
+
description: "Read every association from one record to an object type, with each one's labels.",
|
|
158
|
+
input: z.object({
|
|
159
|
+
fromObjectId: shape.fromObjectId,
|
|
160
|
+
fromObjectType: shape.fromObjectType,
|
|
161
|
+
toObjectType: shape.toObjectType
|
|
162
|
+
}),
|
|
163
|
+
output: z.object({
|
|
164
|
+
results: associationsPage.shape.results
|
|
165
|
+
}),
|
|
166
|
+
idempotent: true,
|
|
167
|
+
options: {
|
|
168
|
+
fromObjectType: objectTypeOptions,
|
|
169
|
+
toObjectType: objectTypeOptions
|
|
170
|
+
},
|
|
171
|
+
async run ({ client, input, req }) {
|
|
172
|
+
const results = [];
|
|
173
|
+
let after;
|
|
174
|
+
do {
|
|
175
|
+
const page = await client.request(associationsPage, {
|
|
176
|
+
path: `/crm/v4/objects/${input.fromObjectType}/${input.fromObjectId}/associations/${input.toObjectType}`,
|
|
177
|
+
query: {
|
|
178
|
+
limit: 500,
|
|
179
|
+
after
|
|
180
|
+
},
|
|
181
|
+
signal: signal(req)
|
|
182
|
+
});
|
|
183
|
+
results.push(...page.results);
|
|
184
|
+
after = page.paging?.next?.after;
|
|
185
|
+
}while (after)
|
|
186
|
+
return {
|
|
187
|
+
results
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=associations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/actions/associations.ts"],"names":["z","signal","objectType","recordId","defineAction","associationLabel","associationTypeOptions","objectTypeOptions","toRecordOptions","batchSize","typeId","union","number","int","string","regex","transform","Number","meta","label","description","shape","fromObjectType","fromObjectId","toObjectType","associationType","toObjectIds","array","min","options","labels","object","results","batchError","message","category","optional","batchErrors","default","client","input","abort","found","request","path","type","find","Error","batches","associationCategory","inputs","map","id","from","to","types","associationTypeId","Array","length","Math","ceil","_","index","slice","createdAssociation","coerce","toObjectId","created","errors","createAssociations","slug","output","totalAssociations","batchCount","idempotent","run","req","chunks","responses","push","method","body","flatMap","response","removeAssociations","success","literal","json","associationsPage","associationTypes","paging","next","after","findAssociations","page","query","limit"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAA6BC,MAAM,QAAQ,eAAe;AAC1D,SAASC,UAAU,EAAEC,QAAQ,QAAQ,eAAe;AACpD,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,sBAAsB,EAAEC,iBAAiB,EAAEC,eAAe,QAAQ,eAAe;AAE1F,MAAMC,YAAY;AAElB,MAAMC,SAASV,EACZW,KAAK,CAAC;IAACX,EAAEY,MAAM,GAAGC,GAAG;IAAIb,EAAEc,MAAM,GAAGC,KAAK,CAAC,SAASC,SAAS,CAACC;CAAQ,EACrEC,IAAI,CAAC;IAAEC,OAAO;IAA2BC,aAAa;AAA2B;AAEpF,MAAMC,QAAQ;IACZC,gBAAgBpB,WAAWgB,IAAI,CAAC;QAAEC,OAAO;IAAmB;IAC5DI,cAAcpB,SAAS;IACvBqB,cAActB,WAAWgB,IAAI,CAAC;QAAEC,OAAO;IAAiB;IACxDM,iBAAiBf;IACjBgB,aAAa1B,EAAE2B,KAAK,CAACxB,SAAS,iBAAiByB,GAAG,CAAC,GAAGV,IAAI,CAAC;QAAEC,OAAO;IAAgB;AACtF;AAEA,MAAMU,UAAU;IACdP,gBAAgBf;IAChBiB,cAAcjB;IACdkB,iBAAiBnB;IACjBoB,aAAalB;AACf;AAEA,MAAMsB,SAAS9B,EAAE+B,MAAM,CAAC;IAAEC,SAAShC,EAAE2B,KAAK,CAACtB;AAAkB;AAE7D,MAAM4B,aAAajC,EAAE+B,MAAM,CAAC;IAAEG,SAASlC,EAAEc,MAAM;IAAIqB,UAAUnC,EAAEc,MAAM,GAAGsB,QAAQ;AAAG;AAEnF,MAAMC,cAAcrC,EAAE2B,KAAK,CAACM,YAAYG,QAAQ,GAAGE,OAAO,CAAC,EAAE;AAU7D,eAAeH,SAASI,MAAq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,YAAY;IAClC;IACA+C,QAAQvE,EAAE+B,MAAM,CAAC;QAAEC,SAASwD,iBAAiBnE,KAAK,CAACW,OAAO;IAAC;IAC3D0C,YAAY;IACZ7C,SAAS;QAAEP,gBAAgBf;QAAmBiB,cAAcjB;IAAkB;IAC9E,MAAMoE,KAAI,EAAEpC,MAAM,EAAEC,KAAK,EAAEoC,GAAG,EAAE;QAC9B,MAAM5C,UAAwD,EAAE;QAChE,IAAI4D;QAEJ,GAAG;YACD,MAAME,OAAO,MAAMvD,OAAOI,OAAO,CAAC6C,kBAAkB;gBAClD5C,MAAM,CAAC,gBAAgB,EAAEJ,MAAMlB,cAAc,CAAC,CAAC,EAAEkB,MAAMjB,YAAY,CAAC,cAAc,EAAEiB,MAAMhB,YAAY,EAAE;gBACxGuE,OAAO;oBAAEC,OAAO;oBAAKJ;gBAAM;gBAC3B3F,QAAQA,OAAO2E;YACjB;YAEA5C,QAAQ+C,IAAI,IAAIe,KAAK9D,OAAO;YAC5B4D,QAAQE,KAAKJ,MAAM,EAAEC,MAAMC;QAC7B,QAASA,MAAO;QAEhB,OAAO;YAAE5D;QAAQ;IACnB;AACF,GAAG","file":"associations.js"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createOrUpdateContact: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
objectProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
properties: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
8
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
9
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
10
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
12
|
+
results: z.ZodArray<z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
type: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>>>;
|
|
17
|
+
}, z.core.$strip>, Record<string, never>, {
|
|
18
|
+
json: (request: import("../client.js").HubSpotRequest) => Promise<unknown>;
|
|
19
|
+
request: <T>(schema: z.ZodType<T>, options: import("../client.js").HubSpotRequest) => Promise<T>;
|
|
20
|
+
authorize(headers: Headers): void;
|
|
21
|
+
}, {
|
|
22
|
+
id: string;
|
|
23
|
+
properties: Record<string, string | null>;
|
|
24
|
+
createdAt?: string | undefined;
|
|
25
|
+
updatedAt?: string | undefined;
|
|
26
|
+
archived?: boolean | undefined;
|
|
27
|
+
associations?: Record<string, {
|
|
28
|
+
results: {
|
|
29
|
+
id: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}[];
|
|
32
|
+
}> | undefined;
|
|
33
|
+
}> & {
|
|
34
|
+
slug: "createOrUpdateContact";
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=createOrUpdateContact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrUpdateContact.d.ts","sourceRoot":"","sources":["../../src/actions/createOrUpdateContact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ChC,CAAC"}
|