@keystrokehq/docusign 0.0.1
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/README.md +248 -0
- package/dist/_official/index.d.mts +3 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/account-custom-fields.d.mts +65 -0
- package/dist/account-custom-fields.mjs +63 -0
- package/dist/account-stamps.d.mts +164 -0
- package/dist/account-stamps.mjs +144 -0
- package/dist/account-tabs.d.mts +90 -0
- package/dist/account-tabs.mjs +80 -0
- package/dist/account.d.mts +233 -0
- package/dist/account.mjs +207 -0
- package/dist/admin.d.mts +18 -0
- package/dist/admin.mjs +20 -0
- package/dist/auth.d.mts +37 -0
- package/dist/auth.mjs +53 -0
- package/dist/bcc-archive.d.mts +64 -0
- package/dist/bcc-archive.mjs +70 -0
- package/dist/billing.d.mts +217 -0
- package/dist/billing.mjs +208 -0
- package/dist/brands.d.mts +192 -0
- package/dist/brands.mjs +157 -0
- package/dist/bulk-send.d.mts +137 -0
- package/dist/bulk-send.mjs +115 -0
- package/dist/chunked-uploads.d.mts +78 -0
- package/dist/chunked-uploads.mjs +74 -0
- package/dist/click.d.mts +18 -0
- package/dist/click.mjs +20 -0
- package/dist/client.d.mts +47 -0
- package/dist/client.mjs +286 -0
- package/dist/clm.d.mts +18 -0
- package/dist/clm.mjs +20 -0
- package/dist/cloud-storage.d.mts +122 -0
- package/dist/cloud-storage.mjs +115 -0
- package/dist/connect.d.mts +252 -0
- package/dist/connect.mjs +217 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/contacts.d.mts +80 -0
- package/dist/contacts.mjs +79 -0
- package/dist/enote.d.mts +44 -0
- package/dist/enote.mjs +45 -0
- package/dist/envelope-attachments.d.mts +86 -0
- package/dist/envelope-attachments.mjs +76 -0
- package/dist/envelope-custom-fields.d.mts +166 -0
- package/dist/envelope-custom-fields.mjs +92 -0
- package/dist/envelope-documents.d.mts +271 -0
- package/dist/envelope-documents.mjs +219 -0
- package/dist/envelope-email.d.mts +65 -0
- package/dist/envelope-email.mjs +60 -0
- package/dist/envelope-lock.d.mts +65 -0
- package/dist/envelope-lock.mjs +60 -0
- package/dist/envelope-logs.d.mts +126 -0
- package/dist/envelope-logs.mjs +126 -0
- package/dist/envelope-notifications.d.mts +47 -0
- package/dist/envelope-notifications.mjs +44 -0
- package/dist/envelope-recipients.d.mts +171 -0
- package/dist/envelope-recipients.mjs +136 -0
- package/dist/envelope-tabs.d.mts +52 -0
- package/dist/envelope-tabs.mjs +49 -0
- package/dist/envelope-views.d.mts +99 -0
- package/dist/envelope-views.mjs +88 -0
- package/dist/envelope-workflow.d.mts +208 -0
- package/dist/envelope-workflow.mjs +176 -0
- package/dist/envelopes.d.mts +430 -0
- package/dist/envelopes.mjs +190 -0
- package/dist/errors.d.mts +48 -0
- package/dist/errors.mjs +76 -0
- package/dist/events.d.mts +192 -0
- package/dist/events.mjs +146 -0
- package/dist/factory-wViQTjgN.mjs +8 -0
- package/dist/groups.d.mts +191 -0
- package/dist/groups.mjs +146 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-CmRztL9R.mjs +229 -0
- package/dist/integration-DqwHRkRh.d.mts +73 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/monitor.d.mts +18 -0
- package/dist/monitor.mjs +20 -0
- package/dist/notary.d.mts +129 -0
- package/dist/notary.mjs +122 -0
- package/dist/operation-helpers-BMTArRh9.mjs +102 -0
- package/dist/permission-profiles.d.mts +78 -0
- package/dist/permission-profiles.mjs +70 -0
- package/dist/power-forms.d.mts +51 -0
- package/dist/power-forms.mjs +62 -0
- package/dist/provider-app-CWp1SuI4.d.mts +88 -0
- package/dist/rooms.d.mts +18 -0
- package/dist/rooms.mjs +28 -0
- package/dist/schemas/index.d.mts +581 -0
- package/dist/schemas/index.mjs +309 -0
- package/dist/shared-DTUCJayR.mjs +27 -0
- package/dist/signing-groups.d.mts +139 -0
- package/dist/signing-groups.mjs +117 -0
- package/dist/template-custom-fields.d.mts +199 -0
- package/dist/template-custom-fields.mjs +107 -0
- package/dist/template-documents.d.mts +132 -0
- package/dist/template-documents.mjs +109 -0
- package/dist/template-lock.d.mts +65 -0
- package/dist/template-lock.mjs +60 -0
- package/dist/template-sharing.d.mts +129 -0
- package/dist/template-sharing.mjs +108 -0
- package/dist/template-workflow.d.mts +184 -0
- package/dist/template-workflow.mjs +152 -0
- package/dist/templates.d.mts +158 -0
- package/dist/templates.mjs +110 -0
- package/dist/triggers.d.mts +43 -0
- package/dist/triggers.mjs +91 -0
- package/dist/user-authorizations.d.mts +129 -0
- package/dist/user-authorizations.mjs +133 -0
- package/dist/user-custom-settings.d.mts +81 -0
- package/dist/user-custom-settings.mjs +69 -0
- package/dist/user-profile.d.mts +109 -0
- package/dist/user-profile.mjs +106 -0
- package/dist/user-signatures.d.mts +208 -0
- package/dist/user-signatures.mjs +180 -0
- package/dist/users.d.mts +128 -0
- package/dist/users.mjs +98 -0
- package/dist/verification.d.mts +19 -0
- package/dist/verification.mjs +59 -0
- package/dist/workspaces.d.mts +173 -0
- package/dist/workspaces.mjs +143 -0
- package/package.json +291 -0
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { DocusignApiError } from "./errors.mjs";
|
|
2
|
+
import { r as toQueryValue } from "./shared-DTUCJayR.mjs";
|
|
3
|
+
import { CredentialRevokedError } from "@keystrokehq/core/errors";
|
|
4
|
+
|
|
5
|
+
//#region src/client.ts
|
|
6
|
+
/**
|
|
7
|
+
* Hand-rolled typed DocuSign eSignature REST v2.1 client.
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities:
|
|
10
|
+
* - account-scoped URL construction (`{baseUri}/restapi/v2.1/accounts/{accountId}`)
|
|
11
|
+
* - JSON, binary, and multipart request/response handling
|
|
12
|
+
* - retry on 429 + 5xx with `Retry-After` honoring and jittered exponential
|
|
13
|
+
* backoff for transient failures
|
|
14
|
+
* - error normalization through `DocusignApiError`
|
|
15
|
+
* - `listAll` pagination walker for endpoints that expose `nextUri`
|
|
16
|
+
* - minimal surface — each domain file builds a typed request from the
|
|
17
|
+
* low-level `request`/`requestBinary`/`requestMultipart` helpers instead
|
|
18
|
+
* of depending on a huge method-per-endpoint wrapper object.
|
|
19
|
+
*
|
|
20
|
+
* Why not the official `docusign-esign` SDK: it pulls `superagent`, `node:fs`,
|
|
21
|
+
* and `jsonwebtoken` which do not work in Cloudflare Workers / V8 isolates.
|
|
22
|
+
* See IMPLEMENTATION_NOTES.md § 3.
|
|
23
|
+
*/
|
|
24
|
+
const ESIGNATURE_API_PREFIX = "/restapi/v2.1/accounts";
|
|
25
|
+
const MAX_RETRIES = 3;
|
|
26
|
+
const BASE_RETRY_DELAY_MS = 250;
|
|
27
|
+
const MAX_RETRY_DELAY_MS = 8e3;
|
|
28
|
+
function normalizeBaseUri(baseUri) {
|
|
29
|
+
return baseUri.endsWith("/") ? baseUri.slice(0, -1) : baseUri;
|
|
30
|
+
}
|
|
31
|
+
function jitter(ms) {
|
|
32
|
+
return ms + Math.floor(Math.random() * ms * .25);
|
|
33
|
+
}
|
|
34
|
+
function parseRetryAfterHeader(value) {
|
|
35
|
+
if (!value) return void 0;
|
|
36
|
+
const asNumber = Number(value);
|
|
37
|
+
if (Number.isFinite(asNumber)) return Math.max(0, asNumber * 1e3);
|
|
38
|
+
const asDate = Date.parse(value);
|
|
39
|
+
if (Number.isFinite(asDate)) return Math.max(0, asDate - Date.now());
|
|
40
|
+
}
|
|
41
|
+
async function sleep(ms) {
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
43
|
+
}
|
|
44
|
+
function applyQuery(url, query) {
|
|
45
|
+
if (!query) return;
|
|
46
|
+
for (const [key, value] of Object.entries(query)) {
|
|
47
|
+
const serialized = toQueryValue(value);
|
|
48
|
+
if (serialized !== void 0) url.searchParams.set(key, serialized);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function resolveUrl(internals, init) {
|
|
52
|
+
const base = normalizeBaseUri(internals.baseUri);
|
|
53
|
+
const prefix = init.accountScoped === false ? "" : `${ESIGNATURE_API_PREFIX}/${internals.accountId}`;
|
|
54
|
+
const path = init.path.startsWith("/") ? init.path : `/${init.path}`;
|
|
55
|
+
const url = new URL(`${base}${prefix}${path}`);
|
|
56
|
+
applyQuery(url, init.query);
|
|
57
|
+
return url.toString();
|
|
58
|
+
}
|
|
59
|
+
function buildResolvedRequest(internals, init) {
|
|
60
|
+
const method = init.method ?? "GET";
|
|
61
|
+
const url = resolveUrl(internals, init);
|
|
62
|
+
const headers = {
|
|
63
|
+
Authorization: `Bearer ${internals.accessToken}`,
|
|
64
|
+
Accept: init.accept ?? "application/json",
|
|
65
|
+
...init.headers ?? {}
|
|
66
|
+
};
|
|
67
|
+
let body;
|
|
68
|
+
if (init.body !== void 0) if (init.body instanceof Uint8Array) {
|
|
69
|
+
body = init.body;
|
|
70
|
+
headers["Content-Type"] = headers["Content-Type"] ?? "application/octet-stream";
|
|
71
|
+
} else if (typeof init.body === "string") {
|
|
72
|
+
body = init.body;
|
|
73
|
+
headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
|
|
74
|
+
} else {
|
|
75
|
+
body = JSON.stringify(init.body);
|
|
76
|
+
headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
url,
|
|
80
|
+
method,
|
|
81
|
+
headers,
|
|
82
|
+
body
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function extractRequestId(headers) {
|
|
86
|
+
return headers.get("X-DocuSign-TraceToken") ?? headers.get("x-docusign-tracetoken") ?? void 0;
|
|
87
|
+
}
|
|
88
|
+
function collectHeaders(headers) {
|
|
89
|
+
const collected = {};
|
|
90
|
+
headers.forEach((value, key) => {
|
|
91
|
+
collected[key.toLowerCase()] = value;
|
|
92
|
+
});
|
|
93
|
+
return collected;
|
|
94
|
+
}
|
|
95
|
+
async function readErrorBody(response) {
|
|
96
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
97
|
+
try {
|
|
98
|
+
if (contentType.includes("application/json")) return await response.json();
|
|
99
|
+
return await response.text();
|
|
100
|
+
} catch {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function readJsonBody(response) {
|
|
105
|
+
if (response.status === 204) return void 0;
|
|
106
|
+
if ((response.headers.get("content-type") ?? "").includes("application/json")) return await response.json();
|
|
107
|
+
return await response.text();
|
|
108
|
+
}
|
|
109
|
+
function isAuthError(error) {
|
|
110
|
+
if (error instanceof DocusignApiError) return error.kind === "auth";
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
function buildMultipartBody(parts) {
|
|
114
|
+
const boundary = `----docusign-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
115
|
+
const delimiter = `--${boundary}`;
|
|
116
|
+
const closing = `--${boundary}--`;
|
|
117
|
+
const chunks = [];
|
|
118
|
+
const encoder = new TextEncoder();
|
|
119
|
+
for (const part of parts) {
|
|
120
|
+
const header = `${delimiter}\r\nContent-Disposition: ${part.filename ? `form-data; name="${part.name}"; filename="${part.filename}"` : `form-data; name="${part.name}"`}\r\nContent-Type: ${part.contentType}\r\n\r\n`;
|
|
121
|
+
chunks.push(encoder.encode(header));
|
|
122
|
+
const rawContent = part.serializeAsJson ? JSON.stringify(part.content) : part.content;
|
|
123
|
+
if (typeof rawContent === "string") chunks.push(encoder.encode(rawContent));
|
|
124
|
+
else if (rawContent instanceof Uint8Array) chunks.push(rawContent);
|
|
125
|
+
else chunks.push(encoder.encode(JSON.stringify(rawContent)));
|
|
126
|
+
chunks.push(encoder.encode("\r\n"));
|
|
127
|
+
}
|
|
128
|
+
chunks.push(encoder.encode(`${closing}\r\n`));
|
|
129
|
+
const totalLength = chunks.reduce((size, chunk) => size + chunk.length, 0);
|
|
130
|
+
const combined = new Uint8Array(totalLength);
|
|
131
|
+
let offset = 0;
|
|
132
|
+
for (const chunk of chunks) {
|
|
133
|
+
combined.set(chunk, offset);
|
|
134
|
+
offset += chunk.length;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
body: combined,
|
|
138
|
+
contentType: `multipart/form-data; boundary=${boundary}`
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async function performRequest(resolved, internals) {
|
|
142
|
+
let attempt = 0;
|
|
143
|
+
while (true) {
|
|
144
|
+
let response;
|
|
145
|
+
try {
|
|
146
|
+
response = await fetch(resolved.url, {
|
|
147
|
+
method: resolved.method,
|
|
148
|
+
headers: resolved.headers,
|
|
149
|
+
body: resolved.body
|
|
150
|
+
});
|
|
151
|
+
} catch (cause) {
|
|
152
|
+
if (attempt >= MAX_RETRIES) throw new DocusignApiError(`DocuSign ${resolved.method} ${resolved.url} network error.`, {
|
|
153
|
+
kind: "network",
|
|
154
|
+
retryable: true,
|
|
155
|
+
cause
|
|
156
|
+
});
|
|
157
|
+
await sleep(Math.min(MAX_RETRY_DELAY_MS, jitter(BASE_RETRY_DELAY_MS * 2 ** attempt)));
|
|
158
|
+
attempt += 1;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (response.status === 429 || response.status >= 500) {
|
|
162
|
+
if (attempt >= MAX_RETRIES) return response;
|
|
163
|
+
const delay = parseRetryAfterHeader(response.headers.get("retry-after")) ?? jitter(BASE_RETRY_DELAY_MS * 2 ** attempt);
|
|
164
|
+
await sleep(Math.min(MAX_RETRY_DELAY_MS, delay));
|
|
165
|
+
attempt += 1;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function resolveErrorFromResponse(resolved, response) {
|
|
172
|
+
const body = await readErrorBody(response);
|
|
173
|
+
return DocusignApiError.fromResponse({
|
|
174
|
+
status: response.status,
|
|
175
|
+
body,
|
|
176
|
+
requestId: extractRequestId(response.headers),
|
|
177
|
+
retryAfterMs: parseRetryAfterHeader(response.headers.get("retry-after")),
|
|
178
|
+
url: resolved.url,
|
|
179
|
+
method: resolved.method
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function createDocusignClient(credentials) {
|
|
183
|
+
const accessToken = credentials.DOCUSIGN_ACCESS_TOKEN.trim();
|
|
184
|
+
const accountId = credentials.DOCUSIGN_ACCOUNT_ID.trim();
|
|
185
|
+
const baseUri = credentials.DOCUSIGN_BASE_URI.trim();
|
|
186
|
+
if (accessToken.length === 0 || accountId.length === 0 || baseUri.length === 0) throw new CredentialRevokedError("keystroke:docusign", "DocuSign credentials are missing required fields (access token, account id, base URI). Re-run `keystroke connect docusign`.");
|
|
187
|
+
const internals = {
|
|
188
|
+
accessToken,
|
|
189
|
+
accountId,
|
|
190
|
+
baseUri
|
|
191
|
+
};
|
|
192
|
+
async function request(init) {
|
|
193
|
+
const resolved = buildResolvedRequest(internals, init);
|
|
194
|
+
const response = await performRequest(resolved, internals);
|
|
195
|
+
if (!response.ok) {
|
|
196
|
+
const error = await resolveErrorFromResponse(resolved, response);
|
|
197
|
+
if (isAuthError(error)) throw new CredentialRevokedError("keystroke:docusign", `DocuSign authentication failed while calling ${resolved.method} ${resolved.url}. The stored credentials may be revoked or expired.`);
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
return await readJsonBody(response);
|
|
201
|
+
}
|
|
202
|
+
async function requestBinary(init) {
|
|
203
|
+
const resolved = buildResolvedRequest(internals, {
|
|
204
|
+
...init,
|
|
205
|
+
accept: init.accept ?? "application/pdf"
|
|
206
|
+
});
|
|
207
|
+
const response = await performRequest(resolved, internals);
|
|
208
|
+
if (!response.ok) {
|
|
209
|
+
const error = await resolveErrorFromResponse(resolved, response);
|
|
210
|
+
if (isAuthError(error)) throw new CredentialRevokedError("keystroke:docusign", `DocuSign authentication failed while downloading ${resolved.method} ${resolved.url}.`);
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
body: new Uint8Array(await response.arrayBuffer()),
|
|
215
|
+
contentType: response.headers.get("content-type") ?? void 0,
|
|
216
|
+
contentDisposition: response.headers.get("content-disposition") ?? void 0,
|
|
217
|
+
status: response.status,
|
|
218
|
+
headers: collectHeaders(response.headers)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async function requestMultipart(init) {
|
|
222
|
+
const { parts, headers, ...rest } = init;
|
|
223
|
+
const { body, contentType } = buildMultipartBody(parts);
|
|
224
|
+
return request({
|
|
225
|
+
...rest,
|
|
226
|
+
body,
|
|
227
|
+
headers: {
|
|
228
|
+
...headers ?? {},
|
|
229
|
+
"Content-Type": contentType
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
async function* listAll(init, options) {
|
|
234
|
+
let cursor = {
|
|
235
|
+
path: init.path,
|
|
236
|
+
query: init.query
|
|
237
|
+
};
|
|
238
|
+
while (true) {
|
|
239
|
+
const payload = await request({
|
|
240
|
+
...init,
|
|
241
|
+
path: cursor.path ?? init.path,
|
|
242
|
+
query: cursor.query ?? init.query
|
|
243
|
+
});
|
|
244
|
+
for (const item of options.items(payload)) yield item;
|
|
245
|
+
const nextUri = extractNextUri(payload);
|
|
246
|
+
if (!nextUri) return;
|
|
247
|
+
const relative = extractRelativePath(nextUri, internals);
|
|
248
|
+
if (!relative) return;
|
|
249
|
+
cursor = relative;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
accountId,
|
|
254
|
+
baseUri,
|
|
255
|
+
request,
|
|
256
|
+
requestBinary,
|
|
257
|
+
requestMultipart,
|
|
258
|
+
listAll
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function extractNextUri(payload) {
|
|
262
|
+
if (typeof payload !== "object" || payload === null) return void 0;
|
|
263
|
+
const nextUri = payload.nextUri;
|
|
264
|
+
return typeof nextUri === "string" && nextUri.length > 0 ? nextUri : void 0;
|
|
265
|
+
}
|
|
266
|
+
function extractRelativePath(nextUri, internals) {
|
|
267
|
+
try {
|
|
268
|
+
const absolute = nextUri.startsWith("http") ? new URL(nextUri) : new URL(nextUri, normalizeBaseUri(internals.baseUri));
|
|
269
|
+
const prefix = `${ESIGNATURE_API_PREFIX}/${internals.accountId}`;
|
|
270
|
+
const pathname = absolute.pathname;
|
|
271
|
+
const path = pathname.startsWith(prefix) ? pathname.slice(prefix.length) : pathname;
|
|
272
|
+
const query = {};
|
|
273
|
+
absolute.searchParams.forEach((value, key) => {
|
|
274
|
+
query[key] = value;
|
|
275
|
+
});
|
|
276
|
+
return {
|
|
277
|
+
path,
|
|
278
|
+
query
|
|
279
|
+
};
|
|
280
|
+
} catch {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
//#endregion
|
|
286
|
+
export { createDocusignClient };
|
package/dist/clm.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/clm.d.ts
|
|
6
|
+
declare const clmNotImplemented: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
7
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
8
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
9
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
10
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
11
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
12
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
13
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
14
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
15
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
16
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { clmNotImplemented };
|
package/dist/clm.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { docusignGenericObjectSchema } from "./schemas/index.mjs";
|
|
2
|
+
import { n as definePlanGatedOperation } from "./operation-helpers-BMTArRh9.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/clm.ts
|
|
6
|
+
/**
|
|
7
|
+
* DocuSign CLM (SpringCM) — plan-gated in v1.
|
|
8
|
+
*/
|
|
9
|
+
const clmNotImplemented = definePlanGatedOperation({
|
|
10
|
+
id: "clm_not_implemented",
|
|
11
|
+
slug: "DOCUSIGN_CLM_NOT_IMPLEMENTED",
|
|
12
|
+
name: "DocuSign CLM (not implemented)",
|
|
13
|
+
description: "Placeholder for DocuSign Contract Lifecycle Management. Plan-gated in v1.",
|
|
14
|
+
input: z.object({}).catchall(z.unknown()),
|
|
15
|
+
output: docusignGenericObjectSchema,
|
|
16
|
+
reason: "DocuSign CLM is a plan-gated product with a region-specific host (`https://apiuatna11.springcm.com/v2/...`). Not enabled in this Keystroke deployment."
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { clmNotImplemented };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/cloud-storage.d.ts
|
|
6
|
+
declare const configureCloudStorageRedirectUrl: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
userId: z.ZodString;
|
|
8
|
+
serviceId: z.ZodString;
|
|
9
|
+
cloudStorage: z.ZodObject<{
|
|
10
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
11
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
14
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
15
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
16
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
17
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
18
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
19
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
20
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
21
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
22
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
23
|
+
declare const getUserCloudStorageProviderConfiguration: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
24
|
+
userId: z.ZodString;
|
|
25
|
+
serviceId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
28
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
29
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
30
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
31
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
32
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
33
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
34
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
35
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
36
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
37
|
+
declare const retrieveCloudStorageProviderConfiguration: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
38
|
+
userId: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
41
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
42
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
43
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
44
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
45
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
46
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
47
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
48
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
49
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
50
|
+
declare const deleteUserAuthForCloudStorageProviders: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
51
|
+
userId: z.ZodString;
|
|
52
|
+
cloudStorage: z.ZodObject<{
|
|
53
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
54
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
success: z.ZodBoolean;
|
|
57
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
58
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
59
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
60
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
61
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
62
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
63
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
64
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
65
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
66
|
+
declare const deleteUserCloudStorageAuthentication: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
67
|
+
userId: z.ZodString;
|
|
68
|
+
serviceId: z.ZodString;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
success: z.ZodBoolean;
|
|
71
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
72
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
73
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
74
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
75
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
76
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
77
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
78
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
79
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
80
|
+
declare const listCloudStorageItems: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
81
|
+
userId: z.ZodString;
|
|
82
|
+
serviceId: z.ZodString;
|
|
83
|
+
cloudStorageFolderPath: z.ZodOptional<z.ZodString>;
|
|
84
|
+
cloudStorageFolderidPlain: z.ZodOptional<z.ZodString>;
|
|
85
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
87
|
+
asc: "asc";
|
|
88
|
+
desc: "desc";
|
|
89
|
+
}>>;
|
|
90
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
91
|
+
searchText: z.ZodOptional<z.ZodString>;
|
|
92
|
+
startPosition: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
95
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
96
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
97
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
98
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
99
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
100
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
101
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
102
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
103
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
104
|
+
declare const retrieveItemsInCloudStorageFolder: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
105
|
+
userId: z.ZodString;
|
|
106
|
+
serviceId: z.ZodString;
|
|
107
|
+
folderId: z.ZodString;
|
|
108
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
startPosition: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
112
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"docusign", z.ZodObject<{
|
|
113
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
114
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
115
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
116
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
117
|
+
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
118
|
+
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
119
|
+
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
120
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { configureCloudStorageRedirectUrl, deleteUserAuthForCloudStorageProviders, deleteUserCloudStorageAuthentication, getUserCloudStorageProviderConfiguration, listCloudStorageItems, retrieveCloudStorageProviderConfiguration, retrieveItemsInCloudStorageFolder };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { docusignGenericObjectSchema, docusignLooseObjectSchema, docusignSuccessSchema } from "./schemas/index.mjs";
|
|
2
|
+
import { r as defineRestOperation } from "./operation-helpers-BMTArRh9.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/cloud-storage.ts
|
|
6
|
+
/**
|
|
7
|
+
* Cloud storage integration (per-user provider config + items). Covers PLAN.md § 6.27.
|
|
8
|
+
*/
|
|
9
|
+
const userId = z.object({ userId: z.string().min(1) });
|
|
10
|
+
const userProvider = userId.extend({ serviceId: z.string().min(1) });
|
|
11
|
+
const configureCloudStorageRedirectUrl = defineRestOperation({
|
|
12
|
+
id: "configure_cloud_storage_redirect_url",
|
|
13
|
+
slug: "DOCUSIGN_CONFIGURE_CLOUD_STORAGE_REDIRECT_URL",
|
|
14
|
+
name: "Configure Cloud Storage Redirect URL",
|
|
15
|
+
description: "Configure the OAuth redirect URL for a cloud-storage provider for a user.",
|
|
16
|
+
needsApproval: true,
|
|
17
|
+
method: "POST",
|
|
18
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage/${ctx.encode(String(ctx.input.serviceId))}`,
|
|
19
|
+
input: userProvider.extend({ cloudStorage: docusignLooseObjectSchema() }),
|
|
20
|
+
output: docusignGenericObjectSchema,
|
|
21
|
+
body: (input) => input.cloudStorage
|
|
22
|
+
});
|
|
23
|
+
const getUserCloudStorageProviderConfiguration = defineRestOperation({
|
|
24
|
+
id: "get_user_cloud_storage_provider_configuration",
|
|
25
|
+
slug: "DOCUSIGN_GET_USER_CLOUD_STORAGE_PROVIDER_CONFIGURATION",
|
|
26
|
+
name: "Get User Cloud Storage Provider",
|
|
27
|
+
description: "Get the cloud-storage provider config for a user.",
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage/${ctx.encode(String(ctx.input.serviceId))}`,
|
|
30
|
+
input: userProvider,
|
|
31
|
+
output: docusignGenericObjectSchema
|
|
32
|
+
});
|
|
33
|
+
const retrieveCloudStorageProviderConfiguration = defineRestOperation({
|
|
34
|
+
id: "retrieve_cloud_storage_provider_configuration",
|
|
35
|
+
slug: "DOCUSIGN_RETRIEVE_CLOUD_STORAGE_PROVIDER_CONFIGURATION",
|
|
36
|
+
name: "Retrieve Cloud Storage Provider",
|
|
37
|
+
description: "List configured cloud-storage providers for a user.",
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage`,
|
|
40
|
+
input: userId,
|
|
41
|
+
output: docusignGenericObjectSchema
|
|
42
|
+
});
|
|
43
|
+
const deleteUserAuthForCloudStorageProviders = defineRestOperation({
|
|
44
|
+
id: "delete_user_auth_for_cloud_storage_providers",
|
|
45
|
+
slug: "DOCUSIGN_DELETE_USER_AUTH_FOR_CLOUD_STORAGE_PROVIDERS",
|
|
46
|
+
name: "Delete User Cloud Storage Auth (bulk)",
|
|
47
|
+
description: "Remove a user authentication from a cloud-storage provider.",
|
|
48
|
+
needsApproval: true,
|
|
49
|
+
method: "DELETE",
|
|
50
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage`,
|
|
51
|
+
input: userId.extend({ cloudStorage: docusignLooseObjectSchema() }),
|
|
52
|
+
output: docusignSuccessSchema,
|
|
53
|
+
body: (input) => input.cloudStorage,
|
|
54
|
+
transformResponse: () => ({ success: true })
|
|
55
|
+
});
|
|
56
|
+
const deleteUserCloudStorageAuthentication = defineRestOperation({
|
|
57
|
+
id: "delete_user_cloud_storage_authentication",
|
|
58
|
+
slug: "DOCUSIGN_DELETE_USER_CLOUD_STORAGE_AUTHENTICATION",
|
|
59
|
+
name: "Delete User Cloud Storage Authentication",
|
|
60
|
+
description: "Remove a single cloud-storage authentication for a user.",
|
|
61
|
+
needsApproval: true,
|
|
62
|
+
method: "DELETE",
|
|
63
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage/${ctx.encode(String(ctx.input.serviceId))}`,
|
|
64
|
+
input: userProvider,
|
|
65
|
+
output: docusignSuccessSchema,
|
|
66
|
+
transformResponse: () => ({ success: true })
|
|
67
|
+
});
|
|
68
|
+
const listCloudStorageItems = defineRestOperation({
|
|
69
|
+
id: "list_cloud_storage_items",
|
|
70
|
+
slug: "DOCUSIGN_LIST_CLOUD_STORAGE_ITEMS",
|
|
71
|
+
name: "List Cloud Storage Items",
|
|
72
|
+
description: "List items available in a configured cloud-storage provider for a user.",
|
|
73
|
+
method: "GET",
|
|
74
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage/${ctx.encode(String(ctx.input.serviceId))}/folders`,
|
|
75
|
+
input: userProvider.extend({
|
|
76
|
+
cloudStorageFolderPath: z.string().optional(),
|
|
77
|
+
cloudStorageFolderidPlain: z.string().optional(),
|
|
78
|
+
count: z.number().int().positive().optional(),
|
|
79
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
80
|
+
orderBy: z.string().optional(),
|
|
81
|
+
searchText: z.string().optional(),
|
|
82
|
+
startPosition: z.number().int().nonnegative().optional()
|
|
83
|
+
}),
|
|
84
|
+
output: docusignGenericObjectSchema,
|
|
85
|
+
query: (input) => ({
|
|
86
|
+
cloud_storage_folder_path: input.cloudStorageFolderPath,
|
|
87
|
+
cloud_storage_folderid_plain: input.cloudStorageFolderidPlain,
|
|
88
|
+
count: input.count,
|
|
89
|
+
order: input.order,
|
|
90
|
+
order_by: input.orderBy,
|
|
91
|
+
search_text: input.searchText,
|
|
92
|
+
start_position: input.startPosition
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
const retrieveItemsInCloudStorageFolder = defineRestOperation({
|
|
96
|
+
id: "retrieve_items_in_cloud_storage_folder",
|
|
97
|
+
slug: "DOCUSIGN_RETRIEVE_ITEMS_IN_CLOUD_STORAGE_FOLDER",
|
|
98
|
+
name: "Retrieve Items In Cloud Storage Folder",
|
|
99
|
+
description: "Retrieve items inside a specific cloud-storage folder.",
|
|
100
|
+
method: "GET",
|
|
101
|
+
path: (ctx) => `/users/${ctx.encode(String(ctx.input.userId))}/cloud_storage/${ctx.encode(String(ctx.input.serviceId))}/folders/${ctx.encode(String(ctx.input.folderId))}`,
|
|
102
|
+
input: userProvider.extend({
|
|
103
|
+
folderId: z.string().min(1),
|
|
104
|
+
count: z.number().int().positive().optional(),
|
|
105
|
+
startPosition: z.number().int().nonnegative().optional()
|
|
106
|
+
}),
|
|
107
|
+
output: docusignGenericObjectSchema,
|
|
108
|
+
query: (input) => ({
|
|
109
|
+
count: input.count,
|
|
110
|
+
start_position: input.startPosition
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { configureCloudStorageRedirectUrl, deleteUserAuthForCloudStorageProviders, deleteUserCloudStorageAuthentication, getUserCloudStorageProviderConfiguration, listCloudStorageItems, retrieveCloudStorageProviderConfiguration, retrieveItemsInCloudStorageFolder };
|