instasign 1.1.3 → 1.1.5
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/CHANGELOG.md +7 -0
- package/README.md +9 -5
- package/dist/index.cjs +37 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -142
- package/dist/index.d.ts +214 -142
- package/dist/index.js +32 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/schema.d.ts +137 -119
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { WebhookEventType, WebhookPayloadMap } from './webhook.types.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -7,7 +6,7 @@ import { WebhookEventType, WebhookPayloadMap } from './webhook.types.js';
|
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
interface paths {
|
|
10
|
-
"/functions/envelope:add-sign-
|
|
9
|
+
"/functions/envelope:add-sign-requests": {
|
|
11
10
|
parameters: {
|
|
12
11
|
query?: never;
|
|
13
12
|
header?: never;
|
|
@@ -16,7 +15,7 @@ interface paths {
|
|
|
16
15
|
};
|
|
17
16
|
get?: never;
|
|
18
17
|
put?: never;
|
|
19
|
-
/** envelope:add-sign-
|
|
18
|
+
/** envelope:add-sign-requests */
|
|
20
19
|
post: {
|
|
21
20
|
parameters: {
|
|
22
21
|
query?: never;
|
|
@@ -28,12 +27,15 @@ interface paths {
|
|
|
28
27
|
content: {
|
|
29
28
|
"application/json": {
|
|
30
29
|
envelopeId: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
signRequests: {
|
|
31
|
+
filename: string;
|
|
32
|
+
base64File?: string;
|
|
33
|
+
fileUrl?: string;
|
|
34
|
+
metadata?: {
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
clientReferenceId?: string;
|
|
38
|
+
}[];
|
|
37
39
|
};
|
|
38
40
|
};
|
|
39
41
|
};
|
|
@@ -45,11 +47,7 @@ interface paths {
|
|
|
45
47
|
};
|
|
46
48
|
content: {
|
|
47
49
|
"application/json": {
|
|
48
|
-
result:
|
|
49
|
-
requestId: string;
|
|
50
|
-
signUrl: string;
|
|
51
|
-
envelopeSignUrl?: string;
|
|
52
|
-
};
|
|
50
|
+
result: components["schemas"]["EnvelopeAddSignRequestsResult"];
|
|
53
51
|
};
|
|
54
52
|
};
|
|
55
53
|
};
|
|
@@ -93,10 +91,7 @@ interface paths {
|
|
|
93
91
|
};
|
|
94
92
|
content: {
|
|
95
93
|
"application/json": {
|
|
96
|
-
result:
|
|
97
|
-
success: boolean;
|
|
98
|
-
message: string;
|
|
99
|
-
};
|
|
94
|
+
result: components["schemas"]["EnvelopeCompleteResult"];
|
|
100
95
|
};
|
|
101
96
|
};
|
|
102
97
|
};
|
|
@@ -147,9 +142,7 @@ interface paths {
|
|
|
147
142
|
};
|
|
148
143
|
content: {
|
|
149
144
|
"application/json": {
|
|
150
|
-
result:
|
|
151
|
-
envelopeId: string;
|
|
152
|
-
};
|
|
145
|
+
result: components["schemas"]["EnvelopeCreateResult"];
|
|
153
146
|
};
|
|
154
147
|
};
|
|
155
148
|
};
|
|
@@ -193,9 +186,7 @@ interface paths {
|
|
|
193
186
|
};
|
|
194
187
|
content: {
|
|
195
188
|
"application/json": {
|
|
196
|
-
result:
|
|
197
|
-
success: boolean;
|
|
198
|
-
};
|
|
189
|
+
result: components["schemas"]["EnvelopeDeleteResult"];
|
|
199
190
|
};
|
|
200
191
|
};
|
|
201
192
|
};
|
|
@@ -240,34 +231,7 @@ interface paths {
|
|
|
240
231
|
};
|
|
241
232
|
content: {
|
|
242
233
|
"application/json": {
|
|
243
|
-
result:
|
|
244
|
-
envelopeId: string;
|
|
245
|
-
name: string;
|
|
246
|
-
description?: string;
|
|
247
|
-
/** @enum {string} */
|
|
248
|
-
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
249
|
-
clientReferenceId?: string;
|
|
250
|
-
signRequestsCount: number;
|
|
251
|
-
signRequests: {
|
|
252
|
-
requestId: string;
|
|
253
|
-
/** @enum {string} */
|
|
254
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
255
|
-
fileName: string;
|
|
256
|
-
fileUrl: string;
|
|
257
|
-
signedFileUrl?: string;
|
|
258
|
-
metadata: {
|
|
259
|
-
[key: string]: unknown;
|
|
260
|
-
};
|
|
261
|
-
clientReferenceId?: string;
|
|
262
|
-
}[];
|
|
263
|
-
/** Format: date-time */
|
|
264
|
-
createdAt: string;
|
|
265
|
-
/** Format: date-time */
|
|
266
|
-
updatedAt: string;
|
|
267
|
-
/** Format: date-time */
|
|
268
|
-
expirationDate?: string;
|
|
269
|
-
signUrl?: string;
|
|
270
|
-
};
|
|
234
|
+
result: components["schemas"]["EnvelopeGetResult"];
|
|
271
235
|
};
|
|
272
236
|
};
|
|
273
237
|
};
|
|
@@ -324,34 +288,7 @@ interface paths {
|
|
|
324
288
|
};
|
|
325
289
|
content: {
|
|
326
290
|
"application/json": {
|
|
327
|
-
result:
|
|
328
|
-
envelopeId: string;
|
|
329
|
-
name: string;
|
|
330
|
-
description?: string;
|
|
331
|
-
/** @enum {string} */
|
|
332
|
-
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
333
|
-
clientReferenceId?: string;
|
|
334
|
-
signRequestsCount: number;
|
|
335
|
-
signRequests: {
|
|
336
|
-
requestId: string;
|
|
337
|
-
/** @enum {string} */
|
|
338
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
339
|
-
fileName: string;
|
|
340
|
-
fileUrl: string;
|
|
341
|
-
signedFileUrl?: string;
|
|
342
|
-
metadata: {
|
|
343
|
-
[key: string]: unknown;
|
|
344
|
-
};
|
|
345
|
-
clientReferenceId?: string;
|
|
346
|
-
}[];
|
|
347
|
-
/** Format: date-time */
|
|
348
|
-
createdAt: string;
|
|
349
|
-
/** Format: date-time */
|
|
350
|
-
updatedAt: string;
|
|
351
|
-
/** Format: date-time */
|
|
352
|
-
expirationDate?: string;
|
|
353
|
-
signUrl?: string;
|
|
354
|
-
}[];
|
|
291
|
+
result: components["schemas"]["EnvelopeListResult"][];
|
|
355
292
|
};
|
|
356
293
|
};
|
|
357
294
|
};
|
|
@@ -396,10 +333,7 @@ interface paths {
|
|
|
396
333
|
};
|
|
397
334
|
content: {
|
|
398
335
|
"application/json": {
|
|
399
|
-
result:
|
|
400
|
-
success: boolean;
|
|
401
|
-
message: string;
|
|
402
|
-
};
|
|
336
|
+
result: components["schemas"]["EnvelopeRemoveSignRequestResult"];
|
|
403
337
|
};
|
|
404
338
|
};
|
|
405
339
|
};
|
|
@@ -446,12 +380,7 @@ interface paths {
|
|
|
446
380
|
};
|
|
447
381
|
content: {
|
|
448
382
|
"application/json": {
|
|
449
|
-
result:
|
|
450
|
-
envelopeId: string;
|
|
451
|
-
metadata: {
|
|
452
|
-
[key: string]: unknown;
|
|
453
|
-
};
|
|
454
|
-
};
|
|
383
|
+
result: components["schemas"]["EnvelopeUpdateMetadataResult"];
|
|
455
384
|
};
|
|
456
385
|
};
|
|
457
386
|
};
|
|
@@ -496,9 +425,7 @@ interface paths {
|
|
|
496
425
|
};
|
|
497
426
|
content: {
|
|
498
427
|
"application/json": {
|
|
499
|
-
result:
|
|
500
|
-
signedFileUrl: string;
|
|
501
|
-
};
|
|
428
|
+
result: components["schemas"]["SignRequestCompleteResult"];
|
|
502
429
|
};
|
|
503
430
|
};
|
|
504
431
|
};
|
|
@@ -550,10 +477,7 @@ interface paths {
|
|
|
550
477
|
};
|
|
551
478
|
content: {
|
|
552
479
|
"application/json": {
|
|
553
|
-
result:
|
|
554
|
-
requestId: string;
|
|
555
|
-
signUrl: string;
|
|
556
|
-
};
|
|
480
|
+
result: components["schemas"]["SignRequestCreateResult"];
|
|
557
481
|
};
|
|
558
482
|
};
|
|
559
483
|
};
|
|
@@ -597,22 +521,7 @@ interface paths {
|
|
|
597
521
|
};
|
|
598
522
|
content: {
|
|
599
523
|
"application/json": {
|
|
600
|
-
result:
|
|
601
|
-
requestId: string;
|
|
602
|
-
/** @enum {string} */
|
|
603
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
604
|
-
fileName: string;
|
|
605
|
-
originalFile: string;
|
|
606
|
-
signedFile?: string;
|
|
607
|
-
metadata?: {
|
|
608
|
-
[key: string]: unknown;
|
|
609
|
-
};
|
|
610
|
-
clientReferenceId?: string;
|
|
611
|
-
/** Format: date-time */
|
|
612
|
-
createdAt: string;
|
|
613
|
-
/** Format: date-time */
|
|
614
|
-
updatedAt: string;
|
|
615
|
-
};
|
|
524
|
+
result: components["schemas"]["SignRequestGetResult"];
|
|
616
525
|
};
|
|
617
526
|
};
|
|
618
527
|
};
|
|
@@ -659,12 +568,7 @@ interface paths {
|
|
|
659
568
|
};
|
|
660
569
|
content: {
|
|
661
570
|
"application/json": {
|
|
662
|
-
result:
|
|
663
|
-
requestId: string;
|
|
664
|
-
metadata: {
|
|
665
|
-
[key: string]: unknown;
|
|
666
|
-
};
|
|
667
|
-
};
|
|
571
|
+
result: components["schemas"]["SignRequestUpdateMetadataResult"];
|
|
668
572
|
};
|
|
669
573
|
};
|
|
670
574
|
};
|
|
@@ -679,7 +583,120 @@ interface paths {
|
|
|
679
583
|
}
|
|
680
584
|
type webhooks = Record<string, never>;
|
|
681
585
|
interface components {
|
|
682
|
-
schemas:
|
|
586
|
+
schemas: {
|
|
587
|
+
EnvelopeAddSignRequestsResult: {
|
|
588
|
+
signRequests: {
|
|
589
|
+
requestId: string;
|
|
590
|
+
signUrl: string;
|
|
591
|
+
}[];
|
|
592
|
+
envelopeSignUrl?: string;
|
|
593
|
+
};
|
|
594
|
+
EnvelopeCompleteResult: {
|
|
595
|
+
success: boolean;
|
|
596
|
+
message: string;
|
|
597
|
+
};
|
|
598
|
+
EnvelopeCreateResult: {
|
|
599
|
+
envelopeId: string;
|
|
600
|
+
};
|
|
601
|
+
EnvelopeDeleteResult: {
|
|
602
|
+
success: boolean;
|
|
603
|
+
};
|
|
604
|
+
EnvelopeGetResult: {
|
|
605
|
+
envelopeId: string;
|
|
606
|
+
name: string;
|
|
607
|
+
description?: string;
|
|
608
|
+
/** @enum {string} */
|
|
609
|
+
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
610
|
+
clientReferenceId?: string;
|
|
611
|
+
signRequestsCount: number;
|
|
612
|
+
signRequests: {
|
|
613
|
+
requestId: string;
|
|
614
|
+
/** @enum {string} */
|
|
615
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
616
|
+
fileName: string;
|
|
617
|
+
fileUrl: string;
|
|
618
|
+
signedFileUrl?: string;
|
|
619
|
+
metadata: {
|
|
620
|
+
[key: string]: unknown;
|
|
621
|
+
};
|
|
622
|
+
clientReferenceId?: string;
|
|
623
|
+
}[];
|
|
624
|
+
/** Format: date-time */
|
|
625
|
+
createdAt: string;
|
|
626
|
+
/** Format: date-time */
|
|
627
|
+
updatedAt: string;
|
|
628
|
+
/** Format: date-time */
|
|
629
|
+
expirationDate?: string;
|
|
630
|
+
signUrl?: string;
|
|
631
|
+
};
|
|
632
|
+
EnvelopeListResult: {
|
|
633
|
+
envelopeId: string;
|
|
634
|
+
name: string;
|
|
635
|
+
description?: string;
|
|
636
|
+
/** @enum {string} */
|
|
637
|
+
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
638
|
+
clientReferenceId?: string;
|
|
639
|
+
signRequestsCount: number;
|
|
640
|
+
signRequests: {
|
|
641
|
+
requestId: string;
|
|
642
|
+
/** @enum {string} */
|
|
643
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
644
|
+
fileName: string;
|
|
645
|
+
fileUrl: string;
|
|
646
|
+
signedFileUrl?: string;
|
|
647
|
+
metadata: {
|
|
648
|
+
[key: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
clientReferenceId?: string;
|
|
651
|
+
}[];
|
|
652
|
+
/** Format: date-time */
|
|
653
|
+
createdAt: string;
|
|
654
|
+
/** Format: date-time */
|
|
655
|
+
updatedAt: string;
|
|
656
|
+
/** Format: date-time */
|
|
657
|
+
expirationDate?: string;
|
|
658
|
+
signUrl?: string;
|
|
659
|
+
};
|
|
660
|
+
EnvelopeRemoveSignRequestResult: {
|
|
661
|
+
success: boolean;
|
|
662
|
+
message: string;
|
|
663
|
+
};
|
|
664
|
+
EnvelopeUpdateMetadataResult: {
|
|
665
|
+
envelopeId: string;
|
|
666
|
+
metadata: {
|
|
667
|
+
[key: string]: unknown;
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
SignRequestCompleteResult: {
|
|
671
|
+
signedFileUrl: string;
|
|
672
|
+
};
|
|
673
|
+
SignRequestCreateResult: {
|
|
674
|
+
requestId: string;
|
|
675
|
+
signUrl: string;
|
|
676
|
+
};
|
|
677
|
+
SignRequestGetResult: {
|
|
678
|
+
requestId: string;
|
|
679
|
+
/** @enum {string} */
|
|
680
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
681
|
+
fileName: string;
|
|
682
|
+
originalFile: string;
|
|
683
|
+
signedFile?: string;
|
|
684
|
+
metadata?: {
|
|
685
|
+
[key: string]: unknown;
|
|
686
|
+
};
|
|
687
|
+
clientReferenceId?: string;
|
|
688
|
+
/** Format: date-time */
|
|
689
|
+
createdAt: string;
|
|
690
|
+
/** Format: date-time */
|
|
691
|
+
updatedAt: string;
|
|
692
|
+
};
|
|
693
|
+
SignRequestUpdateMetadataResult: {
|
|
694
|
+
requestId: string;
|
|
695
|
+
metadata: {
|
|
696
|
+
[key: string]: unknown;
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
};
|
|
683
700
|
responses: never;
|
|
684
701
|
parameters: never;
|
|
685
702
|
requestBodies: never;
|
|
@@ -689,6 +706,43 @@ interface components {
|
|
|
689
706
|
type $defs = Record<string, never>;
|
|
690
707
|
type operations = Record<string, never>;
|
|
691
708
|
|
|
709
|
+
declare const VALID_WEBHOOK_EVENT_TYPES: readonly ["envelope_created", "envelope_expired", "sign_request_created", "sign_request_signed", "sign_request_expired"];
|
|
710
|
+
type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];
|
|
711
|
+
type WebhookStatus = 'pending' | 'success' | 'error';
|
|
712
|
+
type WebhookPayloadMap = {
|
|
713
|
+
'envelope_created': {
|
|
714
|
+
envelopeId: string;
|
|
715
|
+
};
|
|
716
|
+
'envelope_expired': {
|
|
717
|
+
envelopeId: string;
|
|
718
|
+
};
|
|
719
|
+
'sign_request_created': {
|
|
720
|
+
requestId: string;
|
|
721
|
+
status: string;
|
|
722
|
+
envelopeId?: string;
|
|
723
|
+
};
|
|
724
|
+
'sign_request_signed': {
|
|
725
|
+
requestId: string;
|
|
726
|
+
status: string;
|
|
727
|
+
envelopeId?: string;
|
|
728
|
+
};
|
|
729
|
+
'sign_request_expired': {
|
|
730
|
+
requestId: string;
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
declare const VALID_SIGN_REQUEST_STATUSES: readonly ["pending", "completed", "canceled", "queued"];
|
|
734
|
+
type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];
|
|
735
|
+
declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "cancelled"];
|
|
736
|
+
type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];
|
|
737
|
+
type SignRequestMetadata = Record<string, unknown>;
|
|
738
|
+
type EnvelopeMetadata = Record<string, unknown>;
|
|
739
|
+
declare const VALID_ORDER_BY: readonly ["updatedAt", "createdAt"];
|
|
740
|
+
type OrderBy = (typeof VALID_ORDER_BY)[number];
|
|
741
|
+
declare const VALID_ORDER_DIRECTION: readonly ["asc", "desc"];
|
|
742
|
+
type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];
|
|
743
|
+
|
|
744
|
+
/** Extract a named component schema from the OpenAPI definition */
|
|
745
|
+
type SchemaResult<N extends keyof components['schemas']> = components['schemas'][N];
|
|
692
746
|
interface OperationResponse {
|
|
693
747
|
success?: boolean;
|
|
694
748
|
message?: string;
|
|
@@ -697,27 +751,45 @@ interface OperationResponse {
|
|
|
697
751
|
type ResponseResult<P extends keyof paths> = NonNullable<NonNullable<paths[P]['post']['responses']>[200]['content']>['application/json']['result'];
|
|
698
752
|
/** Extract the request body type from a Cloud Function */
|
|
699
753
|
type RequestBody<P extends keyof paths> = NonNullable<NonNullable<paths[P]['post']['requestBody']>['content']>['application/json'];
|
|
700
|
-
|
|
701
754
|
/** A full envelope with its sign requests */
|
|
702
|
-
|
|
755
|
+
interface Envelope extends SchemaResult<'EnvelopeGetResult'> {
|
|
756
|
+
}
|
|
703
757
|
/** Envelope as returned in a list */
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
758
|
+
interface EnvelopeListItem extends SchemaResult<'EnvelopeListResult'> {
|
|
759
|
+
}
|
|
760
|
+
interface CreateEnvelopeParams extends RequestBody<'/functions/envelope:create'> {
|
|
761
|
+
}
|
|
762
|
+
interface GetEnvelopesParams extends RequestBody<'/functions/envelope:list'> {
|
|
763
|
+
}
|
|
764
|
+
interface UpdateEnvelopeMetadataParams extends RequestBody<'/functions/envelope:update-metadata'> {
|
|
765
|
+
}
|
|
766
|
+
interface RemoveSignRequestFromEnvelopeParams extends RequestBody<'/functions/envelope:remove-sign-request'> {
|
|
767
|
+
}
|
|
768
|
+
interface AddSignRequestsToEnvelopeParams extends RequestBody<'/functions/envelope:add-sign-requests'> {
|
|
769
|
+
}
|
|
770
|
+
interface CreateEnvelopeResponse extends ResponseResult<'/functions/envelope:create'> {
|
|
771
|
+
}
|
|
772
|
+
interface UpdateEnvelopeMetadataResponse extends ResponseResult<'/functions/envelope:update-metadata'> {
|
|
773
|
+
}
|
|
774
|
+
interface AddSignRequestsToEnvelopeResponse extends ResponseResult<'/functions/envelope:add-sign-requests'> {
|
|
775
|
+
}
|
|
714
776
|
/** A single sign request */
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
777
|
+
interface SignRequest extends SchemaResult<'SignRequestGetResult'> {
|
|
778
|
+
}
|
|
779
|
+
interface CreateSignRequestParams extends RequestBody<'/functions/sign-request:create'> {
|
|
780
|
+
}
|
|
781
|
+
interface CompleteSignRequestParams extends RequestBody<'/functions/sign-request:complete'> {
|
|
782
|
+
}
|
|
783
|
+
interface GetFileFromRequestIdParams extends RequestBody<'/functions/sign-request:get'> {
|
|
784
|
+
}
|
|
785
|
+
interface UpdateSignRequestMetadataParams extends RequestBody<'/functions/sign-request:update-metadata'> {
|
|
786
|
+
}
|
|
787
|
+
interface CreateSignRequestResponse extends ResponseResult<'/functions/sign-request:create'> {
|
|
788
|
+
}
|
|
789
|
+
interface CompleteSignRequestResponse extends ResponseResult<'/functions/sign-request:complete'> {
|
|
790
|
+
}
|
|
791
|
+
interface UpdateSignRequestMetadataResponse extends ResponseResult<'/functions/sign-request:update-metadata'> {
|
|
792
|
+
}
|
|
721
793
|
type WebhookEvent = {
|
|
722
794
|
[T in WebhookEventType]: {
|
|
723
795
|
eventType: T;
|
|
@@ -769,11 +841,11 @@ declare class Envelopes {
|
|
|
769
841
|
/**
|
|
770
842
|
* Remove a sign request from an envelope
|
|
771
843
|
*/
|
|
772
|
-
|
|
844
|
+
remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined>;
|
|
773
845
|
/**
|
|
774
|
-
* Add
|
|
846
|
+
* Add sign requests to an envelope
|
|
775
847
|
*/
|
|
776
|
-
|
|
848
|
+
addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined>;
|
|
777
849
|
}
|
|
778
850
|
|
|
779
851
|
declare class SignRequests {
|
|
@@ -817,4 +889,4 @@ declare class Instasign {
|
|
|
817
889
|
constructor(config: IInstasignConfig);
|
|
818
890
|
}
|
|
819
891
|
|
|
820
|
-
export { type $defs, type
|
|
892
|
+
export { type $defs, type AddSignRequestsToEnvelopeParams, type AddSignRequestsToEnvelopeResponse, type CompleteSignRequestParams, type CompleteSignRequestResponse, type CreateEnvelopeParams, type CreateEnvelopeResponse, type CreateSignRequestParams, type CreateSignRequestResponse, type Envelope, type EnvelopeCreatedEvent, type EnvelopeExpiredEvent, type EnvelopeListItem, type EnvelopeMetadata, type EnvelopeStatus, Envelopes, type GetEnvelopesParams, type GetFileFromRequestIdParams, type IInstasignConfig, Instasign, type OperationResponse, type OrderBy, type OrderDirection, type RemoveSignRequestFromEnvelopeParams, type RequestBody, type ResponseResult, type SchemaResult, type SignRequest, type SignRequestCreatedEvent, type SignRequestExpiredEvent, type SignRequestMetadata, type SignRequestSignedEvent, type SignRequestStatus, SignRequests, type UpdateEnvelopeMetadataParams, type UpdateEnvelopeMetadataResponse, type UpdateSignRequestMetadataParams, type UpdateSignRequestMetadataResponse, VALID_ENVELOPE_STATUSES, VALID_ORDER_BY, VALID_ORDER_DIRECTION, VALID_SIGN_REQUEST_STATUSES, VALID_WEBHOOK_EVENT_TYPES, type WebhookEvent, type WebhookEventType, type WebhookPayloadMap, type WebhookStatus, Webhooks, type components, type operations, type paths, type webhooks };
|
package/dist/index.js
CHANGED
|
@@ -48,25 +48,17 @@ var Envelopes = class {
|
|
|
48
48
|
/**
|
|
49
49
|
* Remove a sign request from an envelope
|
|
50
50
|
*/
|
|
51
|
-
async
|
|
51
|
+
async remove(params) {
|
|
52
52
|
const response = await this.client.post("/functions/envelope:remove-sign-request", params);
|
|
53
53
|
return response.data.result;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Add
|
|
56
|
+
* Add sign requests to an envelope
|
|
57
57
|
*/
|
|
58
|
-
async
|
|
59
|
-
const response = await this.client.post("/functions/envelope:add-sign-
|
|
58
|
+
async addAll(params) {
|
|
59
|
+
const response = await this.client.post("/functions/envelope:add-sign-requests", params);
|
|
60
60
|
return response.data.result;
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Add multiple sign requests to an envelope
|
|
64
|
-
*/
|
|
65
|
-
// async addSignRequests(params: AddSignRequestToEnvelopeParams[]): Promise<AddSignRequestToEnvelopeResponse[] | undefined> {
|
|
66
|
-
// // TODO(ciro): must be implemented on back-end
|
|
67
|
-
// const response = await this.client.post('/functions/addMultipleSignRequestsToEnvelope', params);
|
|
68
|
-
// return response.data.result;
|
|
69
|
-
// }
|
|
70
62
|
};
|
|
71
63
|
|
|
72
64
|
// src/resources/SignRequests.ts
|
|
@@ -152,10 +144,38 @@ var Instasign = class {
|
|
|
152
144
|
this.webhooks = new Webhooks(config.webhookTolerance ?? 300);
|
|
153
145
|
}
|
|
154
146
|
};
|
|
147
|
+
|
|
148
|
+
// ../types/src/index.ts
|
|
149
|
+
var VALID_WEBHOOK_EVENT_TYPES = [
|
|
150
|
+
"envelope_created",
|
|
151
|
+
"envelope_expired",
|
|
152
|
+
"sign_request_created",
|
|
153
|
+
"sign_request_signed",
|
|
154
|
+
"sign_request_expired"
|
|
155
|
+
];
|
|
156
|
+
var VALID_SIGN_REQUEST_STATUSES = [
|
|
157
|
+
"pending",
|
|
158
|
+
"completed",
|
|
159
|
+
"canceled",
|
|
160
|
+
"queued"
|
|
161
|
+
];
|
|
162
|
+
var VALID_ENVELOPE_STATUSES = [
|
|
163
|
+
"pending",
|
|
164
|
+
"in-progress",
|
|
165
|
+
"completed",
|
|
166
|
+
"cancelled"
|
|
167
|
+
];
|
|
168
|
+
var VALID_ORDER_BY = ["updatedAt", "createdAt"];
|
|
169
|
+
var VALID_ORDER_DIRECTION = ["asc", "desc"];
|
|
155
170
|
export {
|
|
156
171
|
Envelopes,
|
|
157
172
|
Instasign,
|
|
158
173
|
SignRequests,
|
|
174
|
+
VALID_ENVELOPE_STATUSES,
|
|
175
|
+
VALID_ORDER_BY,
|
|
176
|
+
VALID_ORDER_DIRECTION,
|
|
177
|
+
VALID_SIGN_REQUEST_STATUSES,
|
|
178
|
+
VALID_WEBHOOK_EVENT_TYPES,
|
|
159
179
|
Webhooks
|
|
160
180
|
};
|
|
161
181
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestToEnvelopeParams,\n type AddSignRequestToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async removeSignRequest(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add a sign request to an envelope\n */\n async addSignRequest(params: AddSignRequestToEnvelopeParams): Promise<AddSignRequestToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add multiple sign requests to an envelope\n */\n // async addSignRequests(params: AddSignRequestToEnvelopeParams[]): Promise<AddSignRequestToEnvelopeResponse[] | undefined> {\n // // TODO(ciro): must be implemented on back-end\n // const response = await this.client.post('/functions/addMultipleSignRequestsToEnvelope', params);\n // return response.data.result;\n // }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n}\n\n"],"mappings":";AAcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA;AAAA;AAAA;AAAA,EAK7C,MAAM,OAAO,QAA2E;AACpF,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,8BAA8B,MAAM;AAC5E,WAAO,SAAS,KAAK;AAAA,EAC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iBAAiB;AAAA,IACjC;AAEA,QAAI,CAAC,SAAS;AACV,YAAM,IAAI,MAAM,mBAAmB;AAAA,IACvC;AAEA,WAAO,KAAK,MAAM,OAAO;AAAA,EAC7B;AACJ;;;ACxCA,OAAO,WAA8B;AAiB9B,IAAM,YAAN,MAAgB;AAAA,EACX;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,YAAY,QAA0B;AAClC,SAAK,SAAS,MAAM,OAAO;AAAA,MACvB,SAAS,OAAO;AAAA,MAChB,SAAS;AAAA,QACL,0BAA0B,OAAO;AAAA,QACjC,wBAAwB,OAAO;AAAA,QAC/B,aAAa,OAAO;AAAA,QACpB,gBAAgB;AAAA,MACpB;AAAA,IACJ,CAAC;AAED,SAAK,YAAY,IAAI,UAAU,KAAK,MAAM;AAC1C,SAAK,eAAe,IAAI,aAAa,KAAK,MAAM;AAChD,SAAK,WAAW,IAAI,SAAS,OAAO,oBAAoB,GAAG;AAAA,EAC/D;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts","../../types/src/index.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestsToEnvelopeParams,\n type AddSignRequestsToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add sign requests to an envelope\n */\n async addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-requests', params);\n return response.data.result;\n }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types.js';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n}\n\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\n 'sign_request_created',\n 'sign_request_signed',\n 'sign_request_expired',\n] as const;\n\nexport type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];\n\nexport type WebhookStatus = 'pending' | 'success' | 'error';\n\nexport type WebhookPayloadMap = {\n 'envelope_created': { envelopeId: string };\n 'envelope_expired': { envelopeId: string };\n 'sign_request_created': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_signed': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_expired': { requestId: string };\n};\n\nexport const VALID_SIGN_REQUEST_STATUSES = [\n 'pending',\n 'completed',\n 'canceled',\n 'queued',\n] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'cancelled',\n] as const;\n\nexport type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];\n\nexport type SignRequestMetadata = Record<string, unknown>;\nexport type EnvelopeMetadata = Record<string, unknown>;\n\nexport const VALID_ORDER_BY = ['updatedAt', 'createdAt'] as const;\nexport type OrderBy = (typeof VALID_ORDER_BY)[number];\n\nexport const VALID_ORDER_DIRECTION = ['asc', 'desc'] as const;\nexport type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];\n"],"mappings":";AAcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA;AAAA;AAAA;AAAA,EAK7C,MAAM,OAAO,QAA2E;AACpF,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,8BAA8B,MAAM;AAC5E,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,SAA6B,CAAC,GAAoC;AACzE,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK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