@assinafy/cli 2.3.0 → 2.4.1
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 +3 -2
- package/README.md +2 -2
- package/dist/api.cjs +66 -24
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +63 -23
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +437 -383
- package/dist/types/api/index.d.ts +1 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/authentication.d.ts +1 -1
- package/dist/types/api/resources/authentication.d.ts.map +1 -1
- package/dist/types/api/resources/documents.d.ts.map +1 -1
- package/dist/types/api/resources/oauth.d.ts +4 -1
- package/dist/types/api/resources/oauth.d.ts.map +1 -1
- package/dist/types/api/resources/signers.d.ts.map +1 -1
- package/dist/types/api/resources/workspaces.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +9 -3
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/utils.d.ts +4 -0
- package/dist/types/api/utils.d.ts.map +1 -1
- package/docs/api-operations.json +2 -2
- package/docs/api-reference.md +40 -18
- package/docs/assignments.md +10 -7
- package/docs/auth.md +1 -1
- package/docs/documents.md +5 -3
- package/docs/fields.md +2 -2
- package/docs/oauth-guide.md +23 -14
- package/docs/oauth.md +4 -4
- package/docs/sdk-reference.md +6 -6
- package/docs/users.md +2 -1
- package/docs/workspaces.md +6 -3
- package/package.json +1 -1
package/docs/oauth-guide.md
CHANGED
|
@@ -4,7 +4,7 @@ Assinafy uses OAuth 2.1 authorization code with mandatory S256 PKCE for public a
|
|
|
4
4
|
|
|
5
5
|
Use a separate connection for each customer workspace. An OAuth access token carries the consenting user's permissions, the granted scopes, and exactly one workspace. It never grants billing, workspace creation/deletion, API-key management, or other platform administration. An API key remains available for direct owner integrations. Signer access codes remain a separate authentication mechanism.
|
|
6
6
|
|
|
7
|
-
Use `oauth.userinfo()` for the consenting user's profile. Production rejects OAuth application tokens for `users.self`, user statistics and notification preferences, workspace statistics, API-key lookup
|
|
7
|
+
Use `oauth.userinfo()` for the consenting user's profile. Production rejects OAuth application tokens for `users.self`, user statistics and notification preferences, workspace statistics, and API-key lookup. These operations require the owner or first-party credential supported by their endpoint. Per the live OAuth guide, `documents:read` covers webhook event types, webhook delivery history and the WhatsApp notifications sent for an assignment, and `account:read` covers reading the workspace's webhook subscription. Requesting additional OAuth scopes does not grant access to them.
|
|
8
8
|
|
|
9
9
|
## Register the application
|
|
10
10
|
|
|
@@ -34,12 +34,13 @@ The resource indicator is an origin, distinct from the SDK `baseUrl`, which incl
|
|
|
34
34
|
| `templates:read` | Read templates. |
|
|
35
35
|
| `templates:write` | Permitted template operations. |
|
|
36
36
|
| `account:read` | Read the selected workspace. |
|
|
37
|
+
| `webhooks:write` | Change webhook delivery and deactivate the subscription. Requested by `oauth connect` by default. |
|
|
37
38
|
| `openid` | Request OpenID Connect identity and UserInfo. |
|
|
38
39
|
| `profile` | Include permitted profile claims. |
|
|
39
40
|
| `email` | Include permitted email claims. |
|
|
40
41
|
| `offline_access` | Request rotating refresh tokens for background work. |
|
|
41
42
|
|
|
42
|
-
`oauth connect` requests all
|
|
43
|
+
`oauth connect` requests all ten published scopes by default, so the CLI can access documents, templates, the selected workspace, webhook settings and UserInfo, and obtain refresh tokens. The public application registration must permit all ten. Existing connections need a new authorization with the larger scope set; refreshing an old token does not add permissions. Use `--scope` to explicitly select fewer scopes when needed. For other applications, request only scopes they use. Resource metadata lists API scopes; authorization-server metadata also describes authentication features such as `offline_access`. The returned `scope` string is authoritative for the access token; do not infer granted scopes from what the browser requested. It never lists `offline_access`, even when granted: a `refresh_token` in the response is the only signal that refresh is available. A scope never bypasses a user's role or the token's workspace boundary. Billing, subscriptions, workspace membership, credential management, and administration remain unavailable to OAuth tokens; those CLI operations require the non-OAuth credential documented for each endpoint.
|
|
43
44
|
|
|
44
45
|
## Discover and start authorization
|
|
45
46
|
|
|
@@ -62,7 +63,7 @@ const request = await oauthClient.oauth.authorize({
|
|
|
62
63
|
{
|
|
63
64
|
"resource": "https://api.assinafy.com.br",
|
|
64
65
|
"authorization_servers": ["https://auth.assinafy.com.br"],
|
|
65
|
-
"scopes_supported": ["documents:read", "documents:write", "templates:read", "templates:write", "account:read", "openid", "profile", "email"],
|
|
66
|
+
"scopes_supported": ["documents:read", "documents:write", "templates:read", "templates:write", "account:read", "webhooks:write", "openid", "profile", "email"],
|
|
66
67
|
"bearer_methods_supported": ["header"]
|
|
67
68
|
}
|
|
68
69
|
```
|
|
@@ -77,7 +78,7 @@ const request = await oauthClient.oauth.authorize({
|
|
|
77
78
|
"revocation_endpoint": "https://api.assinafy.com.br/v1/oauth/revoke",
|
|
78
79
|
"userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
|
|
79
80
|
"jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
|
|
80
|
-
"scopes_supported": ["documents:read", "documents:write", "templates:read", "templates:write", "account:read", "openid", "profile", "email", "offline_access"],
|
|
81
|
+
"scopes_supported": ["documents:read", "documents:write", "templates:read", "templates:write", "account:read", "webhooks:write", "openid", "profile", "email", "offline_access"],
|
|
81
82
|
"response_types_supported": ["code"],
|
|
82
83
|
"grant_types_supported": ["authorization_code", "refresh_token"],
|
|
83
84
|
"code_challenge_methods_supported": ["S256"],
|
|
@@ -142,7 +143,7 @@ For applications that already perform callback validation, `token(payload)` acce
|
|
|
142
143
|
}
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
The SDK
|
|
146
|
+
The SDK sends these fields form-encoded (`application/x-www-form-urlencoded`). Omit `client_secret` for public clients. `resource` is optional in the token request; if provided, use the authorization resource. A direct `token()` call does not validate a browser callback, state, issuer, or session. The verifier must contain 43–128 RFC 7636 unreserved characters.
|
|
146
147
|
|
|
147
148
|
Both methods return the direct `IOAuthTokenResponse`, without an Assinafy `{ data }` envelope:
|
|
148
149
|
|
|
@@ -180,9 +181,10 @@ Persist the workspace ID with the application's tenant/customer ID, issuer, reso
|
|
|
180
181
|
|
|
181
182
|
## Refresh without losing the connection
|
|
182
183
|
|
|
183
|
-
`token(payload)` accepts the refresh grant:
|
|
184
|
+
`token(payload)` accepts the refresh grant. In these examples, `tokenStore` stands for the application's encrypted per-connection storage. Hold the connection's refresh lock from reading the stored token until the new response is saved:
|
|
184
185
|
|
|
185
186
|
```ts
|
|
187
|
+
const storedRefreshToken = await tokenStore.getRefreshToken(connectionId);
|
|
186
188
|
const next = await oauthClient.oauth.token({
|
|
187
189
|
grant_type: 'refresh_token',
|
|
188
190
|
client_id: process.env.ASSINAFY_OAUTH_CLIENT_ID!,
|
|
@@ -190,9 +192,11 @@ const next = await oauthClient.oauth.token({
|
|
|
190
192
|
refresh_token: storedRefreshToken,
|
|
191
193
|
resource: 'https://api.assinafy.com.br',
|
|
192
194
|
});
|
|
195
|
+
// storedRefreshToken is now retired. Save the whole response, with its new refresh token, before using it.
|
|
196
|
+
await tokenStore.save(connectionId, next);
|
|
193
197
|
```
|
|
194
198
|
|
|
195
|
-
The complete
|
|
199
|
+
The complete payload, sent form-encoded, is:
|
|
196
200
|
|
|
197
201
|
```json
|
|
198
202
|
{
|
|
@@ -206,7 +210,9 @@ The complete wire body is:
|
|
|
206
210
|
|
|
207
211
|
Its response has the same token shape above, with new access and refresh values. Each successful refresh consumes the previous refresh token. Reusing it revokes the entire connection. Serialize refreshes per connection across every worker and process; atomically store the complete new response before releasing the lock or using it. A lock local to one process is insufficient for a distributed application.
|
|
208
212
|
|
|
209
|
-
|
|
213
|
+
If a successful refresh response has no new `refresh_token`, or returns the submitted one, `token()` throws `ValidationError` with `errors.field` set to `'refresh_token'` instead of returning the response. The submitted token may already be retired: do not reuse it; mark the connection for reconnection.
|
|
214
|
+
|
|
215
|
+
Access tokens last one hour. A refresh token is valid for 30 days, and every refresh returns a new one with a fresh 30 days, so a connection expires only after 30 days without a refresh; after that, the user must connect again. Approving the application again with different permissions immediately invalidates the previous tokens; treat that as a reconnect. A timeout means the refresh may have succeeded: re-read the stored token before retrying and never replay the old one blindly; if nothing new was stored, mark that connection for recovery/reconnection. On `invalid_grant`, require new consent. The SDK has no automatic refresh or request retry and never persists tokens. Construct a new authenticated `AssinafyClient` with the current access token after rotation.
|
|
210
216
|
|
|
211
217
|
## UserInfo and disconnect
|
|
212
218
|
|
|
@@ -227,7 +233,7 @@ const identity = await new AssinafyClient({ token: tokens.access_token }).oauth.
|
|
|
227
233
|
|
|
228
234
|
Only `sub` is mandatory; other claims can be missing or null. Prefer the stable subject over an email address as an identity key, and include the issuer in that key.
|
|
229
235
|
|
|
230
|
-
To disconnect, `revoke(payload)`
|
|
236
|
+
To disconnect, `revoke(payload)` sends these form fields:
|
|
231
237
|
|
|
232
238
|
```json
|
|
233
239
|
{
|
|
@@ -239,21 +245,23 @@ To disconnect, `revoke(payload)` posts:
|
|
|
239
245
|
```
|
|
240
246
|
|
|
241
247
|
```ts
|
|
248
|
+
// Under the same lock, read back the latest saved token: each refresh retires the previous one.
|
|
249
|
+
const latestRefreshToken = await tokenStore.getRefreshToken(connectionId);
|
|
242
250
|
await oauthClient.oauth.revoke({
|
|
243
|
-
token:
|
|
251
|
+
token: latestRefreshToken,
|
|
244
252
|
client_id: process.env.ASSINAFY_OAUTH_CLIENT_ID!,
|
|
245
253
|
client_secret: process.env.ASSINAFY_OAUTH_CLIENT_SECRET,
|
|
246
254
|
token_type_hint: 'refresh_token',
|
|
247
255
|
});
|
|
248
256
|
```
|
|
249
257
|
|
|
250
|
-
`token_type_hint` is optional and accepts `access_token` or `refresh_token`. Successful revocation returns HTTP 200 with no required response body; the SDK resolves to `undefined`. Unknown/already revoked tokens also succeed for an authenticated client. Invalid client authentication returns 401. Revoke the connection before removing local credentials when possible, then mark it disconnected and stop its background work. CLI success prints `{ "revoked": true }`, a local confirmation rather than an API response payload.
|
|
258
|
+
`token_type_hint` is optional and accepts `access_token` or `refresh_token`. Successful revocation returns HTTP 200 with no required response body; the SDK resolves to `undefined`. Unknown/already revoked tokens also succeed for an authenticated client, so revoking a retired refresh token reports success while its replacement stays active. Invalid client authentication returns 401. Revoke the connection before removing local credentials when possible, then mark it disconnected and stop its background work. CLI success prints `{ "revoked": true }`, a local confirmation rather than an API response payload.
|
|
251
259
|
|
|
252
260
|
## CLI flow
|
|
253
261
|
|
|
254
262
|
### Automatic browser return
|
|
255
263
|
|
|
256
|
-
The distributed CLI includes the official **Public** application's client ID, `96BZZ0sZTb2NkEXt1GCaIRCTprI2YKHZr8JDHawuXUyCLC88`. This public identifier is not a secret. The CLI uses PKCE S256 and the scopes `account:read documents:read documents:write templates:read templates:write openid profile email offline_access`; keep the registered permissions consistent with the requested scopes. No client secret is used by `oauth connect`, including when `ASSINAFY_OAUTH_CLIENT_SECRET` is set for another application.
|
|
264
|
+
The distributed CLI includes the official **Public** application's client ID, `96BZZ0sZTb2NkEXt1GCaIRCTprI2YKHZr8JDHawuXUyCLC88`. This public identifier is not a secret. The CLI uses PKCE S256 and the scopes `account:read documents:read documents:write templates:read templates:write webhooks:write openid profile email offline_access`; keep the registered permissions consistent with the requested scopes. No client secret is used by `oauth connect`, including when `ASSINAFY_OAUTH_CLIENT_SECRET` is set for another application.
|
|
257
265
|
|
|
258
266
|
Application maintainers must deploy the callback from `integrations-generic-callback` and register this exact HTTPS URI, without an extension or trailing slash:
|
|
259
267
|
|
|
@@ -279,7 +287,7 @@ assinafy documents list --json
|
|
|
279
287
|
| --- | --- |
|
|
280
288
|
| `--client-id <id>` | Override the bundled public application ID; takes precedence over `ASSINAFY_OAUTH_CLIENT_ID`. |
|
|
281
289
|
| `--redirect-uri <uri>` | Registered HTTPS relay URI; defaults to the extensionless URL above. Query parameters and fragments are unsupported for this browser relay. |
|
|
282
|
-
| `--scope '<scopes>'` | Space-separated scopes; defaults to `account:read documents:read documents:write templates:read templates:write openid profile email offline_access`. |
|
|
290
|
+
| `--scope '<scopes>'` | Space-separated scopes; defaults to `account:read documents:read documents:write templates:read templates:write webhooks:write openid profile email offline_access`. |
|
|
283
291
|
| `--timeout <seconds>` | Browser response deadline, 1–600 seconds; default 180. API calls use the SDK's network timeout. |
|
|
284
292
|
| `--no-browser` | Print the authorization URL for manual opening; the local listener still receives the return automatically. |
|
|
285
293
|
|
|
@@ -328,7 +336,7 @@ Select the single returned workspace as `ASSINAFY_ACCOUNT_ID`. Remove the consum
|
|
|
328
336
|
|
|
329
337
|
An API key wins when both credential types are supplied at the same precedence level. A higher-precedence `--token` overrides environment or profile credentials as a group. Avoid leaving a stale `ASSINAFY_API_KEY` in an OAuth session.
|
|
330
338
|
|
|
331
|
-
Provision the current refresh token as `ASSINAFY_OAUTH_REFRESH_TOKEN`; `assinafy oauth refresh --resource https://api.assinafy.com.br --json` emits the rotated token response. Save to a private new file and atomically replace the previous file only on success. Never launch concurrent refresh commands. Use `ASSINAFY_OAUTH_REVOKE_TOKEN` for `assinafy oauth revoke --token-type-hint refresh_token --json`. For UserInfo, request `openid` during consent and run `assinafy oauth userinfo --json` with the access token.
|
|
339
|
+
Provision the current refresh token as `ASSINAFY_OAUTH_REFRESH_TOKEN`; `assinafy oauth refresh --resource https://api.assinafy.com.br --json` emits the rotated token response. Save to a private new file and atomically replace the previous file only on success. Never launch concurrent refresh commands. If the command reports that the response has no new refresh token, do not run it again with the same token; run `assinafy oauth connect`. Use `ASSINAFY_OAUTH_REVOKE_TOKEN` with the latest saved refresh token for `assinafy oauth revoke --token-type-hint refresh_token --json`. For UserInfo, request `openid` during consent and run `assinafy oauth userinfo --json` with the access token.
|
|
332
340
|
|
|
333
341
|
Request files, callback URLs, token output, and environment variables are sensitive. Protect them using the OS's user-only permissions, keep them out of logs and version control, and remove consumed requests. The CLI's temporary listener serves only a browser handoff; token storage and connection lifecycle remain the caller's responsibility.
|
|
334
342
|
|
|
@@ -337,6 +345,7 @@ Request files, callback URLs, token output, and environment variables are sensit
|
|
|
337
345
|
| Result | Application behavior |
|
|
338
346
|
| --- | --- |
|
|
339
347
|
| `400 invalid_grant` | Code expired/used or refresh no longer usable; reconnect rather than retrying the old grant. |
|
|
348
|
+
| `ValidationError`, `errors.field` `refresh_token` | Refresh returned no new refresh token; the submitted one may be retired. Do not reuse it; reconnect. |
|
|
340
349
|
| `401 invalid_client` | Check application type, client ID, client secret, and environment. |
|
|
341
350
|
| API `401` | Access token invalid/expired; perform one serialized refresh if the connection is recoverable. |
|
|
342
351
|
| `403` with `insufficient_scope` | Read `ApiError.wwwAuthenticate`; obtain consent for the missing scope. |
|
package/docs/oauth.md
CHANGED
|
@@ -41,10 +41,10 @@ Options:
|
|
|
41
41
|
ASSINAFY_OAUTH_CLIENT_ID)
|
|
42
42
|
--redirect-uri <uri> Exactly registered HTTPS relay URI (default:
|
|
43
43
|
"https://integrations.assinafy.com.br/assinafy-cli/oauth-callback")
|
|
44
|
-
--scope <scopes> Space-separated scopes;
|
|
45
|
-
|
|
46
|
-
documents:write templates:read templates:write
|
|
47
|
-
profile email offline_access")
|
|
44
|
+
--scope <scopes> Space-separated scopes; the default requests every
|
|
45
|
+
published scope (default: "account:read documents:read
|
|
46
|
+
documents:write templates:read templates:write
|
|
47
|
+
webhooks:write openid profile email offline_access")
|
|
48
48
|
--timeout <seconds> Wait for browser consent (1–600 seconds) (default:
|
|
49
49
|
"180")
|
|
50
50
|
--no-browser Print the authorization URL without opening the system
|
package/docs/sdk-reference.md
CHANGED
|
@@ -194,7 +194,7 @@ Assignment payload:
|
|
|
194
194
|
|
|
195
195
|
Production defaults `notification_methods: []` to `['Email']` and sends an invitation. An empty array is not a way to disable delivery. Choose the intended supported channel explicitly before creating an assignment.
|
|
196
196
|
|
|
197
|
-
`buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. It resolves synchronously to the JSON assignment body above; no HTTP call occurs. Options are `{ allowSignersWithoutId?: boolean;
|
|
197
|
+
`buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. It resolves synchronously to the JSON assignment body above; no HTTP call occurs. Options are `{ allowSignersWithoutId?: boolean; skipDigitalCertificateStepValidation?: boolean }`, both false by default. Both support cost estimation: the first accepts signer descriptors without an `id`, and the second bypasses signing-order and certificate-step checks for estimates. An empty signer list always throws `ValidationError('At least one signer is required')`, in `virtual` and `collect` modes and in cost estimates alike. `create` enforces complete contiguous signing steps from 1 when supplied and requires each digital-certificate signer to be alone in its step. The estimate schema has no `step`, so `estimateCost` passes `skipDigitalCertificateStepValidation` to skip that create-only rule. Assignment list params are pagination plus the compatible `sort?: 'created_at' | '-created_at'`; the runtime endpoint requires the SDK's `accountId` query even though the published parameter table omits it. Assignment `search` is unsupported and rejected locally.
|
|
198
198
|
|
|
199
199
|
`estimateResendCost(documentId, assignmentId, signerId)` sends a POST without a body. Its production result is:
|
|
200
200
|
|
|
@@ -410,7 +410,7 @@ Notification counters can overlap when a request uses multiple delivery channels
|
|
|
410
410
|
| `requestPasswordReset(email)` | [`PUT /authentication/request-password-reset`](./api-reference.md#request-password-reset) | `{ email }` |
|
|
411
411
|
| `resetPassword({ email, token?, new_password })` | [`PUT /authentication/reset-password`](./api-reference.md#reset-password) | `{ email }` |
|
|
412
412
|
| `createApiKey(password)` | [`POST /users/api-keys`](./api-reference.md#create-api-key) | `IApiKeyResponse` |
|
|
413
|
-
| `getApiKey()` | [`GET /users/api-keys`](./api-reference.md#get-api-key) | `
|
|
413
|
+
| `getApiKey()` | [`GET /users/api-keys`](./api-reference.md#get-api-key) | `IMaskedApiKeyResponse`; 404 means no key |
|
|
414
414
|
| `deleteApiKey()` | [`DELETE /users/api-keys`](./api-reference.md#delete-api-key) | `IEmptyResult` (`unknown[]`) |
|
|
415
415
|
|
|
416
416
|
Login/social/reset bootstrap calls can use an unauthenticated client. The published authenticated user endpoints permit either a bearer JWT or `X-Api-Key`; use the credential type appropriate to the account and endpoint policy.
|
|
@@ -423,13 +423,13 @@ Login/social/reset bootstrap calls can use an unauthenticated client. The publis
|
|
|
423
423
|
| `discovery(issuer)` | `GET {issuer}/.well-known/oauth-authorization-server`; requires HTTPS and matching issuer | `IOAuthAuthorizationServer` |
|
|
424
424
|
| `authorize({ clientId, redirectUri, scopes })` | Discover resource/server and generate a fresh S256 verifier, state, and optional OIDC nonce | `IOAuthAuthorizationRequest` |
|
|
425
425
|
| `exchangeCode(callbackUrl, request, clientSecret?)` | Validate callback URI/state/issuer and submit the authorization code | `IOAuthTokenResponse` |
|
|
426
|
-
| `token(payload)` | [`POST /oauth/token`](./api-reference.md#exchange-a-code-or-
|
|
426
|
+
| `token(payload)` | [`POST /oauth/token`](./api-reference.md#exchange-a-code-refresh-token-or-subject-token-for-an-access-token), with code or refresh grant | `IOAuthTokenResponse` |
|
|
427
427
|
| `revoke(payload)` | [`POST /oauth/revoke`](./api-reference.md#revoke-a-token) | `void` |
|
|
428
428
|
| `userinfo()` | `GET /oauth/userinfo`, using the current OAuth bearer token with `openid` | `IOAuthUserInfo` |
|
|
429
429
|
|
|
430
430
|
All request types, full payload examples and response shapes are in the [OAuth guide](./oauth-guide.md). `IOAuthTokenPayload` is a discriminated union: code exchange requires `code`, `redirect_uri`, and `code_verifier`; refresh requires `refresh_token`; both require `client_id` and optionally accept `client_secret` and `resource`. `IOAuthRevokePayload` requires `token` and `client_id`, with optional `client_secret` and `token_type_hint`.
|
|
431
431
|
|
|
432
|
-
Metadata, discovery, token, and revoke calls remove owner headers. UserInfo uses the configured credential; construct the client with `token` for OAuth. OAuth bodies have no Assinafy envelope. The SDK returns credentials to the caller and does not persist, retry, or automatically refresh them. Store authorization requests in a single-use session; serialize refreshes across workers and atomically save the rotated result. Use an OIDC library to validate ID tokens before relying on identity claims.
|
|
432
|
+
Metadata, discovery, token, and revoke calls remove owner headers. UserInfo uses the configured credential; construct the client with `token` for OAuth. OAuth bodies have no Assinafy envelope. The SDK returns credentials to the caller and does not persist, retry, or automatically refresh them. A refresh response without a new `refresh_token`, or with the submitted one, throws `ValidationError` with `errors.field` set to `'refresh_token'`; do not reuse the submitted token, reconnect instead. Store authorization requests in a single-use session; serialize refreshes across workers and atomically save the rotated result. Use an OIDC library to validate ID tokens before relying on identity claims.
|
|
433
433
|
|
|
434
434
|
## Fields (`client.fields`)
|
|
435
435
|
|
|
@@ -515,14 +515,14 @@ Template list params support pagination, published `search`, and compatible `sor
|
|
|
515
515
|
|
|
516
516
|
Registration payload: `{ url: string; email: string; events?: string[]; is_active?: boolean }`. When `events` is omitted the SDK uses `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document`, and `document_processing_failed`; pass `[]` deliberately for none. Dispatch filters extend pagination with `{ event?, delivered?, from?, to?, sort?: 'created_at' | '-created_at' }`; sort is a compatibility extension. Dispatch `search` is unsupported and rejected locally. The API does not expose a delete-subscription operation; use `inactivate`.
|
|
517
517
|
|
|
518
|
-
Decline operations require a non-empty reason of at most 2,000 Unicode characters. `signers.findByEmail` follows pagination metadata until an exact case-insensitive email match is found or the search is exhausted.
|
|
518
|
+
Decline operations require a non-empty reason of at most 2,000 Unicode characters. `signers.findByEmail` follows pagination metadata until an exact case-insensitive email match is found or the search is exhausted; when a response carries no pagination metadata a partial page ends the search, and the scan is bounded at 100 pages.
|
|
519
519
|
|
|
520
520
|
## Responses, pagination, errors, and binary data
|
|
521
521
|
|
|
522
522
|
- JSON responses with `data` are unwrapped from the API envelope; direct status bodies remain `IStatusResponse`. Paginated calls resolve to `{ data: T[]; meta?: { current_page?, last_page?, per_page?, total? } }`; metadata comes from `X-Pagination-*` headers.
|
|
523
523
|
- Binary methods resolve to Node.js `Buffer`; the SDK is not a browser package. It never writes downloaded data to disk.
|
|
524
524
|
- `ValidationError` means local input validation failed before a request. `ApiError` exposes `statusCode`, `responseData`, `wwwAuthenticate` and `retryAfter`; binary JSON error bodies are decoded before normalization. OAuth responses are flat JSON, and OAuth revocation resolves to `undefined`. `NetworkError` covers timeout/DNS/transport failures. `PartialWorkflowError` reports `documents upload --wait` or a multi-step helper that failed after creating resources and exposes `documentId` and `signerIds`. All extend `AssinafyError`, which exposes `context` and preserves `cause` where available.
|
|
525
|
-
- `normalizeBaseUrl(url)` is exported and removes one trailing slash.
|
|
525
|
+
- `normalizeBaseUrl(url)` is exported and removes one trailing slash. The CLI-facing guards `requireDocumentArtifactName(name)` and `requireSignerImageType(type)` are also exported.
|
|
526
526
|
|
|
527
527
|
Exported error constructors/helpers are `new AssinafyError(message, context?, { cause? }?)`, `new ApiError(message, statusCode, responseData?, { cause?, wwwAuthenticate?, retryAfter? }?)`, `ApiError.fromResponse(statusCode, responseData, headers?)`, `new ValidationError(message?, errors?)`, `new NetworkError(message, { cause? }?)`, and `new PartialWorkflowError(message, { documentId?, signerIds? }, { cause? }?)`. Resource classes and all named request/response types are also exported for dependency injection and type annotations; normal applications should obtain resource instances from `AssinafyClient`.
|
|
528
528
|
|
package/docs/users.md
CHANGED
|
@@ -39,7 +39,8 @@ Usage: assinafy users stats [options]
|
|
|
39
39
|
Show document KPIs across the user's accounts
|
|
40
40
|
|
|
41
41
|
Options:
|
|
42
|
-
--granularity <value> monthly or daily (
|
|
42
|
+
--granularity <value> monthly or daily (choices: "monthly", "daily", default:
|
|
43
|
+
"monthly")
|
|
43
44
|
--month <yyyy-mm> Month required for daily granularity
|
|
44
45
|
-h, --help display help for command
|
|
45
46
|
```
|
package/docs/workspaces.md
CHANGED
|
@@ -31,7 +31,8 @@ Create a workspace (account)
|
|
|
31
31
|
|
|
32
32
|
Options:
|
|
33
33
|
--name <name> Workspace name
|
|
34
|
-
--notification-sender <type> Notification sender: User or Account
|
|
34
|
+
--notification-sender <type> Notification sender: User or Account (choices:
|
|
35
|
+
"User", "Account")
|
|
35
36
|
--primary-color <hex> Primary brand color
|
|
36
37
|
--secondary-color <hex> Secondary brand color
|
|
37
38
|
-h, --help display help for command
|
|
@@ -87,7 +88,8 @@ Arguments:
|
|
|
87
88
|
id Account/workspace ID
|
|
88
89
|
|
|
89
90
|
Options:
|
|
90
|
-
--granularity <value> monthly or daily (
|
|
91
|
+
--granularity <value> monthly or daily (choices: "monthly", "daily", default:
|
|
92
|
+
"monthly")
|
|
91
93
|
--month <yyyy-mm> Month required for daily granularity
|
|
92
94
|
-h, --help display help for command
|
|
93
95
|
```
|
|
@@ -168,7 +170,8 @@ Arguments:
|
|
|
168
170
|
|
|
169
171
|
Options:
|
|
170
172
|
--name <name> New name
|
|
171
|
-
--notification-sender <type> Notification sender: User or Account
|
|
173
|
+
--notification-sender <type> Notification sender: User or Account (choices:
|
|
174
|
+
"User", "Account")
|
|
172
175
|
--primary-color <hex> Primary brand color (pass empty to clear)
|
|
173
176
|
--secondary-color <hex> Secondary brand color (pass empty to clear)
|
|
174
177
|
-h, --help display help for command
|