@assinafy/sdk 2.3.0 → 2.4.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 +34 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.4.0] - 2026-09-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **`assignments.estimateCost` now sends `signers` for `collect` too.** The
|
|
15
|
+
published contract marks `signers` as required only for `virtual`, but the
|
|
16
|
+
API rejects *any* estimate without it — `collect` requests came back as
|
|
17
|
+
`400 Pelo menos um signatários precisa ser informado.` Pricing is per signer
|
|
18
|
+
in both modes (`Whatsapp` costs 0.45 credits per signer,
|
|
19
|
+
`DigitalCertificate` two), so a signer-less body could never be priced.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- `IEstimateAssignmentCostPayload.signers` is now required. TypeScript callers
|
|
24
|
+
that omitted it for `collect` will stop compiling; those calls were already
|
|
25
|
+
failing at runtime, so no working code changes behaviour. Pass one descriptor
|
|
26
|
+
per signer —
|
|
27
|
+
`{}` prices the default Email channel:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
await client.assignments.estimateCost(documentId, {
|
|
31
|
+
method: 'collect',
|
|
32
|
+
signers: [{}, { verification_method: 'Whatsapp' }],
|
|
33
|
+
entries,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `buildAssignmentEstimatePayload` throws `ValidationError` for an empty
|
|
38
|
+
signer list in either mode, so JavaScript callers get a local error instead
|
|
39
|
+
of an opaque upstream rejection. The message is now method-neutral:
|
|
40
|
+
`At least one signer is required for a cost estimate`.
|
|
41
|
+
|
|
10
42
|
## [2.3.0] - 2026-09-20
|
|
11
43
|
|
|
12
44
|
### Added
|
|
@@ -621,7 +653,8 @@ fields (`cpf`, `whatsapp_phone_number`) with the PHP SDK and n8n node.
|
|
|
621
653
|
- High-level `uploadAndRequestSignatures` helper on `AssinafyClient`.
|
|
622
654
|
- `PaginatedResult<T>` with parsed `X-Pagination-*` header meta.
|
|
623
655
|
|
|
624
|
-
[Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.
|
|
656
|
+
[Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.4.0...HEAD
|
|
657
|
+
[2.4.0]: https://github.com/assinafy/typescript-sdk/compare/v2.3.0...v2.4.0
|
|
625
658
|
[2.3.0]: https://github.com/assinafy/typescript-sdk/compare/v2.2.0...v2.3.0
|
|
626
659
|
[2.2.0]: https://github.com/assinafy/typescript-sdk/compare/v2.1.2...v2.2.0
|
|
627
660
|
[2.1.2]: https://github.com/assinafy/typescript-sdk/compare/v2.1.1...v2.1.2
|
package/dist/index.d.mts
CHANGED
|
@@ -303,9 +303,13 @@ interface IAssignmentCostSigner {
|
|
|
303
303
|
*/
|
|
304
304
|
interface IEstimateAssignmentCostPayload {
|
|
305
305
|
method?: AssignmentMethod;
|
|
306
|
-
/**
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Required for both methods — the API rejects an estimate without it, and
|
|
308
|
+
* per-signer `verification_method` is what the estimate prices. `{}` prices
|
|
309
|
+
* the default Email channel.
|
|
310
|
+
*/
|
|
311
|
+
signers: IAssignmentCostSigner[];
|
|
312
|
+
/** Required for `collect`. */
|
|
309
313
|
entries?: IAssignmentEntry[];
|
|
310
314
|
}
|
|
311
315
|
/** A signer as embedded inside an assignment (richer than the bare {@link ISigner}). */
|
|
@@ -2933,7 +2937,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2933
2937
|
* }
|
|
2934
2938
|
* ```
|
|
2935
2939
|
* @throws {ValidationError} If `documentId` is missing, a `virtual` request
|
|
2936
|
-
* has no signer entry, or a `collect` request has no
|
|
2940
|
+
* has no signer entry, or a `collect` request has no signer entry or no
|
|
2941
|
+
* field-placement entry.
|
|
2937
2942
|
* @throws {ApiError} If the API rejects the request.
|
|
2938
2943
|
*
|
|
2939
2944
|
* @example
|
package/dist/index.d.ts
CHANGED
|
@@ -303,9 +303,13 @@ interface IAssignmentCostSigner {
|
|
|
303
303
|
*/
|
|
304
304
|
interface IEstimateAssignmentCostPayload {
|
|
305
305
|
method?: AssignmentMethod;
|
|
306
|
-
/**
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Required for both methods — the API rejects an estimate without it, and
|
|
308
|
+
* per-signer `verification_method` is what the estimate prices. `{}` prices
|
|
309
|
+
* the default Email channel.
|
|
310
|
+
*/
|
|
311
|
+
signers: IAssignmentCostSigner[];
|
|
312
|
+
/** Required for `collect`. */
|
|
309
313
|
entries?: IAssignmentEntry[];
|
|
310
314
|
}
|
|
311
315
|
/** A signer as embedded inside an assignment (richer than the bare {@link ISigner}). */
|
|
@@ -2933,7 +2937,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2933
2937
|
* }
|
|
2934
2938
|
* ```
|
|
2935
2939
|
* @throws {ValidationError} If `documentId` is missing, a `virtual` request
|
|
2936
|
-
* has no signer entry, or a `collect` request has no
|
|
2940
|
+
* has no signer entry, or a `collect` request has no signer entry or no
|
|
2941
|
+
* field-placement entry.
|
|
2937
2942
|
* @throws {ApiError} If the API rejects the request.
|
|
2938
2943
|
*
|
|
2939
2944
|
* @example
|
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.
|
|
637
|
+
version: "2.4.0",
|
|
638
638
|
packageManager: "bun@1.4.0",
|
|
639
639
|
description: "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
640
640
|
type: "commonjs",
|
|
@@ -1071,8 +1071,8 @@ function buildAssignmentEstimatePayload(payload) {
|
|
|
1071
1071
|
throw new ValidationError("method must be virtual or collect");
|
|
1072
1072
|
}
|
|
1073
1073
|
const signers = Array.isArray(payload.signers) ? payload.signers : [];
|
|
1074
|
-
if (
|
|
1075
|
-
throw new ValidationError("At least one signer is required for a
|
|
1074
|
+
if (signers.length === 0) {
|
|
1075
|
+
throw new ValidationError("At least one signer is required for a cost estimate");
|
|
1076
1076
|
}
|
|
1077
1077
|
const entries = payload.entries === void 0 ? void 0 : normaliseAssignmentEntries(payload.entries);
|
|
1078
1078
|
if (method === "collect" && (!entries || entries.length === 0)) {
|
|
@@ -1080,7 +1080,7 @@ function buildAssignmentEstimatePayload(payload) {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
return cleanParams({
|
|
1082
1082
|
method,
|
|
1083
|
-
signers: signers.
|
|
1083
|
+
signers: signers.map((signer) => normaliseEstimateSigner(signer)),
|
|
1084
1084
|
entries
|
|
1085
1085
|
});
|
|
1086
1086
|
}
|
|
@@ -1461,7 +1461,8 @@ var AssignmentResource = class extends BaseResource {
|
|
|
1461
1461
|
* }
|
|
1462
1462
|
* ```
|
|
1463
1463
|
* @throws {ValidationError} If `documentId` is missing, a `virtual` request
|
|
1464
|
-
* has no signer entry, or a `collect` request has no
|
|
1464
|
+
* has no signer entry, or a `collect` request has no signer entry or no
|
|
1465
|
+
* field-placement entry.
|
|
1465
1466
|
* @throws {ApiError} If the API rejects the request.
|
|
1466
1467
|
*
|
|
1467
1468
|
* @example
|
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.
|
|
577
|
+
version: "2.4.0",
|
|
578
578
|
packageManager: "bun@1.4.0",
|
|
579
579
|
description: "TypeScript SDK for Assinafy API - Digital signature platform",
|
|
580
580
|
type: "commonjs",
|
|
@@ -1011,8 +1011,8 @@ function buildAssignmentEstimatePayload(payload) {
|
|
|
1011
1011
|
throw new ValidationError("method must be virtual or collect");
|
|
1012
1012
|
}
|
|
1013
1013
|
const signers = Array.isArray(payload.signers) ? payload.signers : [];
|
|
1014
|
-
if (
|
|
1015
|
-
throw new ValidationError("At least one signer is required for a
|
|
1014
|
+
if (signers.length === 0) {
|
|
1015
|
+
throw new ValidationError("At least one signer is required for a cost estimate");
|
|
1016
1016
|
}
|
|
1017
1017
|
const entries = payload.entries === void 0 ? void 0 : normaliseAssignmentEntries(payload.entries);
|
|
1018
1018
|
if (method === "collect" && (!entries || entries.length === 0)) {
|
|
@@ -1020,7 +1020,7 @@ function buildAssignmentEstimatePayload(payload) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
return cleanParams({
|
|
1022
1022
|
method,
|
|
1023
|
-
signers: signers.
|
|
1023
|
+
signers: signers.map((signer) => normaliseEstimateSigner(signer)),
|
|
1024
1024
|
entries
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
@@ -1401,7 +1401,8 @@ var AssignmentResource = class extends BaseResource {
|
|
|
1401
1401
|
* }
|
|
1402
1402
|
* ```
|
|
1403
1403
|
* @throws {ValidationError} If `documentId` is missing, a `virtual` request
|
|
1404
|
-
* has no signer entry, or a `collect` request has no
|
|
1404
|
+
* has no signer entry, or a `collect` request has no signer entry or no
|
|
1405
|
+
* field-placement entry.
|
|
1405
1406
|
* @throws {ApiError} If the API rejects the request.
|
|
1406
1407
|
*
|
|
1407
1408
|
* @example
|