@assinafy/cli 2.0.1 → 2.0.3
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.md +41 -9
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/api.cjs +165 -32
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +165 -32
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +717 -170
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/api/resources/assignments.d.ts +3 -1
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/documents.d.ts +3 -3
- package/dist/types/api/resources/documents.d.ts.map +1 -1
- package/dist/types/api/resources/fields.d.ts.map +1 -1
- package/dist/types/api/resources/signer-documents.d.ts +9 -5
- package/dist/types/api/resources/signer-documents.d.ts.map +1 -1
- package/dist/types/api/resources/signers.d.ts.map +1 -1
- package/dist/types/api/resources/webhooks.d.ts.map +1 -1
- package/dist/types/api/support/webhook-verifier.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +56 -51
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/utils.d.ts +18 -0
- package/dist/types/api/utils.d.ts.map +1 -1
- package/docs/api-operations.json +1 -1
- package/docs/api-reference.md +78 -68
- package/docs/assignments.md +3 -3
- package/docs/documents.md +8 -8
- package/docs/fields.md +4 -4
- package/docs/releasing.md +7 -2
- package/docs/sdk-reference.md +72 -10
- package/docs/signer.md +3 -2
- package/package.json +4 -4
package/docs/fields.md
CHANGED
|
@@ -34,7 +34,7 @@ Options:
|
|
|
34
34
|
--name <name> Field name
|
|
35
35
|
--regex <regex> Validation regex
|
|
36
36
|
--required Mark the field as required
|
|
37
|
-
--inactive
|
|
37
|
+
--inactive Compatibility: create the field inactive
|
|
38
38
|
-h, --help display help for command
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -76,12 +76,12 @@ Arguments:
|
|
|
76
76
|
id Field ID
|
|
77
77
|
|
|
78
78
|
Options:
|
|
79
|
-
--type <type>
|
|
79
|
+
--type <type> Compatibility: change the field type
|
|
80
80
|
--name <name> Field name
|
|
81
81
|
--regex <regex> Validation regex
|
|
82
82
|
--clear-regex Remove the existing validation regex
|
|
83
|
-
--required
|
|
84
|
-
--optional
|
|
83
|
+
--required Compatibility: mark as required
|
|
84
|
+
--optional Compatibility: mark as not required
|
|
85
85
|
--active Activate the field
|
|
86
86
|
--inactive Deactivate the field
|
|
87
87
|
-h, --help display help for command
|
package/docs/releasing.md
CHANGED
|
@@ -7,6 +7,9 @@ branches and `v*` tags to GitHub; GitHub Release objects are created by
|
|
|
7
7
|
## One-time repository setup
|
|
8
8
|
|
|
9
9
|
- Create a protected GitHub environment named `release` for the publish job.
|
|
10
|
+
- Create a protected `sandbox` environment for `.github/workflows/sandbox.yml` and
|
|
11
|
+
configure its four `ASSINAFY_SANDBOX_*` secrets described in `CONTRIBUTING.md`.
|
|
12
|
+
Do not require a reviewer if the scheduled weekly run must execute unattended.
|
|
10
13
|
- Configure npm trusted publishing for this GitHub repository, workflow
|
|
11
14
|
`release.yml`, and environment `release`. No long-lived npm token is used.
|
|
12
15
|
- Allow the repository `GITHUB_TOKEN` to write GitHub Releases and Packages.
|
|
@@ -20,8 +23,10 @@ branches and `v*` tags to GitHub; GitHub Release objects are created by
|
|
|
20
23
|
|
|
21
24
|
## Publish
|
|
22
25
|
|
|
23
|
-
1. Run `npm ci`, `npm run typecheck`, `npm run lint`, `npm test`,
|
|
24
|
-
`npm run
|
|
26
|
+
1. Run `npm ci`, `npm run typecheck`, `npm run lint`, `npm test`,
|
|
27
|
+
`npm run docs:api`, `npm run verify:api-docs`, and `npm run pack:release` on
|
|
28
|
+
the release commit. Commit the generated API reference when the official
|
|
29
|
+
contract changes.
|
|
25
30
|
2. Set `package.json` to the exact SemVer version and push the matching signed or
|
|
26
31
|
annotated `vX.Y.Z` tag from GitLab.
|
|
27
32
|
3. Confirm the GitHub workflow verifies that exact tag/commit, uploads its checked
|
package/docs/sdk-reference.md
CHANGED
|
@@ -132,10 +132,14 @@ interface IDocumentUploadOptions {
|
|
|
132
132
|
}
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
Uploads must be non-empty PDFs up to 25 MiB. `DocumentArtifactName` is `original | certificated | certificate-page | pades | bundle`; `bundle` is ZIP and the other document artifacts are PDF. Prefer the published `sendToken(documentId, { email })` form. The string overload sends the live-compatible legacy `{ recipient, channel }` body for email or WhatsApp integrations that still require it.
|
|
135
|
+
Uploads must be non-empty PDFs up to 25 MiB. `DocumentArtifactName` is `original | certificated | certificate-page | pades | bundle`; `bundle` is ZIP and the other document artifacts are PDF. Prefer the published `sendToken(documentId, { email })` form. The current sandbox rejects that form with HTTP 400, so use the string overload there; it sends the live-compatible legacy `{ recipient, channel }` body for email or WhatsApp integrations that still require it.
|
|
136
|
+
|
|
137
|
+
Template document creation sends `{ signers, name?, message?, expires_at?, editor_fields?, tags? }`. Each signer is `{ role_id, id, verification_method?, notification_methods?, step? }`; each editor field is `{ field_id, value: string }`. Template cost estimation publishes `{ signers: Array<{ role_id, verification_method?, notification_methods? }> }`. The optional cost-signer `id` and `step` properties remain compatibility extensions for existing integrations.
|
|
136
138
|
|
|
137
139
|
Document list params are `{ page?, per_page?, status?, method?, tags?, search?, sort? }`; search params omit `method`/`tags`. Supported sort values are `name`, `-name`, `updated_at`, and `-updated_at`.
|
|
138
140
|
|
|
141
|
+
`replaceTags` and `addTags` take tag IDs, as required by the published request bodies. Values are still forwarded unchanged for compatibility with deployments that accept tag names; new integrations should use IDs from `client.tags.list()`.
|
|
142
|
+
|
|
139
143
|
Document responses expose typed `IDocumentArtifacts`, `IDocumentPage`, inline tags, assignment/signing state, decline state, and creation/update timestamps. `IPublicDocumentInfo` models the complete published public-document payload while retaining the older optional `page_count` and `created_by` fields.
|
|
140
144
|
|
|
141
145
|
## Assignments (`client.assignments`)
|
|
@@ -145,7 +149,7 @@ Document responses expose typed `IDocumentArtifacts`, `IDocumentPage`, inline ta
|
|
|
145
149
|
| `list(params?, accountId?)` | [`GET /assignments?accountId=…`](./api-reference.md#list-assignments) | `PaginatedResult<IAssignment>` |
|
|
146
150
|
| `create(documentId, payload)` | [`POST /documents/{documentId}/assignments`](./api-reference.md#create-assignment-request-signatures) | `IAssignment` |
|
|
147
151
|
| `estimateCost(documentId, payload)` | [`POST /documents/{documentId}/assignments/estimate-cost`](./api-reference.md#estimate-assignment-cost) | `IEstimateCostResponse` |
|
|
148
|
-
| `resetExpiration(documentId, assignmentId, expiresAt)` | [`PUT …/reset-expiration`](./api-reference.md#reset-assignment-expiration) | `IAssignment`;
|
|
152
|
+
| `resetExpiration(documentId, assignmentId, expiresAt)` | [`PUT …/reset-expiration`](./api-reference.md#reset-assignment-expiration) | `IAssignment`; the published API accepts an ISO 8601 timestamp, and deployments that support clearing also accept `null` |
|
|
149
153
|
| `resendNotification(documentId, assignmentId, signerId)` | [`PUT …/signers/{signerId}/resend`](./api-reference.md#resend-signature-request) | `IResendEmailResponse` |
|
|
150
154
|
| `estimateResendCost(documentId, assignmentId, signerId)` | [`POST …/estimate-resend-cost`](./api-reference.md#estimate-resend-cost) | `IResendCostEstimate` |
|
|
151
155
|
| `listWhatsAppNotifications(documentId, assignmentId)` | [`GET …/whatsapp-notifications`](./api-reference.md#list-whatsapp-notifications) | `IWhatsAppNotification[]` |
|
|
@@ -171,7 +175,7 @@ Assignment payload:
|
|
|
171
175
|
}
|
|
172
176
|
```
|
|
173
177
|
|
|
174
|
-
`buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. `create` requires at least one signer
|
|
178
|
+
`buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. `create` requires at least one signer and enforces the documented one-digital-certificate-signer-per-step rule. The estimate schema has no `step`, so `estimateCost` does not apply that create-only rule and permits zero signers for `collect`. Assignment list params are pagination plus the live-verified `sort?: 'created_at' | '-created_at'`; the runtime endpoint requires the SDK's `accountId` query even though the published parameter table omits it. The sandbox ignored an assignment `search` query, so the SDK does not expose it.
|
|
175
179
|
|
|
176
180
|
## Signers (`client.signers`)
|
|
177
181
|
|
|
@@ -184,18 +188,18 @@ Assignment payload:
|
|
|
184
188
|
| `delete(signerId, accountId?)` | [`DELETE /accounts/{accountId}/signers/{signerId}`](./api-reference.md#delete-signer) | `IEmptyResult` (`unknown[]`) |
|
|
185
189
|
| `findByEmail(email, accountId?)` | SDK helper over `list({ search: email })` | `ISigner | null` |
|
|
186
190
|
|
|
187
|
-
Create payload: `{ full_name: string; email?; whatsapp_phone_number?; phone?; cpf?; metadata? }`. Update payload: `{ full_name?; email?; whatsapp_phone_number?; phone?; government_id?; cpf? }`. `phone` and update-time `cpf` are compatibility
|
|
191
|
+
Create payload: `{ full_name: string; email?; whatsapp_phone_number?; phone?; cpf?; metadata? }`. Update payload: `{ full_name?; email?; whatsapp_phone_number?; phone?; government_id?; cpf? }`. `phone`, create-time `cpf`/`metadata`, and update-time `cpf` are compatibility extensions; new integrations should use the published fields. Creation is idempotent by exact case-insensitive email when email is supplied; full-name-only signers are valid. List params support published `search` and live-verified `sort?: 'full_name' | '-full_name'`; ignored sort fields are rejected locally.
|
|
188
192
|
|
|
189
193
|
## Signer-side flows (`client.signerDocuments`)
|
|
190
194
|
|
|
191
|
-
These methods use the one-time `signer-access-code`, not the workspace API key.
|
|
195
|
+
These methods use the one-time `signer-access-code`, not the workspace API key, except for the artifact download that the API publishes as a public route.
|
|
192
196
|
|
|
193
197
|
| SDK method | HTTP operation | Resolves to |
|
|
194
198
|
| --- | --- | --- |
|
|
195
199
|
| `getCurrent(signerId, accessCode)` | [`GET /signers/{signerId}/document`](./api-reference.md#get-signers-document) | `IDocumentDetailsResponse` |
|
|
196
200
|
| `list(signerId, accessCode, params?)` | [`GET /signers/{signerId}/documents`](./api-reference.md#list-signers-documents) | `IDocumentListResponse` |
|
|
197
201
|
| `search(signerId, search, accessCode)` | [`GET /signers/{signerId}/documents/search`](./api-reference.md#search-signers-documents) | `IDocumentListResponse` |
|
|
198
|
-
| `download(signerId, documentId, artifact, accessCode)` | [`GET /signers/{signerId}/documents/{documentId}/download/{artifact}`](./api-reference.md#download-signers-document-artifact) | `Buffer` |
|
|
202
|
+
| `download(signerId, documentId, artifact, accessCode?)` | [`GET /signers/{signerId}/documents/{documentId}/download/{artifact}`](./api-reference.md#download-signers-document-artifact) | `Buffer` |
|
|
199
203
|
| `signMultiple(documentIds, accessCode)` | [`PUT /signers/documents/sign-multiple`](./api-reference.md#sign-multiple-documents) | `unknown[]` |
|
|
200
204
|
| `declineMultiple(documentIds, reason, accessCode)` | [`PUT /signers/documents/decline-multiple`](./api-reference.md#decline-multiple-documents) | `unknown[]` |
|
|
201
205
|
| `self(accessCode)` | [`GET /signers/self`](./api-reference.md#get-current-signer) | `ISignerSelf` |
|
|
@@ -210,7 +214,7 @@ These methods use the one-time `signer-access-code`, not the workspace API key.
|
|
|
210
214
|
|
|
211
215
|
`confirmData` accepts `{ full_name?, email?, government_id?, whatsapp_phone_number?, has_accepted_terms? }`. `uploadSignature` accepts a non-empty image `Buffer` plus `{ imageType?: 'signature' | 'initial'; contentType?: string; reuse?: boolean }`. Each signing entry is `{ itemId, fieldId, pageId, value }`.
|
|
212
216
|
|
|
213
|
-
`download`
|
|
217
|
+
The artifact `download` route is public in the published API. If `accessCode` is supplied, the SDK first verifies it through `/signers/self` and confirms that it belongs to the requested signer before downloading.
|
|
214
218
|
|
|
215
219
|
## Workspaces (`client.workspaces`)
|
|
216
220
|
|
|
@@ -229,6 +233,29 @@ These methods use the one-time `signer-access-code`, not the workspace API key.
|
|
|
229
233
|
|
|
230
234
|
Create/update payloads use `name` and `notification_sender_type?: 'User' | 'Account'`; legacy color fields remain accepted for compatibility. List/detail responses include `resource`, `id`, `name`, nullable colors, `notification_sender_type`, roles, delete permission, and `created_at`. `IAccountTheme` is `{ account_name; primary_color; secondary_color: string | null; logo: string | null }`. Logo options are `{ fileName?, contentType? }`. Statistics params are `{ granularity?: 'monthly' | 'daily'; month?: 'YYYY-MM' }`; `month` is required for daily data.
|
|
231
235
|
|
|
236
|
+
Both account and user statistics resolve to the complete published row:
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
interface IDocumentStatsRow {
|
|
240
|
+
period: string; // YYYY-MM or YYYY-MM-DD
|
|
241
|
+
documents_uploaded: number;
|
|
242
|
+
documents_sent: number;
|
|
243
|
+
signature_requests: number;
|
|
244
|
+
signature_requests_notification_email: number;
|
|
245
|
+
signature_requests_notification_whatsapp: number;
|
|
246
|
+
signature_requests_notification_bypass: number;
|
|
247
|
+
signature_requests_verification_email: number;
|
|
248
|
+
signature_requests_verification_whatsapp: number;
|
|
249
|
+
signature_requests_verification_bypass: number;
|
|
250
|
+
signature_requests_verification_digital_certificate: number;
|
|
251
|
+
signature_requests_viewed: number;
|
|
252
|
+
signature_requests_completed: number;
|
|
253
|
+
documents_certified: number;
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Notification counters can overlap when a request uses multiple delivery channels. The four verification counters are mutually exclusive and add up to `signature_requests`.
|
|
258
|
+
|
|
232
259
|
## Users (`client.users`)
|
|
233
260
|
|
|
234
261
|
| SDK method | HTTP operation | Resolves to |
|
|
@@ -269,7 +296,7 @@ Login/social/reset bootstrap calls can use an unauthenticated client. The publis
|
|
|
269
296
|
| `validateMultiple(entries, options?)` | [`POST …/fields/validate-multiple`](./api-reference.md#validate-multiple-field-values) | `IFieldValidationResult[]` |
|
|
270
297
|
| `listTypes()` | [`GET /field-types`](./api-reference.md#list-field-types) | `IFieldType[]` |
|
|
271
298
|
|
|
272
|
-
|
|
299
|
+
Published create payload: `{ type: string; name: string; regex?; is_required? }`. Published update payload: `{ name?; regex?: string | null; is_active? }`. The SDK retains create-time `is_active` and update-time `type`/`is_required` as compatibility extensions. List params are `{ include_inactive?, include_standard? }`. Validation options are `{ signerAccessCode?, accountId? }`; multiple entries are `{ field_id, value }[]`. When a signer code is supplied, the SDK removes any configured owner API-key/bearer headers from that request.
|
|
273
300
|
|
|
274
301
|
## Tags (`client.tags`)
|
|
275
302
|
|
|
@@ -288,9 +315,44 @@ Create payload: `{ type: string; name: string; regex?; is_required?; is_active?
|
|
|
288
315
|
| `get(templateId, accountId?)` | `GET /accounts/{accountId}/templates/{templateId}` | `ITemplateDetailsResponse` |
|
|
289
316
|
| `downloadPage(templateId, pageId, accountId?)` | `GET /accounts/{accountId}/templates/{templateId}/pages/{pageId}/download` | JPEG `Buffer` |
|
|
290
317
|
|
|
291
|
-
The last two
|
|
318
|
+
The last two routes are retained for platform compatibility although they are not in the published OpenAPI. Neither sends a request body. `get` unwraps the normal Assinafy envelope and returns:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
interface ITemplateDetailsResponse {
|
|
322
|
+
resource?: string;
|
|
323
|
+
id: string;
|
|
324
|
+
name: string;
|
|
325
|
+
document_name?: string | null;
|
|
326
|
+
message?: string | null;
|
|
327
|
+
status: string;
|
|
328
|
+
account_id?: string;
|
|
329
|
+
pages?: Array<{
|
|
330
|
+
id: string;
|
|
331
|
+
number: number;
|
|
332
|
+
height: number;
|
|
333
|
+
width: number;
|
|
334
|
+
download_url: string;
|
|
335
|
+
fields: Array<{
|
|
336
|
+
id: string;
|
|
337
|
+
field_id: string;
|
|
338
|
+
role_id: string;
|
|
339
|
+
label: string;
|
|
340
|
+
display_settings: IDisplaySettings | unknown[] | null;
|
|
341
|
+
created_at: string;
|
|
342
|
+
updated_at: string;
|
|
343
|
+
}>;
|
|
344
|
+
}>;
|
|
345
|
+
roles?: ITemplateRole[];
|
|
346
|
+
tags?: IInlineTag[];
|
|
347
|
+
default_document_tags?: IInlineTag[];
|
|
348
|
+
created_at: string;
|
|
349
|
+
updated_at?: string;
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
`downloadPage` returns the raw JPEG response as a Node.js `Buffer`; it does not unwrap JSON.
|
|
292
354
|
|
|
293
|
-
Template list params support pagination, published `search`, and live-verified `sort?: 'name' | '-name'`; ignored sort fields are rejected locally. `ITemplatePage` contains document page dimensions/URL plus typed `ITemplateField[]` entries (`id`, `field_id`, `role_id`, `label`, `display_settings`, and timestamps). Template document creation accepts `editor_fields?: Array<{ field_id: string; value:
|
|
355
|
+
Template list params support pagination, published `search`, and live-verified `sort?: 'name' | '-name'`; ignored sort fields are rejected locally. `ITemplatePage` contains document page dimensions/URL plus typed `ITemplateField[]` entries (`id`, `field_id`, `role_id`, `label`, `display_settings`, and timestamps). Template document creation accepts `editor_fields?: Array<{ field_id: string; value: string }>`.
|
|
294
356
|
|
|
295
357
|
## Webhooks (`client.webhooks`)
|
|
296
358
|
|
package/docs/signer.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
```text
|
|
6
6
|
Usage: assinafy signer [options] [command]
|
|
7
7
|
|
|
8
|
-
Signer-side flows
|
|
8
|
+
Signer-side flows and public artifact downloads
|
|
9
9
|
|
|
10
10
|
Options:
|
|
11
11
|
-h, --help display help for command
|
|
@@ -93,7 +93,8 @@ Arguments:
|
|
|
93
93
|
bundle
|
|
94
94
|
|
|
95
95
|
Options:
|
|
96
|
-
--access-code <code>
|
|
96
|
+
--access-code <code> Optional signer identity preflight code (env:
|
|
97
|
+
ASSINAFY_SIGNER_ACCESS_CODE)
|
|
97
98
|
-o, --output <path> Output file path
|
|
98
99
|
--force Overwrite the output file if it already exists
|
|
99
100
|
-h, --help display help for command
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assinafy/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "The official command-line interface for the Assinafy digital-signature API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"prepublishOnly": "npm run typecheck && npm run lint && npm run test && npm run build && npm run verify:bundle"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@types/node": "^22.
|
|
75
|
-
"axios": "^1.
|
|
74
|
+
"@types/node": "^22.20.1",
|
|
75
|
+
"axios": "^1.20.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@biomejs/biome": "^2.5.
|
|
78
|
+
"@biomejs/biome": "^2.5.10",
|
|
79
79
|
"@clack/prompts": "^1.7.0",
|
|
80
80
|
"@commander-js/extra-typings": "^15.0.0",
|
|
81
81
|
"commander": "^15.0.0",
|