@assinafy/sdk 2.4.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/CHANGELOG.md +7 -0
- package/README.en.md +3 -0
- package/README.md +3 -0
- package/dist/index.d.mts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +14 -6
- package/dist/index.mjs +14 -6
- package/docs/API_COVERAGE.md +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.4.1] - 2026-09-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- OAuth's `webhooks:write` scope is available in `OAuthScope` and documented for
|
|
15
|
+
webhook subscription updates and inactivation.
|
|
16
|
+
|
|
10
17
|
## [2.4.0] - 2026-09-21
|
|
11
18
|
|
|
12
19
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -228,6 +228,7 @@ await client.oauth.getUserInfo(tokens.access_token); // OIDC claims; needs `open
|
|
|
228
228
|
| `templates:read` | Read templates |
|
|
229
229
|
| `templates:write` | Create and change templates |
|
|
230
230
|
| `account:read` | Read the workspace's profile, theme and logo |
|
|
231
|
+
| `webhooks:write` | Update or inactivate the workspace's webhook subscription |
|
|
231
232
|
| `openid` | Receive an `id_token` identifying the user |
|
|
232
233
|
| `profile` | Read the user's name |
|
|
233
234
|
| `email` | Read the user's email and whether it is verified |
|
|
@@ -1095,6 +1096,8 @@ await client.users.updateNotificationPreferences({
|
|
|
1095
1096
|
|
|
1096
1097
|
### Webhooks
|
|
1097
1098
|
|
|
1099
|
+
OAuth tokens need `webhooks:write` for `register()` and `inactivate()`.
|
|
1100
|
+
|
|
1098
1101
|
```ts
|
|
1099
1102
|
await client.webhooks.register({
|
|
1100
1103
|
url: 'https://example.com/webhooks/assinafy',
|
package/README.md
CHANGED
|
@@ -222,6 +222,7 @@ await client.oauth.getUserInfo(tokens.access_token); // claims OIDC; exige `ope
|
|
|
222
222
|
| `templates:read` | Ler templates |
|
|
223
223
|
| `templates:write` | Criar e alterar templates |
|
|
224
224
|
| `account:read` | Ler perfil, tema e logotipo do workspace |
|
|
225
|
+
| `webhooks:write` | Atualizar ou inativar a assinatura de webhooks do workspace |
|
|
225
226
|
| `openid` | Receber um `id_token` identificando o usuário |
|
|
226
227
|
| `profile` | Ler o nome do usuário |
|
|
227
228
|
| `email` | Ler o e-mail do usuário e se está verificado |
|
|
@@ -1093,6 +1094,8 @@ await client.users.updateNotificationPreferences({
|
|
|
1093
1094
|
|
|
1094
1095
|
### Webhooks
|
|
1095
1096
|
|
|
1097
|
+
Tokens OAuth exigem `webhooks:write` para `register()` e `inactivate()`.
|
|
1098
|
+
|
|
1096
1099
|
```ts
|
|
1097
1100
|
await client.webhooks.register({
|
|
1098
1101
|
url: 'https://exemplo.com.br/webhooks/assinafy',
|
package/dist/index.d.mts
CHANGED
|
@@ -1154,7 +1154,7 @@ interface IUpdateTagPayload {
|
|
|
1154
1154
|
* `scopes_supported` in
|
|
1155
1155
|
* {@link IOAuthAuthorizationServerMetadata}.
|
|
1156
1156
|
*/
|
|
1157
|
-
type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
|
|
1157
|
+
type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'webhooks:write' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
|
|
1158
1158
|
/**
|
|
1159
1159
|
* RFC 9728 protected-resource metadata served at
|
|
1160
1160
|
* `https://api.assinafy.com.br/.well-known/oauth-protected-resource`.
|
|
@@ -3127,6 +3127,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
3127
3127
|
* When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
|
|
3128
3128
|
* (`document_ready`, `document_prepared`, `signer_signed_document`,
|
|
3129
3129
|
* `signer_rejected_document`, `document_processing_failed`).
|
|
3130
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3130
3131
|
*
|
|
3131
3132
|
* @param payload - Subscription details. `url` and `email` are required;
|
|
3132
3133
|
* `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
|
|
@@ -3150,7 +3151,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3150
3151
|
* ```
|
|
3151
3152
|
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
3152
3153
|
* `is_active` has the wrong type, or no account ID is available.
|
|
3153
|
-
* @throws {ApiError} If the API rejects the subscription
|
|
3154
|
+
* @throws {ApiError} If the API rejects the subscription, including `403`
|
|
3155
|
+
* when an OAuth token lacks `webhooks:write`.
|
|
3154
3156
|
*
|
|
3155
3157
|
* @example
|
|
3156
3158
|
* ```ts
|
|
@@ -3209,6 +3211,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
3209
3211
|
* subscription-delete route. The subscription is retained (with its `url`
|
|
3210
3212
|
* and `events`) and simply stops firing; re-enable it by calling
|
|
3211
3213
|
* {@link WebhookResource.register} again with `is_active: true`.
|
|
3214
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3212
3215
|
*
|
|
3213
3216
|
* @param accountId - Override the client's default account ID.
|
|
3214
3217
|
* @returns The subscription with `is_active` flipped to `false`. Response
|
|
@@ -3229,7 +3232,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3229
3232
|
* }
|
|
3230
3233
|
* ```
|
|
3231
3234
|
* @throws {ValidationError} If no account ID is available.
|
|
3232
|
-
* @throws {ApiError} If the API rejects the request
|
|
3235
|
+
* @throws {ApiError} If the API rejects the request, including `403` when
|
|
3236
|
+
* an OAuth token lacks `webhooks:write`.
|
|
3233
3237
|
*
|
|
3234
3238
|
* @example
|
|
3235
3239
|
* ```ts
|
|
@@ -4243,7 +4247,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4243
4247
|
* "scopes_supported": [
|
|
4244
4248
|
* "documents:read", "documents:write",
|
|
4245
4249
|
* "templates:read", "templates:write",
|
|
4246
|
-
* "account:read", "openid", "profile", "email"
|
|
4250
|
+
* "account:read", "webhooks:write", "openid", "profile", "email"
|
|
4247
4251
|
* ],
|
|
4248
4252
|
* "bearer_methods_supported": ["header"]
|
|
4249
4253
|
* }
|
|
@@ -4280,16 +4284,19 @@ declare class OAuthResource extends BaseResource {
|
|
|
4280
4284
|
* "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
|
|
4281
4285
|
* "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
|
|
4282
4286
|
* "scopes_supported": ["documents:read", "documents:write", "templates:read",
|
|
4283
|
-
* "templates:write", "account:read", "openid",
|
|
4287
|
+
* "templates:write", "account:read", "webhooks:write", "openid",
|
|
4284
4288
|
* "profile", "email", "offline_access"],
|
|
4285
4289
|
* "response_types_supported": ["code"],
|
|
4286
|
-
* "grant_types_supported": ["authorization_code", "refresh_token"
|
|
4290
|
+
* "grant_types_supported": ["authorization_code", "refresh_token",
|
|
4291
|
+
* "urn:ietf:params:oauth:grant-type:token-exchange"],
|
|
4287
4292
|
* "code_challenge_methods_supported": ["S256"],
|
|
4288
4293
|
* "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
|
|
4289
4294
|
* "authorization_response_iss_parameter_supported": true,
|
|
4290
4295
|
* "client_id_metadata_document_supported": true
|
|
4291
4296
|
* }
|
|
4292
4297
|
* ```
|
|
4298
|
+
* The token-exchange grant is reserved for Assinafy's internal service
|
|
4299
|
+
* clients; integrations use `authorization_code` and `refresh_token`.
|
|
4293
4300
|
* @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
|
|
4294
4301
|
* or the document's own `issuer` disagrees with where it was fetched from
|
|
4295
4302
|
* (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
|
|
@@ -4323,6 +4330,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4323
4330
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
4324
4331
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
4325
4332
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
4333
|
+
* `webhooks:write` permits subscription updates and inactivation.
|
|
4326
4334
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
4327
4335
|
* endpoint yourself. Defaults to the discovered
|
|
4328
4336
|
* `authorization_endpoint`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1154,7 +1154,7 @@ interface IUpdateTagPayload {
|
|
|
1154
1154
|
* `scopes_supported` in
|
|
1155
1155
|
* {@link IOAuthAuthorizationServerMetadata}.
|
|
1156
1156
|
*/
|
|
1157
|
-
type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
|
|
1157
|
+
type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'webhooks:write' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
|
|
1158
1158
|
/**
|
|
1159
1159
|
* RFC 9728 protected-resource metadata served at
|
|
1160
1160
|
* `https://api.assinafy.com.br/.well-known/oauth-protected-resource`.
|
|
@@ -3127,6 +3127,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
3127
3127
|
* When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
|
|
3128
3128
|
* (`document_ready`, `document_prepared`, `signer_signed_document`,
|
|
3129
3129
|
* `signer_rejected_document`, `document_processing_failed`).
|
|
3130
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3130
3131
|
*
|
|
3131
3132
|
* @param payload - Subscription details. `url` and `email` are required;
|
|
3132
3133
|
* `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
|
|
@@ -3150,7 +3151,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3150
3151
|
* ```
|
|
3151
3152
|
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
3152
3153
|
* `is_active` has the wrong type, or no account ID is available.
|
|
3153
|
-
* @throws {ApiError} If the API rejects the subscription
|
|
3154
|
+
* @throws {ApiError} If the API rejects the subscription, including `403`
|
|
3155
|
+
* when an OAuth token lacks `webhooks:write`.
|
|
3154
3156
|
*
|
|
3155
3157
|
* @example
|
|
3156
3158
|
* ```ts
|
|
@@ -3209,6 +3211,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
3209
3211
|
* subscription-delete route. The subscription is retained (with its `url`
|
|
3210
3212
|
* and `events`) and simply stops firing; re-enable it by calling
|
|
3211
3213
|
* {@link WebhookResource.register} again with `is_active: true`.
|
|
3214
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3212
3215
|
*
|
|
3213
3216
|
* @param accountId - Override the client's default account ID.
|
|
3214
3217
|
* @returns The subscription with `is_active` flipped to `false`. Response
|
|
@@ -3229,7 +3232,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3229
3232
|
* }
|
|
3230
3233
|
* ```
|
|
3231
3234
|
* @throws {ValidationError} If no account ID is available.
|
|
3232
|
-
* @throws {ApiError} If the API rejects the request
|
|
3235
|
+
* @throws {ApiError} If the API rejects the request, including `403` when
|
|
3236
|
+
* an OAuth token lacks `webhooks:write`.
|
|
3233
3237
|
*
|
|
3234
3238
|
* @example
|
|
3235
3239
|
* ```ts
|
|
@@ -4243,7 +4247,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4243
4247
|
* "scopes_supported": [
|
|
4244
4248
|
* "documents:read", "documents:write",
|
|
4245
4249
|
* "templates:read", "templates:write",
|
|
4246
|
-
* "account:read", "openid", "profile", "email"
|
|
4250
|
+
* "account:read", "webhooks:write", "openid", "profile", "email"
|
|
4247
4251
|
* ],
|
|
4248
4252
|
* "bearer_methods_supported": ["header"]
|
|
4249
4253
|
* }
|
|
@@ -4280,16 +4284,19 @@ declare class OAuthResource extends BaseResource {
|
|
|
4280
4284
|
* "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
|
|
4281
4285
|
* "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
|
|
4282
4286
|
* "scopes_supported": ["documents:read", "documents:write", "templates:read",
|
|
4283
|
-
* "templates:write", "account:read", "openid",
|
|
4287
|
+
* "templates:write", "account:read", "webhooks:write", "openid",
|
|
4284
4288
|
* "profile", "email", "offline_access"],
|
|
4285
4289
|
* "response_types_supported": ["code"],
|
|
4286
|
-
* "grant_types_supported": ["authorization_code", "refresh_token"
|
|
4290
|
+
* "grant_types_supported": ["authorization_code", "refresh_token",
|
|
4291
|
+
* "urn:ietf:params:oauth:grant-type:token-exchange"],
|
|
4287
4292
|
* "code_challenge_methods_supported": ["S256"],
|
|
4288
4293
|
* "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
|
|
4289
4294
|
* "authorization_response_iss_parameter_supported": true,
|
|
4290
4295
|
* "client_id_metadata_document_supported": true
|
|
4291
4296
|
* }
|
|
4292
4297
|
* ```
|
|
4298
|
+
* The token-exchange grant is reserved for Assinafy's internal service
|
|
4299
|
+
* clients; integrations use `authorization_code` and `refresh_token`.
|
|
4293
4300
|
* @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
|
|
4294
4301
|
* or the document's own `issuer` disagrees with where it was fetched from
|
|
4295
4302
|
* (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
|
|
@@ -4323,6 +4330,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4323
4330
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
4324
4331
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
4325
4332
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
4333
|
+
* `webhooks:write` permits subscription updates and inactivation.
|
|
4326
4334
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
4327
4335
|
* endpoint yourself. Defaults to the discovered
|
|
4328
4336
|
* `authorization_endpoint`.
|
package/dist/index.js
CHANGED
|
@@ -634,7 +634,7 @@ var import_axios2 = __toESM(require("axios"));
|
|
|
634
634
|
// package.json
|
|
635
635
|
var package_default = {
|
|
636
636
|
name: "@assinafy/sdk",
|
|
637
|
-
version: "2.4.
|
|
637
|
+
version: "2.4.1",
|
|
638
638
|
packageManager: "bun@1.4.0",
|
|
639
639
|
description: "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
640
640
|
type: "commonjs",
|
|
@@ -3668,6 +3668,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
3668
3668
|
* When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
|
|
3669
3669
|
* (`document_ready`, `document_prepared`, `signer_signed_document`,
|
|
3670
3670
|
* `signer_rejected_document`, `document_processing_failed`).
|
|
3671
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3671
3672
|
*
|
|
3672
3673
|
* @param payload - Subscription details. `url` and `email` are required;
|
|
3673
3674
|
* `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
|
|
@@ -3691,7 +3692,8 @@ var WebhookResource = class extends BaseResource {
|
|
|
3691
3692
|
* ```
|
|
3692
3693
|
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
3693
3694
|
* `is_active` has the wrong type, or no account ID is available.
|
|
3694
|
-
* @throws {ApiError} If the API rejects the subscription
|
|
3695
|
+
* @throws {ApiError} If the API rejects the subscription, including `403`
|
|
3696
|
+
* when an OAuth token lacks `webhooks:write`.
|
|
3695
3697
|
*
|
|
3696
3698
|
* @example
|
|
3697
3699
|
* ```ts
|
|
@@ -3789,6 +3791,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
3789
3791
|
* subscription-delete route. The subscription is retained (with its `url`
|
|
3790
3792
|
* and `events`) and simply stops firing; re-enable it by calling
|
|
3791
3793
|
* {@link WebhookResource.register} again with `is_active: true`.
|
|
3794
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3792
3795
|
*
|
|
3793
3796
|
* @param accountId - Override the client's default account ID.
|
|
3794
3797
|
* @returns The subscription with `is_active` flipped to `false`. Response
|
|
@@ -3809,7 +3812,8 @@ var WebhookResource = class extends BaseResource {
|
|
|
3809
3812
|
* }
|
|
3810
3813
|
* ```
|
|
3811
3814
|
* @throws {ValidationError} If no account ID is available.
|
|
3812
|
-
* @throws {ApiError} If the API rejects the request
|
|
3815
|
+
* @throws {ApiError} If the API rejects the request, including `403` when
|
|
3816
|
+
* an OAuth token lacks `webhooks:write`.
|
|
3813
3817
|
*
|
|
3814
3818
|
* @example
|
|
3815
3819
|
* ```ts
|
|
@@ -4987,7 +4991,7 @@ var OAuthResource = class extends BaseResource {
|
|
|
4987
4991
|
* "scopes_supported": [
|
|
4988
4992
|
* "documents:read", "documents:write",
|
|
4989
4993
|
* "templates:read", "templates:write",
|
|
4990
|
-
* "account:read", "openid", "profile", "email"
|
|
4994
|
+
* "account:read", "webhooks:write", "openid", "profile", "email"
|
|
4991
4995
|
* ],
|
|
4992
4996
|
* "bearer_methods_supported": ["header"]
|
|
4993
4997
|
* }
|
|
@@ -5029,16 +5033,19 @@ var OAuthResource = class extends BaseResource {
|
|
|
5029
5033
|
* "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
|
|
5030
5034
|
* "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
|
|
5031
5035
|
* "scopes_supported": ["documents:read", "documents:write", "templates:read",
|
|
5032
|
-
* "templates:write", "account:read", "openid",
|
|
5036
|
+
* "templates:write", "account:read", "webhooks:write", "openid",
|
|
5033
5037
|
* "profile", "email", "offline_access"],
|
|
5034
5038
|
* "response_types_supported": ["code"],
|
|
5035
|
-
* "grant_types_supported": ["authorization_code", "refresh_token"
|
|
5039
|
+
* "grant_types_supported": ["authorization_code", "refresh_token",
|
|
5040
|
+
* "urn:ietf:params:oauth:grant-type:token-exchange"],
|
|
5036
5041
|
* "code_challenge_methods_supported": ["S256"],
|
|
5037
5042
|
* "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
|
|
5038
5043
|
* "authorization_response_iss_parameter_supported": true,
|
|
5039
5044
|
* "client_id_metadata_document_supported": true
|
|
5040
5045
|
* }
|
|
5041
5046
|
* ```
|
|
5047
|
+
* The token-exchange grant is reserved for Assinafy's internal service
|
|
5048
|
+
* clients; integrations use `authorization_code` and `refresh_token`.
|
|
5042
5049
|
* @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
|
|
5043
5050
|
* or the document's own `issuer` disagrees with where it was fetched from
|
|
5044
5051
|
* (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
|
|
@@ -5086,6 +5093,7 @@ var OAuthResource = class extends BaseResource {
|
|
|
5086
5093
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
5087
5094
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
5088
5095
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
5096
|
+
* `webhooks:write` permits subscription updates and inactivation.
|
|
5089
5097
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
5090
5098
|
* endpoint yourself. Defaults to the discovered
|
|
5091
5099
|
* `authorization_endpoint`.
|
package/dist/index.mjs
CHANGED
|
@@ -574,7 +574,7 @@ import axios2 from "axios";
|
|
|
574
574
|
// package.json
|
|
575
575
|
var package_default = {
|
|
576
576
|
name: "@assinafy/sdk",
|
|
577
|
-
version: "2.4.
|
|
577
|
+
version: "2.4.1",
|
|
578
578
|
packageManager: "bun@1.4.0",
|
|
579
579
|
description: "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
580
580
|
type: "commonjs",
|
|
@@ -3608,6 +3608,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
3608
3608
|
* When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
|
|
3609
3609
|
* (`document_ready`, `document_prepared`, `signer_signed_document`,
|
|
3610
3610
|
* `signer_rejected_document`, `document_processing_failed`).
|
|
3611
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3611
3612
|
*
|
|
3612
3613
|
* @param payload - Subscription details. `url` and `email` are required;
|
|
3613
3614
|
* `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
|
|
@@ -3631,7 +3632,8 @@ var WebhookResource = class extends BaseResource {
|
|
|
3631
3632
|
* ```
|
|
3632
3633
|
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
3633
3634
|
* `is_active` has the wrong type, or no account ID is available.
|
|
3634
|
-
* @throws {ApiError} If the API rejects the subscription
|
|
3635
|
+
* @throws {ApiError} If the API rejects the subscription, including `403`
|
|
3636
|
+
* when an OAuth token lacks `webhooks:write`.
|
|
3635
3637
|
*
|
|
3636
3638
|
* @example
|
|
3637
3639
|
* ```ts
|
|
@@ -3729,6 +3731,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
3729
3731
|
* subscription-delete route. The subscription is retained (with its `url`
|
|
3730
3732
|
* and `events`) and simply stops firing; re-enable it by calling
|
|
3731
3733
|
* {@link WebhookResource.register} again with `is_active: true`.
|
|
3734
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
3732
3735
|
*
|
|
3733
3736
|
* @param accountId - Override the client's default account ID.
|
|
3734
3737
|
* @returns The subscription with `is_active` flipped to `false`. Response
|
|
@@ -3749,7 +3752,8 @@ var WebhookResource = class extends BaseResource {
|
|
|
3749
3752
|
* }
|
|
3750
3753
|
* ```
|
|
3751
3754
|
* @throws {ValidationError} If no account ID is available.
|
|
3752
|
-
* @throws {ApiError} If the API rejects the request
|
|
3755
|
+
* @throws {ApiError} If the API rejects the request, including `403` when
|
|
3756
|
+
* an OAuth token lacks `webhooks:write`.
|
|
3753
3757
|
*
|
|
3754
3758
|
* @example
|
|
3755
3759
|
* ```ts
|
|
@@ -4927,7 +4931,7 @@ var OAuthResource = class extends BaseResource {
|
|
|
4927
4931
|
* "scopes_supported": [
|
|
4928
4932
|
* "documents:read", "documents:write",
|
|
4929
4933
|
* "templates:read", "templates:write",
|
|
4930
|
-
* "account:read", "openid", "profile", "email"
|
|
4934
|
+
* "account:read", "webhooks:write", "openid", "profile", "email"
|
|
4931
4935
|
* ],
|
|
4932
4936
|
* "bearer_methods_supported": ["header"]
|
|
4933
4937
|
* }
|
|
@@ -4969,16 +4973,19 @@ var OAuthResource = class extends BaseResource {
|
|
|
4969
4973
|
* "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
|
|
4970
4974
|
* "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
|
|
4971
4975
|
* "scopes_supported": ["documents:read", "documents:write", "templates:read",
|
|
4972
|
-
* "templates:write", "account:read", "openid",
|
|
4976
|
+
* "templates:write", "account:read", "webhooks:write", "openid",
|
|
4973
4977
|
* "profile", "email", "offline_access"],
|
|
4974
4978
|
* "response_types_supported": ["code"],
|
|
4975
|
-
* "grant_types_supported": ["authorization_code", "refresh_token"
|
|
4979
|
+
* "grant_types_supported": ["authorization_code", "refresh_token",
|
|
4980
|
+
* "urn:ietf:params:oauth:grant-type:token-exchange"],
|
|
4976
4981
|
* "code_challenge_methods_supported": ["S256"],
|
|
4977
4982
|
* "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
|
|
4978
4983
|
* "authorization_response_iss_parameter_supported": true,
|
|
4979
4984
|
* "client_id_metadata_document_supported": true
|
|
4980
4985
|
* }
|
|
4981
4986
|
* ```
|
|
4987
|
+
* The token-exchange grant is reserved for Assinafy's internal service
|
|
4988
|
+
* clients; integrations use `authorization_code` and `refresh_token`.
|
|
4982
4989
|
* @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
|
|
4983
4990
|
* or the document's own `issuer` disagrees with where it was fetched from
|
|
4984
4991
|
* (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
|
|
@@ -5026,6 +5033,7 @@ var OAuthResource = class extends BaseResource {
|
|
|
5026
5033
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
5027
5034
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
5028
5035
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
5036
|
+
* `webhooks:write` permits subscription updates and inactivation.
|
|
5029
5037
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
5030
5038
|
* endpoint yourself. Defaults to the discovered
|
|
5031
5039
|
* `authorization_endpoint`.
|
package/docs/API_COVERAGE.md
CHANGED
|
@@ -101,6 +101,8 @@ operations answer with flat RFC 6749 / OIDC bodies rather than the
|
|
|
101
101
|
`{ status, message, data }` envelope used everywhere else, and the SDK returns
|
|
102
102
|
them unwrapped. The browser-facing `/oauth/authorize` page belongs to the
|
|
103
103
|
authorization server (`https://auth.assinafy.com.br`), not to this API.
|
|
104
|
+
The token endpoint also advertises an internal-service token-exchange grant;
|
|
105
|
+
ordinary OAuth applications use the two SDK methods listed below.
|
|
104
106
|
|
|
105
107
|
| Method | Path | SDK method | Status |
|
|
106
108
|
| --- | --- | --- | --- |
|