@assinafy/cli 2.9.1 → 2.10.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/README.en.md CHANGED
@@ -4,7 +4,7 @@ _[Leia em português](README.md) · English_
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 147 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`; the HTTP reference covers all 158 published production 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
 
@@ -86,11 +86,11 @@ Use an API key for direct owner integrations, OAuth for customer-consented marke
86
86
  | OAuth access token | `Authorization: Bearer <token>` | Marketplace connections, limited to granted scopes and one workspace. |
87
87
  | User JWT | `Authorization: Bearer <jwt>` | User sessions and permitted account operations. |
88
88
 
89
- Generate an API key from the Assinafy dashboard, or from the CLI with an existing session:
89
+ Generate an API key from the Assinafy dashboard. The CLI can inspect or revoke an existing key with a permitted user session:
90
90
 
91
91
  ```bash
92
- assinafy auth login you@example.com # returns a JWT
93
- assinafy auth api-keys create --token <jwt> # generates (and rotates) the key
92
+ assinafy auth login user@example.com # returns a JWT
93
+ assinafy auth api-keys get --token <jwt> # shows the masked key
94
94
  ```
95
95
 
96
96
  When two-factor authentication is enabled, `auth login` asks for an authenticator or recovery code (or reads `--mfa-code` / `ASSINAFY_MFA_CODE`); the challenge is single-use and expires after 5 minutes. `auth mfa enroll`, `confirm`, `list`, `recovery-codes`, and `remove` manage the authenticator and recovery codes.
@@ -450,7 +450,7 @@ Assinafy runs a **separate sandbox** at `https://sandbox.assinafy.com.br/v1`. It
450
450
 
451
451
  ## Command reference
452
452
 
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.
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 158 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
454
454
 
455
455
  Global flags accepted by every command: `--api-key`, `--token`, `--account-id`, `--base-url`, `-p, --profile`, `--json`, `-q, --quiet`. `assinafy -v` prints the version.
456
456
 
@@ -480,6 +480,7 @@ assinafy send contract.pdf \
480
480
  | `documents thumbnail <id> [-o] [--force]` | Download the thumbnail (JPEG) |
481
481
  | `documents download-page <id> <pageId> [-o] [--force]` | Download one page (JPEG) |
482
482
  | `documents activities <id>` | Activity log |
483
+ | `documents cancel <id> [-y]` | Cancel an open document and retain its files and history |
483
484
  | `documents delete <id> [-y]` | Delete a document |
484
485
  | `documents tags <id>` | List attached tags |
485
486
  | `documents tags-set <id> [tags...]` | Replace the tag set by name (none detaches all) |
@@ -559,7 +560,7 @@ Field definitions are what `--method collect` assignments gather. Run `fields ty
559
560
 
560
561
  ### `auth`
561
562
 
562
- `login <email> [--mfa-code]` · `social-login` · `link-social-login` · `change-password` · `request-password-reset <email>` · `reset-password --reset-token` · `api-keys create|get|delete` · `mfa verify --mfa-token [--mfa-code]` · `mfa list` · `mfa enroll [--label]` · `mfa confirm <methodId> [--code] [--password|--reauth-code]` · `mfa recovery-codes [--password|--mfa-code]` · `mfa remove <methodId> [--password|--mfa-code] [-y]`
563
+ `login <email> [--mfa-code]` · `social-login` · `link-social-login` · `change-password` · `request-password-reset <email>` · `reset-password --reset-token` · `api-keys get|delete` · `mfa verify --mfa-token [--mfa-code]` · `mfa list` · `mfa enroll [--label]` · `mfa confirm <methodId> [--code] [--password|--reauth-code]` · `mfa recovery-codes [--password|--mfa-code]` · `mfa remove <methodId> [--password|--mfa-code] [-y]`
563
564
 
564
565
  For server-to-server use, prefer an API key (`assinafy login` or `--api-key`) and skip this group. `auth login`, `auth mfa verify`, `auth social-login`, `auth request-password-reset`, and `auth reset-password` run without stored credentials; the rest accept the API key or JWT documented for their endpoint.
565
566
 
@@ -653,9 +654,9 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
653
654
 
654
655
  ## Contract boundaries
655
656
 
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.
657
+ - The production OpenAPI publishes 158 operations. The SDK intentionally omits personal API-key creation; create keys in the Assinafy dashboard. Masked lookup and revocation remain available.
657
658
  - 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.
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.
659
+ - 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 158 OpenAPI operations.
659
660
  - `send-token` sends the email-only body `{ "channel": "email", "recipient": "..." }`; WhatsApp and the older `{ "email" }` body are rejected by the API with `400`.
660
661
  - `signer documents` and `signer search` accept the workspace API key or token when `--access-code` is omitted.
661
662
  - 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.
@@ -664,4 +665,4 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
664
665
 
665
666
  MIT © Assinafy
666
667
 
667
- Staging publishes additional scheduled-send, watcher, signer-capacity, delivery-history and envelope-reminder-estimate operations. Set `ASSINAFY_BASE_URL=https://api.angry-pisco.stage.assinafy.com.br/v1` with staging credentials. See [SDK flows](docs/sdk-reference.md#scheduled-sends-clientscheduledsends) and [complete staging HTTP contracts](docs/api-reference-staging.md).
668
+ Scheduled sends, document watchers, signer capacities, notification history and envelope reminder estimates are published production operations. See their [SDK flows](docs/sdk-reference.md#scheduled-sends-clientscheduledsends) and [HTTP contracts](docs/api-reference.md).
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  _Português · [Read in English](README.en.md)_
4
4
 
5
- CLI e SDK TypeScript para as 147 operações de produção e 157 de staging publicadas da [API Assinafy](https://api.assinafy.com.br/v1/docs): documentos, signatários, assinaturas, templates, contratos, envelopes, assinatura incorporada, OAuth e webhooks.
6
-
7
- Staging também oferece envios agendados, observadores, capacidades dos signatários e histórico de entrega: [fluxos e contratos](docs/sdk-reference.md#scheduled-sends-clientscheduledsends). Configure `ASSINAFY_BASE_URL=https://api.angry-pisco.stage.assinafy.com.br/v1` com credenciais próprias.
5
+ CLI e SDK TypeScript para a [API Assinafy](https://api.assinafy.com.br/v1/docs): documentos, signatários, assinaturas, templates, contratos, envelopes, assinatura incorporada, OAuth, envios agendados e webhooks. A referência HTTP inclui as 158 operações de produção publicadas.
8
6
 
9
7
  ## Instalação
10
8
 
@@ -178,7 +176,7 @@ Respostas envelopadas resolvem para `data`; listas paginadas retornam `{ data, m
178
176
 
179
177
  ## Referências e desenvolvimento
180
178
 
181
- - [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as 147 operações publicadas.
179
+ - [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as 158 operações publicadas.
182
180
  - [Referência do SDK](docs/sdk-reference.md): métodos, helpers, compatibilidade e fluxos adicionais.
183
181
  - [Comandos](docs/README.md): documentos, signatários, assignments, signer, OAuth, auth, workspaces, usuários, templates, contratos, tags, fields, webhooks e configuração.
184
182
  - [Segurança](SECURITY.md), [contribuição](CONTRIBUTING.md) e [releases](docs/releasing.md).
@@ -62,7 +62,7 @@ Source: git+https://github.com/commander-js/extra-typings.git
62
62
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63
63
  SOFTWARE.
64
64
 
65
- ## @types/node 26.6.6
65
+ ## @types/node 26.6.11
66
66
 
67
67
  License: MIT
68
68
 
@@ -124,7 +124,7 @@ Source: git+https://github.com/alexindigo/asynckit.git
124
124
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
125
125
  SOFTWARE.
126
126
 
127
- ## axios 1.21.0
127
+ ## axios 1.21.1
128
128
 
129
129
  License: MIT
130
130
 
@@ -499,7 +499,7 @@ Source: git+https://github.com/43081j/fast-wrap-ansi.git
499
499
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
500
500
  SOFTWARE.
501
501
 
502
- ## follow-redirects 1.16.2
502
+ ## follow-redirects 1.16.3
503
503
 
504
504
  License: MIT
505
505
 
package/dist/api.cjs CHANGED
@@ -650,7 +650,7 @@ function normaliseSignerRef(ref, options) {
650
650
  throw new ValidationError("Invalid signer reference", { ref });
651
651
  }
652
652
  var AssignmentResource = class extends BaseResource {
653
- /** Keep a request for later; no invitation or charge until the server sends it (staging). */
653
+ /** Keep a request for later; no invitation or charge until the server sends it. */
654
654
  async schedule(documentId, payload) {
655
655
  const id = this.requireId(documentId, "Document ID");
656
656
  requireScheduledTime(payload?.send_at);
@@ -915,14 +915,6 @@ var AuthenticationResource = class extends BaseResource {
915
915
  () => this.http.post("/auth/link-social-login", payload)
916
916
  );
917
917
  }
918
- /** `POST /users/api-keys` — generate (and rotate) the current user's API key. */
919
- async createApiKey(password) {
920
- if (!password) throw new ValidationError("password is required");
921
- return this.call(
922
- "Failed to create API key",
923
- () => this.http.post("/users/api-keys", { password })
924
- );
925
- }
926
918
  /**
927
919
  * `GET /users/api-keys` — fetch a masked version of the current API key, or
928
920
  * `null` if no key has been generated yet.
@@ -1137,7 +1129,7 @@ var FAILED_STATUSES = /* @__PURE__ */ new Set([
1137
1129
  "expired"
1138
1130
  ]);
1139
1131
  var DocumentResource = class extends BaseResource {
1140
- /** Read contacts who receive a completion email without document access (staging). */
1132
+ /** Read contacts who receive a completion email without document access. */
1141
1133
  async listWatchers(documentId) {
1142
1134
  const id = this.requireId(documentId, "Document ID");
1143
1135
  return this.call(
@@ -1145,7 +1137,7 @@ var DocumentResource = class extends BaseResource {
1145
1137
  () => this.http.get(`/documents/${id}/watchers`)
1146
1138
  );
1147
1139
  }
1148
- /** Replace all watchers; an empty list clears them. Owner credentials required (staging). */
1140
+ /** Replace all watchers; an empty list clears them. Owner credentials required. */
1149
1141
  async setWatchers(documentId, watcherIds) {
1150
1142
  const id = this.requireId(documentId, "Document ID");
1151
1143
  if (!Array.isArray(watcherIds) || new Set(watcherIds).size > 10 || watcherIds.some((value) => typeof value !== "string" || !value.trim())) {
@@ -1360,6 +1352,11 @@ var DocumentResource = class extends BaseResource {
1360
1352
  const id = this.requireId(documentId, "Document ID");
1361
1353
  return this.call("Failed to delete document", () => this.http.delete(`/documents/${id}`));
1362
1354
  }
1355
+ /** Cancel an open document while retaining its files and history. */
1356
+ async cancel(documentId) {
1357
+ const id = this.requireId(documentId, "Document ID");
1358
+ return this.call("Failed to cancel document", () => this.http.put(`/documents/${id}/cancel`));
1359
+ }
1363
1360
  /** List the tags attached to a document. */
1364
1361
  async listTags(documentId, accountId) {
1365
1362
  const accId = this.accountId(accountId);
@@ -1686,7 +1683,7 @@ function validateOrigin(value) {
1686
1683
 
1687
1684
  // src/api/resources/envelopes.ts
1688
1685
  var EnvelopeResource = class extends BaseResource {
1689
- /** Schedule one envelope request; idempotency headers are not supported here (staging). */
1686
+ /** Schedule one envelope request; idempotency headers are not supported here. */
1690
1687
  async schedule(payload, accountId) {
1691
1688
  const id = this.accountId(accountId);
1692
1689
  validateCreate(payload);
@@ -1696,7 +1693,7 @@ var EnvelopeResource = class extends BaseResource {
1696
1693
  () => this.http.post(`/accounts/${id}/scheduled-sends`, payload)
1697
1694
  );
1698
1695
  }
1699
- /** Estimate one reminder for the whole envelope without sending or charging (staging). */
1696
+ /** Estimate one reminder for the whole envelope without sending or charging. */
1700
1697
  async estimateResendCost(envelopeId, signerId, accountId) {
1701
1698
  const id = this.accountId(accountId);
1702
1699
  const eid = this.requireId(envelopeId, "Envelope ID");