@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
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,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HubSpot TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@superdurable/connector-hubspot` provides Dex Steps for `searchObjects`, `getObject`, `upsertObject`, and `updateObject`. It supports HubSpot private app tokens and HubSpot OAuth. The connection resolves credentials at dispatch, refreshes OAuth tokens through the generated manifest driver, and retries one request after a rejected OAuth access token. The two writes are repeat-safe: upsert uses a unique HubSpot property and update replaces named property values.
|
|
4
|
+
|
|
5
|
+
The [search deals example](examples/search-deals/README.md) is a runnable Flow with a Worker entrypoint and static `hubspot-crm` connection name. Create that connection in Dex Web **Connections**. For private apps, open [HubSpot](https://app.hubspot.com/), choose **Development > Legacy apps > Create legacy app > Private**, grant the CRM read and write scopes listed in `connector.yaml`, and copy the access token from the app's **Auth** tab. For OAuth, choose a public legacy app or project app, register the redirect URI shown in Dex Web on the app's **Auth** tab, add the manifest scopes, enter the client ID and secret, and complete consent. Dex Web holds the credentials; they never enter Flow input or output.
|
|
6
|
+
|
|
7
|
+
From this directory, run `npm ci`, `npm run check`, and `npm run example:search`. To submit the sample input, run `npm run example:search:start -- examples/search-deals/input.example.json` in another terminal. Set `DEX_FLOW_SERVICE_ADDRESS` when Dex uses a nondefault port. `npm run test:integration` runs the same Flow through a real Dex Worker and Client against a local provider stand-in.
|
|
8
|
+
|
|
9
|
+
The package exports generated Config, Credentials, operation models, definitions, Step factories, and mock cases. Use `newProjectConnection(project, ConnectionName)` to bind the project connection, or `newConnection(new HubSpotClient(config, credentialSource), reference)` when constructing a client directly. The provider endpoint defaults to HubSpot's public API; `maxResponseBytes` defaults to one MiB.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "hubspot",
|
|
3
|
+
"releaseTag": "connectors/hubspot/go/v0.24.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-hubspot",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newSearchObjectsStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "searchObjects",
|
|
14
|
+
"fields": {
|
|
15
|
+
"stepType": "stepType",
|
|
16
|
+
"annotations": "annotations",
|
|
17
|
+
"connectionName": "connectionName",
|
|
18
|
+
"resultAttribute": "resultAttribute"
|
|
19
|
+
},
|
|
20
|
+
"branches": [
|
|
21
|
+
{
|
|
22
|
+
"id": "searched",
|
|
23
|
+
"field": "searched",
|
|
24
|
+
"optional": false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "providerRejected",
|
|
28
|
+
"field": "providerRejected",
|
|
29
|
+
"optional": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "invalidResponse",
|
|
33
|
+
"field": "invalidResponse",
|
|
34
|
+
"optional": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "defect",
|
|
38
|
+
"field": "defect",
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "newGetObjectStep",
|
|
45
|
+
"kind": "query",
|
|
46
|
+
"operationId": "getObject",
|
|
47
|
+
"fields": {
|
|
48
|
+
"stepType": "stepType",
|
|
49
|
+
"annotations": "annotations",
|
|
50
|
+
"connectionName": "connectionName",
|
|
51
|
+
"resultAttribute": "resultAttribute"
|
|
52
|
+
},
|
|
53
|
+
"branches": [
|
|
54
|
+
{
|
|
55
|
+
"id": "found",
|
|
56
|
+
"field": "found",
|
|
57
|
+
"optional": false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "notFound",
|
|
61
|
+
"field": "notFound",
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "providerRejected",
|
|
66
|
+
"field": "providerRejected",
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "invalidResponse",
|
|
71
|
+
"field": "invalidResponse",
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "defect",
|
|
76
|
+
"field": "defect",
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "newUpsertObjectStep",
|
|
83
|
+
"kind": "mutation",
|
|
84
|
+
"operationId": "upsertObject",
|
|
85
|
+
"fields": {
|
|
86
|
+
"stepType": "stepType",
|
|
87
|
+
"annotations": "annotations",
|
|
88
|
+
"connectionName": "connectionName",
|
|
89
|
+
"resultAttribute": "resultAttribute"
|
|
90
|
+
},
|
|
91
|
+
"branches": [
|
|
92
|
+
{
|
|
93
|
+
"id": "upserted",
|
|
94
|
+
"field": "upserted",
|
|
95
|
+
"optional": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "conflict",
|
|
99
|
+
"field": "conflict",
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "providerRejected",
|
|
104
|
+
"field": "providerRejected",
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "invalidResponse",
|
|
109
|
+
"field": "invalidResponse",
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "defect",
|
|
114
|
+
"field": "defect",
|
|
115
|
+
"optional": true
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "newUpdateObjectStep",
|
|
121
|
+
"kind": "mutation",
|
|
122
|
+
"operationId": "updateObject",
|
|
123
|
+
"fields": {
|
|
124
|
+
"stepType": "stepType",
|
|
125
|
+
"annotations": "annotations",
|
|
126
|
+
"connectionName": "connectionName",
|
|
127
|
+
"resultAttribute": "resultAttribute"
|
|
128
|
+
},
|
|
129
|
+
"branches": [
|
|
130
|
+
{
|
|
131
|
+
"id": "updated",
|
|
132
|
+
"field": "updated",
|
|
133
|
+
"optional": false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "notFound",
|
|
137
|
+
"field": "notFound",
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "conflict",
|
|
142
|
+
"field": "conflict",
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "providerRejected",
|
|
147
|
+
"field": "providerRejected",
|
|
148
|
+
"optional": true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "invalidResponse",
|
|
152
|
+
"field": "invalidResponse",
|
|
153
|
+
"optional": true
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "defect",
|
|
157
|
+
"field": "defect",
|
|
158
|
+
"optional": true
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var goTimeJSONPattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{1,2}):(\d{2}):(\d{2})(?:[.,](\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
|
|
5
|
+
function isGoTimeJSON(value) {
|
|
6
|
+
const match = goTimeJSONPattern.exec(value);
|
|
7
|
+
if (!match) return false;
|
|
8
|
+
const [, yearText, monthText, dayText, hourText, minuteText, secondText, , zone, , zoneHourText, zoneMinuteText] = match;
|
|
9
|
+
const year = Number(yearText);
|
|
10
|
+
const month = Number(monthText);
|
|
11
|
+
const day = Number(dayText);
|
|
12
|
+
const isLeap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
13
|
+
const monthDays = [31, isLeap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
14
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= monthDays[month - 1] && Number(hourText) <= 23 && Number(minuteText) <= 59 && Number(secondText) <= 59 && (zone === "Z" || Number(zoneHourText) <= 24 && Number(zoneMinuteText) <= 60);
|
|
15
|
+
}
|
|
16
|
+
function canonicalGoTimeJSON(value) {
|
|
17
|
+
const match = goTimeJSONPattern.exec(value);
|
|
18
|
+
const [, year, month, day, hour, minute, second, fraction, zone, sign, zoneHour, zoneMinute] = match;
|
|
19
|
+
const clock = year + "-" + month + "-" + day + "T" + hour.padStart(2, "0") + ":" + minute + ":" + second;
|
|
20
|
+
const digits = (fraction ?? "").slice(0, 9).replace(/0+$/, "");
|
|
21
|
+
const offsetMinutes = zone === "Z" ? 0 : (Number(zoneHour) * 60 + Number(zoneMinute)) * (sign === "+" ? 1 : -1);
|
|
22
|
+
if (Math.abs(offsetMinutes) >= 1440) return value;
|
|
23
|
+
const offset = offsetMinutes === 0 ? "Z" : (offsetMinutes > 0 ? "+" : "-") + String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(2, "0") + ":" + String(Math.abs(offsetMinutes) % 60).padStart(2, "0");
|
|
24
|
+
return clock + (digits ? "." + digits : "") + offset;
|
|
25
|
+
}
|
|
26
|
+
var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
|
|
27
|
+
var ConfigSchema = z.object({
|
|
28
|
+
"endpoint": z.string().optional(),
|
|
29
|
+
"maxResponseBytes": z.number().int().optional()
|
|
30
|
+
});
|
|
31
|
+
function decodeCredentials(value) {
|
|
32
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
33
|
+
const fields = value;
|
|
34
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
35
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
36
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
37
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
38
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
39
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
40
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
41
|
+
if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
|
|
42
|
+
const method = selectedMethod || "private-app-token";
|
|
43
|
+
const credentials = { authMethodId: method };
|
|
44
|
+
if (method === "private-app-token") {
|
|
45
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
46
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
47
|
+
} else if (method === "hubspot-oauth") {
|
|
48
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
49
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
50
|
+
if (!fields["oauth_client_secret"]) throw new TypeError("credential oauth_client_secret is required");
|
|
51
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
52
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
53
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
54
|
+
if (!fields["refresh_token"]) throw new TypeError("credential refresh_token is required");
|
|
55
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
56
|
+
} else {
|
|
57
|
+
throw new TypeError("credential auth_method is invalid");
|
|
58
|
+
}
|
|
59
|
+
return credentials;
|
|
60
|
+
}
|
|
61
|
+
function decodeSharedCredentials(value) {
|
|
62
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
63
|
+
const fields = value;
|
|
64
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
65
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
66
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
67
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
68
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
69
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
70
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
71
|
+
if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
|
|
72
|
+
const method = selectedMethod || "private-app-token";
|
|
73
|
+
const credentials = { authMethodId: method };
|
|
74
|
+
if (method === "private-app-token") {
|
|
75
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
76
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
77
|
+
} else if (method === "hubspot-oauth") {
|
|
78
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
79
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
80
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
81
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
82
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
83
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
84
|
+
} else {
|
|
85
|
+
throw new TypeError("credential auth_method is invalid");
|
|
86
|
+
}
|
|
87
|
+
return credentials;
|
|
88
|
+
}
|
|
89
|
+
var SearchFilterSchema = z.strictObject({
|
|
90
|
+
"propertyName": z.string(),
|
|
91
|
+
"operator": z.string(),
|
|
92
|
+
"value": z.string().optional(),
|
|
93
|
+
"highValue": z.string().optional(),
|
|
94
|
+
"values": z.array(z.string()).optional()
|
|
95
|
+
});
|
|
96
|
+
var SearchFilterGroupSchema = z.strictObject({
|
|
97
|
+
"filters": z.array(SearchFilterSchema).nullable()
|
|
98
|
+
});
|
|
99
|
+
var SearchSortSchema = z.strictObject({
|
|
100
|
+
"propertyName": z.string(),
|
|
101
|
+
"direction": z.string()
|
|
102
|
+
});
|
|
103
|
+
var SearchObjectsInputSchema = z.strictObject({
|
|
104
|
+
"objectType": z.string(),
|
|
105
|
+
"filterGroups": z.array(SearchFilterGroupSchema).optional(),
|
|
106
|
+
"query": z.string().optional(),
|
|
107
|
+
"sort": SearchSortSchema.optional(),
|
|
108
|
+
"properties": z.array(z.string()).optional(),
|
|
109
|
+
"limit": z.number().int().optional(),
|
|
110
|
+
"after": z.string().optional()
|
|
111
|
+
});
|
|
112
|
+
var CRMObjectSchema = z.strictObject({
|
|
113
|
+
"objectType": z.string(),
|
|
114
|
+
"id": z.string(),
|
|
115
|
+
"properties": z.record(z.string(), z.string()).optional(),
|
|
116
|
+
"createdAt": GoTimeJSONSchema.optional(),
|
|
117
|
+
"updatedAt": GoTimeJSONSchema.optional(),
|
|
118
|
+
"archived": z.boolean(),
|
|
119
|
+
"url": z.string().optional()
|
|
120
|
+
});
|
|
121
|
+
var ObjectPageSchema = z.strictObject({
|
|
122
|
+
"objectType": z.string(),
|
|
123
|
+
"total": z.number().int(),
|
|
124
|
+
"objects": z.array(CRMObjectSchema).nullable(),
|
|
125
|
+
"nextAfter": z.string().optional()
|
|
126
|
+
});
|
|
127
|
+
var GetObjectInputSchema = z.strictObject({
|
|
128
|
+
"objectType": z.string(),
|
|
129
|
+
"objectId": z.string(),
|
|
130
|
+
"properties": z.array(z.string()).optional()
|
|
131
|
+
});
|
|
132
|
+
var UpsertObjectInputSchema = z.strictObject({
|
|
133
|
+
"objectType": z.string(),
|
|
134
|
+
"idProperty": z.string(),
|
|
135
|
+
"idValue": z.string(),
|
|
136
|
+
"properties": z.record(z.string(), z.string()).optional()
|
|
137
|
+
});
|
|
138
|
+
var UpsertedObjectSchema = z.strictObject({
|
|
139
|
+
"object": CRMObjectSchema,
|
|
140
|
+
"created": z.boolean()
|
|
141
|
+
});
|
|
142
|
+
var UpdateObjectInputSchema = z.strictObject({
|
|
143
|
+
"objectType": z.string(),
|
|
144
|
+
"objectId": z.string(),
|
|
145
|
+
"properties": z.record(z.string(), z.string()).nullable()
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// src/generated/definitions.ts
|
|
149
|
+
var ConnectorID = "hubspot";
|
|
150
|
+
var ProviderID = "hubspot";
|
|
151
|
+
var SearchObjectsBranch = {
|
|
152
|
+
Searched: "searched",
|
|
153
|
+
ProviderRejected: "providerRejected",
|
|
154
|
+
InvalidResponse: "invalidResponse",
|
|
155
|
+
Defect: "defect"
|
|
156
|
+
};
|
|
157
|
+
var SearchObjectsBranchSearched = SearchObjectsBranch.Searched;
|
|
158
|
+
var SearchObjectsBranchProviderRejected = SearchObjectsBranch.ProviderRejected;
|
|
159
|
+
var SearchObjectsBranchInvalidResponse = SearchObjectsBranch.InvalidResponse;
|
|
160
|
+
var SearchObjectsBranchDefect = SearchObjectsBranch.Defect;
|
|
161
|
+
var SearchObjectsDefinition = {
|
|
162
|
+
operation: { connectorId: ConnectorID, operationId: "searchObjects" },
|
|
163
|
+
branches: [
|
|
164
|
+
{ id: "searched", description: "HubSpot returned one bounded page of matching records; the page may be empty." },
|
|
165
|
+
{ id: "providerRejected", description: "HubSpot conclusively rejected the search, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit.", optional: true },
|
|
166
|
+
{ id: "invalidResponse", description: "HubSpot returned an invalid or oversized search response.", optional: true },
|
|
167
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
168
|
+
],
|
|
169
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
170
|
+
};
|
|
171
|
+
var SearchObjectsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
172
|
+
var GetObjectBranch = {
|
|
173
|
+
Found: "found",
|
|
174
|
+
NotFound: "notFound",
|
|
175
|
+
ProviderRejected: "providerRejected",
|
|
176
|
+
InvalidResponse: "invalidResponse",
|
|
177
|
+
Defect: "defect"
|
|
178
|
+
};
|
|
179
|
+
var GetObjectBranchFound = GetObjectBranch.Found;
|
|
180
|
+
var GetObjectBranchNotFound = GetObjectBranch.NotFound;
|
|
181
|
+
var GetObjectBranchProviderRejected = GetObjectBranch.ProviderRejected;
|
|
182
|
+
var GetObjectBranchInvalidResponse = GetObjectBranch.InvalidResponse;
|
|
183
|
+
var GetObjectBranchDefect = GetObjectBranch.Defect;
|
|
184
|
+
var GetObjectDefinition = {
|
|
185
|
+
operation: { connectorId: ConnectorID, operationId: "getObject" },
|
|
186
|
+
branches: [
|
|
187
|
+
{ id: "found", description: "The record exists and was returned." },
|
|
188
|
+
{ id: "notFound", description: "No unarchived record of that object type has the record ID.", optional: true },
|
|
189
|
+
{ id: "providerRejected", description: "HubSpot conclusively rejected the read, such as an unknown property, a missing scope, a rejected token, or an exhausted daily limit.", optional: true },
|
|
190
|
+
{ id: "invalidResponse", description: "HubSpot returned an invalid or oversized record response.", optional: true },
|
|
191
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
192
|
+
],
|
|
193
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
194
|
+
};
|
|
195
|
+
var GetObjectMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
196
|
+
var UpsertObjectBranch = {
|
|
197
|
+
Upserted: "upserted",
|
|
198
|
+
Conflict: "conflict",
|
|
199
|
+
ProviderRejected: "providerRejected",
|
|
200
|
+
InvalidResponse: "invalidResponse",
|
|
201
|
+
Defect: "defect"
|
|
202
|
+
};
|
|
203
|
+
var UpsertObjectBranchUpserted = UpsertObjectBranch.Upserted;
|
|
204
|
+
var UpsertObjectBranchConflict = UpsertObjectBranch.Conflict;
|
|
205
|
+
var UpsertObjectBranchProviderRejected = UpsertObjectBranch.ProviderRejected;
|
|
206
|
+
var UpsertObjectBranchInvalidResponse = UpsertObjectBranch.InvalidResponse;
|
|
207
|
+
var UpsertObjectBranchDefect = UpsertObjectBranch.Defect;
|
|
208
|
+
var UpsertObjectDefinition = {
|
|
209
|
+
operation: { connectorId: ConnectorID, operationId: "upsertObject" },
|
|
210
|
+
branches: [
|
|
211
|
+
{ id: "upserted", description: "HubSpot created the record or updated the record that owns the unique value." },
|
|
212
|
+
{ id: "conflict", description: "The properties conflict with another record, such as an email that another contact already owns.", optional: true },
|
|
213
|
+
{ id: "providerRejected", description: "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.", optional: true },
|
|
214
|
+
{ id: "invalidResponse", description: "HubSpot applied or rejected the upsert but returned an invalid or oversized response.", optional: true },
|
|
215
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
216
|
+
],
|
|
217
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
218
|
+
};
|
|
219
|
+
var UpsertObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
220
|
+
var UpdateObjectBranch = {
|
|
221
|
+
Updated: "updated",
|
|
222
|
+
NotFound: "notFound",
|
|
223
|
+
Conflict: "conflict",
|
|
224
|
+
ProviderRejected: "providerRejected",
|
|
225
|
+
InvalidResponse: "invalidResponse",
|
|
226
|
+
Defect: "defect"
|
|
227
|
+
};
|
|
228
|
+
var UpdateObjectBranchUpdated = UpdateObjectBranch.Updated;
|
|
229
|
+
var UpdateObjectBranchNotFound = UpdateObjectBranch.NotFound;
|
|
230
|
+
var UpdateObjectBranchConflict = UpdateObjectBranch.Conflict;
|
|
231
|
+
var UpdateObjectBranchProviderRejected = UpdateObjectBranch.ProviderRejected;
|
|
232
|
+
var UpdateObjectBranchInvalidResponse = UpdateObjectBranch.InvalidResponse;
|
|
233
|
+
var UpdateObjectBranchDefect = UpdateObjectBranch.Defect;
|
|
234
|
+
var UpdateObjectDefinition = {
|
|
235
|
+
operation: { connectorId: ConnectorID, operationId: "updateObject" },
|
|
236
|
+
branches: [
|
|
237
|
+
{ id: "updated", description: "HubSpot updated the record and returned it." },
|
|
238
|
+
{ id: "notFound", description: "No unarchived record of that object type has the record ID.", optional: true },
|
|
239
|
+
{ id: "conflict", description: "The properties conflict with another record, such as an email that another contact already owns.", optional: true },
|
|
240
|
+
{ id: "providerRejected", description: "HubSpot conclusively rejected the update, such as an invalid property value, a missing scope, a rejected token, or an exhausted daily limit.", optional: true },
|
|
241
|
+
{ id: "invalidResponse", description: "HubSpot applied or rejected the update but returned an invalid or oversized response.", optional: true },
|
|
242
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
243
|
+
],
|
|
244
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
245
|
+
};
|
|
246
|
+
var UpdateObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
247
|
+
|
|
248
|
+
// src/generated/connection.ts
|
|
249
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
250
|
+
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
251
|
+
var Connection = class {
|
|
252
|
+
/** Stable provider and connection name. */
|
|
253
|
+
reference;
|
|
254
|
+
/** Bound provider operations. */
|
|
255
|
+
operations;
|
|
256
|
+
/** Validate a reference and bind operations. */
|
|
257
|
+
constructor(reference, operations) {
|
|
258
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
259
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
260
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
261
|
+
this.operations = operations;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
function newConnection(client, reference) {
|
|
265
|
+
if (!client) throw new TypeError("connector client is required");
|
|
266
|
+
return new Connection(reference, client);
|
|
267
|
+
}
|
|
268
|
+
function newConnectionWithOperations(operations, reference) {
|
|
269
|
+
return new Connection(reference, operations);
|
|
270
|
+
}
|
|
271
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
272
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
273
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
274
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
275
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
276
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
277
|
+
}
|
|
278
|
+
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
279
|
+
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export {
|
|
283
|
+
ConfigSchema,
|
|
284
|
+
decodeCredentials,
|
|
285
|
+
decodeSharedCredentials,
|
|
286
|
+
SearchFilterSchema,
|
|
287
|
+
SearchFilterGroupSchema,
|
|
288
|
+
SearchSortSchema,
|
|
289
|
+
SearchObjectsInputSchema,
|
|
290
|
+
CRMObjectSchema,
|
|
291
|
+
ObjectPageSchema,
|
|
292
|
+
GetObjectInputSchema,
|
|
293
|
+
UpsertObjectInputSchema,
|
|
294
|
+
UpsertedObjectSchema,
|
|
295
|
+
UpdateObjectInputSchema,
|
|
296
|
+
ConnectorID,
|
|
297
|
+
ProviderID,
|
|
298
|
+
SearchObjectsBranch,
|
|
299
|
+
SearchObjectsBranchSearched,
|
|
300
|
+
SearchObjectsBranchProviderRejected,
|
|
301
|
+
SearchObjectsBranchInvalidResponse,
|
|
302
|
+
SearchObjectsBranchDefect,
|
|
303
|
+
SearchObjectsDefinition,
|
|
304
|
+
SearchObjectsMetadata,
|
|
305
|
+
GetObjectBranch,
|
|
306
|
+
GetObjectBranchFound,
|
|
307
|
+
GetObjectBranchNotFound,
|
|
308
|
+
GetObjectBranchProviderRejected,
|
|
309
|
+
GetObjectBranchInvalidResponse,
|
|
310
|
+
GetObjectBranchDefect,
|
|
311
|
+
GetObjectDefinition,
|
|
312
|
+
GetObjectMetadata,
|
|
313
|
+
UpsertObjectBranch,
|
|
314
|
+
UpsertObjectBranchUpserted,
|
|
315
|
+
UpsertObjectBranchConflict,
|
|
316
|
+
UpsertObjectBranchProviderRejected,
|
|
317
|
+
UpsertObjectBranchInvalidResponse,
|
|
318
|
+
UpsertObjectBranchDefect,
|
|
319
|
+
UpsertObjectDefinition,
|
|
320
|
+
UpsertObjectMetadata,
|
|
321
|
+
UpdateObjectBranch,
|
|
322
|
+
UpdateObjectBranchUpdated,
|
|
323
|
+
UpdateObjectBranchNotFound,
|
|
324
|
+
UpdateObjectBranchConflict,
|
|
325
|
+
UpdateObjectBranchProviderRejected,
|
|
326
|
+
UpdateObjectBranchInvalidResponse,
|
|
327
|
+
UpdateObjectBranchDefect,
|
|
328
|
+
UpdateObjectDefinition,
|
|
329
|
+
UpdateObjectMetadata,
|
|
330
|
+
Connection,
|
|
331
|
+
newConnection,
|
|
332
|
+
newConnectionWithOperations,
|
|
333
|
+
newProjectConnection,
|
|
334
|
+
newProjectCredentialProvider
|
|
335
|
+
};
|