@assinafy/sdk 2.9.1 → 2.11.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 +51 -1
- package/README.en.md +57 -23
- package/README.md +57 -22
- package/dist/index.d.mts +173 -76
- package/dist/index.d.ts +173 -76
- package/dist/index.js +200 -82
- package/dist/index.mjs +200 -82
- package/docs/API_COVERAGE.md +1 -1
- package/docs/COMPATIBILITY.md +98 -30
- package/docs/RELEASING.md +13 -6
- package/package.json +3 -2
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -43,9 +43,8 @@ They map to `auth.getSocialLoginUrl()` and
|
|
|
43
43
|
The SDK also includes the production contract additions for:
|
|
44
44
|
|
|
45
45
|
- the `pades` document artifact;
|
|
46
|
-
- `DigitalCertificate` verification on
|
|
47
|
-
estimation (
|
|
48
|
-
the server derives their method);
|
|
46
|
+
- `DigitalCertificate` verification on direct and template assignment creation
|
|
47
|
+
and cost estimation (templates with placed signer fields return `400`);
|
|
49
48
|
- typed `display_settings` for collect fields;
|
|
50
49
|
- signer `government_id` updates;
|
|
51
50
|
- signature-image `reuse`;
|
|
@@ -65,12 +64,34 @@ the hourly renewal and expiration lifecycle, and expose portfolio filters.
|
|
|
65
64
|
OAuth reads require `documents:read`; writes require `documents:write` plus a
|
|
66
65
|
workspace plan with contract tracking.
|
|
67
66
|
|
|
67
|
+
Owner assignment is optional. Integrations that do not manage ownership can
|
|
68
|
+
omit `owner_id` without discovering or supplying workspace member IDs.
|
|
69
|
+
Workspace membership is never available to OAuth tokens, including those with
|
|
70
|
+
`account:read`: the member directory includes other members' and pending
|
|
71
|
+
invitees' emails, roles, and session-only data. Adding it to that scope would
|
|
72
|
+
expand existing grants without renewed consent.
|
|
73
|
+
|
|
74
|
+
For an explicit "assign to me" action, `client.oauth.getUserInfo()` calls
|
|
75
|
+
`GET /v1/oauth/userinfo` with the `openid` scope. Its `sub` is the signed-in
|
|
76
|
+
user's ID in the format accepted by `owner_id`; this does not enumerate other
|
|
77
|
+
members. Assignment to someone else by email is not a supported contract field.
|
|
78
|
+
|
|
79
|
+
An amendment's `apply_error` is human-readable text, not a stable code. Do not
|
|
80
|
+
parse it to select localized guidance. The published causes are a missing
|
|
81
|
+
contract-tracking plan, a parent that cannot accept the delta, an earlier signed
|
|
82
|
+
instrument still pending, a later signed instrument already applied, and an
|
|
83
|
+
unexpected failure. A machine-readable error code requires an API contract
|
|
84
|
+
addition before the SDK can expose it.
|
|
85
|
+
|
|
68
86
|
A sandbox may return the generic `404` while these routes are not deployed, or
|
|
69
87
|
`403` while its workspace plan does not include contract tracking. The SDK does
|
|
70
88
|
not reinterpret either response or route a sandbox request to production.
|
|
71
89
|
Read operations remain available after a production plan lapses; writes are
|
|
72
90
|
plan-gated. Signed amendments wait and the lifecycle catches up after the plan
|
|
73
91
|
returns, as defined by the production integration guide.
|
|
92
|
+
The current sandbox specification publishes neither the six CLM operations nor
|
|
93
|
+
activity paging. The SDK's `audit:api` checks the production contract; passing
|
|
94
|
+
sandbox smoke tests does not verify either capability.
|
|
74
95
|
|
|
75
96
|
`documents.details()` can expose `has_contract` only in a workspace context and
|
|
76
97
|
only when contract tracking is available. A missing key means unknown, not
|
|
@@ -146,8 +167,8 @@ identifier.
|
|
|
146
167
|
|
|
147
168
|
## List pagination
|
|
148
169
|
|
|
149
|
-
Two behaviours
|
|
150
|
-
surfaces as an error a caller could react to:
|
|
170
|
+
Two behaviours observed on document and signer lists are silent rather than
|
|
171
|
+
loud, so neither surfaces as an error a caller could react to:
|
|
151
172
|
|
|
152
173
|
- Only the hyphenated `per-page` is read. `per_page` is accepted and discarded,
|
|
153
174
|
and the response falls back to the default of 20 rows. The SDK normalizes
|
|
@@ -165,7 +186,49 @@ const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_S
|
|
|
165
186
|
// page size the server actually applied — prefer it over the requested value.
|
|
166
187
|
```
|
|
167
188
|
|
|
168
|
-
`signers.findByEmail()` pins this maximum
|
|
189
|
+
`signers.findByEmail()` pins this maximum when scanning matching signer pages.
|
|
190
|
+
|
|
191
|
+
### Document activities
|
|
192
|
+
|
|
193
|
+
Production `GET /v1/documents/{documentId}/activities` is paginated: 20 entries
|
|
194
|
+
per page by default, with `page`, `per-page` (documented maximum 100), and `sort`
|
|
195
|
+
(`-id` for newest first, the default; `id` for oldest first). A page beyond the
|
|
196
|
+
end returns an empty `data` array. Its documented limit differs from the observed
|
|
197
|
+
50-row cap above; the SDK forwards the requested size without clamping it.
|
|
198
|
+
|
|
199
|
+
`documents.activities(documentId, params?)` continues to return
|
|
200
|
+
`IDocumentActivity[]`, normalizing an absent body to `[]`. It accepts `per_page`
|
|
201
|
+
as an alias for `per-page`, with the hyphenated form taking precedence. It makes
|
|
202
|
+
one request. Use `documents.listActivities()` to receive `{ data, meta }`, with
|
|
203
|
+
`current_page`, `per_page`, `total` and `last_page` parsed from the production
|
|
204
|
+
`X-Pagination-*` headers. `meta` is absent when the server sends no pagination
|
|
205
|
+
headers.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
import type { IDocumentActivity } from '@assinafy/sdk';
|
|
209
|
+
|
|
210
|
+
const events: IDocumentActivity[] = [];
|
|
211
|
+
for (let page = 1; ; page++) {
|
|
212
|
+
const { data, meta } = await client.documents.listActivities('document-id', {
|
|
213
|
+
page, 'per-page': 100, sort: 'id',
|
|
214
|
+
});
|
|
215
|
+
events.push(...data);
|
|
216
|
+
// Unpaged sandbox responses have no meta and must be consumed only once.
|
|
217
|
+
if (!meta?.last_page || page >= meta.last_page || data.length === 0) break;
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Production's change from an unpaged history to a default page of 20 affects
|
|
222
|
+
existing clients even without an SDK upgrade: a successful request no longer
|
|
223
|
+
implies a complete activity log. SDK 2.9.1 and earlier cannot request later
|
|
224
|
+
pages through `activities()`. Integrations that need the full history must
|
|
225
|
+
upgrade to SDK 2.10.0 or later and explicitly traverse
|
|
226
|
+
pages. This SDK change does not automatically fetch the entire history.
|
|
227
|
+
|
|
228
|
+
Sandbox still serves an unpaged activity log and may ignore these parameters.
|
|
229
|
+
Do not use a loop that waits for an empty page on that deployment: it can keep
|
|
230
|
+
returning the same full log. A successful sandbox call does not verify production
|
|
231
|
+
pagination.
|
|
169
232
|
|
|
170
233
|
## Assignment list account context
|
|
171
234
|
|
|
@@ -315,11 +378,11 @@ estimation with `ValidationError.errors.code` set to
|
|
|
315
378
|
|
|
316
379
|
Template role IDs do not reveal which entries are signers, editors or copy
|
|
317
380
|
receivers. The SDK validates each entry's channel and positive `step`, then
|
|
318
|
-
lets the API enforce role-aware signing order. The server
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
`
|
|
322
|
-
|
|
381
|
+
lets the API enforce role-aware signing order. The server derives the method:
|
|
382
|
+
a fieldless template supports `DigitalCertificate`, while placed signer fields
|
|
383
|
+
produce `collect` and return `400`. A template signer can identify an existing
|
|
384
|
+
signer by `id`, or use `email` to reuse or create one; `id` wins when both are
|
|
385
|
+
sent.
|
|
323
386
|
|
|
324
387
|
## Identity document and face verification
|
|
325
388
|
|
|
@@ -404,9 +467,10 @@ Document upload accepts a PDF of at most 25 MB and 2,000 pages. The multipart
|
|
|
404
467
|
schema documents the file; the SDK's optional `metadata` JSON part is retained
|
|
405
468
|
for deployments that accept application-owned opaque metadata.
|
|
406
469
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
470
|
+
Assignment expiration accepts an ISO-8601 date (ending at 23:59 UTC), a
|
|
471
|
+
date-time without an offset (UTC), or an offset-aware date-time. The
|
|
472
|
+
reset-expiration schema requires the `expires_at` key itself; send `null` to
|
|
473
|
+
remove the expiration. The SDK always sends that key.
|
|
410
474
|
|
|
411
475
|
## Resend-cost response variants
|
|
412
476
|
|
|
@@ -466,12 +530,13 @@ signer access or verification value; treat it as a credential and never log it.
|
|
|
466
530
|
Assinafy sends webhook events as HTTP `POST` JSON requests with
|
|
467
531
|
`Connection: close`, `webhook-id` and `webhook-timestamp` headers, and a
|
|
468
532
|
`webhook-signature` header on signing-enabled endpoints. Every active endpoint
|
|
469
|
-
subscribed to an event receives it independently. Any `2xx` is successful.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
533
|
+
subscribed to an event receives it independently. Any `2xx` is successful.
|
|
534
|
+
Connection failures, timeouts, `408`, `429`, and `5xx` receive up to six
|
|
535
|
+
attempts about ten minutes apart. After ten failed deliveries in a row, the
|
|
536
|
+
endpoint is held and probed after 3, 15, and 60 minutes, then every six hours.
|
|
537
|
+
Success replays missed events oldest first. `webhooks.retryDispatch()` sends
|
|
538
|
+
once immediately, even while held. The first 2,000 response characters and the
|
|
539
|
+
delivery entry are retained for seven days.
|
|
475
540
|
|
|
476
541
|
The common body contains `id`, `event`, nullable `message`, nullable `payload`,
|
|
477
542
|
nullable `origin`, Unix-second `created_at`, polymorphic `subject` and `object`,
|
|
@@ -487,10 +552,13 @@ oldest endpoint; the endpoint routes address each one by ID. Exact registered
|
|
|
487
552
|
URLs can also filter `listEndpoints(accountId?, { url })` and identify the
|
|
488
553
|
target of `deleteEndpointByUrl(url, accountId?)`.
|
|
489
554
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
555
|
+
New or changed endpoint URLs must use HTTPS. Endpoint responses expose
|
|
556
|
+
`is_held` and `held_since`; dispatch entries expose `webhook_id`, `attempt`,
|
|
557
|
+
`kind`, and `will_retry`. `createEndpoint()` returns
|
|
558
|
+
`IWebhookEndpointCreateResponse` with `secret` when signing is enabled.
|
|
559
|
+
`updateEndpoint()` returns the same shape and includes `secret` when that
|
|
560
|
+
request turns signing on. Store the value securely. OAuth applications cannot
|
|
561
|
+
read it afterward, but can rotate it with `webhooks:write`.
|
|
494
562
|
|
|
495
563
|
Signing-enabled endpoints follow Standard Webhooks:
|
|
496
564
|
`webhook-signature` holds space-separated `v1,<base64>` entries, each an
|
|
@@ -498,14 +566,14 @@ HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
|
|
|
498
566
|
base64-decoded part of the `whsec_` secret.
|
|
499
567
|
`webhookVerifier.verifySignature()` implements this, with a 300-second
|
|
500
568
|
timestamp tolerance by default; non-finite or negative windows fail closed.
|
|
501
|
-
The
|
|
502
|
-
|
|
569
|
+
The secret-read route is not available to OAuth applications. The earlier
|
|
570
|
+
`webhookVerifier.verify()` (hex HMAC over the
|
|
503
571
|
body alone) is deprecated; it never matched an Assinafy signature.
|
|
504
572
|
|
|
505
|
-
Older sandbox deployments can omit `secret` from
|
|
506
|
-
return `404` for deletion by URL. API-key integrations can still
|
|
507
|
-
|
|
508
|
-
|
|
573
|
+
Older sandbox deployments can omit `secret` from creation/update responses and
|
|
574
|
+
return `404` for deletion by URL. API-key integrations can still read/rotate
|
|
575
|
+
the secret and delete by ID. OAuth integrations can rotate a lost secret where
|
|
576
|
+
the production route is available.
|
|
509
577
|
|
|
510
578
|
## Authentication isolation
|
|
511
579
|
|
package/docs/RELEASING.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
GitLab is the canonical repository and push-mirrors branches and tags to
|
|
4
4
|
GitHub. Publishing is performed by `.github/workflows/release.yml` when GitHub
|
|
5
5
|
receives a tag matching `v*`; a mirrored tag does not create a GitHub `release`
|
|
6
|
-
event,
|
|
6
|
+
event, so the workflow creates the GitHub Release page after both registries
|
|
7
|
+
accept the package.
|
|
7
8
|
|
|
8
9
|
## Release support matrix
|
|
9
10
|
|
|
@@ -12,7 +13,7 @@ event, and the workflow intentionally does not depend on one.
|
|
|
12
13
|
| Bun 1.4.4 | Locked install, tests, build, contract checks, and packaging |
|
|
13
14
|
| Node.js 22 | Minimum supported consumer runtime |
|
|
14
15
|
| Node.js 24 LTS | Packaging and registry publishing runtime |
|
|
15
|
-
| Node.js 26
|
|
16
|
+
| Node.js 26 LTS | Forward-compatibility consumer test |
|
|
16
17
|
|
|
17
18
|
Keep this table, `package.json`, GitLab CI, and the GitHub workflows synchronized
|
|
18
19
|
when changing runtime support.
|
|
@@ -116,9 +117,11 @@ The workflow serializes releases repository-wide and performs these steps:
|
|
|
116
117
|
and build once;
|
|
117
118
|
3. create one `.tgz` with lifecycle scripts disabled and record its SHA-256;
|
|
118
119
|
4. upload that archive and checksum as a seven-day workflow artifact;
|
|
119
|
-
5. verify and publish the archive to npm through trusted-publisher OIDC;
|
|
120
|
+
5. verify and publish the archive to npm through trusted-publisher OIDC;
|
|
120
121
|
6. verify and publish the **same bytes** to GitHub Packages using
|
|
121
|
-
`GITHUB_TOKEN
|
|
122
|
+
`GITHUB_TOKEN`; and
|
|
123
|
+
7. create the GitHub Release page with generated notes, the same `.tgz`, and
|
|
124
|
+
`SHA256SUMS` after both registries succeed.
|
|
122
125
|
|
|
123
126
|
The GitHub Packages job depends on npm publishing, preventing a GitHub-only
|
|
124
127
|
release when npm fails. Both registry jobs validate `SHA256SUMS`; neither
|
|
@@ -128,8 +131,9 @@ contract and must be preserved when editing the workflow.
|
|
|
128
131
|
## Verification and recovery
|
|
129
132
|
|
|
130
133
|
After publishing, confirm that the expected version appears on npm and GitHub
|
|
131
|
-
Packages,
|
|
132
|
-
|
|
134
|
+
Packages, the GitHub Release is marked latest with both verified assets, a
|
|
135
|
+
clean Node.js consumer can import both the ESM and CommonJS entrypoints, and
|
|
136
|
+
registry downloads have the expected checksum.
|
|
133
137
|
|
|
134
138
|
If packaging or npm publishing fails, fix the source, increment or retain the
|
|
135
139
|
version as registry state allows, and create a new tag only after review. Never
|
|
@@ -145,6 +149,9 @@ archive already published to npm. Do not repack an approximation or unpublish a
|
|
|
145
149
|
released npm version. If the artifact has expired, stop and review recovery with
|
|
146
150
|
the maintainers before changing workflow dependencies or registry state.
|
|
147
151
|
|
|
152
|
+
If both registries succeed and GitHub Release creation fails, rerun only the
|
|
153
|
+
failed release job while the workflow artifact is retained.
|
|
154
|
+
|
|
148
155
|
For a defective published release, prefer deprecating the affected version and
|
|
149
156
|
shipping a reviewed patch. Record the incident and remediation in the
|
|
150
157
|
changelog and any applicable security advisory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assinafy/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"packageManager": "bun@1.4.4",
|
|
5
5
|
"description": "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -84,7 +84,8 @@
|
|
|
84
84
|
"overrides": {
|
|
85
85
|
"esbuild": "0.28.2",
|
|
86
86
|
"follow-redirects": "1.16.2",
|
|
87
|
-
"brace-expansion": "5.0.12"
|
|
87
|
+
"brace-expansion": "5.0.12",
|
|
88
|
+
"minimatch": "11.0.3"
|
|
88
89
|
},
|
|
89
90
|
"files": [
|
|
90
91
|
"dist",
|