@keystrokehq/docusign 0.0.15 → 0.0.16-integration-id-canonicalization.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/README.md +3 -2
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +4 -0
- package/dist/docusign-jwt.credential-set-B0sXS-5i.mjs +39 -0
- package/dist/docusign-jwt.credential-set-Bz99DTgx.d.mts +90 -0
- package/dist/docusign.credential-set-DRhK9ICD.mjs +183 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +6 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/void-envelope.operation-Bim49UXq.mjs +8192 -0
- package/dist/void-envelope.operation-D-onxqe_.d.mts +18203 -0
- package/package.json +11 -226
- package/dist/_official/index.d.mts +0 -75
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -1
- package/dist/_runtime/index.mjs +0 -1
- package/dist/account-custom-fields.d.mts +0 -48
- package/dist/account-custom-fields.mjs +0 -63
- package/dist/account-stamps.d.mts +0 -119
- package/dist/account-stamps.mjs +0 -144
- package/dist/account-tabs.d.mts +0 -65
- package/dist/account-tabs.mjs +0 -80
- package/dist/account.d.mts +0 -160
- package/dist/account.mjs +0 -207
- package/dist/admin.d.mts +0 -13
- package/dist/admin.mjs +0 -20
- package/dist/auth.d.mts +0 -28
- package/dist/auth.mjs +0 -64
- package/dist/bcc-archive.d.mts +0 -47
- package/dist/bcc-archive.mjs +0 -70
- package/dist/billing.d.mts +0 -152
- package/dist/billing.mjs +0 -208
- package/dist/brands.d.mts +0 -147
- package/dist/brands.mjs +0 -157
- package/dist/bulk-send.d.mts +0 -104
- package/dist/bulk-send.mjs +0 -115
- package/dist/chunked-uploads.d.mts +0 -57
- package/dist/chunked-uploads.mjs +0 -74
- package/dist/click.d.mts +0 -13
- package/dist/click.mjs +0 -20
- package/dist/client.d.mts +0 -47
- package/dist/client.mjs +0 -286
- package/dist/clm.d.mts +0 -13
- package/dist/clm.mjs +0 -20
- package/dist/cloud-storage.d.mts +0 -93
- package/dist/cloud-storage.mjs +0 -115
- package/dist/connect.d.mts +0 -183
- package/dist/connect.mjs +0 -217
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/contacts.d.mts +0 -59
- package/dist/contacts.mjs +0 -79
- package/dist/enote.d.mts +0 -31
- package/dist/enote.mjs +0 -45
- package/dist/envelope-attachments.d.mts +0 -65
- package/dist/envelope-attachments.mjs +0 -76
- package/dist/envelope-custom-fields.d.mts +0 -137
- package/dist/envelope-custom-fields.mjs +0 -92
- package/dist/envelope-documents.d.mts +0 -206
- package/dist/envelope-documents.mjs +0 -219
- package/dist/envelope-email.d.mts +0 -48
- package/dist/envelope-email.mjs +0 -60
- package/dist/envelope-lock.d.mts +0 -48
- package/dist/envelope-lock.mjs +0 -60
- package/dist/envelope-logs.d.mts +0 -89
- package/dist/envelope-logs.mjs +0 -126
- package/dist/envelope-notifications.d.mts +0 -34
- package/dist/envelope-notifications.mjs +0 -44
- package/dist/envelope-recipients.d.mts +0 -126
- package/dist/envelope-recipients.mjs +0 -136
- package/dist/envelope-tabs.d.mts +0 -39
- package/dist/envelope-tabs.mjs +0 -49
- package/dist/envelope-views.d.mts +0 -74
- package/dist/envelope-views.mjs +0 -88
- package/dist/envelope-workflow.d.mts +0 -151
- package/dist/envelope-workflow.mjs +0 -176
- package/dist/envelopes.d.mts +0 -377
- package/dist/envelopes.mjs +0 -190
- package/dist/errors.d.mts +0 -48
- package/dist/errors.mjs +0 -76
- package/dist/events.d.mts +0 -192
- package/dist/events.mjs +0 -146
- package/dist/factory-5kY-Jnda.mjs +0 -8
- package/dist/groups.d.mts +0 -150
- package/dist/groups.mjs +0 -146
- package/dist/integration-H05G5JY8.mjs +0 -112
- package/dist/integration-Mk1ScWT6.d.mts +0 -30
- package/dist/messaging.d.mts +0 -1
- package/dist/messaging.mjs +0 -1
- package/dist/monitor.d.mts +0 -13
- package/dist/monitor.mjs +0 -20
- package/dist/notary.d.mts +0 -92
- package/dist/notary.mjs +0 -122
- package/dist/operation-helpers-D25WHTo1.mjs +0 -102
- package/dist/permission-profiles.d.mts +0 -57
- package/dist/permission-profiles.mjs +0 -70
- package/dist/power-forms.d.mts +0 -38
- package/dist/power-forms.mjs +0 -62
- package/dist/rooms.d.mts +0 -13
- package/dist/rooms.mjs +0 -28
- package/dist/shared-DTUCJayR.mjs +0 -27
- package/dist/signing-groups.d.mts +0 -102
- package/dist/signing-groups.mjs +0 -117
- package/dist/template-custom-fields.d.mts +0 -166
- package/dist/template-custom-fields.mjs +0 -107
- package/dist/template-documents.d.mts +0 -99
- package/dist/template-documents.mjs +0 -109
- package/dist/template-lock.d.mts +0 -48
- package/dist/template-lock.mjs +0 -60
- package/dist/template-sharing.d.mts +0 -96
- package/dist/template-sharing.mjs +0 -108
- package/dist/template-workflow.d.mts +0 -135
- package/dist/template-workflow.mjs +0 -152
- package/dist/templates.d.mts +0 -129
- package/dist/templates.mjs +0 -110
- package/dist/user-authorizations.d.mts +0 -96
- package/dist/user-authorizations.mjs +0 -133
- package/dist/user-custom-settings.d.mts +0 -60
- package/dist/user-custom-settings.mjs +0 -69
- package/dist/user-profile.d.mts +0 -80
- package/dist/user-profile.mjs +0 -106
- package/dist/user-signatures.d.mts +0 -155
- package/dist/user-signatures.mjs +0 -180
- package/dist/users.d.mts +0 -103
- package/dist/users.mjs +0 -98
- package/dist/verification.d.mts +0 -19
- package/dist/verification.mjs +0 -59
- package/dist/workspaces.d.mts +0 -128
- package/dist/workspaces.mjs +0 -143
package/dist/click.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { docusignGenericObjectSchema } from "./schemas/index.mjs";
|
|
2
|
-
import { n as definePlanGatedOperation } from "./operation-helpers-D25WHTo1.mjs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
//#region src/click.ts
|
|
6
|
-
/**
|
|
7
|
-
* DocuSign Click (clickwrap) — plan-gated in v1.
|
|
8
|
-
*/
|
|
9
|
-
const clickNotImplemented = definePlanGatedOperation({
|
|
10
|
-
id: "docusign.click-not-implemented",
|
|
11
|
-
slug: "DOCUSIGN_CLICK_NOT_IMPLEMENTED",
|
|
12
|
-
name: "DocuSign Click (not implemented)",
|
|
13
|
-
description: "Placeholder for DocuSign Click (clickwrap) API.",
|
|
14
|
-
input: z.object({}).catchall(z.unknown()),
|
|
15
|
-
output: docusignGenericObjectSchema,
|
|
16
|
-
reason: "DocuSign Click requires `click.manage` / `click.send` scopes and a Click-licensed account."
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { clickNotImplemented };
|
package/dist/client.d.mts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { t as DocusignCredentials } from "./integration-Mk1ScWT6.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/client.d.ts
|
|
4
|
-
type DocusignQueryValue = string | number | boolean | ReadonlyArray<string | number | boolean> | undefined;
|
|
5
|
-
type DocusignHttpMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
|
|
6
|
-
interface DocusignRequestInit {
|
|
7
|
-
readonly method?: DocusignHttpMethod;
|
|
8
|
-
readonly path: string;
|
|
9
|
-
readonly query?: Record<string, DocusignQueryValue>;
|
|
10
|
-
readonly body?: unknown;
|
|
11
|
-
readonly accept?: string;
|
|
12
|
-
readonly headers?: Record<string, string>;
|
|
13
|
-
/** Skip the `/restapi/v2.1/accounts/{accountId}` prefix (e.g. `/oauth/userinfo`). */
|
|
14
|
-
readonly accountScoped?: boolean;
|
|
15
|
-
}
|
|
16
|
-
interface DocusignMultipartPart {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly filename?: string;
|
|
19
|
-
readonly contentType: string;
|
|
20
|
-
readonly content: string | Uint8Array | Record<string, unknown>;
|
|
21
|
-
/** When true, the `content` is a JSON value that should be serialized. */
|
|
22
|
-
readonly serializeAsJson?: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface DocusignBinaryResponse {
|
|
25
|
-
readonly body: Uint8Array;
|
|
26
|
-
readonly contentType: string | undefined;
|
|
27
|
-
readonly contentDisposition: string | undefined;
|
|
28
|
-
readonly status: number;
|
|
29
|
-
readonly headers: Record<string, string>;
|
|
30
|
-
}
|
|
31
|
-
interface DocusignClient {
|
|
32
|
-
readonly accountId: string;
|
|
33
|
-
readonly baseUri: string;
|
|
34
|
-
request<T>(init: DocusignRequestInit): Promise<T>;
|
|
35
|
-
requestBinary(init: DocusignRequestInit): Promise<DocusignBinaryResponse>;
|
|
36
|
-
requestMultipart<T>(init: Omit<DocusignRequestInit, 'body' | 'headers'> & {
|
|
37
|
-
readonly parts: readonly DocusignMultipartPart[];
|
|
38
|
-
readonly headers?: Record<string, string>;
|
|
39
|
-
}): Promise<T>;
|
|
40
|
-
listAll<T>(init: DocusignRequestInit, options: {
|
|
41
|
-
readonly items: (payload: unknown) => readonly T[];
|
|
42
|
-
}): AsyncGenerator<T, void, void>;
|
|
43
|
-
}
|
|
44
|
-
declare function createDocusignClient(credentials: DocusignCredentials): DocusignClient;
|
|
45
|
-
type DocusignClientType = ReturnType<typeof createDocusignClient>;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { DocusignBinaryResponse, DocusignClient, DocusignClientType, DocusignHttpMethod, DocusignMultipartPart, DocusignQueryValue, DocusignRequestInit, createDocusignClient };
|
package/dist/client.mjs
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/clm.d.ts
|
|
5
|
-
declare const clmNotImplemented: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
6
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
7
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
8
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
9
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
10
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
11
|
-
}, z.core.$strip>>], undefined>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { clmNotImplemented };
|
package/dist/clm.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { docusignGenericObjectSchema } from "./schemas/index.mjs";
|
|
2
|
-
import { n as definePlanGatedOperation } from "./operation-helpers-D25WHTo1.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: "docusign.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 };
|
package/dist/cloud-storage.d.mts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/cloud-storage.d.ts
|
|
5
|
-
declare const configureCloudStorageRedirectUrl: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
6
|
-
userId: z.ZodString;
|
|
7
|
-
serviceId: z.ZodString;
|
|
8
|
-
cloudStorage: z.ZodObject<{
|
|
9
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
10
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
11
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
13
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
14
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
15
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
16
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
17
|
-
}, z.core.$strip>>], undefined>;
|
|
18
|
-
declare const getUserCloudStorageProviderConfiguration: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
19
|
-
userId: z.ZodString;
|
|
20
|
-
serviceId: z.ZodString;
|
|
21
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
23
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
24
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
25
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
26
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
27
|
-
}, z.core.$strip>>], undefined>;
|
|
28
|
-
declare const retrieveCloudStorageProviderConfiguration: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
29
|
-
userId: z.ZodString;
|
|
30
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
32
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", 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>;
|
|
37
|
-
declare const deleteUserAuthForCloudStorageProviders: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
38
|
-
userId: z.ZodString;
|
|
39
|
-
cloudStorage: z.ZodObject<{
|
|
40
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
41
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
42
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
-
success: z.ZodBoolean;
|
|
44
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
45
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
46
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
47
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
48
|
-
}, z.core.$strip>>], undefined>;
|
|
49
|
-
declare const deleteUserCloudStorageAuthentication: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
50
|
-
userId: z.ZodString;
|
|
51
|
-
serviceId: z.ZodString;
|
|
52
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
-
success: z.ZodBoolean;
|
|
54
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
55
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
56
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
57
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
58
|
-
}, z.core.$strip>>], undefined>;
|
|
59
|
-
declare const listCloudStorageItems: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
60
|
-
userId: z.ZodString;
|
|
61
|
-
serviceId: z.ZodString;
|
|
62
|
-
cloudStorageFolderPath: z.ZodOptional<z.ZodString>;
|
|
63
|
-
cloudStorageFolderidPlain: z.ZodOptional<z.ZodString>;
|
|
64
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
order: z.ZodOptional<z.ZodEnum<{
|
|
66
|
-
asc: "asc";
|
|
67
|
-
desc: "desc";
|
|
68
|
-
}>>;
|
|
69
|
-
orderBy: z.ZodOptional<z.ZodString>;
|
|
70
|
-
searchText: z.ZodOptional<z.ZodString>;
|
|
71
|
-
startPosition: z.ZodOptional<z.ZodNumber>;
|
|
72
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
74
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
75
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
76
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
77
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
78
|
-
}, z.core.$strip>>], undefined>;
|
|
79
|
-
declare const retrieveItemsInCloudStorageFolder: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
80
|
-
userId: z.ZodString;
|
|
81
|
-
serviceId: z.ZodString;
|
|
82
|
-
folderId: z.ZodString;
|
|
83
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
startPosition: z.ZodOptional<z.ZodNumber>;
|
|
85
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
87
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:docusign", z.ZodObject<{
|
|
88
|
-
DOCUSIGN_ACCESS_TOKEN: z.ZodString;
|
|
89
|
-
DOCUSIGN_ACCOUNT_ID: z.ZodString;
|
|
90
|
-
DOCUSIGN_BASE_URI: z.ZodURL;
|
|
91
|
-
}, z.core.$strip>>], undefined>;
|
|
92
|
-
//#endregion
|
|
93
|
-
export { configureCloudStorageRedirectUrl, deleteUserAuthForCloudStorageProviders, deleteUserCloudStorageAuthentication, getUserCloudStorageProviderConfiguration, listCloudStorageItems, retrieveCloudStorageProviderConfiguration, retrieveItemsInCloudStorageFolder };
|
package/dist/cloud-storage.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { docusignGenericObjectSchema, docusignLooseObjectSchema, docusignSuccessSchema } from "./schemas/index.mjs";
|
|
2
|
-
import { r as defineRestOperation } from "./operation-helpers-D25WHTo1.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: "docusign.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: "docusign.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: "docusign.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: "docusign.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: "docusign.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: "docusign.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: "docusign.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 };
|