@superdurable/connector-hubspot 0.0.0-stage → 0.1.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 +8 -2
- package/dex-connector.json +163 -0
- package/dist/chunk-SUNBKTMW.js +335 -0
- package/dist/connection-B7L88dB2.d.ts +288 -0
- package/dist/index.d.ts +292 -0
- package/dist/index.js +772 -0
- package/dist/mock.d.ts +118 -0
- package/dist/mock.js +284 -0
- package/package.json +61 -4
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { RefreshingCredentialProvider, SecretString, Query, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** HubSpot API base URL; leave blank for HubSpot's public API host, which serves every data center. Enter an absolute HTTPS URL only for an explicitly supported compatible gateway, or a loopback HTTP URL for a local test server. */
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
/** Maximum complete HubSpot API response in bytes; enter a positive integer only to change the safety limit. Oversized responses select invalidResponse. */
|
|
9
|
+
maxResponseBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Runtime schema for manifest configuration. */
|
|
12
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
13
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
14
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/** Private connector credentials resolved by the host. */
|
|
17
|
+
interface Credentials {
|
|
18
|
+
/** Selected authorization method. */
|
|
19
|
+
authMethodId?: string;
|
|
20
|
+
/** Secret 30-minute access token produced automatically by HubSpot OAuth and refreshed before it expires; never paste a token here. */
|
|
21
|
+
accessToken: SecretString;
|
|
22
|
+
/** Non-secret OAuth client ID copied from https://app.hubspot.com under Development > Legacy apps > the public app > Auth, or from a project app's Auth settings; it has the UUID shape aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee, and blank means authorization and refresh cannot start. */
|
|
23
|
+
oauthClientId?: string;
|
|
24
|
+
/** Secret OAuth client secret copied from the same Auth page; Dex Web stores it as a secret and sends it only to HubSpot's token endpoint, and blank means authorization and refresh cannot start. */
|
|
25
|
+
oauthClientSecret?: SecretString;
|
|
26
|
+
/** Secret long-lived refresh token produced by HubSpot OAuth; Dex stores any replacement HubSpot returns, and a blank or rejected token means you must authorize again. */
|
|
27
|
+
refreshToken?: SecretString;
|
|
28
|
+
}
|
|
29
|
+
/** Decode private credential fields for the selected authorization method. */
|
|
30
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
31
|
+
/** Decode shared credential fields for the selected authorization method. */
|
|
32
|
+
declare function decodeSharedCredentials(value: unknown): Credentials;
|
|
33
|
+
/** Host-owned source of private connector credentials. */
|
|
34
|
+
type CredentialSource = RefreshingCredentialProvider<Credentials>;
|
|
35
|
+
/** SearchFilter is one typed CRM search condition. */
|
|
36
|
+
interface SearchFilter {
|
|
37
|
+
/** PropertyName is an internal property name such as email, or an
|
|
38
|
+
* association pseudo-property such as associations.contact. */
|
|
39
|
+
"propertyName": string;
|
|
40
|
+
/** Operator selects the comparison. */
|
|
41
|
+
"operator": "BETWEEN" | "CONTAINS_TOKEN" | "EQ" | "GT" | "GTE" | "HAS_PROPERTY" | "IN" | "LT" | "LTE" | "NEQ" | "NOT_CONTAINS_TOKEN" | "NOT_HAS_PROPERTY" | "NOT_IN" | (string & {});
|
|
42
|
+
/** Value is the comparison value for EQ, NEQ, LT, LTE, GT, GTE, BETWEEN,
|
|
43
|
+
* CONTAINS_TOKEN, and NOT_CONTAINS_TOKEN. Dates are Unix milliseconds. */
|
|
44
|
+
"value"?: string | undefined;
|
|
45
|
+
/** HighValue is the inclusive upper bound for BETWEEN. */
|
|
46
|
+
"highValue"?: string | undefined;
|
|
47
|
+
/** Values lists the candidates for IN and NOT_IN. HubSpot requires lowercase
|
|
48
|
+
* values when the property is a string property. */
|
|
49
|
+
"values"?: Array<string> | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** SearchFilterGroup AND-s its filters. A search OR-s its groups. */
|
|
52
|
+
interface SearchFilterGroup {
|
|
53
|
+
/** Filters are the conditions that must all match. */
|
|
54
|
+
"filters": Array<SearchFilter> | null;
|
|
55
|
+
}
|
|
56
|
+
/** SearchSort orders search results by one property. */
|
|
57
|
+
interface SearchSort {
|
|
58
|
+
/** PropertyName is the internal property name to sort by. */
|
|
59
|
+
"propertyName": string;
|
|
60
|
+
/** Direction is ascending or descending. */
|
|
61
|
+
"direction": "ASCENDING" | "DESCENDING" | (string & {});
|
|
62
|
+
}
|
|
63
|
+
/** SearchObjectsInput selects one bounded page of matching records. */
|
|
64
|
+
interface SearchObjectsInput {
|
|
65
|
+
/** ObjectType is the object type to search. */
|
|
66
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
67
|
+
/** FilterGroups are OR-ed; empty matches every record. HubSpot allows five
|
|
68
|
+
* groups, six filters per group, and eighteen filters in total. */
|
|
69
|
+
"filterGroups"?: Array<SearchFilterGroup> | undefined;
|
|
70
|
+
/** Query optionally searches the object's default text properties. */
|
|
71
|
+
"query"?: string | undefined;
|
|
72
|
+
/** Sort optionally orders results; without it HubSpot returns oldest records first. */
|
|
73
|
+
"sort"?: SearchSort | undefined;
|
|
74
|
+
/** Properties lists the property values to return; empty returns HubSpot's
|
|
75
|
+
* default properties for the object type. */
|
|
76
|
+
"properties"?: Array<string> | undefined;
|
|
77
|
+
/** Limit is the page size from 1 through 200; zero uses 10. */
|
|
78
|
+
"limit"?: number | undefined;
|
|
79
|
+
/** After is the NextAfter cursor of the previous page; empty starts at the
|
|
80
|
+
* first result. Paging cannot pass HubSpot's 10,000th result. */
|
|
81
|
+
"after"?: string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/** CRMObject is one HubSpot CRM record. */
|
|
84
|
+
interface CRMObject {
|
|
85
|
+
/** ObjectType is the record's object type. */
|
|
86
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
87
|
+
/** ID is HubSpot's record ID (hs_object_id), a decimal string. */
|
|
88
|
+
"id": string;
|
|
89
|
+
/** Properties holds the returned property values keyed by internal property
|
|
90
|
+
* name. HubSpot returns every value as a string; a property without a value
|
|
91
|
+
* is absent. */
|
|
92
|
+
"properties"?: {
|
|
93
|
+
[key: string]: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
/** CreatedAt is when HubSpot created the record, when reported. */
|
|
96
|
+
"createdAt"?: string | undefined;
|
|
97
|
+
/** UpdatedAt is when HubSpot last modified the record, when reported. */
|
|
98
|
+
"updatedAt"?: string | undefined;
|
|
99
|
+
/** Archived reports whether the record is archived. */
|
|
100
|
+
"archived": boolean;
|
|
101
|
+
/** URL is the HubSpot app link to the record when HubSpot returns one. */
|
|
102
|
+
"url"?: string | undefined;
|
|
103
|
+
}
|
|
104
|
+
/** ObjectPage is one page of CRM search results. */
|
|
105
|
+
interface ObjectPage {
|
|
106
|
+
/** ObjectType is the searched object type. */
|
|
107
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
108
|
+
/** Total is HubSpot's count of all matching records. */
|
|
109
|
+
"total": number;
|
|
110
|
+
/** Objects are the records on this page, possibly none. */
|
|
111
|
+
"objects": Array<CRMObject> | null;
|
|
112
|
+
/** NextAfter is the cursor for the next page, empty on the last page. */
|
|
113
|
+
"nextAfter"?: string | undefined;
|
|
114
|
+
}
|
|
115
|
+
/** GetObjectInput identifies one record. */
|
|
116
|
+
interface GetObjectInput {
|
|
117
|
+
/** ObjectType is the record's object type. */
|
|
118
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
119
|
+
/** ObjectID is HubSpot's decimal record ID. */
|
|
120
|
+
"objectId": string;
|
|
121
|
+
/** Properties lists the property values to return; empty returns HubSpot's
|
|
122
|
+
* default properties for the object type. */
|
|
123
|
+
"properties"?: Array<string> | undefined;
|
|
124
|
+
}
|
|
125
|
+
/** UpsertObjectInput creates or updates one record identified by a unique property value. */
|
|
126
|
+
interface UpsertObjectInput {
|
|
127
|
+
/** ObjectType is the record's object type. */
|
|
128
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
129
|
+
/** IDProperty is a unique identifier property: email for contacts, or a
|
|
130
|
+
* custom property created with unique values for any object type. */
|
|
131
|
+
"idProperty": string;
|
|
132
|
+
/** IDValue is the unique value that identifies the record, such as the email address. */
|
|
133
|
+
"idValue": string;
|
|
134
|
+
/** Properties are the values to set, keyed by internal property name. An
|
|
135
|
+
* empty string clears a value. */
|
|
136
|
+
"properties"?: {
|
|
137
|
+
[key: string]: string;
|
|
138
|
+
} | undefined;
|
|
139
|
+
}
|
|
140
|
+
/** UpsertedObject is the record an upsert created or updated. */
|
|
141
|
+
interface UpsertedObject {
|
|
142
|
+
/** Object is the record with the values HubSpot returned. */
|
|
143
|
+
"object": CRMObject;
|
|
144
|
+
/** Created reports whether the dispatch HubSpot answered created the record.
|
|
145
|
+
* After a Dex retry or a repeated dispatch it can be false even though an
|
|
146
|
+
* earlier dispatch of the same Step created the record. */
|
|
147
|
+
"created": boolean;
|
|
148
|
+
}
|
|
149
|
+
/** UpdateObjectInput replaces property values on one record. */
|
|
150
|
+
interface UpdateObjectInput {
|
|
151
|
+
/** ObjectType is the record's object type. */
|
|
152
|
+
"objectType": "companies" | "contacts" | "deals" | (string & {});
|
|
153
|
+
/** ObjectID is HubSpot's decimal record ID. */
|
|
154
|
+
"objectId": string;
|
|
155
|
+
/** Properties are the values to set, keyed by internal property name. At
|
|
156
|
+
* least one is required, and an empty string clears a value. */
|
|
157
|
+
"properties": {
|
|
158
|
+
[key: string]: string;
|
|
159
|
+
} | null;
|
|
160
|
+
}
|
|
161
|
+
/** Runtime validator for SearchFilter. */
|
|
162
|
+
declare const SearchFilterSchema: z.ZodObject<{
|
|
163
|
+
propertyName: z.ZodString;
|
|
164
|
+
operator: z.ZodString;
|
|
165
|
+
value: z.ZodOptional<z.ZodString>;
|
|
166
|
+
highValue: z.ZodOptional<z.ZodString>;
|
|
167
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
/** Runtime validator for SearchFilterGroup. */
|
|
170
|
+
declare const SearchFilterGroupSchema: z.ZodObject<{
|
|
171
|
+
filters: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
172
|
+
propertyName: z.ZodString;
|
|
173
|
+
operator: z.ZodString;
|
|
174
|
+
value: z.ZodOptional<z.ZodString>;
|
|
175
|
+
highValue: z.ZodOptional<z.ZodString>;
|
|
176
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
177
|
+
}, z.core.$strict>>>;
|
|
178
|
+
}, z.core.$strict>;
|
|
179
|
+
/** Runtime validator for SearchSort. */
|
|
180
|
+
declare const SearchSortSchema: z.ZodObject<{
|
|
181
|
+
propertyName: z.ZodString;
|
|
182
|
+
direction: z.ZodString;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
/** Runtime validator for SearchObjectsInput. */
|
|
185
|
+
declare const SearchObjectsInputSchema: z.ZodObject<{
|
|
186
|
+
objectType: z.ZodString;
|
|
187
|
+
filterGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
188
|
+
filters: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
189
|
+
propertyName: z.ZodString;
|
|
190
|
+
operator: z.ZodString;
|
|
191
|
+
value: z.ZodOptional<z.ZodString>;
|
|
192
|
+
highValue: z.ZodOptional<z.ZodString>;
|
|
193
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
194
|
+
}, z.core.$strict>>>;
|
|
195
|
+
}, z.core.$strict>>>;
|
|
196
|
+
query: z.ZodOptional<z.ZodString>;
|
|
197
|
+
sort: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
propertyName: z.ZodString;
|
|
199
|
+
direction: z.ZodString;
|
|
200
|
+
}, z.core.$strict>>;
|
|
201
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
202
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
after: z.ZodOptional<z.ZodString>;
|
|
204
|
+
}, z.core.$strict>;
|
|
205
|
+
/** Runtime validator for CRMObject. */
|
|
206
|
+
declare const CRMObjectSchema: z.ZodObject<{
|
|
207
|
+
objectType: z.ZodString;
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
210
|
+
createdAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
211
|
+
updatedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
212
|
+
archived: z.ZodBoolean;
|
|
213
|
+
url: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, z.core.$strict>;
|
|
215
|
+
/** Runtime validator for ObjectPage. */
|
|
216
|
+
declare const ObjectPageSchema: z.ZodObject<{
|
|
217
|
+
objectType: z.ZodString;
|
|
218
|
+
total: z.ZodNumber;
|
|
219
|
+
objects: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
220
|
+
objectType: z.ZodString;
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
223
|
+
createdAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
224
|
+
updatedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
225
|
+
archived: z.ZodBoolean;
|
|
226
|
+
url: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, z.core.$strict>>>;
|
|
228
|
+
nextAfter: z.ZodOptional<z.ZodString>;
|
|
229
|
+
}, z.core.$strict>;
|
|
230
|
+
/** Runtime validator for GetObjectInput. */
|
|
231
|
+
declare const GetObjectInputSchema: z.ZodObject<{
|
|
232
|
+
objectType: z.ZodString;
|
|
233
|
+
objectId: z.ZodString;
|
|
234
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
/** Runtime validator for UpsertObjectInput. */
|
|
237
|
+
declare const UpsertObjectInputSchema: z.ZodObject<{
|
|
238
|
+
objectType: z.ZodString;
|
|
239
|
+
idProperty: z.ZodString;
|
|
240
|
+
idValue: z.ZodString;
|
|
241
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
242
|
+
}, z.core.$strict>;
|
|
243
|
+
/** Runtime validator for UpsertedObject. */
|
|
244
|
+
declare const UpsertedObjectSchema: z.ZodObject<{
|
|
245
|
+
object: z.ZodObject<{
|
|
246
|
+
objectType: z.ZodString;
|
|
247
|
+
id: z.ZodString;
|
|
248
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
249
|
+
createdAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
250
|
+
updatedAt: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
251
|
+
archived: z.ZodBoolean;
|
|
252
|
+
url: z.ZodOptional<z.ZodString>;
|
|
253
|
+
}, z.core.$strict>;
|
|
254
|
+
created: z.ZodBoolean;
|
|
255
|
+
}, z.core.$strict>;
|
|
256
|
+
/** Runtime validator for UpdateObjectInput. */
|
|
257
|
+
declare const UpdateObjectInputSchema: z.ZodObject<{
|
|
258
|
+
objectType: z.ZodString;
|
|
259
|
+
objectId: z.ZodString;
|
|
260
|
+
properties: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
|
|
263
|
+
/** Typed operations supplied by a client or mock. */
|
|
264
|
+
interface Operations {
|
|
265
|
+
/** Invoke searchObjects through this connection. */
|
|
266
|
+
searchObjects(): Query<SearchObjectsInput, ObjectPage>;
|
|
267
|
+
/** Invoke getObject through this connection. */
|
|
268
|
+
getObject(): Query<GetObjectInput, CRMObject>;
|
|
269
|
+
/** Invoke upsertObject through this connection. */
|
|
270
|
+
upsertObject(): Mutation<UpsertObjectInput, UpsertedObject>;
|
|
271
|
+
/** Invoke updateObject through this connection. */
|
|
272
|
+
updateObject(): Mutation<UpdateObjectInput, CRMObject>;
|
|
273
|
+
}
|
|
274
|
+
/** Named connector connection kept outside Flow state. */
|
|
275
|
+
declare class Connection<BoundOperations = Operations> {
|
|
276
|
+
/** Stable provider and connection name. */
|
|
277
|
+
readonly reference: ConnectionRef;
|
|
278
|
+
/** Bound provider operations. */
|
|
279
|
+
readonly operations: BoundOperations;
|
|
280
|
+
/** Validate a reference and bind operations. */
|
|
281
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
282
|
+
}
|
|
283
|
+
/** Bind a client to a named connection. */
|
|
284
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
285
|
+
/** Bind scripted operations to a named connection. */
|
|
286
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
287
|
+
|
|
288
|
+
export { type CRMObject as C, type GetObjectInput as G, type ObjectPage as O, type SearchObjectsInput as S, type UpdateObjectInput as U, Connection as a, type UpsertObjectInput as b, type UpsertedObject as c, type Config as d, type CredentialSource as e, type Operations as f, CRMObjectSchema as g, ConfigSchema as h, type Credentials as i, GetObjectInputSchema as j, ObjectPageSchema as k, type SearchFilter as l, type SearchFilterGroup as m, SearchFilterGroupSchema as n, SearchFilterSchema as o, SearchObjectsInputSchema as p, type SearchSort as q, SearchSortSchema as r, UpdateObjectInputSchema as s, UpsertObjectInputSchema as t, UpsertedObjectSchema as u, decodeCredentials as v, decodeSharedCredentials as w, newConnection as x, newConnectionWithOperations as y };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { G as GetObjectInput, C as CRMObject, a as Connection, S as SearchObjectsInput, O as ObjectPage, U as UpdateObjectInput, b as UpsertObjectInput, c as UpsertedObject, d as Config, e as CredentialSource, f as Operations } from './connection-B7L88dB2.js';
|
|
2
|
+
export { g as CRMObjectSchema, h as ConfigSchema, i as Credentials, j as GetObjectInputSchema, k as ObjectPageSchema, l as SearchFilter, m as SearchFilterGroup, n as SearchFilterGroupSchema, o as SearchFilterSchema, p as SearchObjectsInputSchema, q as SearchSort, r as SearchSortSchema, s as UpdateObjectInputSchema, t as UpsertObjectInputSchema, u as UpsertedObjectSchema, v as decodeCredentials, w as decodeSharedCredentials, x as newConnection, y as newConnectionWithOperations } from './connection-B7L88dB2.js';
|
|
3
|
+
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
+
import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, QueryAttempt, MutationAttempt, ReceiptDraft, Failure } from '@superdurable/connectors-sdk';
|
|
5
|
+
import { StepTarget } from '@superdurable/dex';
|
|
6
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
7
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
8
|
+
import 'zod';
|
|
9
|
+
|
|
10
|
+
/** Stable connector identity. */
|
|
11
|
+
declare const ConnectorID = "hubspot";
|
|
12
|
+
/** Provider identity for named connections. */
|
|
13
|
+
declare const ProviderID = "hubspot";
|
|
14
|
+
/** Branch IDs for searchObjects. */
|
|
15
|
+
declare const SearchObjectsBranch: {
|
|
16
|
+
readonly Searched: "searched";
|
|
17
|
+
readonly ProviderRejected: "providerRejected";
|
|
18
|
+
readonly InvalidResponse: "invalidResponse";
|
|
19
|
+
readonly Defect: "defect";
|
|
20
|
+
};
|
|
21
|
+
/** HubSpot returned one bounded page of matching records; the page may be empty. */
|
|
22
|
+
declare const SearchObjectsBranchSearched: "searched";
|
|
23
|
+
/** HubSpot conclusively rejected the search, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
24
|
+
declare const SearchObjectsBranchProviderRejected: "providerRejected";
|
|
25
|
+
/** HubSpot returned an invalid or oversized search response. */
|
|
26
|
+
declare const SearchObjectsBranchInvalidResponse: "invalidResponse";
|
|
27
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
28
|
+
declare const SearchObjectsBranchDefect: "defect";
|
|
29
|
+
/** Manifest definition for searchObjects. */
|
|
30
|
+
declare const SearchObjectsDefinition: QueryDefinition;
|
|
31
|
+
/** Manifest metadata for searchObjects. */
|
|
32
|
+
declare const SearchObjectsMetadata: {
|
|
33
|
+
readonly kind: "query";
|
|
34
|
+
readonly idempotency: "none";
|
|
35
|
+
readonly authorization: "required";
|
|
36
|
+
};
|
|
37
|
+
/** Branch IDs for getObject. */
|
|
38
|
+
declare const GetObjectBranch: {
|
|
39
|
+
readonly Found: "found";
|
|
40
|
+
readonly NotFound: "notFound";
|
|
41
|
+
readonly ProviderRejected: "providerRejected";
|
|
42
|
+
readonly InvalidResponse: "invalidResponse";
|
|
43
|
+
readonly Defect: "defect";
|
|
44
|
+
};
|
|
45
|
+
/** The record exists and was returned. */
|
|
46
|
+
declare const GetObjectBranchFound: "found";
|
|
47
|
+
/** No unarchived record of that object type has the record ID. */
|
|
48
|
+
declare const GetObjectBranchNotFound: "notFound";
|
|
49
|
+
/** HubSpot conclusively rejected the read, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
50
|
+
declare const GetObjectBranchProviderRejected: "providerRejected";
|
|
51
|
+
/** HubSpot returned an invalid or oversized record response. */
|
|
52
|
+
declare const GetObjectBranchInvalidResponse: "invalidResponse";
|
|
53
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
54
|
+
declare const GetObjectBranchDefect: "defect";
|
|
55
|
+
/** Manifest definition for getObject. */
|
|
56
|
+
declare const GetObjectDefinition: QueryDefinition;
|
|
57
|
+
/** Manifest metadata for getObject. */
|
|
58
|
+
declare const GetObjectMetadata: {
|
|
59
|
+
readonly kind: "query";
|
|
60
|
+
readonly idempotency: "none";
|
|
61
|
+
readonly authorization: "required";
|
|
62
|
+
};
|
|
63
|
+
/** Branch IDs for upsertObject. */
|
|
64
|
+
declare const UpsertObjectBranch: {
|
|
65
|
+
readonly Upserted: "upserted";
|
|
66
|
+
readonly Conflict: "conflict";
|
|
67
|
+
readonly ProviderRejected: "providerRejected";
|
|
68
|
+
readonly InvalidResponse: "invalidResponse";
|
|
69
|
+
readonly Defect: "defect";
|
|
70
|
+
};
|
|
71
|
+
/** HubSpot created the record or updated the record that owns the unique value. */
|
|
72
|
+
declare const UpsertObjectBranchUpserted: "upserted";
|
|
73
|
+
/** The properties conflict with another record, such as an email that another contact already owns. */
|
|
74
|
+
declare const UpsertObjectBranchConflict: "conflict";
|
|
75
|
+
/** HubSpot conclusively rejected the upsert, such as an invalid property value, a property that is not unique, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
76
|
+
declare const UpsertObjectBranchProviderRejected: "providerRejected";
|
|
77
|
+
/** HubSpot applied or rejected the upsert but returned an invalid or oversized response. */
|
|
78
|
+
declare const UpsertObjectBranchInvalidResponse: "invalidResponse";
|
|
79
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
80
|
+
declare const UpsertObjectBranchDefect: "defect";
|
|
81
|
+
/** Manifest definition for upsertObject. */
|
|
82
|
+
declare const UpsertObjectDefinition: MutationDefinition;
|
|
83
|
+
/** Manifest metadata for upsertObject. */
|
|
84
|
+
declare const UpsertObjectMetadata: {
|
|
85
|
+
readonly kind: "mutation";
|
|
86
|
+
readonly idempotency: "required";
|
|
87
|
+
readonly authorization: "required";
|
|
88
|
+
};
|
|
89
|
+
/** Branch IDs for updateObject. */
|
|
90
|
+
declare const UpdateObjectBranch: {
|
|
91
|
+
readonly Updated: "updated";
|
|
92
|
+
readonly NotFound: "notFound";
|
|
93
|
+
readonly Conflict: "conflict";
|
|
94
|
+
readonly ProviderRejected: "providerRejected";
|
|
95
|
+
readonly InvalidResponse: "invalidResponse";
|
|
96
|
+
readonly Defect: "defect";
|
|
97
|
+
};
|
|
98
|
+
/** HubSpot updated the record and returned it. */
|
|
99
|
+
declare const UpdateObjectBranchUpdated: "updated";
|
|
100
|
+
/** No unarchived record of that object type has the record ID. */
|
|
101
|
+
declare const UpdateObjectBranchNotFound: "notFound";
|
|
102
|
+
/** The properties conflict with another record, such as an email that another contact already owns. */
|
|
103
|
+
declare const UpdateObjectBranchConflict: "conflict";
|
|
104
|
+
/** HubSpot conclusively rejected the update, such as an invalid property value, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
105
|
+
declare const UpdateObjectBranchProviderRejected: "providerRejected";
|
|
106
|
+
/** HubSpot applied or rejected the update but returned an invalid or oversized response. */
|
|
107
|
+
declare const UpdateObjectBranchInvalidResponse: "invalidResponse";
|
|
108
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
109
|
+
declare const UpdateObjectBranchDefect: "defect";
|
|
110
|
+
/** Manifest definition for updateObject. */
|
|
111
|
+
declare const UpdateObjectDefinition: MutationDefinition;
|
|
112
|
+
/** Manifest metadata for updateObject. */
|
|
113
|
+
declare const UpdateObjectMetadata: {
|
|
114
|
+
readonly kind: "mutation";
|
|
115
|
+
readonly idempotency: "required";
|
|
116
|
+
readonly authorization: "required";
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Configuration for the searchObjects connector Step. */
|
|
120
|
+
interface SearchObjectsStepConfig<StepInput, OperationInput = SearchObjectsInput, OperationOutput = ObjectPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
121
|
+
/** Named connection supplying this operation. */
|
|
122
|
+
connection: Connection<{
|
|
123
|
+
searchObjects(): Query<OperationInput, OperationOutput>;
|
|
124
|
+
}>;
|
|
125
|
+
/** Name matching the bound connection. */
|
|
126
|
+
connectionName: string;
|
|
127
|
+
/** HubSpot returned one bounded page of matching records; the page may be empty. */
|
|
128
|
+
searched: StepTarget<QueryResult<OperationOutput>>;
|
|
129
|
+
/** HubSpot conclusively rejected the search, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
130
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
131
|
+
/** HubSpot returned an invalid or oversized search response. */
|
|
132
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
133
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
134
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
135
|
+
}
|
|
136
|
+
/** Build the searchObjects Step from a named connection. */
|
|
137
|
+
declare function newSearchObjectsStep<StepInput, OperationInput = SearchObjectsInput, OperationOutput = ObjectPage>(configuration: SearchObjectsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
138
|
+
/** Configuration for the getObject connector Step. */
|
|
139
|
+
interface GetObjectStepConfig<StepInput, OperationInput = GetObjectInput, OperationOutput = CRMObject> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
140
|
+
/** Named connection supplying this operation. */
|
|
141
|
+
connection: Connection<{
|
|
142
|
+
getObject(): Query<OperationInput, OperationOutput>;
|
|
143
|
+
}>;
|
|
144
|
+
/** Name matching the bound connection. */
|
|
145
|
+
connectionName: string;
|
|
146
|
+
/** The record exists and was returned. */
|
|
147
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
148
|
+
/** No unarchived record of that object type has the record ID. */
|
|
149
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
150
|
+
/** HubSpot conclusively rejected the read, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
151
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
152
|
+
/** HubSpot returned an invalid or oversized record response. */
|
|
153
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
154
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
155
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
156
|
+
}
|
|
157
|
+
/** Build the getObject Step from a named connection. */
|
|
158
|
+
declare function newGetObjectStep<StepInput, OperationInput = GetObjectInput, OperationOutput = CRMObject>(configuration: GetObjectStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
159
|
+
/** Configuration for the upsertObject connector Step. */
|
|
160
|
+
interface UpsertObjectStepConfig<StepInput, OperationInput = UpsertObjectInput, OperationOutput = UpsertedObject> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
161
|
+
/** Named connection supplying this operation. */
|
|
162
|
+
connection: Connection<{
|
|
163
|
+
upsertObject(): Mutation<OperationInput, OperationOutput>;
|
|
164
|
+
}>;
|
|
165
|
+
/** Name matching the bound connection. */
|
|
166
|
+
connectionName: string;
|
|
167
|
+
/** HubSpot created the record or updated the record that owns the unique value. */
|
|
168
|
+
upserted: StepTarget<MutationResult<OperationOutput>>;
|
|
169
|
+
/** The properties conflict with another record, such as an email that another contact already owns. */
|
|
170
|
+
conflict?: StepTarget<MutationResult<OperationOutput>>;
|
|
171
|
+
/** HubSpot conclusively rejected the upsert, such as an invalid property value, a property that is not unique, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
172
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
173
|
+
/** HubSpot applied or rejected the upsert but returned an invalid or oversized response. */
|
|
174
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
175
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
176
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
177
|
+
}
|
|
178
|
+
/** Build the upsertObject Step from a named connection. */
|
|
179
|
+
declare function newUpsertObjectStep<StepInput, OperationInput = UpsertObjectInput, OperationOutput = UpsertedObject>(configuration: UpsertObjectStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
180
|
+
/** Configuration for the updateObject connector Step. */
|
|
181
|
+
interface UpdateObjectStepConfig<StepInput, OperationInput = UpdateObjectInput, OperationOutput = CRMObject> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
182
|
+
/** Named connection supplying this operation. */
|
|
183
|
+
connection: Connection<{
|
|
184
|
+
updateObject(): Mutation<OperationInput, OperationOutput>;
|
|
185
|
+
}>;
|
|
186
|
+
/** Name matching the bound connection. */
|
|
187
|
+
connectionName: string;
|
|
188
|
+
/** HubSpot updated the record and returned it. */
|
|
189
|
+
updated: StepTarget<MutationResult<OperationOutput>>;
|
|
190
|
+
/** No unarchived record of that object type has the record ID. */
|
|
191
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
192
|
+
/** The properties conflict with another record, such as an email that another contact already owns. */
|
|
193
|
+
conflict?: StepTarget<MutationResult<OperationOutput>>;
|
|
194
|
+
/** HubSpot conclusively rejected the update, such as an invalid property value, a missing scope, a rejected token, or an exhausted daily limit. */
|
|
195
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
196
|
+
/** HubSpot applied or rejected the update but returned an invalid or oversized response. */
|
|
197
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
198
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
199
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
200
|
+
}
|
|
201
|
+
/** Build the updateObject Step from a named connection. */
|
|
202
|
+
declare function newUpdateObjectStep<StepInput, OperationInput = UpdateObjectInput, OperationOutput = CRMObject>(configuration: UpdateObjectStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
203
|
+
|
|
204
|
+
/** Search one bounded CRM page. */
|
|
205
|
+
declare class SearchObjectsOperation implements Query<SearchObjectsInput, ObjectPage> {
|
|
206
|
+
private readonly client;
|
|
207
|
+
/** Bind a client. */ constructor(client: HubSpotClient);
|
|
208
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
209
|
+
/** Validate, send, and decode a search. */
|
|
210
|
+
invoke(call: Call, input: SearchObjectsInput): Promise<QueryAttempt<ObjectPage>>;
|
|
211
|
+
}
|
|
212
|
+
/** Get one CRM record. */
|
|
213
|
+
declare class GetObjectOperation implements Query<GetObjectInput, CRMObject> {
|
|
214
|
+
private readonly client;
|
|
215
|
+
/** Bind a client. */ constructor(client: HubSpotClient);
|
|
216
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
217
|
+
/** Validate, send, and decode one record. */
|
|
218
|
+
invoke(call: Call, input: GetObjectInput): Promise<QueryAttempt<CRMObject>>;
|
|
219
|
+
}
|
|
220
|
+
/** Upsert one CRM record by a unique property. */
|
|
221
|
+
declare class UpsertObjectOperation implements Mutation<UpsertObjectInput, UpsertedObject> {
|
|
222
|
+
private readonly client;
|
|
223
|
+
/** Bind a client. */ constructor(client: HubSpotClient);
|
|
224
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
225
|
+
/** Reuse the stable Call ID for a repeat-safe upsert. */ idempotencyKey(callId: string): string;
|
|
226
|
+
/** Validate and dispatch, repeating one conflicting upsert. */
|
|
227
|
+
invoke(call: Call, input: UpsertObjectInput): Promise<MutationAttempt<UpsertedObject>>;
|
|
228
|
+
}
|
|
229
|
+
/** Replace named properties on one CRM record. */
|
|
230
|
+
declare class UpdateObjectOperation implements Mutation<UpdateObjectInput, CRMObject> {
|
|
231
|
+
private readonly client;
|
|
232
|
+
/** Bind a client. */ constructor(client: HubSpotClient);
|
|
233
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
234
|
+
/** Reuse the stable Call ID for an absolute update. */ idempotencyKey(callId: string): string;
|
|
235
|
+
/** Validate, send, and decode one update. */
|
|
236
|
+
invoke(call: Call, input: UpdateObjectInput): Promise<MutationAttempt<CRMObject>>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Replace the provider sender or clock in deterministic tests. */
|
|
240
|
+
interface HubSpotClientOptions {
|
|
241
|
+
/** Caller-owned provider sender. */
|
|
242
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
243
|
+
/** Clock used for retry dates and receipts. */
|
|
244
|
+
now?: () => Date;
|
|
245
|
+
}
|
|
246
|
+
/** Classified unsuccessful exchange. */
|
|
247
|
+
interface ExchangeFailure {
|
|
248
|
+
/** Retry or terminal disposition. */
|
|
249
|
+
disposition: 'retry' | 'notFound' | 'conflict' | 'rejected' | 'invalidResponse' | 'defect';
|
|
250
|
+
/** Safe failure. */
|
|
251
|
+
failure: Failure;
|
|
252
|
+
/** Provider-directed retry delay. */
|
|
253
|
+
retryAfterMs: number;
|
|
254
|
+
/** Provider receipt. */
|
|
255
|
+
receipt: ReceiptDraft;
|
|
256
|
+
}
|
|
257
|
+
/** Successful response or classified failure. */
|
|
258
|
+
type ExchangeResult = {
|
|
259
|
+
response: ProviderResponse;
|
|
260
|
+
} | {
|
|
261
|
+
outcome: ExchangeFailure;
|
|
262
|
+
};
|
|
263
|
+
/** HubSpot CRM client using host-owned renewable credentials. */
|
|
264
|
+
declare class HubSpotClient {
|
|
265
|
+
private readonly credentials;
|
|
266
|
+
private readonly endpoint;
|
|
267
|
+
private readonly maxResponseBytes;
|
|
268
|
+
private readonly send;
|
|
269
|
+
private readonly now;
|
|
270
|
+
private readonly refreshDriver;
|
|
271
|
+
/** Validate settings and bind a credential source without contacting HubSpot. */
|
|
272
|
+
constructor(config: Config, credentials: CredentialSource, options?: HubSpotClientOptions);
|
|
273
|
+
/** Bind the search query. */ searchObjects(): SearchObjectsOperation;
|
|
274
|
+
/** Bind the record query. */ getObject(): GetObjectOperation;
|
|
275
|
+
/** Bind the unique-property upsert. */ upsertObject(): UpsertObjectOperation;
|
|
276
|
+
/** Bind the absolute update. */ updateObject(): UpdateObjectOperation;
|
|
277
|
+
/** Return a safe receipt for a completed provider attempt. */
|
|
278
|
+
receipt(call: Call, response?: ProviderResponse, objectId?: string): ReceiptDraft;
|
|
279
|
+
/** Resolve, send, refresh after one OAuth 401, then classify the response. */
|
|
280
|
+
exchange(call: Call, operation: string, objectId: string, method: string, path: string, query?: string, body?: unknown): Promise<ExchangeResult>;
|
|
281
|
+
private validateCredentials;
|
|
282
|
+
private sendRequest;
|
|
283
|
+
/** Classify a batch upsert error using the same status rules as an HTTP error. */
|
|
284
|
+
classifyBatchError(operation: string, response: ProviderResponse, receipt: ReceiptDraft): ExchangeFailure;
|
|
285
|
+
private classify;
|
|
286
|
+
private failure;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Open a named HubSpot project connection with generated OAuth credential wiring. */
|
|
290
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: HubSpotClientOptions): Connection<Operations>;
|
|
291
|
+
|
|
292
|
+
export { CRMObject, Config, Connection, ConnectorID, CredentialSource, GetObjectBranch, GetObjectBranchDefect, GetObjectBranchFound, GetObjectBranchInvalidResponse, GetObjectBranchNotFound, GetObjectBranchProviderRejected, GetObjectDefinition, GetObjectInput, GetObjectMetadata, GetObjectOperation, type GetObjectStepConfig, HubSpotClient, type HubSpotClientOptions, ObjectPage, ProviderID, SearchObjectsBranch, SearchObjectsBranchDefect, SearchObjectsBranchInvalidResponse, SearchObjectsBranchProviderRejected, SearchObjectsBranchSearched, SearchObjectsDefinition, SearchObjectsInput, SearchObjectsMetadata, SearchObjectsOperation, type SearchObjectsStepConfig, UpdateObjectBranch, UpdateObjectBranchConflict, UpdateObjectBranchDefect, UpdateObjectBranchInvalidResponse, UpdateObjectBranchNotFound, UpdateObjectBranchProviderRejected, UpdateObjectBranchUpdated, UpdateObjectDefinition, UpdateObjectInput, UpdateObjectMetadata, UpdateObjectOperation, type UpdateObjectStepConfig, UpsertObjectBranch, UpsertObjectBranchConflict, UpsertObjectBranchDefect, UpsertObjectBranchInvalidResponse, UpsertObjectBranchProviderRejected, UpsertObjectBranchUpserted, UpsertObjectDefinition, UpsertObjectInput, UpsertObjectMetadata, UpsertObjectOperation, type UpsertObjectStepConfig, UpsertedObject, newGetObjectStep, newProjectConnection, newSearchObjectsStep, newUpdateObjectStep, newUpsertObjectStep };
|