@assinafy/cli 2.7.1 → 2.8.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.
Files changed (52) hide show
  1. package/.env.example +2 -0
  2. package/README.en.md +14 -8
  3. package/README.md +11 -3
  4. package/dist/api.cjs +517 -61
  5. package/dist/api.cjs.map +1 -1
  6. package/dist/api.js +514 -61
  7. package/dist/api.js.map +1 -1
  8. package/dist/cli.cjs +1009 -169
  9. package/dist/types/api/client.d.ts +5 -0
  10. package/dist/types/api/client.d.ts.map +1 -1
  11. package/dist/types/api/envelope-types.d.ts +73 -0
  12. package/dist/types/api/envelope-types.d.ts.map +1 -0
  13. package/dist/types/api/index.d.ts +3 -0
  14. package/dist/types/api/index.d.ts.map +1 -1
  15. package/dist/types/api/resources/assignments.d.ts.map +1 -1
  16. package/dist/types/api/resources/contracts.d.ts +3 -1
  17. package/dist/types/api/resources/contracts.d.ts.map +1 -1
  18. package/dist/types/api/resources/documents.d.ts +21 -6
  19. package/dist/types/api/resources/documents.d.ts.map +1 -1
  20. package/dist/types/api/resources/embed.d.ts +14 -0
  21. package/dist/types/api/resources/embed.d.ts.map +1 -0
  22. package/dist/types/api/resources/envelopes.d.ts +31 -0
  23. package/dist/types/api/resources/envelopes.d.ts.map +1 -0
  24. package/dist/types/api/resources/signer-documents.d.ts +23 -11
  25. package/dist/types/api/resources/signer-documents.d.ts.map +1 -1
  26. package/dist/types/api/resources/signers.d.ts +1 -1
  27. package/dist/types/api/resources/signers.d.ts.map +1 -1
  28. package/dist/types/api/resources/users.d.ts +3 -1
  29. package/dist/types/api/resources/users.d.ts.map +1 -1
  30. package/dist/types/api/resources/webhooks.d.ts +6 -2
  31. package/dist/types/api/resources/webhooks.d.ts.map +1 -1
  32. package/dist/types/api/resources/workspaces.d.ts +9 -2
  33. package/dist/types/api/resources/workspaces.d.ts.map +1 -1
  34. package/dist/types/api/types.d.ts +103 -7
  35. package/dist/types/api/types.d.ts.map +1 -1
  36. package/dist/types/api/utils.d.ts +6 -0
  37. package/dist/types/api/utils.d.ts.map +1 -1
  38. package/docs/README.md +3 -1
  39. package/docs/api-operations.json +234 -2
  40. package/docs/api-reference.md +11533 -3716
  41. package/docs/assignments.md +16 -14
  42. package/docs/contracts.md +4 -3
  43. package/docs/documents.md +44 -27
  44. package/docs/embed.md +119 -0
  45. package/docs/envelopes.md +210 -0
  46. package/docs/sdk-reference.md +215 -29
  47. package/docs/send.md +15 -11
  48. package/docs/signer.md +84 -3
  49. package/docs/users.md +41 -0
  50. package/docs/webhooks.md +22 -6
  51. package/docs/workspaces.md +66 -3
  52. package/package.json +1 -1
package/.env.example CHANGED
@@ -32,6 +32,8 @@ ASSINAFY_RESET_TOKEN=
32
32
  ASSINAFY_SIGNER_ACCESS_CODE=
33
33
  ASSINAFY_VERIFICATION_CODE=
34
34
  ASSINAFY_CERTIFICATE_TOKEN=
35
+ ASSINAFY_EMBED_SESSION_TOKEN=
36
+ ASSINAFY_DOWNLOAD_TOKEN=
35
37
  ASSINAFY_MFA_CODE=
36
38
  ASSINAFY_MFA_TOKEN=
37
39
 
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  The official command-line interface and Node.js SDK for the [Assinafy API](https://api.assinafy.com.br/v1/docs), a Brazilian digital-signature platform. Upload PDFs, manage signers, request signatures, track activity history, and download certified documents — from a terminal, a shell script, or an application.
6
6
 
7
- The CLI is a single self-contained executable. It prints human-readable tables by default and structured JSON with `--json`, so the same commands serve both interactive use and automation. The same package exposes a fully typed SDK at `@assinafy/cli/api` covering all 118 published API operations.
7
+ The CLI is a single self-contained executable. It prints human-readable tables by default and structured JSON with `--json`, so the same commands serve both interactive use and automation. The same package exposes a fully typed SDK at `@assinafy/cli/api` covering all 147 published API operations.
8
8
 
9
9
  This document reads top to bottom: install, authenticate, send your first signature request, then understand the model well enough to automate it. The [command reference](#command-reference) and [SDK](#nodejs-sdk) sections near the end are lookup tables you can jump to once the flow makes sense.
10
10
 
@@ -281,11 +281,17 @@ assinafy signer sign <documentId> <assignmentId> --entries '[]'
281
281
 
282
282
  Single-document confirmation, signing, and decline commands verify that the access code matches the requested document and assignment before writing.
283
283
 
284
- Owner API credentials are stripped from every public and signer-side request, so an access-code flow can never leak your workspace key. The published signer artifact download is public; passing `--access-code` adds an identity preflight that confirms the code belongs to the signer being downloaded for.
284
+ Owner API credentials are stripped from every public and signer-side request, so an access-code flow can never leak your workspace key. Original signer downloads require `--access-code`; completed copies use `signer download-copy` with `ASSINAFY_DOWNLOAD_TOKEN`. Legacy artifact call forms remain available, subject to server restrictions.
285
+
286
+ ## Envelopes and embedded signing
287
+
288
+ Use `envelopes estimate-cost|create` after uploading and processing up to 20 documents. Creation accepts an idempotency key and credit ceiling. Documents retain their own assignments and certificates. `embed origins` manages exact application origins, and `embed session` mints a private single-use iframe URL for an embedded Email/Whatsapp signer. Owner credentials stay on the backend. See [complete envelope and iframe flows](docs/sdk-reference.md#envelopes-clientenvelopes).
289
+
290
+ `workspaces usage` reads plan/balances, `workspaces notification-policy` controls workspace alerts, and `users push-preferences` controls mobile push preferences. `signer certified-copy` sends a fresh certified-copy link to the original signing contact. All request/response contracts are in the [SDK reference](docs/sdk-reference.md).
285
291
 
286
292
  ## Contract tracking (CLM)
287
293
 
288
- Contract tracking records counterparty, value, dates, renewal settings and signed amendments on an existing document. Upload and signing remain separate. Writes need a plan with contract tracking; reads remain available when that plan lapses. OAuth uses `documents:read` and `documents:write`.
294
+ Contract tracking records counterparty, value, dates, renewal settings and signed amendments on an existing document. Upload and signing remain separate. Contract tracking is included in every standard plan, including Free; writes require the feature to be active; reads remain available when that plan lapses. OAuth uses `documents:read` and `documents:write`.
289
295
 
290
296
  Upload the document and persist its ID first. Set draft terms, activate them when lifecycle tracking should begin, and use separate uploaded documents for signed amendments. An amendment's delta applies after certification, in signing order.
291
297
 
@@ -330,7 +336,7 @@ assinafy webhooks retry <dispatchId> # redeliver one event
330
336
  assinafy webhooks verify body.json --id <webhook-id> --timestamp <webhook-timestamp> --signature <webhook-signature>
331
337
  ```
332
338
 
333
- Omitting `--events` subscribes to `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document`, and `document_processing_failed`. `endpoints update` changes only the flags given (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); disabling signing discards the secret. `rotate-secret` invalidates the previous secret immediately. A duplicate URL within the workspace returns `400`; creating past the plan limit returns `403`. OAuth applications cannot read an existing signing secret; `webhooks:write` permits rotation and returns the new secret. Enabling signing on an existing endpoint also returns the new secret once. New or changed webhook URLs require HTTPS. `retry` re-sends only to that delivery's endpoint, and only while it is active.
339
+ Omitting `--events` subscribes to `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document`, and `document_processing_failed`. `endpoints update` changes only the flags given (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); disabling signing discards the secret. `rotate-secret` invalidates the previous secret immediately unless `--keep-previous` requests a 24-hour overlap. A duplicate URL within the workspace returns `400`; creating past the plan limit returns `403`. OAuth applications cannot read an existing signing secret; `webhooks:write` permits rotation and returns the new secret. Enabling signing on an existing endpoint also returns the new secret once. New or changed webhook URLs require HTTPS. `retry` re-sends only to that delivery's endpoint, and only while it is active.
334
340
 
335
341
  Creating a signed endpoint returns `secret` once, including through OAuth; store it securely. The CLI prints it in human and JSON output. OAuth applications that lose it can rotate the secret with `webhooks:write` and store the new value. `endpoints list --url <url>` filters by the exact registered URL; `endpoints delete-by-url --url <url>` deletes by that URL and requires confirmation or `--yes`.
336
342
 
@@ -444,7 +450,7 @@ Assinafy runs a **separate sandbox** at `https://sandbox.assinafy.com.br/v1`. It
444
450
 
445
451
  ## Command reference
446
452
 
447
- Run `assinafy <command> --help` for the full flags of any command. Every command's help output is mirrored under [`docs/`](./docs), the [API reference](./docs/api-reference.md) holds the official request/response payloads for all 118 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
453
+ Run `assinafy <command> --help` for the full flags of any command. Every command's help output is mirrored under [`docs/`](./docs), the [API reference](./docs/api-reference.md) holds the official request/response payloads for all 147 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
448
454
 
449
455
  Global flags accepted by every command: `--api-key`, `--token`, `--account-id`, `--base-url`, `-p, --profile`, `--json`, `-q, --quiet`. `assinafy -v` prints the version.
450
456
 
@@ -549,7 +555,7 @@ Field definitions are what `--method collect` assignments gather. Run `fields ty
549
555
 
550
556
  `document <signerId>` · `documents <signerId>` · `search <signerId> <query>` · `download <signerId> <documentId> <artifact>` · `self` · `accept-terms` · `verify-code --code` (alias `verify-email`) · `certificate-start` · `certificate-complete --certificate-token` · `confirm-data <documentId>` · `upload-signature --file` · `download-signature` · `assignment` · `sign <documentId> <assignmentId> --entries` · `decline <documentId> <assignmentId> --reason` · `sign-multiple --document-ids` · `decline-multiple --document-ids --reason`
551
557
 
552
- `documents` and `search` use owner authentication when `--access-code` is omitted. The public artifact `download` accepts it optionally for an identity preflight. Other signer commands require `--access-code <code>`. Use `ASSINAFY_SIGNER_ACCESS_CODE` to keep the code out of process arguments.
558
+ `documents` and `search` use owner authentication when `--access-code` is omitted. The original-artifact `download` requires it on the current API, although the optional CLI flag remains for compatibility. Certified copies use `download-copy` and a private download token. Other signer commands require `--access-code <code>`. Use `ASSINAFY_SIGNER_ACCESS_CODE` to keep the code out of process arguments.
553
559
 
554
560
  ### `auth`
555
561
 
@@ -647,9 +653,9 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
647
653
 
648
654
  ## Contract boundaries
649
655
 
650
- - The production OpenAPI publishes 118 operations and the SDK implements all of them. Sandbox deployments can lag individual routes — account/user statistics and user notification preferences may return route-level 404s there despite being documented in production.
656
+ - The production OpenAPI publishes 147 operations and the SDK implements all of them. Sandbox deployments can lag individual routes — account/user statistics and user notification preferences may return route-level 404s there despite being documented in production.
651
657
  - The SDK keeps two platform-compatible template routes (`GET /accounts/{id}/templates/{id}` and its page download) that are absent from the published OpenAPI paths.
652
- - Certificate start/complete are deployed production extensions of the public signing frontend, exposed as `signerDocuments.startCertificate(accessCode)` and `signerDocuments.completeCertificate(accessCode, token)`. Start posts `{ "signer-access-code": code }` and returns `{ token }`; complete posts `{ "signer-access-code": code, token }` and returns `{ signerName }`. Both also carry the access code in the query string and strip owner credentials. They supplement, but are not part of, the 118 OpenAPI operations.
658
+ - Certificate start/complete are deployed production extensions of the public signing frontend, exposed as `signerDocuments.startCertificate(accessCode)` and `signerDocuments.completeCertificate(accessCode, token)`. Start posts `{ "signer-access-code": code }` and returns `{ token }`; complete posts `{ "signer-access-code": code, token }` and returns `{ signerName }`. Both also carry the access code in the query string and strip owner credentials. They supplement, but are not part of, the 147 OpenAPI operations.
653
659
  - `send-token` sends the email-only body `{ "channel": "email", "recipient": "..." }`; WhatsApp and the older `{ "email" }` body are rejected by the API with `400`.
654
660
  - `signer documents` and `signer search` accept the workspace API key or token when `--access-code` is omitted.
655
661
  - Webhook signatures follow Standard Webhooks; `WebhookVerifier.verifyDelivery` implements the published scheme. The older `verify(body, signature)` method is deprecated and does not match Assinafy deliveries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  *Português · [Read in English](README.en.md)*
4
4
 
5
- CLI e SDK TypeScript para as 118 operações publicadas da [API Assinafy](https://api.assinafy.com.br/v1/docs): documentos, signatários, assinaturas, templates, contratos, OAuth e webhooks.
5
+ CLI e SDK TypeScript para as 147 operações publicadas da [API Assinafy](https://api.assinafy.com.br/v1/docs): documentos, signatários, assinaturas, templates, contratos, envelopes, assinatura incorporada, OAuth e webhooks.
6
6
 
7
7
  ## Instalação
8
8
 
@@ -73,7 +73,7 @@ O PDF deve ser não vazio e ter no máximo 25 MiB. Persista o ID antes de aguard
73
73
  ```bash
74
74
  assinafy assignments estimate-cost "$DOCUMENT_ID" --signer-ids "$SIGNER_ID" --json
75
75
  assinafy assignments create "$DOCUMENT_ID" \
76
- --signer-ids "$SIGNER_ID" --message 'Revise e assine' --json
76
+ --signer-ids "$SIGNER_ID" --message 'Revise e assine' --max-total-credits 0 --json
77
77
  ```
78
78
 
79
79
  Leia custo, saldo e bloqueios antes da escrita. A operação pode consumir créditos e enviar convites. `notification_methods: []` assume Email em produção; informe o canal para escolhê-lo explicitamente.
@@ -156,6 +156,14 @@ console.log(result.document.id, result.assignment.id, result.signer_ids);
156
156
 
157
157
  Respostas envelopadas resolvem para `data`; listas paginadas retornam `{ data, meta? }`; binários retornam `Buffer`. `ValidationError`, `ApiError`, `NetworkError` e `PartialWorkflowError` preservam dados úteis sem carregar a configuração Axios com segredos. A [referência do SDK](docs/sdk-reference.md) descreve todos os recursos, aliases, tipos, payloads e erros.
158
158
 
159
+ ## Envelopes, assinatura incorporada e notificações
160
+
161
+ `envelopes estimate-cost|create` envia até 20 documentos para até 20 signatários. Faça upload e aguarde cada PDF primeiro; use `max_total_credits` e uma chave de idempotência na criação. Cada documento mantém sua própria assinatura e certificado. Veja o [fluxo completo de envelopes](docs/sdk-reference.md#envelopes-clientenvelopes).
162
+
163
+ `embed origins` cadastra a origem HTTPS da aplicação; `embed session` gera a URL privada de uso único para um signatário `embedded: true`. Email e WhatsApp continuam exigindo OTP. Integre o iframe no frontend e mantenha a chave de API no backend. Veja [assinatura incorporada](docs/sdk-reference.md#embedded-signing-clientembed).
164
+
165
+ `workspaces usage` informa saldo e plano; `workspaces notification-policy` controla alertas da conta e `users push-preferences` controla push no celular. `signer certified-copy` reenvia a cópia certificada ao contato original; `download-copy` usa `ASSINAFY_DOWNLOAD_TOKEN`.
166
+
159
167
  ## Templates, contratos e webhooks
160
168
 
161
169
  - Templates: `templates list` e `documents create-from-template`; papéis recebem IDs existentes ou descritores inline.
@@ -164,7 +172,7 @@ Respostas envelopadas resolvem para `data`; listas paginadas retornam `{ data, m
164
172
 
165
173
  ## Referências e desenvolvimento
166
174
 
167
- - [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as 118 operações publicadas.
175
+ - [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as 147 operações publicadas.
168
176
  - [Referência do SDK](docs/sdk-reference.md): métodos, helpers, compatibilidade e fluxos adicionais.
169
177
  - [Comandos](docs/README.md): documentos, signatários, assignments, signer, OAuth, auth, workspaces, usuários, templates, contratos, tags, fields, webhooks e configuração.
170
178
  - [Segurança](SECURITY.md), [contribuição](CONTRIBUTING.md) e [releases](docs/releasing.md).