@superdurable/connector-docusign 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 +10 -2
- package/dex-connector.json +206 -0
- package/dist/chunk-42O7OZRV.js +420 -0
- package/dist/connection-YEptevxS.d.ts +363 -0
- package/dist/index.d.ts +402 -0
- package/dist/index.js +1270 -0
- package/dist/mock.d.ts +149 -0
- package/dist/mock.js +360 -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,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DocuSign TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@superdurable/connector-docusign` provides five eSignature operations for Dex Flows: `createEnvelopeFromTemplate`, `getEnvelope`, `listEnvelopeRecipients`, `voidEnvelope`, and `downloadCombinedDocument`. The package uses the manifest's production and developer OAuth methods, with automatic refresh through the generated credential wiring. DocuSign Connect trigger delivery remains Go-only.
|
|
4
|
+
|
|
5
|
+
The package exports generated operation-specific Step factories, typed models, mock cases, `DocuSignClient`, and `newProjectConnection`. Applications configure a named DocuSign connection in Dex Web using the [connector authorization guide](../README.md). Never put access tokens, refresh tokens, client secrets, Connect HMAC keys, or signed PDFs in Flow inputs, Attributes, Results, or logs.
|
|
6
|
+
|
|
7
|
+
The [envelope status example](examples/envelope-status/README.md) is a runnable Flow, Worker, and Client using the static `docusign-envelope-reader` connection. Its integration test runs through a real Dex Worker and Client with a local DocuSign stand-in. Provider replay scenarios under [`conformance/connectors/docusign`](../../../conformance/connectors/docusign/) check Go and TypeScript request and classification parity. Real DocuSign OAuth authorization, regional account lookup, eSignature requests, and Connect configuration require verification in Dex Web with a user-controlled provider account; they were not exercised by these local tests.
|
|
8
|
+
|
|
9
|
+
The optional `CombinedDocumentStore` supplied to `DocuSignClient` stores a downloaded PDF outside Dex and returns a safe location of at most 1024 bytes. Without a store, `downloadCombinedDocument` returns only its byte count and SHA-256 digest. A store must consume the whole content atomically and be safe to call again after a retry.
|
|
10
|
+
|
|
11
|
+
From this package directory, run `npm ci`, `npm run check`, and `npm run test:integration` with `DEX_FLOW_SERVICE_ADDRESS` pointing to a running `dexcli dev` server.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "docusign",
|
|
3
|
+
"releaseTag": "connectors/docusign/go/v0.24.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-docusign",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newCreateEnvelopeFromTemplateStep",
|
|
12
|
+
"kind": "mutation",
|
|
13
|
+
"operationId": "createEnvelopeFromTemplate",
|
|
14
|
+
"fields": {
|
|
15
|
+
"stepType": "stepType",
|
|
16
|
+
"annotations": "annotations",
|
|
17
|
+
"connectionName": "connectionName",
|
|
18
|
+
"resultAttribute": "resultAttribute"
|
|
19
|
+
},
|
|
20
|
+
"branches": [
|
|
21
|
+
{
|
|
22
|
+
"id": "created",
|
|
23
|
+
"field": "created",
|
|
24
|
+
"optional": false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "providerRejected",
|
|
28
|
+
"field": "providerRejected",
|
|
29
|
+
"optional": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "uncertain",
|
|
33
|
+
"field": "uncertain",
|
|
34
|
+
"optional": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "defect",
|
|
38
|
+
"field": "defect",
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "newGetEnvelopeStep",
|
|
45
|
+
"kind": "query",
|
|
46
|
+
"operationId": "getEnvelope",
|
|
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": "newListEnvelopeRecipientsStep",
|
|
83
|
+
"kind": "query",
|
|
84
|
+
"operationId": "listEnvelopeRecipients",
|
|
85
|
+
"fields": {
|
|
86
|
+
"stepType": "stepType",
|
|
87
|
+
"annotations": "annotations",
|
|
88
|
+
"connectionName": "connectionName",
|
|
89
|
+
"resultAttribute": "resultAttribute"
|
|
90
|
+
},
|
|
91
|
+
"branches": [
|
|
92
|
+
{
|
|
93
|
+
"id": "listed",
|
|
94
|
+
"field": "listed",
|
|
95
|
+
"optional": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "notFound",
|
|
99
|
+
"field": "notFound",
|
|
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": "newVoidEnvelopeStep",
|
|
121
|
+
"kind": "mutation",
|
|
122
|
+
"operationId": "voidEnvelope",
|
|
123
|
+
"fields": {
|
|
124
|
+
"stepType": "stepType",
|
|
125
|
+
"annotations": "annotations",
|
|
126
|
+
"connectionName": "connectionName",
|
|
127
|
+
"resultAttribute": "resultAttribute"
|
|
128
|
+
},
|
|
129
|
+
"branches": [
|
|
130
|
+
{
|
|
131
|
+
"id": "voided",
|
|
132
|
+
"field": "voided",
|
|
133
|
+
"optional": false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "notVoidable",
|
|
137
|
+
"field": "notVoidable",
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "notFound",
|
|
142
|
+
"field": "notFound",
|
|
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
|
+
"name": "newDownloadCombinedDocumentStep",
|
|
164
|
+
"kind": "query",
|
|
165
|
+
"operationId": "downloadCombinedDocument",
|
|
166
|
+
"fields": {
|
|
167
|
+
"stepType": "stepType",
|
|
168
|
+
"annotations": "annotations",
|
|
169
|
+
"connectionName": "connectionName",
|
|
170
|
+
"resultAttribute": "resultAttribute"
|
|
171
|
+
},
|
|
172
|
+
"branches": [
|
|
173
|
+
{
|
|
174
|
+
"id": "downloaded",
|
|
175
|
+
"field": "downloaded",
|
|
176
|
+
"optional": false
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": "notFound",
|
|
180
|
+
"field": "notFound",
|
|
181
|
+
"optional": true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "tooLarge",
|
|
185
|
+
"field": "tooLarge",
|
|
186
|
+
"optional": true
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"id": "providerRejected",
|
|
190
|
+
"field": "providerRejected",
|
|
191
|
+
"optional": true
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"id": "invalidResponse",
|
|
195
|
+
"field": "invalidResponse",
|
|
196
|
+
"optional": true
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "defect",
|
|
200
|
+
"field": "defect",
|
|
201
|
+
"optional": true
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
@@ -0,0 +1,420 @@
|
|
|
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
|
+
"accountId": z.string().optional(),
|
|
29
|
+
"maxResponseBytes": z.number().int().optional(),
|
|
30
|
+
"maxDocumentBytes": z.number().int().optional(),
|
|
31
|
+
"connectMaxBodyBytes": z.number().int().optional()
|
|
32
|
+
});
|
|
33
|
+
function decodeCredentials(value) {
|
|
34
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
35
|
+
const fields = value;
|
|
36
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "connect_hmac_key", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
37
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
38
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
39
|
+
if (fields["connect_hmac_key"] != null && !(typeof fields["connect_hmac_key"] === "string")) throw new TypeError("credential connect_hmac_key has an invalid type");
|
|
40
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
41
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
42
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
43
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
44
|
+
if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
|
|
45
|
+
const method = selectedMethod || "docusign-oauth";
|
|
46
|
+
const credentials = { authMethodId: method };
|
|
47
|
+
if (method === "docusign-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
|
+
credentials.connectHmacKey = new SecretString(fields["connect_hmac_key"] ?? "");
|
|
57
|
+
} else if (method === "docusign-developer-oauth") {
|
|
58
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
59
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
60
|
+
if (!fields["oauth_client_secret"]) throw new TypeError("credential oauth_client_secret is required");
|
|
61
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
62
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
63
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
64
|
+
if (!fields["refresh_token"]) throw new TypeError("credential refresh_token is required");
|
|
65
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
66
|
+
credentials.connectHmacKey = new SecretString(fields["connect_hmac_key"] ?? "");
|
|
67
|
+
} else {
|
|
68
|
+
throw new TypeError("credential auth_method is invalid");
|
|
69
|
+
}
|
|
70
|
+
return credentials;
|
|
71
|
+
}
|
|
72
|
+
function decodeSharedCredentials(value) {
|
|
73
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
74
|
+
const fields = value;
|
|
75
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "access_token", "connect_hmac_key", "oauth_client_id", "oauth_client_secret", "refresh_token"]);
|
|
76
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
77
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new TypeError("credential access_token has an invalid type");
|
|
78
|
+
if (fields["connect_hmac_key"] != null && !(typeof fields["connect_hmac_key"] === "string")) throw new TypeError("credential connect_hmac_key has an invalid type");
|
|
79
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new TypeError("credential oauth_client_id has an invalid type");
|
|
80
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new TypeError("credential oauth_client_secret has an invalid type");
|
|
81
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new TypeError("credential refresh_token has an invalid type");
|
|
82
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
83
|
+
if (typeof selectedMethod !== "string") throw new TypeError("credential auth_method is invalid");
|
|
84
|
+
const method = selectedMethod || "docusign-oauth";
|
|
85
|
+
const credentials = { authMethodId: method };
|
|
86
|
+
if (method === "docusign-oauth") {
|
|
87
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
88
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
89
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
90
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
91
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
92
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
93
|
+
credentials.connectHmacKey = new SecretString(fields["connect_hmac_key"] ?? "");
|
|
94
|
+
} else if (method === "docusign-developer-oauth") {
|
|
95
|
+
if (!fields["oauth_client_id"]) throw new TypeError("credential oauth_client_id is required");
|
|
96
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
97
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
98
|
+
if (!fields["access_token"]) throw new TypeError("credential access_token is required");
|
|
99
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
100
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
101
|
+
credentials.connectHmacKey = new SecretString(fields["connect_hmac_key"] ?? "");
|
|
102
|
+
} else {
|
|
103
|
+
throw new TypeError("credential auth_method is invalid");
|
|
104
|
+
}
|
|
105
|
+
return credentials;
|
|
106
|
+
}
|
|
107
|
+
var TemplateRoleSchema = z.strictObject({
|
|
108
|
+
"roleName": z.string(),
|
|
109
|
+
"name": z.string(),
|
|
110
|
+
"email": z.string(),
|
|
111
|
+
"routingOrder": z.number().int().optional()
|
|
112
|
+
});
|
|
113
|
+
var EnvelopeCustomFieldSchema = z.strictObject({
|
|
114
|
+
"name": z.string(),
|
|
115
|
+
"value": z.string()
|
|
116
|
+
});
|
|
117
|
+
var CreateEnvelopeFromTemplateInputSchema = z.strictObject({
|
|
118
|
+
"templateId": z.string(),
|
|
119
|
+
"templateRoles": z.array(TemplateRoleSchema).nullable(),
|
|
120
|
+
"emailSubject": z.string().optional(),
|
|
121
|
+
"emailBlurb": z.string().optional(),
|
|
122
|
+
"isDraft": z.boolean().optional(),
|
|
123
|
+
"customFields": z.array(EnvelopeCustomFieldSchema).optional()
|
|
124
|
+
});
|
|
125
|
+
var CreatedEnvelopeSchema = z.strictObject({
|
|
126
|
+
"envelopeId": z.string(),
|
|
127
|
+
"status": z.string(),
|
|
128
|
+
"statusChangedAt": GoTimeJSONSchema.nullable().optional(),
|
|
129
|
+
"wasRecovered": z.boolean().optional()
|
|
130
|
+
});
|
|
131
|
+
var GetEnvelopeInputSchema = z.strictObject({
|
|
132
|
+
"envelopeId": z.string()
|
|
133
|
+
});
|
|
134
|
+
var EnvelopeSchema = z.strictObject({
|
|
135
|
+
"envelopeId": z.string(),
|
|
136
|
+
"status": z.string(),
|
|
137
|
+
"emailSubject": z.string().optional(),
|
|
138
|
+
"createdAt": GoTimeJSONSchema.nullable().optional(),
|
|
139
|
+
"sentAt": GoTimeJSONSchema.nullable().optional(),
|
|
140
|
+
"deliveredAt": GoTimeJSONSchema.nullable().optional(),
|
|
141
|
+
"completedAt": GoTimeJSONSchema.nullable().optional(),
|
|
142
|
+
"declinedAt": GoTimeJSONSchema.nullable().optional(),
|
|
143
|
+
"voidedAt": GoTimeJSONSchema.nullable().optional(),
|
|
144
|
+
"statusChangedAt": GoTimeJSONSchema.nullable().optional(),
|
|
145
|
+
"expiresAt": GoTimeJSONSchema.nullable().optional(),
|
|
146
|
+
"voidedReason": z.string().optional(),
|
|
147
|
+
"customFields": z.array(EnvelopeCustomFieldSchema).optional()
|
|
148
|
+
});
|
|
149
|
+
var ListEnvelopeRecipientsInputSchema = z.strictObject({
|
|
150
|
+
"envelopeId": z.string()
|
|
151
|
+
});
|
|
152
|
+
var RecipientSchema = z.strictObject({
|
|
153
|
+
"recipientId": z.string(),
|
|
154
|
+
"type": z.string(),
|
|
155
|
+
"name": z.string().optional(),
|
|
156
|
+
"email": z.string().optional(),
|
|
157
|
+
"roleName": z.string().optional(),
|
|
158
|
+
"routingOrder": z.number().int(),
|
|
159
|
+
"status": z.string(),
|
|
160
|
+
"sentAt": GoTimeJSONSchema.nullable().optional(),
|
|
161
|
+
"deliveredAt": GoTimeJSONSchema.nullable().optional(),
|
|
162
|
+
"signedAt": GoTimeJSONSchema.nullable().optional(),
|
|
163
|
+
"declinedAt": GoTimeJSONSchema.nullable().optional(),
|
|
164
|
+
"declinedReason": z.string().optional()
|
|
165
|
+
});
|
|
166
|
+
var EnvelopeRecipientsSchema = z.strictObject({
|
|
167
|
+
"envelopeId": z.string(),
|
|
168
|
+
"currentRoutingOrder": z.number().int().optional(),
|
|
169
|
+
"recipients": z.array(RecipientSchema).nullable()
|
|
170
|
+
});
|
|
171
|
+
var VoidEnvelopeInputSchema = z.strictObject({
|
|
172
|
+
"envelopeId": z.string(),
|
|
173
|
+
"voidedReason": z.string()
|
|
174
|
+
});
|
|
175
|
+
var VoidedEnvelopeSchema = z.strictObject({
|
|
176
|
+
"envelopeId": z.string(),
|
|
177
|
+
"wasAlreadyVoided": z.boolean().optional(),
|
|
178
|
+
"status": z.string().optional(),
|
|
179
|
+
"voidedReason": z.string().optional()
|
|
180
|
+
});
|
|
181
|
+
var DownloadCombinedDocumentInputSchema = z.strictObject({
|
|
182
|
+
"envelopeId": z.string(),
|
|
183
|
+
"includeCertificate": z.boolean().optional()
|
|
184
|
+
});
|
|
185
|
+
var CombinedDocumentSchema = z.strictObject({
|
|
186
|
+
"envelopeId": z.string(),
|
|
187
|
+
"contentType": z.string(),
|
|
188
|
+
"byteCount": z.number().int(),
|
|
189
|
+
"sha256": z.string(),
|
|
190
|
+
"includesCertificate": z.boolean().optional(),
|
|
191
|
+
"storedLocation": z.string().optional()
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// src/generated/definitions.ts
|
|
195
|
+
var ConnectorID = "docusign";
|
|
196
|
+
var ProviderID = "docusign";
|
|
197
|
+
var CreateEnvelopeFromTemplateBranch = {
|
|
198
|
+
Created: "created",
|
|
199
|
+
ProviderRejected: "providerRejected",
|
|
200
|
+
Uncertain: "uncertain",
|
|
201
|
+
Defect: "defect"
|
|
202
|
+
};
|
|
203
|
+
var CreateEnvelopeFromTemplateBranchCreated = CreateEnvelopeFromTemplateBranch.Created;
|
|
204
|
+
var CreateEnvelopeFromTemplateBranchProviderRejected = CreateEnvelopeFromTemplateBranch.ProviderRejected;
|
|
205
|
+
var CreateEnvelopeFromTemplateBranchUncertain = CreateEnvelopeFromTemplateBranch.Uncertain;
|
|
206
|
+
var CreateEnvelopeFromTemplateBranchDefect = CreateEnvelopeFromTemplateBranch.Defect;
|
|
207
|
+
var CreateEnvelopeFromTemplateDefinition = {
|
|
208
|
+
operation: { connectorId: ConnectorID, operationId: "createEnvelopeFromTemplate" },
|
|
209
|
+
branches: [
|
|
210
|
+
{ id: "created", description: "DocuSign holds the envelope this Step execution created; wasRecovered tells whether a later attempt found it by its custom field after an interrupted one." },
|
|
211
|
+
{ id: "providerRejected", description: "DocuSign conclusively rejected the envelope, such as an unknown template, an unfilled or unknown role, an invalid email address, an exhausted envelope allowance, or a user who may not send; nothing was created.", optional: true },
|
|
212
|
+
{ id: "uncertain", description: "The create request was sent but DocuSign's answer was lost, a server error, or unreadable, and no envelope with this Step's custom field could be found, so an envelope may exist that this Result does not name; do not create another automatically.", optional: true },
|
|
213
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
214
|
+
],
|
|
215
|
+
stepDefaults: { executeMethodTimeoutMs: 6e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 6, totalDurationMs: 39e5 } }
|
|
216
|
+
};
|
|
217
|
+
var CreateEnvelopeFromTemplateMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
218
|
+
var GetEnvelopeBranch = {
|
|
219
|
+
Found: "found",
|
|
220
|
+
NotFound: "notFound",
|
|
221
|
+
ProviderRejected: "providerRejected",
|
|
222
|
+
InvalidResponse: "invalidResponse",
|
|
223
|
+
Defect: "defect"
|
|
224
|
+
};
|
|
225
|
+
var GetEnvelopeBranchFound = GetEnvelopeBranch.Found;
|
|
226
|
+
var GetEnvelopeBranchNotFound = GetEnvelopeBranch.NotFound;
|
|
227
|
+
var GetEnvelopeBranchProviderRejected = GetEnvelopeBranch.ProviderRejected;
|
|
228
|
+
var GetEnvelopeBranchInvalidResponse = GetEnvelopeBranch.InvalidResponse;
|
|
229
|
+
var GetEnvelopeBranchDefect = GetEnvelopeBranch.Defect;
|
|
230
|
+
var GetEnvelopeDefinition = {
|
|
231
|
+
operation: { connectorId: ConnectorID, operationId: "getEnvelope" },
|
|
232
|
+
branches: [
|
|
233
|
+
{ id: "found", description: "DocuSign returned the envelope." },
|
|
234
|
+
{ id: "notFound", description: "The envelope does not exist in the connection's account or the user may not see it.", optional: true },
|
|
235
|
+
{ id: "providerRejected", description: "DocuSign conclusively rejected the read, such as a revoked consent or a user without access to the account.", optional: true },
|
|
236
|
+
{ id: "invalidResponse", description: "DocuSign returned a malformed or oversized response.", optional: true },
|
|
237
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
238
|
+
],
|
|
239
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 0, totalDurationMs: 39e5 } }
|
|
240
|
+
};
|
|
241
|
+
var GetEnvelopeMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
242
|
+
var ListEnvelopeRecipientsBranch = {
|
|
243
|
+
Listed: "listed",
|
|
244
|
+
NotFound: "notFound",
|
|
245
|
+
ProviderRejected: "providerRejected",
|
|
246
|
+
InvalidResponse: "invalidResponse",
|
|
247
|
+
Defect: "defect"
|
|
248
|
+
};
|
|
249
|
+
var ListEnvelopeRecipientsBranchListed = ListEnvelopeRecipientsBranch.Listed;
|
|
250
|
+
var ListEnvelopeRecipientsBranchNotFound = ListEnvelopeRecipientsBranch.NotFound;
|
|
251
|
+
var ListEnvelopeRecipientsBranchProviderRejected = ListEnvelopeRecipientsBranch.ProviderRejected;
|
|
252
|
+
var ListEnvelopeRecipientsBranchInvalidResponse = ListEnvelopeRecipientsBranch.InvalidResponse;
|
|
253
|
+
var ListEnvelopeRecipientsBranchDefect = ListEnvelopeRecipientsBranch.Defect;
|
|
254
|
+
var ListEnvelopeRecipientsDefinition = {
|
|
255
|
+
operation: { connectorId: ConnectorID, operationId: "listEnvelopeRecipients" },
|
|
256
|
+
branches: [
|
|
257
|
+
{ id: "listed", description: "DocuSign returned the envelope's recipients." },
|
|
258
|
+
{ id: "notFound", description: "The envelope does not exist in the connection's account or the user may not see it.", optional: true },
|
|
259
|
+
{ id: "providerRejected", description: "DocuSign conclusively rejected the read, such as a revoked consent or a user without access to the account.", optional: true },
|
|
260
|
+
{ id: "invalidResponse", description: "DocuSign returned a malformed or oversized response.", optional: true },
|
|
261
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
262
|
+
],
|
|
263
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 0, totalDurationMs: 39e5 } }
|
|
264
|
+
};
|
|
265
|
+
var ListEnvelopeRecipientsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
266
|
+
var VoidEnvelopeBranch = {
|
|
267
|
+
Voided: "voided",
|
|
268
|
+
NotVoidable: "notVoidable",
|
|
269
|
+
NotFound: "notFound",
|
|
270
|
+
ProviderRejected: "providerRejected",
|
|
271
|
+
InvalidResponse: "invalidResponse",
|
|
272
|
+
Defect: "defect"
|
|
273
|
+
};
|
|
274
|
+
var VoidEnvelopeBranchVoided = VoidEnvelopeBranch.Voided;
|
|
275
|
+
var VoidEnvelopeBranchNotVoidable = VoidEnvelopeBranch.NotVoidable;
|
|
276
|
+
var VoidEnvelopeBranchNotFound = VoidEnvelopeBranch.NotFound;
|
|
277
|
+
var VoidEnvelopeBranchProviderRejected = VoidEnvelopeBranch.ProviderRejected;
|
|
278
|
+
var VoidEnvelopeBranchInvalidResponse = VoidEnvelopeBranch.InvalidResponse;
|
|
279
|
+
var VoidEnvelopeBranchDefect = VoidEnvelopeBranch.Defect;
|
|
280
|
+
var VoidEnvelopeDefinition = {
|
|
281
|
+
operation: { connectorId: ConnectorID, operationId: "voidEnvelope" },
|
|
282
|
+
branches: [
|
|
283
|
+
{ id: "voided", description: "The envelope is voided, by this call or earlier; wasAlreadyVoided tells which." },
|
|
284
|
+
{ id: "notVoidable", description: "The envelope is completed, declined, or still a draft, which DocuSign does not void; status names which.", optional: true },
|
|
285
|
+
{ id: "notFound", description: "The envelope does not exist in the connection's account or the user may not see it.", optional: true },
|
|
286
|
+
{ id: "providerRejected", description: "DocuSign conclusively rejected the void, such as a user who is not the sender or lacks permission.", optional: true },
|
|
287
|
+
{ id: "invalidResponse", description: "DocuSign returned a malformed or oversized response.", optional: true },
|
|
288
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
289
|
+
],
|
|
290
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 0, totalDurationMs: 39e5 } }
|
|
291
|
+
};
|
|
292
|
+
var VoidEnvelopeMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
293
|
+
var DownloadCombinedDocumentBranch = {
|
|
294
|
+
Downloaded: "downloaded",
|
|
295
|
+
NotFound: "notFound",
|
|
296
|
+
TooLarge: "tooLarge",
|
|
297
|
+
ProviderRejected: "providerRejected",
|
|
298
|
+
InvalidResponse: "invalidResponse",
|
|
299
|
+
Defect: "defect"
|
|
300
|
+
};
|
|
301
|
+
var DownloadCombinedDocumentBranchDownloaded = DownloadCombinedDocumentBranch.Downloaded;
|
|
302
|
+
var DownloadCombinedDocumentBranchNotFound = DownloadCombinedDocumentBranch.NotFound;
|
|
303
|
+
var DownloadCombinedDocumentBranchTooLarge = DownloadCombinedDocumentBranch.TooLarge;
|
|
304
|
+
var DownloadCombinedDocumentBranchProviderRejected = DownloadCombinedDocumentBranch.ProviderRejected;
|
|
305
|
+
var DownloadCombinedDocumentBranchInvalidResponse = DownloadCombinedDocumentBranch.InvalidResponse;
|
|
306
|
+
var DownloadCombinedDocumentBranchDefect = DownloadCombinedDocumentBranch.Defect;
|
|
307
|
+
var DownloadCombinedDocumentDefinition = {
|
|
308
|
+
operation: { connectorId: ConnectorID, operationId: "downloadCombinedDocument" },
|
|
309
|
+
branches: [
|
|
310
|
+
{ id: "downloaded", description: "DocuSign returned the combined PDF and its digest was recorded, and stored when the client has a CombinedDocumentStore." },
|
|
311
|
+
{ id: "notFound", description: "The envelope does not exist in the connection's account or the user may not see it.", optional: true },
|
|
312
|
+
{ id: "tooLarge", description: "The combined PDF exceeds the connection's maxDocumentBytes; nothing was stored.", optional: true },
|
|
313
|
+
{ id: "providerRejected", description: "DocuSign conclusively rejected the download, such as a revoked consent or a user without access to the envelope.", optional: true },
|
|
314
|
+
{ id: "invalidResponse", description: "DocuSign returned something other than a complete PDF, or the CombinedDocumentStore rejected it.", optional: true },
|
|
315
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
316
|
+
],
|
|
317
|
+
stepDefaults: { executeMethodTimeoutMs: 12e4, executeDurability: "async", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 0, totalDurationMs: 39e5 } }
|
|
318
|
+
};
|
|
319
|
+
var DownloadCombinedDocumentMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
320
|
+
|
|
321
|
+
// src/generated/connection.ts
|
|
322
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
323
|
+
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
324
|
+
var Connection = class {
|
|
325
|
+
/** Stable provider and connection name. */
|
|
326
|
+
reference;
|
|
327
|
+
/** Bound provider operations. */
|
|
328
|
+
operations;
|
|
329
|
+
/** Validate a reference and bind operations. */
|
|
330
|
+
constructor(reference, operations) {
|
|
331
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
332
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
333
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
334
|
+
this.operations = operations;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
function newConnection(client, reference) {
|
|
338
|
+
if (!client) throw new TypeError("connector client is required");
|
|
339
|
+
return new Connection(reference, client);
|
|
340
|
+
}
|
|
341
|
+
function newConnectionWithOperations(operations, reference) {
|
|
342
|
+
return new Connection(reference, operations);
|
|
343
|
+
}
|
|
344
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
345
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
346
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
347
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
348
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
349
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
350
|
+
}
|
|
351
|
+
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
352
|
+
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export {
|
|
356
|
+
ConfigSchema,
|
|
357
|
+
decodeCredentials,
|
|
358
|
+
decodeSharedCredentials,
|
|
359
|
+
TemplateRoleSchema,
|
|
360
|
+
EnvelopeCustomFieldSchema,
|
|
361
|
+
CreateEnvelopeFromTemplateInputSchema,
|
|
362
|
+
CreatedEnvelopeSchema,
|
|
363
|
+
GetEnvelopeInputSchema,
|
|
364
|
+
EnvelopeSchema,
|
|
365
|
+
ListEnvelopeRecipientsInputSchema,
|
|
366
|
+
RecipientSchema,
|
|
367
|
+
EnvelopeRecipientsSchema,
|
|
368
|
+
VoidEnvelopeInputSchema,
|
|
369
|
+
VoidedEnvelopeSchema,
|
|
370
|
+
DownloadCombinedDocumentInputSchema,
|
|
371
|
+
CombinedDocumentSchema,
|
|
372
|
+
ConnectorID,
|
|
373
|
+
ProviderID,
|
|
374
|
+
CreateEnvelopeFromTemplateBranch,
|
|
375
|
+
CreateEnvelopeFromTemplateBranchCreated,
|
|
376
|
+
CreateEnvelopeFromTemplateBranchProviderRejected,
|
|
377
|
+
CreateEnvelopeFromTemplateBranchUncertain,
|
|
378
|
+
CreateEnvelopeFromTemplateBranchDefect,
|
|
379
|
+
CreateEnvelopeFromTemplateDefinition,
|
|
380
|
+
CreateEnvelopeFromTemplateMetadata,
|
|
381
|
+
GetEnvelopeBranch,
|
|
382
|
+
GetEnvelopeBranchFound,
|
|
383
|
+
GetEnvelopeBranchNotFound,
|
|
384
|
+
GetEnvelopeBranchProviderRejected,
|
|
385
|
+
GetEnvelopeBranchInvalidResponse,
|
|
386
|
+
GetEnvelopeBranchDefect,
|
|
387
|
+
GetEnvelopeDefinition,
|
|
388
|
+
GetEnvelopeMetadata,
|
|
389
|
+
ListEnvelopeRecipientsBranch,
|
|
390
|
+
ListEnvelopeRecipientsBranchListed,
|
|
391
|
+
ListEnvelopeRecipientsBranchNotFound,
|
|
392
|
+
ListEnvelopeRecipientsBranchProviderRejected,
|
|
393
|
+
ListEnvelopeRecipientsBranchInvalidResponse,
|
|
394
|
+
ListEnvelopeRecipientsBranchDefect,
|
|
395
|
+
ListEnvelopeRecipientsDefinition,
|
|
396
|
+
ListEnvelopeRecipientsMetadata,
|
|
397
|
+
VoidEnvelopeBranch,
|
|
398
|
+
VoidEnvelopeBranchVoided,
|
|
399
|
+
VoidEnvelopeBranchNotVoidable,
|
|
400
|
+
VoidEnvelopeBranchNotFound,
|
|
401
|
+
VoidEnvelopeBranchProviderRejected,
|
|
402
|
+
VoidEnvelopeBranchInvalidResponse,
|
|
403
|
+
VoidEnvelopeBranchDefect,
|
|
404
|
+
VoidEnvelopeDefinition,
|
|
405
|
+
VoidEnvelopeMetadata,
|
|
406
|
+
DownloadCombinedDocumentBranch,
|
|
407
|
+
DownloadCombinedDocumentBranchDownloaded,
|
|
408
|
+
DownloadCombinedDocumentBranchNotFound,
|
|
409
|
+
DownloadCombinedDocumentBranchTooLarge,
|
|
410
|
+
DownloadCombinedDocumentBranchProviderRejected,
|
|
411
|
+
DownloadCombinedDocumentBranchInvalidResponse,
|
|
412
|
+
DownloadCombinedDocumentBranchDefect,
|
|
413
|
+
DownloadCombinedDocumentDefinition,
|
|
414
|
+
DownloadCombinedDocumentMetadata,
|
|
415
|
+
Connection,
|
|
416
|
+
newConnection,
|
|
417
|
+
newConnectionWithOperations,
|
|
418
|
+
newProjectConnection,
|
|
419
|
+
newProjectCredentialProvider
|
|
420
|
+
};
|