@assinafy/sdk 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/README.en.md +6 -0
- package/README.md +7 -0
- package/SECURITY.md +4 -2
- package/dist/index.d.mts +351 -21
- package/dist/index.d.ts +351 -21
- package/dist/index.js +412 -26
- package/dist/index.mjs +411 -26
- package/docs/API_COVERAGE.md +18 -1
- package/docs/COMPATIBILITY.md +29 -5
- package/docs/README.en.md +99 -8
- package/docs/README.md +99 -8
- package/docs/RELEASING.md +5 -3
- package/package.json +12 -12
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -61,6 +61,24 @@ Older signer-self responses can omit `has_signature`, `has_initial`, and
|
|
|
61
61
|
`is_signature_reusable`; assignment signers can omit `notification_history`.
|
|
62
62
|
Those fields are optional in the SDK response types.
|
|
63
63
|
|
|
64
|
+
## Staging additions
|
|
65
|
+
|
|
66
|
+
Staging publishes 157 operations; production publishes 147. The additional
|
|
67
|
+
operations expose scheduled assignments/envelopes (`client.scheduledSends`),
|
|
68
|
+
document watchers, signer capacities, notification delivery/open history, and
|
|
69
|
+
envelope reminder estimates. They are marked **Covered (staging)** in the
|
|
70
|
+
coverage ledger. No method falls back to another environment.
|
|
71
|
+
|
|
72
|
+
Assignment creation and estimates also accept nullable `sign_as`; it is a
|
|
73
|
+
sender-stated certificate label, not an identity claim. Signature-image upload
|
|
74
|
+
accepts PNG and, on staging, JPEG. Plan prices are deployment-specific: use
|
|
75
|
+
cost estimates and pass `max_total_credits` when creating a signing request.
|
|
76
|
+
|
|
77
|
+
Run `ASSINAFY_CONTRACT_ENV=staging ASSINAFY_OPENAPI_URL=... bun run audit:api`
|
|
78
|
+
to validate the staging specification. OAuth discovery checks target the public
|
|
79
|
+
production and sandbox deployments.
|
|
80
|
+
Keep the selected deployment URL in local configuration.
|
|
81
|
+
|
|
64
82
|
## Contract lifecycle management (CLM)
|
|
65
83
|
|
|
66
84
|
Production exposes the six contract lifecycle operations under
|
|
@@ -96,9 +114,8 @@ not reinterpret either response or route a sandbox request to production.
|
|
|
96
114
|
Read operations remain available after a production plan lapses; writes are
|
|
97
115
|
plan-gated. Signed amendments wait and the lifecycle catches up after the plan
|
|
98
116
|
returns, as defined by the production integration guide.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
sandbox smoke tests does not verify either capability.
|
|
117
|
+
Staging publishes the six CLM operations and activity paging. Deployment
|
|
118
|
+
availability remains explicit: configure `baseUrl` for the environment being used.
|
|
102
119
|
|
|
103
120
|
`documents.details()` can expose `has_contract` only in a workspace context and
|
|
104
121
|
only when contract tracking is available. A missing key means unknown, not
|
|
@@ -383,14 +400,21 @@ embed frame then reports `session_expired`.
|
|
|
383
400
|
|
|
384
401
|
`DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
|
|
385
402
|
signer's `government_id`, and exactly one certificate signer in that signing
|
|
386
|
-
step.
|
|
387
|
-
|
|
403
|
+
step. Read the current cost estimate for verification and notification fees.
|
|
404
|
+
Notification methods are `Email`, `Whatsapp` or `Bypass`. It also requires
|
|
388
405
|
`method: virtual`: certificate completion completes a virtual item, while the
|
|
389
406
|
ordinary field-signing endpoint refuses certificate signers. The SDK rejects a
|
|
390
407
|
certificate/`collect` combination before assignment creation or cost
|
|
391
408
|
estimation with `ValidationError.errors.code` set to
|
|
392
409
|
`digital_certificate_requires_virtual_method`.
|
|
393
410
|
|
|
411
|
+
Both cost estimates apply the one-certificate-signer-per-step rule too, and
|
|
412
|
+
the API reads each signer's `step` there although the published estimate
|
|
413
|
+
schemas omit it; signers without a `step` share one step. The SDK forwards
|
|
414
|
+
`step` on assignment and template estimates, so send the creation steps when
|
|
415
|
+
estimating. Assignment estimates check the signing order locally, as creation
|
|
416
|
+
does.
|
|
417
|
+
|
|
394
418
|
Template role IDs do not reveal which entries are signers, editors or copy
|
|
395
419
|
receivers. The SDK validates each entry's channel and positive `step`, then
|
|
396
420
|
lets the API enforce role-aware signing order. The server derives the method:
|
package/docs/README.en.md
CHANGED
|
@@ -344,6 +344,95 @@ const client = AssinafyClient.fromConfig({
|
|
|
344
344
|
The configuration object accepted by `fromConfig` has the exported type
|
|
345
345
|
`ClientConfigInput`.
|
|
346
346
|
|
|
347
|
+
## Scheduled sends and document notifications (staging)
|
|
348
|
+
|
|
349
|
+
These operations require a deployment that publishes them. Configure its API
|
|
350
|
+
URL through `baseUrl`; the SDK never changes environments on a refusal.
|
|
351
|
+
|
|
352
|
+
```ts
|
|
353
|
+
const scheduled = await client.scheduledSends.createAssignment(document.id, {
|
|
354
|
+
method: 'virtual',
|
|
355
|
+
signers: [{ id: signer.id, sign_as: 'Witness', verification_method: 'Email',
|
|
356
|
+
notification_methods: ['Email'] }],
|
|
357
|
+
send_at: new Date(Date.now() + 86_400_000).toISOString(),
|
|
358
|
+
expires_at: null,
|
|
359
|
+
max_total_credits: 0,
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
The request is the ordinary assignment body plus `send_at`. Its response is:
|
|
364
|
+
|
|
365
|
+
```json
|
|
366
|
+
{
|
|
367
|
+
"resource": "scheduled_send", "id": "send-1", "type": "assignment",
|
|
368
|
+
"document_ids": ["doc-1"], "status": "pending",
|
|
369
|
+
"send_at": "2026-12-01T12:00:00Z", "assignment_id": null,
|
|
370
|
+
"envelope_id": null, "failure_reason": null,
|
|
371
|
+
"created_at": "2026-11-30T12:00:00Z", "processed_at": null
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
`send_at` accepts ISO date-time or Unix seconds, one hour to 90 days ahead.
|
|
376
|
+
An offset-free value means UTC. An expiration must be at least two hours after
|
|
377
|
+
the send time. Scheduling sends and charges nothing; execution rechecks the
|
|
378
|
+
request, plan and balance. The server checks due requests every five minutes.
|
|
379
|
+
`sign_as` records the sender's stated capacity on the certificate page only;
|
|
380
|
+
omitting it or sending `null` means `Sign`. It does not change verification.
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
const page = await client.scheduledSends.list({ document_id: document.id });
|
|
384
|
+
await client.scheduledSends.cancel(scheduled.id); // pending → cancelled
|
|
385
|
+
// Alternatively: await client.scheduledSends.sendNow(scheduled.id);
|
|
386
|
+
const envelopeSend = await client.scheduledSends.createEnvelope({
|
|
387
|
+
name: 'Agreement', signers: [{ id: signer.id }],
|
|
388
|
+
documents: [{ id: otherDocument.id, signer_ids: [signer.id] }],
|
|
389
|
+
send_at: new Date(Date.now() + 86_400_000).toISOString(),
|
|
390
|
+
max_total_credits: 0,
|
|
391
|
+
});
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
All five methods, including listing, require OAuth `documents:write`.
|
|
395
|
+
`list()` returns `{ data: IScheduledSend[], meta }`. Cancellation and immediate
|
|
396
|
+
dispatch return the same state object, with `processed_at` and the created
|
|
397
|
+
`assignment_id` or `envelope_id` when sent. A refused immediate dispatch leaves
|
|
398
|
+
the request pending; cancel it to stop its future attempt. A failed scheduled
|
|
399
|
+
execution records `failure_reason`. Mutations have no automatic retry or
|
|
400
|
+
idempotency key; read the state after a lost response before acting again.
|
|
401
|
+
|
|
402
|
+
```ts
|
|
403
|
+
await client.documents.setWatchers(document.id, [contact.id]);
|
|
404
|
+
const watchers = await client.documents.listWatchers(document.id);
|
|
405
|
+
await client.documents.setWatchers(document.id, []); // clear
|
|
406
|
+
const capacities = await client.assignments.getSignerCapacities(document.id);
|
|
407
|
+
const history = await client.assignments.getNotificationHistory(document.id);
|
|
408
|
+
const reminder = await client.envelopes.estimateResendCost(envelope.id, signer.id);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Watcher writes send `{ "watcher_ids": ["contact-1"] }`; reads and writes return
|
|
412
|
+
`ISigner[]`. Up to ten distinct workspace contacts with email receive terminal
|
|
413
|
+
notifications without a document link or attachment. Configure them before
|
|
414
|
+
sending or while the document is open. These routes require an API key or user
|
|
415
|
+
token; OAuth application tokens cannot manage watchers.
|
|
416
|
+
|
|
417
|
+
Capacities return `[{ "signer_id": "signer-1", "sign_as": "Witness" }]`.
|
|
418
|
+
Notification history returns one `{ signer_id, notification_history }` per
|
|
419
|
+
signer; each history entry contains `event`, `status`, nullable `error_code`,
|
|
420
|
+
`error_message`, `sent_at`, `failed_at`, `delivered_at` and `opened_at`. Times
|
|
421
|
+
are ISO strings or null. Opens may be mail scanners, not human reading.
|
|
422
|
+
Both reads require `documents:read` and return `[]` for an unsent document.
|
|
423
|
+
Reminder estimates require `documents:write` and return
|
|
424
|
+
`{ total, breakdown, credit_balance, has_sufficient_credits }` without sending
|
|
425
|
+
or checking the cooldown. See each method's JSDoc for full typed examples and
|
|
426
|
+
HTTP errors. Staging also accepts raw JPEG signature images using
|
|
427
|
+
`uploadSignature(code, bytes, { contentType: 'image/jpeg' })`; PNG remains the default.
|
|
428
|
+
|
|
429
|
+
Signer refusals expose `ApiError.code`: `SignerDataUnconfirmed`,
|
|
430
|
+
`EmailVerificationRequired`, `WhatsappVerificationRequired`,
|
|
431
|
+
`DigitalCertificateRequired` and `IdentityVerificationRequired` identify the
|
|
432
|
+
missing signing step. Complete that step through the appropriate signer flow.
|
|
433
|
+
Email token requests can return `429` during a two-minute cooldown; inspect
|
|
434
|
+
`error.rateLimit.retryAfter` and do not loop on the send operation.
|
|
435
|
+
|
|
347
436
|
## Endpoint coverage
|
|
348
437
|
|
|
349
438
|
All 147 operations documented at https://api.assinafy.com.br/v1/docs are
|
|
@@ -353,11 +442,12 @@ ledger is in [API_COVERAGE.md](API_COVERAGE.md).
|
|
|
353
442
|
|
|
354
443
|
| Resource | Endpoints |
|
|
355
444
|
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
356
|
-
| `client.documents` | list, **search**, upload, details, get, **rename**, activities, listActivities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress |
|
|
445
|
+
| `client.documents` | list, **search**, upload, details, get, **rename**, activities, listActivities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress, listWatchers, setWatchers |
|
|
357
446
|
| `client.signers` | create, get, list, update, delete, findByEmail |
|
|
358
|
-
| `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification
|
|
447
|
+
| `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification, getSignerCapacities, getNotificationHistory |
|
|
448
|
+
| `client.scheduledSends` | createAssignment, createEnvelope, list, cancel, sendNow |
|
|
359
449
|
| `client.contracts` | list, get, set, listRelated, renew, terminate |
|
|
360
|
-
| `client.envelopes` | list, get, create, estimateCost, update, delete, cancel, listActivities, download, addDocument, removeDocument, resendNotification |
|
|
450
|
+
| `client.envelopes` | list, get, create, estimateCost, update, delete, cancel, listActivities, download, addDocument, removeDocument, resendNotification, estimateResendCost |
|
|
361
451
|
| `client.embed` | listOrigins, addOrigin, updateOrigin, deleteOrigin, createSession |
|
|
362
452
|
| `client.templates` | create, list, get, update, delete, downloadPage |
|
|
363
453
|
| `client.tags` | list, create, update, delete |
|
|
@@ -935,7 +1025,7 @@ await client.signers.get(signerId);
|
|
|
935
1025
|
await client.signers.list({ page: 1, 'per-page': 50, search: 'signer' });
|
|
936
1026
|
await client.signers.update(signerId, {
|
|
937
1027
|
full_name: 'Updated Signer',
|
|
938
|
-
government_id: '390.533.447-05', //
|
|
1028
|
+
government_id: '390.533.447-05', // sent unchanged; the API normalizes formatting
|
|
939
1029
|
});
|
|
940
1030
|
await client.signers.delete(signerId);
|
|
941
1031
|
|
|
@@ -1042,7 +1132,7 @@ to `Email`.
|
|
|
1042
1132
|
| --- | --- | --- | --- |
|
|
1043
1133
|
| `Email` *(default)* | One-time code (OTP) by email | `Email` | Free |
|
|
1044
1134
|
| `Whatsapp` | One-time code (OTP) by WhatsApp | `Whatsapp` | 0.45 credit (the notification), paid plans only |
|
|
1045
|
-
| `DigitalCertificate` | The signer signs with their **own ICP-Brasil certificate — A1 or A3 —** through the Web PKI extension, producing a **qualified PAdES signature**; requires `method: 'virtual'` | `Email` **or** `Whatsapp` (or `Bypass`) |
|
|
1135
|
+
| `DigitalCertificate` | The signer signs with their **own ICP-Brasil certificate — A1 or A3 —** through the Web PKI extension, producing a **qualified PAdES signature**; requires `method: 'virtual'` | `Email` **or** `Whatsapp` (or `Bypass`) | Use the current estimate |
|
|
1046
1136
|
| `IdDocumentFaceMatchBasic` | Hosted identity-document, face and liveness verification | `Email` **or** `Whatsapp` (or `Bypass`) | Use `estimateCost()` |
|
|
1047
1137
|
| `Bypass` | No code: your app has already authenticated the signer. Enabled per account by Assinafy | `Email`, `Whatsapp` **or** `Bypass` (sends no invitation) | The notification |
|
|
1048
1138
|
|
|
@@ -1097,8 +1187,9 @@ forward them outside the signing flow.
|
|
|
1097
1187
|
|
|
1098
1188
|
`DigitalCertificate` requires `method: 'virtual'`, the account feature, a CPF
|
|
1099
1189
|
or CNPJ in the signer's `government_id`, and exactly one certificate signer in
|
|
1100
|
-
that signing step.
|
|
1101
|
-
|
|
1190
|
+
that signing step. Estimates take the same `step` as creation: with two or
|
|
1191
|
+
more certificate signers, give each its own step in both calls. The price depends on the workspace and deployment; call `estimateCost()`
|
|
1192
|
+
and use its `total_credits` as `max_total_credits` when creating the request. A certificate flow completes the signer's
|
|
1102
1193
|
virtual item; it cannot submit placed fields through the ordinary `collect`
|
|
1103
1194
|
signing endpoint.
|
|
1104
1195
|
|
|
@@ -1124,7 +1215,7 @@ const certificateSigner = await client.signers.update(signerId, {
|
|
|
1124
1215
|
|
|
1125
1216
|
const certificateCost = await client.assignments.estimateCost(documentId, {
|
|
1126
1217
|
method: 'virtual',
|
|
1127
|
-
signers: [{ verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
|
|
1218
|
+
signers: [{ step: 1, verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
|
|
1128
1219
|
});
|
|
1129
1220
|
|
|
1130
1221
|
await client.assignments.create(documentId, {
|
package/docs/README.md
CHANGED
|
@@ -327,6 +327,95 @@ const client = AssinafyClient.fromConfig({
|
|
|
327
327
|
|
|
328
328
|
O objeto aceito por `fromConfig` tem o tipo exportado `ClientConfigInput`.
|
|
329
329
|
|
|
330
|
+
## Agendamentos e notificações de documentos (staging)
|
|
331
|
+
|
|
332
|
+
Essas operações precisam estar disponíveis no ambiente configurado em
|
|
333
|
+
`baseUrl`. O SDK não muda de ambiente quando recebe uma recusa.
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
const agendamento = await client.scheduledSends.createAssignment(document.id, {
|
|
337
|
+
method: 'virtual',
|
|
338
|
+
signers: [{ id: signer.id, sign_as: 'Witness', verification_method: 'Email',
|
|
339
|
+
notification_methods: ['Email'] }],
|
|
340
|
+
send_at: new Date(Date.now() + 86_400_000).toISOString(),
|
|
341
|
+
expires_at: null,
|
|
342
|
+
max_total_credits: 0,
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
O corpo é o mesmo de criação do assignment, acrescido de `send_at`. Resposta:
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"resource": "scheduled_send", "id": "send-1", "type": "assignment",
|
|
351
|
+
"document_ids": ["doc-1"], "status": "pending",
|
|
352
|
+
"send_at": "2026-12-01T12:00:00Z", "assignment_id": null,
|
|
353
|
+
"envelope_id": null, "failure_reason": null,
|
|
354
|
+
"created_at": "2026-11-30T12:00:00Z", "processed_at": null
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
`send_at` aceita data/hora ISO ou segundos Unix, de uma hora a 90 dias no futuro.
|
|
359
|
+
Sem fuso explícito, vale UTC. A expiração deve ser pelo menos duas horas depois
|
|
360
|
+
do envio. Agendar não envia nem cobra; a execução valida novamente a solicitação,
|
|
361
|
+
o plano e o saldo. O servidor verifica agendamentos a cada cinco minutos.
|
|
362
|
+
`sign_as` indica a qualificação declarada pelo remetente apenas na página do
|
|
363
|
+
certificado; ausente ou `null` significa `Sign`. Não altera a verificação.
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
const pagina = await client.scheduledSends.list({ document_id: document.id });
|
|
367
|
+
await client.scheduledSends.cancel(agendamento.id); // pending → cancelled
|
|
368
|
+
// Alternativa: await client.scheduledSends.sendNow(agendamento.id);
|
|
369
|
+
const envelopeAgendado = await client.scheduledSends.createEnvelope({
|
|
370
|
+
name: 'Contrato', signers: [{ id: signer.id }],
|
|
371
|
+
documents: [{ id: otherDocument.id, signer_ids: [signer.id] }],
|
|
372
|
+
send_at: new Date(Date.now() + 86_400_000).toISOString(),
|
|
373
|
+
max_total_credits: 0,
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Os cinco métodos, inclusive a listagem, exigem OAuth `documents:write`.
|
|
378
|
+
`list()` retorna `{ data: IScheduledSend[], meta }`. Cancelamento e envio imediato
|
|
379
|
+
retornam o mesmo objeto de estado, com `processed_at` e `assignment_id` ou
|
|
380
|
+
`envelope_id` após o envio. Se o envio imediato for recusado, o agendamento
|
|
381
|
+
continua pendente: cancele-o para impedir a tentativa futura. Falhas na execução
|
|
382
|
+
agendada registram `failure_reason`. Não há repetição automática nem chave de
|
|
383
|
+
idempotência; após perder uma resposta, leia o estado antes de agir novamente.
|
|
384
|
+
|
|
385
|
+
```ts
|
|
386
|
+
await client.documents.setWatchers(document.id, [contact.id]);
|
|
387
|
+
const observadores = await client.documents.listWatchers(document.id);
|
|
388
|
+
await client.documents.setWatchers(document.id, []); // remover todos
|
|
389
|
+
const qualificacoes = await client.assignments.getSignerCapacities(document.id);
|
|
390
|
+
const historico = await client.assignments.getNotificationHistory(document.id);
|
|
391
|
+
const lembrete = await client.envelopes.estimateResendCost(envelope.id, signer.id);
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
A escrita de observadores envia `{ "watcher_ids": ["contact-1"] }`; leitura e
|
|
395
|
+
escrita retornam `ISigner[]`. Até dez contatos distintos do workspace, com email,
|
|
396
|
+
recebem avisos de encerramento sem link ou anexo. Configure antes do envio ou
|
|
397
|
+
enquanto o documento estiver aberto. Essas rotas exigem API key ou token de
|
|
398
|
+
usuário; tokens de aplicações OAuth não podem gerenciar observadores.
|
|
399
|
+
|
|
400
|
+
As qualificações retornam `[{ "signer_id": "signer-1", "sign_as": "Witness" }]`.
|
|
401
|
+
O histórico retorna `{ signer_id, notification_history }` por signatário; cada
|
|
402
|
+
entrada contém `event`, `status`, `error_code`, `error_message`, `sent_at`,
|
|
403
|
+
`failed_at`, `delivered_at` e `opened_at`. Erros e horários podem ser nulos;
|
|
404
|
+
horários presentes são ISO. Aberturas podem vir de filtros de email, não de
|
|
405
|
+
pessoas. Ambas as leituras exigem `documents:read` e retornam `[]` antes do envio.
|
|
406
|
+
Estimativas de lembrete exigem `documents:write` e retornam
|
|
407
|
+
`{ total, breakdown, credit_balance, has_sufficient_credits }`, sem envio nem
|
|
408
|
+
verificação do intervalo entre lembretes. O JSDoc de cada método inclui exemplos
|
|
409
|
+
tipados e erros HTTP. Staging também aceita assinaturas JPEG em
|
|
410
|
+
`uploadSignature(code, bytes, { contentType: 'image/jpeg' })`; PNG é o padrão.
|
|
411
|
+
|
|
412
|
+
Recusas de assinatura expõem `ApiError.code`: `SignerDataUnconfirmed`,
|
|
413
|
+
`EmailVerificationRequired`, `WhatsappVerificationRequired`,
|
|
414
|
+
`DigitalCertificateRequired` e `IdentityVerificationRequired` indicam a etapa
|
|
415
|
+
pendente. Complete-a pelo fluxo correspondente. Solicitações de token por email
|
|
416
|
+
podem retornar `429` durante dois minutos; consulte `error.rateLimit.retryAfter`
|
|
417
|
+
e não repita o envio em um laço.
|
|
418
|
+
|
|
330
419
|
## Cobertura de endpoints
|
|
331
420
|
|
|
332
421
|
As 147 operações documentadas em https://api.assinafy.com.br/v1/docs estão mapeadas: 146 têm métodos
|
|
@@ -336,11 +425,12 @@ no SDK, e a troca da sessão incorporada é reservada à página de embed da Ass
|
|
|
336
425
|
|
|
337
426
|
| Recurso | Endpoints |
|
|
338
427
|
| --- | --- |
|
|
339
|
-
| `client.documents` | list, search, upload, details, get, rename, activities, listActivities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress |
|
|
428
|
+
| `client.documents` | list, search, upload, details, get, rename, activities, listActivities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress, listWatchers, setWatchers |
|
|
340
429
|
| `client.signers` | create, get, list, update, delete, findByEmail |
|
|
341
|
-
| `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification |
|
|
430
|
+
| `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification, getSignerCapacities, getNotificationHistory |
|
|
431
|
+
| `client.scheduledSends` | createAssignment, createEnvelope, list, cancel, sendNow |
|
|
342
432
|
| `client.contracts` | list, get, set, listRelated, renew, terminate |
|
|
343
|
-
| `client.envelopes` | list, get, create, estimateCost, update, delete, cancel, listActivities, download, addDocument, removeDocument, resendNotification |
|
|
433
|
+
| `client.envelopes` | list, get, create, estimateCost, update, delete, cancel, listActivities, download, addDocument, removeDocument, resendNotification, estimateResendCost |
|
|
344
434
|
| `client.embed` | listOrigins, addOrigin, updateOrigin, deleteOrigin, createSession |
|
|
345
435
|
| `client.templates` | create, list, get, update, delete, downloadPage |
|
|
346
436
|
| `client.tags` | list, create, update, delete |
|
|
@@ -889,7 +979,7 @@ await client.signers.get(signerId);
|
|
|
889
979
|
await client.signers.list({ page: 1, 'per-page': 50, search: 'signatario' });
|
|
890
980
|
await client.signers.update(signerId, {
|
|
891
981
|
full_name: 'Signatário Atualizado',
|
|
892
|
-
government_id: '390.533.447-05', //
|
|
982
|
+
government_id: '390.533.447-05', // enviado como informado; a API normaliza a formatação
|
|
893
983
|
});
|
|
894
984
|
await client.signers.delete(signerId);
|
|
895
985
|
|
|
@@ -996,7 +1086,7 @@ que faltar é inferido. Sem nenhum dos dois, ambos assumem `Email`.
|
|
|
996
1086
|
| --- | --- | --- | --- |
|
|
997
1087
|
| `Email` *(padrão)* | Código de uso único (OTP) por e-mail | `Email` | Gratuito |
|
|
998
1088
|
| `Whatsapp` | Código de uso único (OTP) por WhatsApp | `Whatsapp` | 0,45 crédito (a notificação), só em planos pagos |
|
|
999
|
-
| `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada**; exige `method: 'virtual'` | `Email` **ou** `Whatsapp` (ou `Bypass`) |
|
|
1089
|
+
| `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada**; exige `method: 'virtual'` | `Email` **ou** `Whatsapp` (ou `Bypass`) | Consulte a estimativa atual |
|
|
1000
1090
|
| `IdDocumentFaceMatchBasic` | Documento de identidade, foto e prova de vida em sessão hospedada | `Email` **ou** `Whatsapp` (ou `Bypass`) | Consulte `estimateCost()` |
|
|
1001
1091
|
| `Bypass` | Sem código: seu app já autenticou o signatário. Habilitado por conta pela Assinafy | `Email`, `Whatsapp` **ou** `Bypass` (não envia convite) | A notificação |
|
|
1002
1092
|
|
|
@@ -1050,8 +1140,9 @@ nem encaminhe fora do fluxo de assinatura.
|
|
|
1050
1140
|
|
|
1051
1141
|
`DigitalCertificate` exige `method: 'virtual'`, o recurso **Certificado Digital** na conta (planos
|
|
1052
1142
|
Standard e Pro), CPF ou CNPJ em `government_id` do signatário, e exatamente **um signatário por
|
|
1053
|
-
certificado naquele passo de assinatura**.
|
|
1054
|
-
|
|
1143
|
+
certificado naquele passo de assinatura**. A estimativa recebe o mesmo `step` da criação: com dois
|
|
1144
|
+
ou mais signatários com certificado, dê a cada um o seu passo nas duas chamadas. O preço depende do workspace e do ambiente; consulte `estimateCost()` e envie
|
|
1145
|
+
o `total_credits` retornado como `max_total_credits` ao criar a solicitação. O fluxo por certificado conclui o item virtual do signatário; ele não consegue
|
|
1055
1146
|
enviar campos posicionados pelo endpoint comum de assinatura `collect`.
|
|
1056
1147
|
|
|
1057
1148
|
O SDK rejeita signatários por certificado em assignments `collect`, tanto em `create()` quanto em
|
|
@@ -1074,7 +1165,7 @@ const signatarioCertificado = await client.signers.update(signerId, {
|
|
|
1074
1165
|
|
|
1075
1166
|
const custoCertificado = await client.assignments.estimateCost(documentId, {
|
|
1076
1167
|
method: 'virtual',
|
|
1077
|
-
signers: [{ verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
|
|
1168
|
+
signers: [{ step: 1, verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
|
|
1078
1169
|
});
|
|
1079
1170
|
|
|
1080
1171
|
await client.assignments.create(documentId, {
|
package/docs/RELEASING.md
CHANGED
|
@@ -12,8 +12,8 @@ accept the package.
|
|
|
12
12
|
| --- | --- |
|
|
13
13
|
| Bun 1.4.4 | Locked install, tests, build, contract checks, and packaging |
|
|
14
14
|
| Node.js 22 | Minimum supported consumer runtime |
|
|
15
|
-
| Node.js 24 LTS |
|
|
16
|
-
| Node.js 26 LTS |
|
|
15
|
+
| Node.js 24 LTS | GitLab verification and consumer compatibility |
|
|
16
|
+
| Node.js 26 LTS | GitHub packaging, registry publishing and consumer compatibility |
|
|
17
17
|
|
|
18
18
|
Keep this table, `package.json`, GitLab CI, and the GitHub workflows synchronized
|
|
19
19
|
when changing runtime support.
|
|
@@ -74,7 +74,9 @@ deleting the same pattern to the mirror/release maintainers. Protect the GitHub
|
|
|
74
74
|
bun run audit:api
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
5. For API changes, run the sandbox smoke
|
|
77
|
+
5. For API changes, run the local sandbox smoke utility against a dedicated account.
|
|
78
|
+
The gitignored live-test utilities are supplied separately by maintainers;
|
|
79
|
+
the required `scripts/node-consumer-smoke.mjs` CI runner remains tracked.
|
|
78
80
|
Start read-only:
|
|
79
81
|
|
|
80
82
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assinafy/sdk",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"packageManager": "bun@1.4.4",
|
|
5
5
|
"description": "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
26
|
-
"test": "bun test",
|
|
27
|
-
"test:coverage": "bun test --coverage",
|
|
28
|
-
"lint": "eslint src
|
|
29
|
-
"lint:fix": "eslint src
|
|
26
|
+
"test": "bun test src tests/api-contract.test.ts",
|
|
27
|
+
"test:coverage": "bun test src tests/api-contract.test.ts --coverage",
|
|
28
|
+
"lint": "eslint src tests/api-contract.test.ts --max-warnings=0",
|
|
29
|
+
"lint:fix": "eslint src tests/api-contract.test.ts --fix",
|
|
30
30
|
"lint:pkg": "publint --strict && attw --pack .",
|
|
31
31
|
"audit": "bun audit",
|
|
32
|
-
"audit:api": "bun
|
|
32
|
+
"audit:api": "ASSINAFY_CONTRACT_CHECK=1 bun test tests/api-contract.test.ts",
|
|
33
33
|
"prepack": "bun run build",
|
|
34
34
|
"prepublishOnly": "bun run verify && bun run audit",
|
|
35
|
-
"typecheck": "bun ./node_modules/@typescript/native/bin/tsc --noEmit && bun ./node_modules/@typescript/native/bin/tsc --noEmit -p tsconfig.
|
|
35
|
+
"typecheck": "bun ./node_modules/@typescript/native/bin/tsc --noEmit && bun ./node_modules/@typescript/native/bin/tsc --noEmit -p tsconfig.tests.json",
|
|
36
36
|
"verify": "bun run typecheck && bun run lint && bun run test:coverage && bun run build && bun run lint:pkg"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
@@ -72,20 +72,20 @@
|
|
|
72
72
|
"@types/bun": "^1.4.4",
|
|
73
73
|
"@types/node": "^22.20.5",
|
|
74
74
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
75
|
-
"eslint": "^10.
|
|
75
|
+
"eslint": "^10.15.0",
|
|
76
76
|
"publint": "^0.3.25",
|
|
77
|
-
"tsup": "^
|
|
77
|
+
"tsup": "^9.0.0",
|
|
78
78
|
"typescript": "^6.0.3",
|
|
79
|
-
"typescript-eslint": "^8.72.
|
|
79
|
+
"typescript-eslint": "^8.72.2"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"axios": "^1.21.
|
|
82
|
+
"axios": "^1.21.1"
|
|
83
83
|
},
|
|
84
84
|
"overrides": {
|
|
85
85
|
"esbuild": "0.28.2",
|
|
86
86
|
"follow-redirects": "1.16.2",
|
|
87
87
|
"brace-expansion": "5.0.12",
|
|
88
|
-
"minimatch": "11.0.
|
|
88
|
+
"minimatch": "11.0.9"
|
|
89
89
|
},
|
|
90
90
|
"files": [
|
|
91
91
|
"dist",
|