@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { docusignEnvelopeCreateInputSchema, docusignEnvelopeIdSchema, docusignEnvelopeSchema, docusignEnvelopeSummarySchema, docusignGenericObjectSchema, docusignIncludeSchema, docusignLooseObjectSchema, docusignSuccessSchema } from "./schemas/index.mjs";
|
|
2
|
+
import { r as defineRestOperation, t as defineBinaryOperation } from "./operation-helpers-BMTArRh9.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/envelopes.ts
|
|
6
|
+
/**
|
|
7
|
+
* Envelope core lifecycle — get, send, replay, audit, transcripts.
|
|
8
|
+
* Covers PLAN.md § 6.1.
|
|
9
|
+
*/
|
|
10
|
+
const binaryResponseSchema = docusignLooseObjectSchema({
|
|
11
|
+
contentType: z.string().optional(),
|
|
12
|
+
contentDisposition: z.string().optional(),
|
|
13
|
+
status: z.number(),
|
|
14
|
+
body: z.string()
|
|
15
|
+
});
|
|
16
|
+
const getEnvelope = defineRestOperation({
|
|
17
|
+
id: "get_envelope",
|
|
18
|
+
slug: "DOCUSIGN_GET_ENVELOPE",
|
|
19
|
+
name: "Get Envelope",
|
|
20
|
+
description: "Fetch a DocuSign envelope by id, optionally expanding recipients/tabs/custom_fields/documents.",
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}`,
|
|
23
|
+
input: z.object({
|
|
24
|
+
envelopeId: docusignEnvelopeIdSchema,
|
|
25
|
+
include: docusignIncludeSchema.optional(),
|
|
26
|
+
advancedUpdate: z.boolean().optional()
|
|
27
|
+
}),
|
|
28
|
+
output: docusignEnvelopeSchema,
|
|
29
|
+
query: (input) => ({
|
|
30
|
+
include: input.include,
|
|
31
|
+
advanced_update: input.advancedUpdate
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
const sendEnvelope = defineRestOperation({
|
|
35
|
+
id: "send_envelope",
|
|
36
|
+
slug: "DOCUSIGN_SEND_ENVELOPE",
|
|
37
|
+
name: "Send Envelope",
|
|
38
|
+
description: "Create and send an envelope in one call (status=sent) or save it as a draft.",
|
|
39
|
+
needsApproval: true,
|
|
40
|
+
method: "POST",
|
|
41
|
+
path: "/envelopes",
|
|
42
|
+
input: docusignEnvelopeCreateInputSchema,
|
|
43
|
+
output: docusignEnvelopeSummarySchema,
|
|
44
|
+
body: (input) => input
|
|
45
|
+
});
|
|
46
|
+
const voidEnvelope = defineRestOperation({
|
|
47
|
+
id: "void_envelope",
|
|
48
|
+
slug: "DOCUSIGN_SEND_ENVELOPE",
|
|
49
|
+
name: "Void Envelope",
|
|
50
|
+
description: "Void an in-flight envelope. Modeled as a PUT on the envelope with status=voided + voidedReason.",
|
|
51
|
+
needsApproval: true,
|
|
52
|
+
method: "PUT",
|
|
53
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}`,
|
|
54
|
+
input: z.object({
|
|
55
|
+
envelopeId: docusignEnvelopeIdSchema,
|
|
56
|
+
voidedReason: z.string().min(1)
|
|
57
|
+
}),
|
|
58
|
+
output: docusignEnvelopeSchema,
|
|
59
|
+
body: (input) => ({
|
|
60
|
+
status: "voided",
|
|
61
|
+
voidedReason: input.voidedReason
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
const createEnvelopeFromTemplate = defineRestOperation({
|
|
65
|
+
id: "create_envelope_from_template",
|
|
66
|
+
slug: "DOCUSIGN_CREATE_ENVELOPE_FROM_TEMPLATE",
|
|
67
|
+
name: "Create Envelope From Template",
|
|
68
|
+
description: "Create a new envelope bound to an existing DocuSign template, filling template roles from input.",
|
|
69
|
+
needsApproval: true,
|
|
70
|
+
method: "POST",
|
|
71
|
+
path: "/envelopes",
|
|
72
|
+
input: docusignEnvelopeCreateInputSchema.extend({
|
|
73
|
+
templateId: z.string().min(1),
|
|
74
|
+
templateRoles: z.array(docusignLooseObjectSchema()).min(1),
|
|
75
|
+
status: z.enum(["created", "sent"]).optional()
|
|
76
|
+
}),
|
|
77
|
+
output: docusignEnvelopeSummarySchema,
|
|
78
|
+
body: (input) => input
|
|
79
|
+
});
|
|
80
|
+
const retrieveEnvelopeAuditEvents = defineRestOperation({
|
|
81
|
+
id: "retrieve_envelope_audit_events",
|
|
82
|
+
slug: "DOCUSIGN_RETRIEVE_ENVELOPE_AUDIT_EVENTS",
|
|
83
|
+
name: "Retrieve Envelope Audit Events",
|
|
84
|
+
description: "Fetch the audit trail for an envelope (send, view, sign, decline, void, etc).",
|
|
85
|
+
method: "GET",
|
|
86
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}/audit_events`,
|
|
87
|
+
input: z.object({ envelopeId: docusignEnvelopeIdSchema }),
|
|
88
|
+
output: docusignLooseObjectSchema({ auditEvents: z.array(docusignLooseObjectSchema()).optional() })
|
|
89
|
+
});
|
|
90
|
+
const republishConnectDataForEnvelope = defineRestOperation({
|
|
91
|
+
id: "republish_connect_data_for_envelope",
|
|
92
|
+
slug: "DOCUSIGN_REPUBLISH_CONNECT_DATA_FOR_ENVELOPE",
|
|
93
|
+
name: "Republish Connect Data For Envelope",
|
|
94
|
+
description: "Retrigger Connect webhooks for a specific envelope.",
|
|
95
|
+
needsApproval: true,
|
|
96
|
+
method: "PUT",
|
|
97
|
+
path: (ctx) => `/connect/envelopes/${ctx.encode(String(ctx.input.envelopeId))}/retry_queue`,
|
|
98
|
+
input: z.object({ envelopeId: docusignEnvelopeIdSchema }),
|
|
99
|
+
output: docusignGenericObjectSchema
|
|
100
|
+
});
|
|
101
|
+
const republishConnectInfoForEnvelopes = defineRestOperation({
|
|
102
|
+
id: "republish_connect_info_for_envelopes",
|
|
103
|
+
slug: "DOCUSIGN_REPUBLISH_CONNECT_INFO_FOR_ENVELOPES",
|
|
104
|
+
name: "Republish Connect Info For Envelopes",
|
|
105
|
+
description: "Retrigger Connect webhooks for a set of envelopes by id (bulk version of the single-envelope call).",
|
|
106
|
+
needsApproval: true,
|
|
107
|
+
method: "PUT",
|
|
108
|
+
path: "/connect/envelopes/retry_queue",
|
|
109
|
+
input: z.object({ envelopeIds: z.array(docusignEnvelopeIdSchema).min(1) }),
|
|
110
|
+
output: docusignGenericObjectSchema,
|
|
111
|
+
body: (input) => ({ envelopeIds: input.envelopeIds })
|
|
112
|
+
});
|
|
113
|
+
const submitBatchHistoricalEnvelopesToWebhook = defineRestOperation({
|
|
114
|
+
id: "submit_batch_historical_envelopes_to_webhook",
|
|
115
|
+
slug: "DOCUSIGN_SUBMIT_BATCH_HISTORICAL_ENVELOPES_TO_WEBHOOK",
|
|
116
|
+
name: "Submit Batch Historical Envelopes To Webhook",
|
|
117
|
+
description: "Queue historical envelopes for delivery to a Connect consumer. Requires JWT Grant + admin consent — v1 ships this as a pass-through; production use is plan-gated until JWT is enabled.",
|
|
118
|
+
needsApproval: true,
|
|
119
|
+
method: "POST",
|
|
120
|
+
path: "/connect/envelopes/publish/historical",
|
|
121
|
+
input: z.object({
|
|
122
|
+
connectId: z.string().min(1),
|
|
123
|
+
envelopeIds: z.array(docusignEnvelopeIdSchema).min(1)
|
|
124
|
+
}),
|
|
125
|
+
output: docusignGenericObjectSchema,
|
|
126
|
+
body: (input) => ({
|
|
127
|
+
connectId: input.connectId,
|
|
128
|
+
envelopeIds: input.envelopeIds
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
const retrieveEnvelopeHtmlDefinition = defineRestOperation({
|
|
132
|
+
id: "retrieve_envelope_html_definition",
|
|
133
|
+
slug: "DOCUSIGN_RETRIEVE_ENVELOPE_HTML_DEFINITION",
|
|
134
|
+
name: "Retrieve Envelope HTML Definition",
|
|
135
|
+
description: "Get the responsive HTML definition for an envelope.",
|
|
136
|
+
method: "GET",
|
|
137
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}/html_definitions`,
|
|
138
|
+
input: z.object({ envelopeId: docusignEnvelopeIdSchema }),
|
|
139
|
+
output: docusignGenericObjectSchema
|
|
140
|
+
});
|
|
141
|
+
const retrieveHtmlDefinitionForResponsiveDocument = defineRestOperation({
|
|
142
|
+
id: "retrieve_html_definition_for_responsive_document",
|
|
143
|
+
slug: "DOCUSIGN_RETRIEVE_HTMLDEFINITION_FOR_RESPONSIVE_DOCUMENT",
|
|
144
|
+
name: "Retrieve HTML Definition For Responsive Document",
|
|
145
|
+
description: "Get the responsive HTML definition for a specific document within an envelope.",
|
|
146
|
+
method: "GET",
|
|
147
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}/documents/${ctx.encode(String(ctx.input.documentId))}/html_definitions`,
|
|
148
|
+
input: z.object({
|
|
149
|
+
envelopeId: docusignEnvelopeIdSchema,
|
|
150
|
+
documentId: z.string().min(1)
|
|
151
|
+
}),
|
|
152
|
+
output: docusignGenericObjectSchema
|
|
153
|
+
});
|
|
154
|
+
const getPdfTranscriptOfEnvelopeComments = defineBinaryOperation({
|
|
155
|
+
id: "get_pdf_transcript_of_envelope_comments",
|
|
156
|
+
slug: "DOCUSIGN_GET_PDFTRANSCRIPT_OF_ENVELOPE_COMMENTS",
|
|
157
|
+
name: "Get PDF Transcript Of Envelope Comments",
|
|
158
|
+
description: "Download a PDF transcript of the comments thread on an envelope.",
|
|
159
|
+
method: "GET",
|
|
160
|
+
path: (ctx) => `/envelopes/${ctx.encode(String(ctx.input.envelopeId))}/comments/transcript`,
|
|
161
|
+
input: z.object({ envelopeId: docusignEnvelopeIdSchema }),
|
|
162
|
+
accept: "application/pdf",
|
|
163
|
+
output: binaryResponseSchema
|
|
164
|
+
});
|
|
165
|
+
const deleteEnvelopeTransferRule = defineRestOperation({
|
|
166
|
+
id: "delete_envelope_transfer_rule",
|
|
167
|
+
slug: "DOCUSIGN_DELETE_ENVELOPE_TRANSFER_RULE",
|
|
168
|
+
name: "Delete Envelope Transfer Rule",
|
|
169
|
+
description: "Remove a single envelope-transfer rule by id.",
|
|
170
|
+
needsApproval: true,
|
|
171
|
+
method: "DELETE",
|
|
172
|
+
path: (ctx) => `/envelopes/transfer_rules/${ctx.encode(String(ctx.input.transferRuleId))}`,
|
|
173
|
+
input: z.object({ transferRuleId: z.string().min(1) }),
|
|
174
|
+
output: docusignSuccessSchema,
|
|
175
|
+
transformResponse: () => ({ success: true })
|
|
176
|
+
});
|
|
177
|
+
const fetchRecipientNamesForEmail = defineRestOperation({
|
|
178
|
+
id: "fetch_recipient_names_for_email",
|
|
179
|
+
slug: "DOCUSIGN_FETCH_RECIPIENT_NAMES_FOR_EMAIL",
|
|
180
|
+
name: "Fetch Recipient Names For Email",
|
|
181
|
+
description: "Look up known recipient names for a given email address on the account.",
|
|
182
|
+
method: "GET",
|
|
183
|
+
path: "/recipient_names",
|
|
184
|
+
input: z.object({ email: z.email() }),
|
|
185
|
+
output: docusignLooseObjectSchema({ recipientNames: z.array(z.string()).optional() }),
|
|
186
|
+
query: (input) => ({ email: input.email })
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
export { createEnvelopeFromTemplate, deleteEnvelopeTransferRule, fetchRecipientNamesForEmail, getEnvelope, getPdfTranscriptOfEnvelopeComments, republishConnectDataForEnvelope, republishConnectInfoForEnvelopes, retrieveEnvelopeAuditEvents, retrieveEnvelopeHtmlDefinition, retrieveHtmlDefinitionForResponsiveDocument, sendEnvelope, submitBatchHistoricalEnvelopesToWebhook, voidEnvelope };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Package-local error class for DocuSign API failures.
|
|
4
|
+
*
|
|
5
|
+
* Carries the provider-returned HTTP status, DocuSign error code (when
|
|
6
|
+
* structured), trace token (`X-DocuSign-TraceToken` echoes back in support
|
|
7
|
+
* queries), and a discriminated `kind` that operations can branch on without
|
|
8
|
+
* string-matching error messages.
|
|
9
|
+
*/
|
|
10
|
+
type DocusignApiErrorKind = 'http' | 'rate_limit' | 'auth' | 'validation' | 'plan_gated' | 'webhook_signature' | 'not_implemented' | 'network';
|
|
11
|
+
interface DocusignApiErrorInit {
|
|
12
|
+
readonly kind: DocusignApiErrorKind;
|
|
13
|
+
readonly status?: number;
|
|
14
|
+
readonly providerErrorCode?: string;
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
readonly retryable?: boolean;
|
|
17
|
+
readonly retryAfterMs?: number;
|
|
18
|
+
readonly body?: unknown;
|
|
19
|
+
readonly cause?: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare class DocusignApiError extends Error {
|
|
22
|
+
readonly kind: DocusignApiErrorKind;
|
|
23
|
+
readonly status: number | undefined;
|
|
24
|
+
readonly providerErrorCode: string | undefined;
|
|
25
|
+
readonly requestId: string | undefined;
|
|
26
|
+
readonly retryable: boolean;
|
|
27
|
+
readonly retryAfterMs: number | undefined;
|
|
28
|
+
readonly body: unknown;
|
|
29
|
+
constructor(message: string, init: DocusignApiErrorInit);
|
|
30
|
+
static notImplemented(init: {
|
|
31
|
+
slug?: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
kind?: Extract<DocusignApiErrorKind, 'plan_gated' | 'not_implemented'>;
|
|
34
|
+
}): DocusignApiError;
|
|
35
|
+
static fromResponse(params: {
|
|
36
|
+
status: number;
|
|
37
|
+
body: unknown;
|
|
38
|
+
requestId?: string;
|
|
39
|
+
retryAfterMs?: number;
|
|
40
|
+
url: string;
|
|
41
|
+
method: string;
|
|
42
|
+
}): DocusignApiError;
|
|
43
|
+
static webhookSignature(message: string): DocusignApiError;
|
|
44
|
+
static validation(message: string, cause?: unknown): DocusignApiError;
|
|
45
|
+
}
|
|
46
|
+
declare function isDocusignApiError(value: unknown): value is DocusignApiError;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { DocusignApiError, DocusignApiErrorInit, DocusignApiErrorKind, isDocusignApiError };
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
var DocusignApiError = class DocusignApiError extends Error {
|
|
3
|
+
kind;
|
|
4
|
+
status;
|
|
5
|
+
providerErrorCode;
|
|
6
|
+
requestId;
|
|
7
|
+
retryable;
|
|
8
|
+
retryAfterMs;
|
|
9
|
+
body;
|
|
10
|
+
constructor(message, init) {
|
|
11
|
+
super(message, { cause: init.cause });
|
|
12
|
+
this.name = "DocusignApiError";
|
|
13
|
+
this.kind = init.kind;
|
|
14
|
+
this.status = init.status;
|
|
15
|
+
this.providerErrorCode = init.providerErrorCode;
|
|
16
|
+
this.requestId = init.requestId;
|
|
17
|
+
this.retryable = init.retryable ?? defaultRetryable(init.kind, init.status);
|
|
18
|
+
this.retryAfterMs = init.retryAfterMs;
|
|
19
|
+
this.body = init.body;
|
|
20
|
+
}
|
|
21
|
+
static notImplemented(init) {
|
|
22
|
+
const kind = init.kind ?? "not_implemented";
|
|
23
|
+
const slugSuffix = init.slug ? ` (${init.slug})` : "";
|
|
24
|
+
return new DocusignApiError(`${init.reason ?? "DocuSign operation is not implemented in this release."}${slugSuffix}`, {
|
|
25
|
+
kind,
|
|
26
|
+
retryable: false
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static fromResponse(params) {
|
|
30
|
+
const { status, body, requestId, retryAfterMs, url, method } = params;
|
|
31
|
+
const bodyRecord = isRecord(body) ? body : void 0;
|
|
32
|
+
const providerErrorCode = readString(bodyRecord?.errorCode) ?? readString(bodyRecord?.code);
|
|
33
|
+
const providerMessage = readString(bodyRecord?.message) ?? readString(bodyRecord?.error_description) ?? readString(bodyRecord?.error);
|
|
34
|
+
const kind = status === 401 || status === 403 ? "auth" : status === 429 ? "rate_limit" : "http";
|
|
35
|
+
return new DocusignApiError(`DocuSign ${method} ${url} failed (${status}): ${providerMessage ?? `HTTP ${status}`}`, {
|
|
36
|
+
kind,
|
|
37
|
+
status,
|
|
38
|
+
providerErrorCode,
|
|
39
|
+
requestId,
|
|
40
|
+
retryAfterMs,
|
|
41
|
+
body,
|
|
42
|
+
retryable: status === 429 || status >= 500
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
static webhookSignature(message) {
|
|
46
|
+
return new DocusignApiError(message, {
|
|
47
|
+
kind: "webhook_signature",
|
|
48
|
+
retryable: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
static validation(message, cause) {
|
|
52
|
+
return new DocusignApiError(message, {
|
|
53
|
+
kind: "validation",
|
|
54
|
+
retryable: false,
|
|
55
|
+
cause
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function defaultRetryable(kind, status) {
|
|
60
|
+
if (kind === "rate_limit") return true;
|
|
61
|
+
if (kind === "network") return true;
|
|
62
|
+
if (typeof status === "number" && status >= 500) return true;
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
function isRecord(value) {
|
|
66
|
+
return typeof value === "object" && value !== null;
|
|
67
|
+
}
|
|
68
|
+
function readString(value) {
|
|
69
|
+
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
70
|
+
}
|
|
71
|
+
function isDocusignApiError(value) {
|
|
72
|
+
return value instanceof DocusignApiError;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { DocusignApiError, isDocusignApiError };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/events.d.ts
|
|
4
|
+
declare const docusignEnvelopeEventNames: readonly ["envelope-sent", "envelope-resent", "envelope-delivered", "envelope-signed", "envelope-completed", "envelope-declined", "envelope-voided", "envelope-corrected", "envelope-discard", "envelope-purge", "envelope-reassign", "envelope-deleted", "envelope-documents-purged"];
|
|
5
|
+
declare const docusignRecipientEventNames: readonly ["recipient-sent", "recipient-resent", "recipient-delivered", "recipient-completed", "recipient-declined", "recipient-authenticationfailed", "recipient-autoresponded", "recipient-delegate", "recipient-finish-later", "recipient-reassign"];
|
|
6
|
+
declare const docusignTemplateEventNames: readonly ["template-created", "template-modified"];
|
|
7
|
+
declare const docusignConnectEventNames: readonly ["envelope-sent", "envelope-resent", "envelope-delivered", "envelope-signed", "envelope-completed", "envelope-declined", "envelope-voided", "envelope-corrected", "envelope-discard", "envelope-purge", "envelope-reassign", "envelope-deleted", "envelope-documents-purged", "recipient-sent", "recipient-resent", "recipient-delivered", "recipient-completed", "recipient-declined", "recipient-authenticationfailed", "recipient-autoresponded", "recipient-delegate", "recipient-finish-later", "recipient-reassign", "template-created", "template-modified"];
|
|
8
|
+
declare const docusignConnectEventNameSchema: z.ZodEnum<{
|
|
9
|
+
"envelope-sent": "envelope-sent";
|
|
10
|
+
"envelope-resent": "envelope-resent";
|
|
11
|
+
"envelope-delivered": "envelope-delivered";
|
|
12
|
+
"envelope-signed": "envelope-signed";
|
|
13
|
+
"envelope-completed": "envelope-completed";
|
|
14
|
+
"envelope-declined": "envelope-declined";
|
|
15
|
+
"envelope-voided": "envelope-voided";
|
|
16
|
+
"envelope-corrected": "envelope-corrected";
|
|
17
|
+
"envelope-discard": "envelope-discard";
|
|
18
|
+
"envelope-purge": "envelope-purge";
|
|
19
|
+
"envelope-reassign": "envelope-reassign";
|
|
20
|
+
"envelope-deleted": "envelope-deleted";
|
|
21
|
+
"envelope-documents-purged": "envelope-documents-purged";
|
|
22
|
+
"recipient-sent": "recipient-sent";
|
|
23
|
+
"recipient-resent": "recipient-resent";
|
|
24
|
+
"recipient-delivered": "recipient-delivered";
|
|
25
|
+
"recipient-completed": "recipient-completed";
|
|
26
|
+
"recipient-declined": "recipient-declined";
|
|
27
|
+
"recipient-authenticationfailed": "recipient-authenticationfailed";
|
|
28
|
+
"recipient-autoresponded": "recipient-autoresponded";
|
|
29
|
+
"recipient-delegate": "recipient-delegate";
|
|
30
|
+
"recipient-finish-later": "recipient-finish-later";
|
|
31
|
+
"recipient-reassign": "recipient-reassign";
|
|
32
|
+
"template-created": "template-created";
|
|
33
|
+
"template-modified": "template-modified";
|
|
34
|
+
}>;
|
|
35
|
+
declare const docusignConnectEnvelopeEventSchema: z.ZodObject<{
|
|
36
|
+
event: z.ZodEnum<{
|
|
37
|
+
"envelope-sent": "envelope-sent";
|
|
38
|
+
"envelope-resent": "envelope-resent";
|
|
39
|
+
"envelope-delivered": "envelope-delivered";
|
|
40
|
+
"envelope-signed": "envelope-signed";
|
|
41
|
+
"envelope-completed": "envelope-completed";
|
|
42
|
+
"envelope-declined": "envelope-declined";
|
|
43
|
+
"envelope-voided": "envelope-voided";
|
|
44
|
+
"envelope-corrected": "envelope-corrected";
|
|
45
|
+
"envelope-discard": "envelope-discard";
|
|
46
|
+
"envelope-purge": "envelope-purge";
|
|
47
|
+
"envelope-reassign": "envelope-reassign";
|
|
48
|
+
"envelope-deleted": "envelope-deleted";
|
|
49
|
+
"envelope-documents-purged": "envelope-documents-purged";
|
|
50
|
+
}>;
|
|
51
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
52
|
+
configurationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
53
|
+
generatedDateTime: z.ZodOptional<z.ZodString>;
|
|
54
|
+
retryCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
55
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
56
|
+
data: z.ZodObject<{
|
|
57
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
59
|
+
envelopeId: z.ZodString;
|
|
60
|
+
envelopeSummary: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
envelopeId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
status: z.ZodOptional<z.ZodString>;
|
|
63
|
+
emailSubject: z.ZodOptional<z.ZodString>;
|
|
64
|
+
emailBlurb: z.ZodOptional<z.ZodString>;
|
|
65
|
+
statusChangedDateTime: z.ZodOptional<z.ZodString>;
|
|
66
|
+
sentDateTime: z.ZodOptional<z.ZodString>;
|
|
67
|
+
completedDateTime: z.ZodOptional<z.ZodString>;
|
|
68
|
+
voidedReason: z.ZodOptional<z.ZodString>;
|
|
69
|
+
senderAccountId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
senderUserId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
72
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
declare const docusignConnectRecipientEventSchema: z.ZodObject<{
|
|
75
|
+
event: z.ZodEnum<{
|
|
76
|
+
"recipient-sent": "recipient-sent";
|
|
77
|
+
"recipient-resent": "recipient-resent";
|
|
78
|
+
"recipient-delivered": "recipient-delivered";
|
|
79
|
+
"recipient-completed": "recipient-completed";
|
|
80
|
+
"recipient-declined": "recipient-declined";
|
|
81
|
+
"recipient-authenticationfailed": "recipient-authenticationfailed";
|
|
82
|
+
"recipient-autoresponded": "recipient-autoresponded";
|
|
83
|
+
"recipient-delegate": "recipient-delegate";
|
|
84
|
+
"recipient-finish-later": "recipient-finish-later";
|
|
85
|
+
"recipient-reassign": "recipient-reassign";
|
|
86
|
+
}>;
|
|
87
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
88
|
+
configurationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
89
|
+
generatedDateTime: z.ZodOptional<z.ZodString>;
|
|
90
|
+
retryCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
91
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
92
|
+
data: z.ZodObject<{
|
|
93
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
95
|
+
envelopeId: z.ZodString;
|
|
96
|
+
recipientId: z.ZodOptional<z.ZodString>;
|
|
97
|
+
recipientIdGuid: z.ZodOptional<z.ZodString>;
|
|
98
|
+
envelopeSummary: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
envelopeId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
status: z.ZodOptional<z.ZodString>;
|
|
101
|
+
emailSubject: z.ZodOptional<z.ZodString>;
|
|
102
|
+
emailBlurb: z.ZodOptional<z.ZodString>;
|
|
103
|
+
statusChangedDateTime: z.ZodOptional<z.ZodString>;
|
|
104
|
+
sentDateTime: z.ZodOptional<z.ZodString>;
|
|
105
|
+
completedDateTime: z.ZodOptional<z.ZodString>;
|
|
106
|
+
voidedReason: z.ZodOptional<z.ZodString>;
|
|
107
|
+
senderAccountId: z.ZodOptional<z.ZodString>;
|
|
108
|
+
senderUserId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
110
|
+
recipientSummary: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
recipientId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
recipientIdGuid: z.ZodOptional<z.ZodString>;
|
|
113
|
+
email: z.ZodOptional<z.ZodString>;
|
|
114
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
115
|
+
status: z.ZodOptional<z.ZodString>;
|
|
116
|
+
routingOrder: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
118
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
declare const docusignConnectTemplateEventSchema: z.ZodObject<{
|
|
121
|
+
event: z.ZodEnum<{
|
|
122
|
+
"template-created": "template-created";
|
|
123
|
+
"template-modified": "template-modified";
|
|
124
|
+
}>;
|
|
125
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
126
|
+
configurationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
127
|
+
generatedDateTime: z.ZodOptional<z.ZodString>;
|
|
128
|
+
retryCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
129
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
130
|
+
data: z.ZodObject<{
|
|
131
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
templateId: z.ZodString;
|
|
133
|
+
templateSummary: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
135
|
+
name: z.ZodOptional<z.ZodString>;
|
|
136
|
+
description: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
138
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
/**
|
|
141
|
+
* The root envelope that wraps every Connect delivery. We keep this loose so
|
|
142
|
+
* downstream `definitionFilter` can branch on `event` without failing parse
|
|
143
|
+
* when DocuSign adds a new event type — the specific per-event schemas above
|
|
144
|
+
* validate the narrowed shape inside each trigger.
|
|
145
|
+
*/
|
|
146
|
+
declare const docusignConnectEnvelopeSchema: z.ZodObject<{
|
|
147
|
+
event: z.ZodString;
|
|
148
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
149
|
+
configurationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
150
|
+
generatedDateTime: z.ZodOptional<z.ZodString>;
|
|
151
|
+
retryCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
152
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
153
|
+
data: z.ZodObject<{
|
|
154
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
envelopeId: z.ZodOptional<z.ZodString>;
|
|
157
|
+
recipientId: z.ZodOptional<z.ZodString>;
|
|
158
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
159
|
+
envelopeSummary: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
envelopeId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
status: z.ZodOptional<z.ZodString>;
|
|
162
|
+
emailSubject: z.ZodOptional<z.ZodString>;
|
|
163
|
+
emailBlurb: z.ZodOptional<z.ZodString>;
|
|
164
|
+
statusChangedDateTime: z.ZodOptional<z.ZodString>;
|
|
165
|
+
sentDateTime: z.ZodOptional<z.ZodString>;
|
|
166
|
+
completedDateTime: z.ZodOptional<z.ZodString>;
|
|
167
|
+
voidedReason: z.ZodOptional<z.ZodString>;
|
|
168
|
+
senderAccountId: z.ZodOptional<z.ZodString>;
|
|
169
|
+
senderUserId: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
171
|
+
recipientSummary: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
recipientId: z.ZodOptional<z.ZodString>;
|
|
173
|
+
recipientIdGuid: z.ZodOptional<z.ZodString>;
|
|
174
|
+
email: z.ZodOptional<z.ZodString>;
|
|
175
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
176
|
+
status: z.ZodOptional<z.ZodString>;
|
|
177
|
+
routingOrder: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
179
|
+
templateSummary: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
181
|
+
name: z.ZodOptional<z.ZodString>;
|
|
182
|
+
description: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
184
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
type DocusignConnectEnvelope = z.infer<typeof docusignConnectEnvelopeSchema>;
|
|
187
|
+
type DocusignConnectEnvelopeEvent = z.infer<typeof docusignConnectEnvelopeEventSchema>;
|
|
188
|
+
type DocusignConnectRecipientEvent = z.infer<typeof docusignConnectRecipientEventSchema>;
|
|
189
|
+
type DocusignConnectTemplateEvent = z.infer<typeof docusignConnectTemplateEventSchema>;
|
|
190
|
+
type DocusignConnectEventName = (typeof docusignConnectEventNames)[number];
|
|
191
|
+
//#endregion
|
|
192
|
+
export { DocusignConnectEnvelope, DocusignConnectEnvelopeEvent, DocusignConnectEventName, DocusignConnectRecipientEvent, DocusignConnectTemplateEvent, docusignConnectEnvelopeEventSchema, docusignConnectEnvelopeSchema, docusignConnectEventNameSchema, docusignConnectEventNames, docusignConnectRecipientEventSchema, docusignConnectTemplateEventSchema, docusignEnvelopeEventNames, docusignRecipientEventNames, docusignTemplateEventNames };
|
package/dist/events.mjs
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { docusignLooseObjectSchema } from "./schemas/index.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/events.ts
|
|
5
|
+
/**
|
|
6
|
+
* DocuSign Connect webhook event schemas.
|
|
7
|
+
*
|
|
8
|
+
* Connect delivers envelope, recipient, and template lifecycle events as
|
|
9
|
+
* JSON payloads under the `envelope-publish v2` format. These schemas
|
|
10
|
+
* describe the shape operations receive after HMAC verification has passed.
|
|
11
|
+
* The envelope union is deliberately loose where DocuSign returns polymorphic
|
|
12
|
+
* sub-shapes that depend on the Connect configuration; inner fields are
|
|
13
|
+
* parsed strictly where they're used for idempotency.
|
|
14
|
+
*
|
|
15
|
+
* See: https://developers.docusign.com/platform/webhooks/connect/event-model/
|
|
16
|
+
*/
|
|
17
|
+
const docusignEnvelopeEventNames = [
|
|
18
|
+
"envelope-sent",
|
|
19
|
+
"envelope-resent",
|
|
20
|
+
"envelope-delivered",
|
|
21
|
+
"envelope-signed",
|
|
22
|
+
"envelope-completed",
|
|
23
|
+
"envelope-declined",
|
|
24
|
+
"envelope-voided",
|
|
25
|
+
"envelope-corrected",
|
|
26
|
+
"envelope-discard",
|
|
27
|
+
"envelope-purge",
|
|
28
|
+
"envelope-reassign",
|
|
29
|
+
"envelope-deleted",
|
|
30
|
+
"envelope-documents-purged"
|
|
31
|
+
];
|
|
32
|
+
const docusignRecipientEventNames = [
|
|
33
|
+
"recipient-sent",
|
|
34
|
+
"recipient-resent",
|
|
35
|
+
"recipient-delivered",
|
|
36
|
+
"recipient-completed",
|
|
37
|
+
"recipient-declined",
|
|
38
|
+
"recipient-authenticationfailed",
|
|
39
|
+
"recipient-autoresponded",
|
|
40
|
+
"recipient-delegate",
|
|
41
|
+
"recipient-finish-later",
|
|
42
|
+
"recipient-reassign"
|
|
43
|
+
];
|
|
44
|
+
const docusignTemplateEventNames = ["template-created", "template-modified"];
|
|
45
|
+
const docusignConnectEventNames = [
|
|
46
|
+
...docusignEnvelopeEventNames,
|
|
47
|
+
...docusignRecipientEventNames,
|
|
48
|
+
...docusignTemplateEventNames
|
|
49
|
+
];
|
|
50
|
+
const docusignConnectEventNameSchema = z.enum(docusignConnectEventNames);
|
|
51
|
+
const envelopeSummarySchema = docusignLooseObjectSchema({
|
|
52
|
+
envelopeId: z.string().optional(),
|
|
53
|
+
status: z.string().optional(),
|
|
54
|
+
emailSubject: z.string().optional(),
|
|
55
|
+
emailBlurb: z.string().optional(),
|
|
56
|
+
statusChangedDateTime: z.string().optional(),
|
|
57
|
+
sentDateTime: z.string().optional(),
|
|
58
|
+
completedDateTime: z.string().optional(),
|
|
59
|
+
voidedReason: z.string().optional(),
|
|
60
|
+
senderAccountId: z.string().optional(),
|
|
61
|
+
senderUserId: z.string().optional()
|
|
62
|
+
});
|
|
63
|
+
const recipientSummarySchema = docusignLooseObjectSchema({
|
|
64
|
+
recipientId: z.string().optional(),
|
|
65
|
+
recipientIdGuid: z.string().optional(),
|
|
66
|
+
email: z.string().optional(),
|
|
67
|
+
userName: z.string().optional(),
|
|
68
|
+
status: z.string().optional(),
|
|
69
|
+
routingOrder: z.string().optional()
|
|
70
|
+
});
|
|
71
|
+
const templateSummarySchema = docusignLooseObjectSchema({
|
|
72
|
+
templateId: z.string().optional(),
|
|
73
|
+
name: z.string().optional(),
|
|
74
|
+
description: z.string().optional()
|
|
75
|
+
});
|
|
76
|
+
const docusignConnectEnvelopeEventSchema = z.object({
|
|
77
|
+
event: z.enum(docusignEnvelopeEventNames),
|
|
78
|
+
apiVersion: z.string().optional(),
|
|
79
|
+
configurationId: z.union([z.string(), z.number()]).optional(),
|
|
80
|
+
generatedDateTime: z.string().optional(),
|
|
81
|
+
retryCount: z.union([z.string(), z.number()]).optional(),
|
|
82
|
+
uri: z.string().optional(),
|
|
83
|
+
data: docusignLooseObjectSchema({
|
|
84
|
+
accountId: z.string().optional(),
|
|
85
|
+
userId: z.string().optional(),
|
|
86
|
+
envelopeId: z.string().min(1),
|
|
87
|
+
envelopeSummary: envelopeSummarySchema.optional()
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
const docusignConnectRecipientEventSchema = z.object({
|
|
91
|
+
event: z.enum(docusignRecipientEventNames),
|
|
92
|
+
apiVersion: z.string().optional(),
|
|
93
|
+
configurationId: z.union([z.string(), z.number()]).optional(),
|
|
94
|
+
generatedDateTime: z.string().optional(),
|
|
95
|
+
retryCount: z.union([z.string(), z.number()]).optional(),
|
|
96
|
+
uri: z.string().optional(),
|
|
97
|
+
data: docusignLooseObjectSchema({
|
|
98
|
+
accountId: z.string().optional(),
|
|
99
|
+
userId: z.string().optional(),
|
|
100
|
+
envelopeId: z.string().min(1),
|
|
101
|
+
recipientId: z.string().optional(),
|
|
102
|
+
recipientIdGuid: z.string().optional(),
|
|
103
|
+
envelopeSummary: envelopeSummarySchema.optional(),
|
|
104
|
+
recipientSummary: recipientSummarySchema.optional()
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
const docusignConnectTemplateEventSchema = z.object({
|
|
108
|
+
event: z.enum(docusignTemplateEventNames),
|
|
109
|
+
apiVersion: z.string().optional(),
|
|
110
|
+
configurationId: z.union([z.string(), z.number()]).optional(),
|
|
111
|
+
generatedDateTime: z.string().optional(),
|
|
112
|
+
retryCount: z.union([z.string(), z.number()]).optional(),
|
|
113
|
+
uri: z.string().optional(),
|
|
114
|
+
data: docusignLooseObjectSchema({
|
|
115
|
+
accountId: z.string().optional(),
|
|
116
|
+
templateId: z.string().min(1),
|
|
117
|
+
templateSummary: templateSummarySchema.optional()
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* The root envelope that wraps every Connect delivery. We keep this loose so
|
|
122
|
+
* downstream `definitionFilter` can branch on `event` without failing parse
|
|
123
|
+
* when DocuSign adds a new event type — the specific per-event schemas above
|
|
124
|
+
* validate the narrowed shape inside each trigger.
|
|
125
|
+
*/
|
|
126
|
+
const docusignConnectEnvelopeSchema = z.object({
|
|
127
|
+
event: z.string().min(1),
|
|
128
|
+
apiVersion: z.string().optional(),
|
|
129
|
+
configurationId: z.union([z.string(), z.number()]).optional(),
|
|
130
|
+
generatedDateTime: z.string().optional(),
|
|
131
|
+
retryCount: z.union([z.string(), z.number()]).optional(),
|
|
132
|
+
uri: z.string().optional(),
|
|
133
|
+
data: docusignLooseObjectSchema({
|
|
134
|
+
accountId: z.string().optional(),
|
|
135
|
+
userId: z.string().optional(),
|
|
136
|
+
envelopeId: z.string().optional(),
|
|
137
|
+
recipientId: z.string().optional(),
|
|
138
|
+
templateId: z.string().optional(),
|
|
139
|
+
envelopeSummary: envelopeSummarySchema.optional(),
|
|
140
|
+
recipientSummary: recipientSummarySchema.optional(),
|
|
141
|
+
templateSummary: templateSummarySchema.optional()
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { docusignConnectEnvelopeEventSchema, docusignConnectEnvelopeSchema, docusignConnectEventNameSchema, docusignConnectEventNames, docusignConnectRecipientEventSchema, docusignConnectTemplateEventSchema, docusignEnvelopeEventNames, docusignRecipientEventNames, docusignTemplateEventNames };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as docusign } from "./integration-CmRztL9R.mjs";
|
|
2
|
+
import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
|
|
3
|
+
|
|
4
|
+
//#region src/factory.ts
|
|
5
|
+
const docusignOperation = createOfficialOperationFactory(docusign);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { docusignOperation as t };
|