@assinafy/sdk 2.5.0 → 2.5.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/CHANGELOG.md +47 -20
- package/README.en.md +58 -7
- package/README.md +4 -4
- package/dist/index.d.mts +133 -22
- package/dist/index.d.ts +133 -22
- package/dist/index.js +126 -34
- package/dist/index.mjs +126 -34
- package/docs/API_COVERAGE.md +11 -0
- package/docs/COMPATIBILITY.md +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,7 @@ interface IAssignment {
|
|
|
361
361
|
sender_email?: string;
|
|
362
362
|
method: AssignmentMethod;
|
|
363
363
|
expires_at?: string | null;
|
|
364
|
+
/** Compatibility extension; absent from the OpenAPI Assignment schema. */
|
|
364
365
|
expiration?: string;
|
|
365
366
|
message?: string | null;
|
|
366
367
|
signers: IAssignmentSigner[];
|
|
@@ -1099,6 +1100,7 @@ interface IWhatsAppNotification {
|
|
|
1099
1100
|
sent_at: number;
|
|
1100
1101
|
header: string;
|
|
1101
1102
|
body: string;
|
|
1103
|
+
/** Compatibility extension: the spec documents only `text`; `url` is retained for deployments that send link buttons. */
|
|
1102
1104
|
buttons: Array<{
|
|
1103
1105
|
text: string;
|
|
1104
1106
|
url?: string;
|
|
@@ -1604,8 +1606,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1604
1606
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1605
1607
|
* }
|
|
1606
1608
|
* ```
|
|
1607
|
-
* @throws {ValidationError} If `documentId` is missing
|
|
1608
|
-
* not one of the five documented artifact names.
|
|
1609
|
+
* @throws {ValidationError} If `documentId` is missing.
|
|
1609
1610
|
* @throws {ApiError} `404` if the document does not exist.
|
|
1610
1611
|
*
|
|
1611
1612
|
* @example
|
|
@@ -2133,7 +2134,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2133
2134
|
sendToken(documentId: string, email: string): Promise<void>;
|
|
2134
2135
|
sendToken(documentId: string, recipient: string, channel: SendTokenChannel): Promise<void>;
|
|
2135
2136
|
/**
|
|
2136
|
-
* Quick boolean check: has every signer
|
|
2137
|
+
* Quick boolean check (`GET /documents/{documentId}`): has every signer
|
|
2138
|
+
* completed their assignment?
|
|
2137
2139
|
*
|
|
2138
2140
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2139
2141
|
* /documents/{documentId}`). Returns `true` when the document status is
|
|
@@ -2155,7 +2157,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2155
2157
|
*/
|
|
2156
2158
|
isFullySigned(documentId: string): Promise<boolean>;
|
|
2157
2159
|
/**
|
|
2158
|
-
* Summarise signing progress for UI display
|
|
2160
|
+
* Summarise signing progress for UI display
|
|
2161
|
+
* (`GET /documents/{documentId}`).
|
|
2159
2162
|
*
|
|
2160
2163
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2161
2164
|
* /documents/{documentId}`). `total` and `signed` come from the assignment
|
|
@@ -2922,11 +2925,11 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2922
2925
|
* @param documentId - The document the assignment would be created on.
|
|
2923
2926
|
* @param payload - `method` plus channel-only signer descriptors and/or
|
|
2924
2927
|
* `collect`-mode `entries`. Create-only fields and signer IDs are not part
|
|
2925
|
-
* of this request schema.
|
|
2926
|
-
* `InsufficientDocuments`, or `InsufficientCredits`.
|
|
2928
|
+
* of this request schema.
|
|
2927
2929
|
* @returns an {@link ICostEstimate} with `total_credits`, balances, a
|
|
2928
|
-
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
2929
|
-
*
|
|
2930
|
+
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
2931
|
+
* `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
|
|
2932
|
+
* `InsufficientCredits`. Response shape:
|
|
2930
2933
|
* ```jsonc
|
|
2931
2934
|
* {
|
|
2932
2935
|
* "documents": 1,
|
|
@@ -3860,7 +3863,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3860
3863
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
3861
3864
|
* "user": {
|
|
3862
3865
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3863
|
-
* "name": "
|
|
3866
|
+
* "name": "Empresa Exemplo",
|
|
3864
3867
|
* "email": "user@example.com",
|
|
3865
3868
|
* "telephone": null,
|
|
3866
3869
|
* "government_id": "",
|
|
@@ -3872,7 +3875,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3872
3875
|
* "accounts": [
|
|
3873
3876
|
* {
|
|
3874
3877
|
* "id": "acc_example",
|
|
3875
|
-
* "name": "
|
|
3878
|
+
* "name": "Empresa Exemplo",
|
|
3876
3879
|
* "roles": ["Owner"],
|
|
3877
3880
|
* "is_delete_allowed": true,
|
|
3878
3881
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -3911,7 +3914,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3911
3914
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
3912
3915
|
* "user": {
|
|
3913
3916
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3914
|
-
* "name": "
|
|
3917
|
+
* "name": "Empresa Exemplo",
|
|
3915
3918
|
* "email": "user@example.com",
|
|
3916
3919
|
* "telephone": null,
|
|
3917
3920
|
* "government_id": "",
|
|
@@ -3923,7 +3926,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3923
3926
|
* "accounts": [
|
|
3924
3927
|
* {
|
|
3925
3928
|
* "id": "acc_example",
|
|
3926
|
-
* "name": "
|
|
3929
|
+
* "name": "Empresa Exemplo",
|
|
3927
3930
|
* "roles": ["Owner"],
|
|
3928
3931
|
* "is_delete_allowed": true,
|
|
3929
3932
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -4985,8 +4988,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4985
4988
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
4986
4989
|
* }
|
|
4987
4990
|
* ```
|
|
4988
|
-
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing
|
|
4989
|
-
* or a supplied `search` value is not a string.
|
|
4991
|
+
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
4990
4992
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
4991
4993
|
*
|
|
4992
4994
|
* @example
|
|
@@ -5056,7 +5058,29 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5056
5058
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
5057
5059
|
* @param search - Free-text term matched against the document name.
|
|
5058
5060
|
* @returns Matching documents for that signer, in the compact
|
|
5059
|
-
* {@link IDocumentListItem} shape, with pagination in `meta
|
|
5061
|
+
* {@link IDocumentListItem} shape, with pagination in `meta`:
|
|
5062
|
+
* ```jsonc
|
|
5063
|
+
* {
|
|
5064
|
+
* "data": [
|
|
5065
|
+
* {
|
|
5066
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
5067
|
+
* "account_id": "acc_example",
|
|
5068
|
+
* "template_id": null,
|
|
5069
|
+
* "name": "Service agreement.pdf",
|
|
5070
|
+
* "status": "pending_signature",
|
|
5071
|
+
* "artifacts": { "original": "https://...", "thumbnail": "https://..." },
|
|
5072
|
+
* "is_closed": false,
|
|
5073
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
5074
|
+
* "decline_reason": null,
|
|
5075
|
+
* "declined_by": null,
|
|
5076
|
+
* "tags": [],
|
|
5077
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
5078
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
5079
|
+
* }
|
|
5080
|
+
* ],
|
|
5081
|
+
* "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
|
|
5082
|
+
* }
|
|
5083
|
+
* ```
|
|
5060
5084
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
5061
5085
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
5062
5086
|
*
|
|
@@ -5274,7 +5298,17 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5274
5298
|
* @param payload - Any of the official `full_name`, `email`, or
|
|
5275
5299
|
* `government_id`, or `has_accepted_terms` fields. Fields left out are not
|
|
5276
5300
|
* sent.
|
|
5277
|
-
* @returns The confirmed signer in the full {@link ISigner} response shape
|
|
5301
|
+
* @returns The confirmed signer in the full {@link ISigner} response shape:
|
|
5302
|
+
* ```jsonc
|
|
5303
|
+
* {
|
|
5304
|
+
* "resource": "signer",
|
|
5305
|
+
* "id": "19e6b92e7895332ed9708535d8c",
|
|
5306
|
+
* "full_name": "Example Signer",
|
|
5307
|
+
* "email": "signer@example.com",
|
|
5308
|
+
* "whatsapp_phone_number": null,
|
|
5309
|
+
* "has_accepted_terms": true
|
|
5310
|
+
* }
|
|
5311
|
+
* ```
|
|
5278
5312
|
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
5279
5313
|
* or a supplied identity value is malformed.
|
|
5280
5314
|
* @throws {ApiError} If the access code is invalid/expired or a value fails
|
|
@@ -5379,7 +5413,48 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5379
5413
|
* @returns The document to sign, including its `assignment` (the
|
|
5380
5414
|
* {@link IAssignment} shape: `signers`, `items`, `summary`, `signing_urls`)
|
|
5381
5415
|
* from which the `itemId` / `fieldId` / `pageId` values for
|
|
5382
|
-
* {@link SignerDocumentsResource.sign} are read
|
|
5416
|
+
* {@link SignerDocumentsResource.sign} are read:
|
|
5417
|
+
* ```jsonc
|
|
5418
|
+
* {
|
|
5419
|
+
* "resource": "document",
|
|
5420
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
5421
|
+
* "account_id": "acc_example",
|
|
5422
|
+
* "template_id": null,
|
|
5423
|
+
* "name": "Service agreement.pdf",
|
|
5424
|
+
* "status": "pending_signature",
|
|
5425
|
+
* "artifacts": {
|
|
5426
|
+
* "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
|
|
5427
|
+
* "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
|
|
5428
|
+
* },
|
|
5429
|
+
* "is_closed": false,
|
|
5430
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
5431
|
+
* "decline_reason": null,
|
|
5432
|
+
* "declined_by": null,
|
|
5433
|
+
* "tags": [],
|
|
5434
|
+
* "assignment": {
|
|
5435
|
+
* "id": "1032c55c58bb00a8dc35db916751",
|
|
5436
|
+
* "method": "virtual",
|
|
5437
|
+
* "sender_email": "sender@example.com",
|
|
5438
|
+
* "expires_at": null,
|
|
5439
|
+
* "signers": [
|
|
5440
|
+
* { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
|
|
5441
|
+
* "full_name": "Example Signer", "notified": true, "completed": false }
|
|
5442
|
+
* ],
|
|
5443
|
+
* "items": [
|
|
5444
|
+
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
5445
|
+
* "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
|
|
5446
|
+
* "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
|
|
5447
|
+
* ],
|
|
5448
|
+
* "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
|
|
5449
|
+
* },
|
|
5450
|
+
* "pages": [
|
|
5451
|
+
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
5452
|
+
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
5453
|
+
* ],
|
|
5454
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
5455
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
5456
|
+
* }
|
|
5457
|
+
* ```
|
|
5383
5458
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
5384
5459
|
* @throws {ApiError} `400` when DigitalCertificate identity/terms are not
|
|
5385
5460
|
* confirmed; `401`/`403` if the access code is invalid or expired; `409`
|
|
@@ -5570,8 +5645,20 @@ declare class UserResource extends BaseResource {
|
|
|
5570
5645
|
* ```json
|
|
5571
5646
|
* { "DocumentCompleted": true, "SignerDeclined": false }
|
|
5572
5647
|
* ```
|
|
5573
|
-
* @returns The complete updated
|
|
5574
|
-
*
|
|
5648
|
+
* @returns The complete updated nine-key preference map:
|
|
5649
|
+
* ```json
|
|
5650
|
+
* {
|
|
5651
|
+
* "DocumentCompleted": true,
|
|
5652
|
+
* "SignerDeclined": false,
|
|
5653
|
+
* "DocumentCancelled": true,
|
|
5654
|
+
* "DocumentAboutToExpire": true,
|
|
5655
|
+
* "DocumentExpired": false,
|
|
5656
|
+
* "DocumentExpirationReset": true,
|
|
5657
|
+
* "DocumentProcessingFailed": true,
|
|
5658
|
+
* "TemplateProcessingFailed": true,
|
|
5659
|
+
* "SignerWhatsappFailed": true
|
|
5660
|
+
* }
|
|
5661
|
+
* ```
|
|
5575
5662
|
* @throws {ValidationError} Before requesting when the map is empty, has an
|
|
5576
5663
|
* unknown key, or contains a non-boolean value.
|
|
5577
5664
|
* @throws {ApiError} `400` if the API rejects the map, `401` for invalid
|
|
@@ -5878,7 +5965,10 @@ declare class AssinafyClient {
|
|
|
5878
5965
|
* the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
|
|
5879
5966
|
* enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
|
|
5880
5967
|
* timeout.
|
|
5881
|
-
* @throws {ApiError} If any underlying API call is rejected
|
|
5968
|
+
* @throws {ApiError} If any underlying API call is rejected — see the
|
|
5969
|
+
* `@throws` of {@link DocumentResource.upload}, {@link SignerResource.create},
|
|
5970
|
+
* {@link AssignmentResource.create}, and
|
|
5971
|
+
* {@link DocumentResource.waitUntilReady} for the per-step statuses.
|
|
5882
5972
|
*
|
|
5883
5973
|
* @example
|
|
5884
5974
|
* ```ts
|
|
@@ -5965,7 +6055,16 @@ interface IAuthenticateChallenge {
|
|
|
5965
6055
|
*
|
|
5966
6056
|
* @param value - Raw header value, or `undefined` when absent.
|
|
5967
6057
|
* @returns The parsed challenge, or `undefined` when there is no header or it
|
|
5968
|
-
* carries no scheme.
|
|
6058
|
+
* carries no scheme. Malformed input never throws; it yields `undefined` or a
|
|
6059
|
+
* scheme-only challenge.
|
|
6060
|
+
*
|
|
6061
|
+
* @example
|
|
6062
|
+
* ```ts
|
|
6063
|
+
* const challenge = parseWwwAuthenticate(
|
|
6064
|
+
* 'Bearer error="insufficient_scope", scope="documents:read"',
|
|
6065
|
+
* );
|
|
6066
|
+
* // → { scheme: 'Bearer', error: 'insufficient_scope', scope: 'documents:read' }
|
|
6067
|
+
* ```
|
|
5969
6068
|
*/
|
|
5970
6069
|
declare function parseWwwAuthenticate(value: string | undefined): IAuthenticateChallenge | undefined;
|
|
5971
6070
|
|
|
@@ -6033,7 +6132,9 @@ declare class ApiError extends AssinafyError {
|
|
|
6033
6132
|
* ones with no structured body to explain them. Anything else falls back to
|
|
6034
6133
|
* the stable message.
|
|
6035
6134
|
* @returns An `ApiError` retaining the original response body in
|
|
6036
|
-
* {@link ApiError.responseData}
|
|
6135
|
+
* {@link ApiError.responseData}. A JSON `message` is used verbatim; only an
|
|
6136
|
+
* unstructured text body is whitespace-collapsed and truncated for
|
|
6137
|
+
* legibility.
|
|
6037
6138
|
*
|
|
6038
6139
|
* @example
|
|
6039
6140
|
* ```ts
|
|
@@ -6093,6 +6194,16 @@ declare class OAuthError extends ApiError {
|
|
|
6093
6194
|
* @param error - Any thrown value.
|
|
6094
6195
|
* @returns An `OAuthError` when the body carries a non-empty string
|
|
6095
6196
|
* `error`, else the original value.
|
|
6197
|
+
*
|
|
6198
|
+
* @example
|
|
6199
|
+
* ```ts
|
|
6200
|
+
* const apiError = ApiError.fromResponse(400, {
|
|
6201
|
+
* error: 'invalid_grant',
|
|
6202
|
+
* error_description: 'The provided authorization grant is invalid.',
|
|
6203
|
+
* });
|
|
6204
|
+
* const upgraded = OAuthError.upgrade(apiError);
|
|
6205
|
+
* // upgraded instanceof OAuthError → true, .error → 'invalid_grant'
|
|
6206
|
+
* ```
|
|
6096
6207
|
*/
|
|
6097
6208
|
static upgrade(error: unknown): unknown;
|
|
6098
6209
|
}
|
package/dist/index.js
CHANGED
|
@@ -140,7 +140,9 @@ var ApiError = class _ApiError extends AssinafyError {
|
|
|
140
140
|
* ones with no structured body to explain them. Anything else falls back to
|
|
141
141
|
* the stable message.
|
|
142
142
|
* @returns An `ApiError` retaining the original response body in
|
|
143
|
-
* {@link ApiError.responseData}
|
|
143
|
+
* {@link ApiError.responseData}. A JSON `message` is used verbatim; only an
|
|
144
|
+
* unstructured text body is whitespace-collapsed and truncated for
|
|
145
|
+
* legibility.
|
|
144
146
|
*
|
|
145
147
|
* @example
|
|
146
148
|
* ```ts
|
|
@@ -193,6 +195,16 @@ var OAuthError = class _OAuthError extends ApiError {
|
|
|
193
195
|
* @param error - Any thrown value.
|
|
194
196
|
* @returns An `OAuthError` when the body carries a non-empty string
|
|
195
197
|
* `error`, else the original value.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const apiError = ApiError.fromResponse(400, {
|
|
202
|
+
* error: 'invalid_grant',
|
|
203
|
+
* error_description: 'The provided authorization grant is invalid.',
|
|
204
|
+
* });
|
|
205
|
+
* const upgraded = OAuthError.upgrade(apiError);
|
|
206
|
+
* // upgraded instanceof OAuthError → true, .error → 'invalid_grant'
|
|
207
|
+
* ```
|
|
196
208
|
*/
|
|
197
209
|
static upgrade(error) {
|
|
198
210
|
if (!(error instanceof ApiError) || error instanceof _OAuthError) return error;
|
|
@@ -634,7 +646,7 @@ var import_axios2 = __toESM(require("axios"));
|
|
|
634
646
|
// package.json
|
|
635
647
|
var package_default = {
|
|
636
648
|
name: "@assinafy/sdk",
|
|
637
|
-
version: "2.5.
|
|
649
|
+
version: "2.5.1",
|
|
638
650
|
packageManager: "bun@1.4.0",
|
|
639
651
|
description: "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
640
652
|
type: "commonjs",
|
|
@@ -1440,11 +1452,11 @@ var AssignmentResource = class extends BaseResource {
|
|
|
1440
1452
|
* @param documentId - The document the assignment would be created on.
|
|
1441
1453
|
* @param payload - `method` plus channel-only signer descriptors and/or
|
|
1442
1454
|
* `collect`-mode `entries`. Create-only fields and signer IDs are not part
|
|
1443
|
-
* of this request schema.
|
|
1444
|
-
* `InsufficientDocuments`, or `InsufficientCredits`.
|
|
1455
|
+
* of this request schema.
|
|
1445
1456
|
* @returns an {@link ICostEstimate} with `total_credits`, balances, a
|
|
1446
|
-
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
1447
|
-
*
|
|
1457
|
+
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
1458
|
+
* `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
|
|
1459
|
+
* `InsufficientCredits`. Response shape:
|
|
1448
1460
|
* ```jsonc
|
|
1449
1461
|
* {
|
|
1450
1462
|
* "documents": 1,
|
|
@@ -1997,8 +2009,7 @@ var DocumentResource = class extends BaseResource {
|
|
|
1997
2009
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1998
2010
|
* }
|
|
1999
2011
|
* ```
|
|
2000
|
-
* @throws {ValidationError} If `documentId` is missing
|
|
2001
|
-
* not one of the five documented artifact names.
|
|
2012
|
+
* @throws {ValidationError} If `documentId` is missing.
|
|
2002
2013
|
* @throws {ApiError} `404` if the document does not exist.
|
|
2003
2014
|
*
|
|
2004
2015
|
* @example
|
|
@@ -2718,7 +2729,8 @@ var DocumentResource = class extends BaseResource {
|
|
|
2718
2729
|
}
|
|
2719
2730
|
}
|
|
2720
2731
|
/**
|
|
2721
|
-
* Quick boolean check: has every signer
|
|
2732
|
+
* Quick boolean check (`GET /documents/{documentId}`): has every signer
|
|
2733
|
+
* completed their assignment?
|
|
2722
2734
|
*
|
|
2723
2735
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2724
2736
|
* /documents/{documentId}`). Returns `true` when the document status is
|
|
@@ -2748,7 +2760,8 @@ var DocumentResource = class extends BaseResource {
|
|
|
2748
2760
|
return false;
|
|
2749
2761
|
}
|
|
2750
2762
|
/**
|
|
2751
|
-
* Summarise signing progress for UI display
|
|
2763
|
+
* Summarise signing progress for UI display
|
|
2764
|
+
* (`GET /documents/{documentId}`).
|
|
2752
2765
|
*
|
|
2753
2766
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2754
2767
|
* /documents/{documentId}`). `total` and `signed` come from the assignment
|
|
@@ -3732,7 +3745,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
3732
3745
|
events: [...payload.events && payload.events.length > 0 ? payload.events : DEFAULT_WEBHOOK_EVENTS],
|
|
3733
3746
|
is_active: payload.is_active ?? true
|
|
3734
3747
|
};
|
|
3735
|
-
this.logger.info("Registering webhook"
|
|
3748
|
+
this.logger.info("Registering webhook");
|
|
3736
3749
|
return this.call(
|
|
3737
3750
|
"Failed to register webhook",
|
|
3738
3751
|
() => this.http.put(
|
|
@@ -4590,7 +4603,7 @@ var AuthenticationResource = class extends BaseResource {
|
|
|
4590
4603
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
4591
4604
|
* "user": {
|
|
4592
4605
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
4593
|
-
* "name": "
|
|
4606
|
+
* "name": "Empresa Exemplo",
|
|
4594
4607
|
* "email": "user@example.com",
|
|
4595
4608
|
* "telephone": null,
|
|
4596
4609
|
* "government_id": "",
|
|
@@ -4602,7 +4615,7 @@ var AuthenticationResource = class extends BaseResource {
|
|
|
4602
4615
|
* "accounts": [
|
|
4603
4616
|
* {
|
|
4604
4617
|
* "id": "acc_example",
|
|
4605
|
-
* "name": "
|
|
4618
|
+
* "name": "Empresa Exemplo",
|
|
4606
4619
|
* "roles": ["Owner"],
|
|
4607
4620
|
* "is_delete_allowed": true,
|
|
4608
4621
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -4648,7 +4661,7 @@ var AuthenticationResource = class extends BaseResource {
|
|
|
4648
4661
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
4649
4662
|
* "user": {
|
|
4650
4663
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
4651
|
-
* "name": "
|
|
4664
|
+
* "name": "Empresa Exemplo",
|
|
4652
4665
|
* "email": "user@example.com",
|
|
4653
4666
|
* "telephone": null,
|
|
4654
4667
|
* "government_id": "",
|
|
@@ -4660,7 +4673,7 @@ var AuthenticationResource = class extends BaseResource {
|
|
|
4660
4673
|
* "accounts": [
|
|
4661
4674
|
* {
|
|
4662
4675
|
* "id": "acc_example",
|
|
4663
|
-
* "name": "
|
|
4676
|
+
* "name": "Empresa Exemplo",
|
|
4664
4677
|
* "roles": ["Owner"],
|
|
4665
4678
|
* "is_delete_allowed": true,
|
|
4666
4679
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -6075,8 +6088,7 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6075
6088
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6076
6089
|
* }
|
|
6077
6090
|
* ```
|
|
6078
|
-
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing
|
|
6079
|
-
* or a supplied `search` value is not a string.
|
|
6091
|
+
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6080
6092
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
6081
6093
|
*
|
|
6082
6094
|
* @example
|
|
@@ -6164,7 +6176,29 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6164
6176
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6165
6177
|
* @param search - Free-text term matched against the document name.
|
|
6166
6178
|
* @returns Matching documents for that signer, in the compact
|
|
6167
|
-
* {@link IDocumentListItem} shape, with pagination in `meta
|
|
6179
|
+
* {@link IDocumentListItem} shape, with pagination in `meta`:
|
|
6180
|
+
* ```jsonc
|
|
6181
|
+
* {
|
|
6182
|
+
* "data": [
|
|
6183
|
+
* {
|
|
6184
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
6185
|
+
* "account_id": "acc_example",
|
|
6186
|
+
* "template_id": null,
|
|
6187
|
+
* "name": "Service agreement.pdf",
|
|
6188
|
+
* "status": "pending_signature",
|
|
6189
|
+
* "artifacts": { "original": "https://...", "thumbnail": "https://..." },
|
|
6190
|
+
* "is_closed": false,
|
|
6191
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
6192
|
+
* "decline_reason": null,
|
|
6193
|
+
* "declined_by": null,
|
|
6194
|
+
* "tags": [],
|
|
6195
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
6196
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6197
|
+
* }
|
|
6198
|
+
* ],
|
|
6199
|
+
* "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
|
|
6200
|
+
* }
|
|
6201
|
+
* ```
|
|
6168
6202
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6169
6203
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
6170
6204
|
*
|
|
@@ -6272,9 +6306,7 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6272
6306
|
* ```
|
|
6273
6307
|
*/
|
|
6274
6308
|
async signMultiple(documentIds, signerAccessCode) {
|
|
6275
|
-
|
|
6276
|
-
throw new ValidationError("documentIds must be a non-empty array of non-empty IDs");
|
|
6277
|
-
}
|
|
6309
|
+
assertDocumentIds(documentIds);
|
|
6278
6310
|
const code = this.requireId(signerAccessCode, "signer-access-code");
|
|
6279
6311
|
return this.callVoid(
|
|
6280
6312
|
"Failed to sign multiple documents",
|
|
@@ -6314,12 +6346,8 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6314
6346
|
* ```
|
|
6315
6347
|
*/
|
|
6316
6348
|
async declineMultiple(documentIds, declineReason, signerAccessCode) {
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
}
|
|
6320
|
-
if (typeof declineReason !== "string" || !declineReason.trim()) {
|
|
6321
|
-
throw new ValidationError("declineReason is required");
|
|
6322
|
-
}
|
|
6349
|
+
assertDocumentIds(documentIds);
|
|
6350
|
+
assertDeclineReason(declineReason);
|
|
6323
6351
|
const code = this.requireId(signerAccessCode, "signer-access-code");
|
|
6324
6352
|
return this.callVoid(
|
|
6325
6353
|
"Failed to decline multiple documents",
|
|
@@ -6550,7 +6578,48 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6550
6578
|
* @returns The document to sign, including its `assignment` (the
|
|
6551
6579
|
* {@link IAssignment} shape: `signers`, `items`, `summary`, `signing_urls`)
|
|
6552
6580
|
* from which the `itemId` / `fieldId` / `pageId` values for
|
|
6553
|
-
* {@link SignerDocumentsResource.sign} are read
|
|
6581
|
+
* {@link SignerDocumentsResource.sign} are read:
|
|
6582
|
+
* ```jsonc
|
|
6583
|
+
* {
|
|
6584
|
+
* "resource": "document",
|
|
6585
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
6586
|
+
* "account_id": "acc_example",
|
|
6587
|
+
* "template_id": null,
|
|
6588
|
+
* "name": "Service agreement.pdf",
|
|
6589
|
+
* "status": "pending_signature",
|
|
6590
|
+
* "artifacts": {
|
|
6591
|
+
* "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
|
|
6592
|
+
* "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
|
|
6593
|
+
* },
|
|
6594
|
+
* "is_closed": false,
|
|
6595
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
6596
|
+
* "decline_reason": null,
|
|
6597
|
+
* "declined_by": null,
|
|
6598
|
+
* "tags": [],
|
|
6599
|
+
* "assignment": {
|
|
6600
|
+
* "id": "1032c55c58bb00a8dc35db916751",
|
|
6601
|
+
* "method": "virtual",
|
|
6602
|
+
* "sender_email": "sender@example.com",
|
|
6603
|
+
* "expires_at": null,
|
|
6604
|
+
* "signers": [
|
|
6605
|
+
* { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
|
|
6606
|
+
* "full_name": "Example Signer", "notified": true, "completed": false }
|
|
6607
|
+
* ],
|
|
6608
|
+
* "items": [
|
|
6609
|
+
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
6610
|
+
* "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
|
|
6611
|
+
* "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
|
|
6612
|
+
* ],
|
|
6613
|
+
* "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
|
|
6614
|
+
* },
|
|
6615
|
+
* "pages": [
|
|
6616
|
+
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
6617
|
+
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
6618
|
+
* ],
|
|
6619
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
6620
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6621
|
+
* }
|
|
6622
|
+
* ```
|
|
6554
6623
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
6555
6624
|
* @throws {ApiError} `400` when DigitalCertificate identity/terms are not
|
|
6556
6625
|
* confirmed; `401`/`403` if the access code is invalid or expired; `409`
|
|
@@ -6672,9 +6741,7 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6672
6741
|
const did = this.requireId(documentId, "Document ID");
|
|
6673
6742
|
const aid = this.requireId(assignmentId, "Assignment ID");
|
|
6674
6743
|
const code = this.requireId(signerAccessCode, "signer-access-code");
|
|
6675
|
-
|
|
6676
|
-
throw new ValidationError("declineReason is required");
|
|
6677
|
-
}
|
|
6744
|
+
assertDeclineReason(declineReason);
|
|
6678
6745
|
return this.callVoid(
|
|
6679
6746
|
"Failed to decline assignment",
|
|
6680
6747
|
() => this.http.put(
|
|
@@ -6685,6 +6752,16 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
6685
6752
|
);
|
|
6686
6753
|
}
|
|
6687
6754
|
};
|
|
6755
|
+
function assertDocumentIds(documentIds) {
|
|
6756
|
+
if (!Array.isArray(documentIds) || documentIds.length === 0 || documentIds.some((id) => typeof id !== "string" || !id.trim())) {
|
|
6757
|
+
throw new ValidationError("documentIds must be a non-empty array of non-empty IDs");
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
function assertDeclineReason(declineReason) {
|
|
6761
|
+
if (typeof declineReason !== "string" || !declineReason.trim()) {
|
|
6762
|
+
throw new ValidationError("declineReason is required");
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6688
6765
|
function validateConfirmDataPayload(payload) {
|
|
6689
6766
|
for (const key of ["full_name", "government_id"]) {
|
|
6690
6767
|
if (payload[key] !== void 0 && typeof payload[key] !== "string") {
|
|
@@ -6830,8 +6907,20 @@ var UserResource = class extends BaseResource {
|
|
|
6830
6907
|
* ```json
|
|
6831
6908
|
* { "DocumentCompleted": true, "SignerDeclined": false }
|
|
6832
6909
|
* ```
|
|
6833
|
-
* @returns The complete updated
|
|
6834
|
-
*
|
|
6910
|
+
* @returns The complete updated nine-key preference map:
|
|
6911
|
+
* ```json
|
|
6912
|
+
* {
|
|
6913
|
+
* "DocumentCompleted": true,
|
|
6914
|
+
* "SignerDeclined": false,
|
|
6915
|
+
* "DocumentCancelled": true,
|
|
6916
|
+
* "DocumentAboutToExpire": true,
|
|
6917
|
+
* "DocumentExpired": false,
|
|
6918
|
+
* "DocumentExpirationReset": true,
|
|
6919
|
+
* "DocumentProcessingFailed": true,
|
|
6920
|
+
* "TemplateProcessingFailed": true,
|
|
6921
|
+
* "SignerWhatsappFailed": true
|
|
6922
|
+
* }
|
|
6923
|
+
* ```
|
|
6835
6924
|
* @throws {ValidationError} Before requesting when the map is empty, has an
|
|
6836
6925
|
* unknown key, or contains a non-boolean value.
|
|
6837
6926
|
* @throws {ApiError} `400` if the API rejects the map, `401` for invalid
|
|
@@ -7283,7 +7372,10 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
7283
7372
|
* the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
|
|
7284
7373
|
* enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
|
|
7285
7374
|
* timeout.
|
|
7286
|
-
* @throws {ApiError} If any underlying API call is rejected
|
|
7375
|
+
* @throws {ApiError} If any underlying API call is rejected — see the
|
|
7376
|
+
* `@throws` of {@link DocumentResource.upload}, {@link SignerResource.create},
|
|
7377
|
+
* {@link AssignmentResource.create}, and
|
|
7378
|
+
* {@link DocumentResource.waitUntilReady} for the per-step statuses.
|
|
7287
7379
|
*
|
|
7288
7380
|
* @example
|
|
7289
7381
|
* ```ts
|