@assinafy/sdk 3.0.0 → 3.0.2

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 CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.2] - 2026-11-12
11
+
12
+ ### Fixed
13
+
14
+ - `contracts.set()` accepts `auto_renew: null`, as the API does: a contract
15
+ resets auto-renewal to `false`, and a pending amendment drops it from its
16
+ terms. `IDocumentContractInput.auto_renew` is `boolean | null`.
17
+ - `assignments.estimateCost()` and `documents.estimateCostFromTemplate()` send
18
+ each signer's `step`, which the API reads to keep every `DigitalCertificate`
19
+ signer alone in its step, so estimates with several certificate signers in
20
+ their own steps succeed. Assignment estimates check the signing order as
21
+ creation does. `IAssignmentCostSigner` and `ITemplateCostSigner` accept `step`.
22
+
23
+ ## [3.0.1] - 2026-11-11
24
+
25
+ ### Fixed
26
+
27
+ - `DigitalCertificate` and `IdDocumentFaceMatchBasic` signers accept the
28
+ `Bypass` notification on assignment, template and envelope requests and cost
29
+ estimates, as the API does.
30
+
10
31
  ## [3.0.0] - 2026-11-11
11
32
 
12
33
  ### Breaking changes
@@ -1018,7 +1039,9 @@ signer fields with `cpf` and `whatsapp_phone_number`.
1018
1039
  - High-level `uploadAndRequestSignatures` helper on `AssinafyClient`.
1019
1040
  - `PaginatedResult<T>` with parsed `X-Pagination-*` header meta.
1020
1041
 
1021
- [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v3.0.0...HEAD
1042
+ [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v3.0.2...HEAD
1043
+ [3.0.2]: https://github.com/assinafy/typescript-sdk/compare/v3.0.1...v3.0.2
1044
+ [3.0.1]: https://github.com/assinafy/typescript-sdk/compare/v3.0.0...v3.0.1
1022
1045
  [3.0.0]: https://github.com/assinafy/typescript-sdk/compare/v2.11.0...v3.0.0
1023
1046
  [2.11.0]: https://github.com/assinafy/typescript-sdk/compare/v2.10.0...v2.11.0
1024
1047
  [2.10.0]: https://github.com/assinafy/typescript-sdk/compare/v2.9.1...v2.10.0
package/dist/index.d.mts CHANGED
@@ -42,8 +42,8 @@ type AssignmentMethod = 'virtual' | 'collect';
42
42
  * verification code travels on the notification channel, so `Email` pairs only
43
43
  * with `Email` and `Whatsapp` only with `Whatsapp`. `DigitalCertificate`
44
44
  * and `IdDocumentFaceMatchBasic` carry no OTP and may be announced over either
45
- * channel; `Bypass` may also use the `Bypass` notification, which sends no
46
- * invitation. The SDK rejects an invalid pairing before the request; the API
45
+ * channel; those and `Bypass` may also use the `Bypass` notification, which
46
+ * sends no invitation. The SDK rejects an invalid pairing before the request; the API
47
47
  * answers `400`. `embedded` signers use `Email`, `Whatsapp` or `Bypass`.
48
48
  *
49
49
  * Send neither field to get `Email`/`Email`; send one and the other is
@@ -132,7 +132,7 @@ interface ISignerIdentityReview {
132
132
  * | --- | --- | --- |
133
133
  * | `Email` | An `email`. | 0 credits |
134
134
  * | `Whatsapp` | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
135
- * | `Bypass` | Sends nothing; only with `Bypass` verification (per-account feature). The signer is reached through your app, e.g. an embed session. | — |
135
+ * | `Bypass` | Sends nothing; with `Bypass`, `DigitalCertificate` or `IdDocumentFaceMatchBasic` verification. Your app delivers the link, e.g. an embed session. | — |
136
136
  *
137
137
  * Notifications are charged when the assignment is created and again on every
138
138
  * resend. See {@link AssignmentVerificationMethod} for the pairing rules.
@@ -400,6 +400,8 @@ interface IAssignmentEntry {
400
400
  interface IAssignmentCostSigner {
401
401
  verification_method?: AssignmentVerificationMethod;
402
402
  notification_methods?: AssignmentNotificationMethod[];
403
+ /** The signer's signing step at creation; each `DigitalCertificate` signer needs its own. */
404
+ step?: number;
403
405
  }
404
406
  /**
405
407
  * Official request body for
@@ -679,7 +681,8 @@ interface IDocumentContractInput {
679
681
  currency?: string | null;
680
682
  start_date?: string | null;
681
683
  end_date?: string | null;
682
- auto_renew?: boolean;
684
+ /** Null resets auto-renewal to false, or drops it from a pending amendment's terms. */
685
+ auto_renew?: boolean | null;
683
686
  renewal_term_months?: number | null;
684
687
  notice_period_days?: number | null;
685
688
  owner_id?: string | null;
@@ -1262,13 +1265,15 @@ interface ITemplateSigner {
1262
1265
  step?: number;
1263
1266
  }
1264
1267
  /**
1265
- * Role/channel descriptor used only for template cost estimation. The official
1266
- * schema intentionally omits signer identity and sequential-signing fields.
1268
+ * Role/channel descriptor used only for template cost estimation. It carries no
1269
+ * signer identity; `step` is the role's signing step at creation, which the API
1270
+ * reads to keep each `DigitalCertificate` signer alone in its step.
1267
1271
  */
1268
1272
  interface ITemplateCostSigner {
1269
1273
  role_id: string;
1270
1274
  verification_method?: AssignmentVerificationMethod;
1271
1275
  notification_methods?: AssignmentNotificationMethod[];
1276
+ step?: number;
1272
1277
  }
1273
1278
  /** Options for creating a document from a template. */
1274
1279
  interface ICreateDocumentFromTemplateOptions {
@@ -2843,9 +2848,10 @@ declare class DocumentResource extends BaseResource {
2843
2848
  *
2844
2849
  * @param templateId - The template that would be instantiated.
2845
2850
  * @param signers - One channel descriptor per template role. Cost requests
2846
- * use only `role_id`, `verification_method`, and `notification_methods`;
2847
- * they do not send a signer ID or signing-order step, and editor roles are
2848
- * ignored by the cost calculation.
2851
+ * use `role_id`, `verification_method`, `notification_methods`, and the
2852
+ * role's creation `step`, which the API reads to keep each
2853
+ * `DigitalCertificate` signer alone in its step; they send no signer ID,
2854
+ * and editor roles are ignored by the cost calculation.
2849
2855
  * @param accountId - Override the client's default account ID.
2850
2856
  * @returns An {@link ICostEstimate}: `total_credits`, balances, and a
2851
2857
  * per-line `breakdown` of what the operation would consume:
@@ -4043,9 +4049,10 @@ declare class AssignmentResource extends BaseResource {
4043
4049
  * ```
4044
4050
  *
4045
4051
  * @param documentId - The document the assignment would be created on.
4046
- * @param payload - `method` plus channel-only signer descriptors and/or
4047
- * `collect`-mode `entries`. Create-only fields and signer IDs are not part
4048
- * of this request schema.
4052
+ * @param payload - `method` plus signer channel descriptors and/or
4053
+ * `collect`-mode `entries`. Signer IDs are not part of this request. Send
4054
+ * each signer's creation `step` too: the API keeps every
4055
+ * `DigitalCertificate` signer alone in its step when it estimates.
4049
4056
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
4050
4057
  * line-item `breakdown`, and a `has_sufficient_resources` gate.
4051
4058
  * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
@@ -4067,7 +4074,8 @@ declare class AssignmentResource extends BaseResource {
4067
4074
  * ```
4068
4075
  * @throws {ValidationError} If `documentId` is missing, a `virtual` request
4069
4076
  * has no signer entry, or a `collect` request has no signer entry or no
4070
- * field-placement entry, or combines `DigitalCertificate` with `collect`.
4077
+ * field-placement entry, the signing order is invalid, or the request
4078
+ * combines `DigitalCertificate` with `collect`.
4071
4079
  * The last case has `errors.code ===
4072
4080
  * 'digital_certificate_requires_virtual_method'`.
4073
4081
  * @throws {ApiError} If the API rejects the request.
@@ -8168,7 +8176,8 @@ declare class ContractResource extends BaseResource {
8168
8176
  * @param payload.currency - Three-letter currency; null resets as documented.
8169
8177
  * @param payload.start_date - Start date (`YYYY-MM-DD`), or null.
8170
8178
  * @param payload.end_date - End date (`YYYY-MM-DD`), or null.
8171
- * @param payload.auto_renew - Whether the hourly lifecycle starts a new term.
8179
+ * @param payload.auto_renew - Whether the hourly lifecycle starts a new term;
8180
+ * null resets it to false, or drops it from a pending amendment's terms.
8172
8181
  * @param payload.renewal_term_months - 1–600 months, or null for the default.
8173
8182
  * @param payload.notice_period_days - 0–3650 days, or null to disable notice.
8174
8183
  * @param payload.owner_id - Active workspace member ID, or null.
@@ -9573,4 +9582,5 @@ declare const MAX_LIST_PAGE_SIZE = 50;
9573
9582
 
9574
9583
  declare const SDK_USER_AGENT: string;
9575
9584
 
9576
- export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, type DocumentArtifactName, type DocumentContractRelationType, type DocumentContractStatus, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, EmbedResource, EnvelopeResource, FieldsResource, type IAcceptTermsResult, type IAccountLimits, type IAccountSigningFeatures, type IAccountTheme, type IAccountUsage, type IAccountUsageBalance, type IAddEnvelopeDocumentPayload, type IApiFieldError, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type ICertifiedCopyResendResult, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateEnvelopePayload, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentContract, type IDocumentContractAmendment, type IDocumentContractExternalReference, type IDocumentContractInput, type IDocumentContractListParams, type IDocumentContractListResponse, type IDocumentDetailsOptions, type IDocumentDetailsResponse, type IDocumentEnvelopeRef, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentRenderOptions, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEmbedOrigin, type IEmbedSession, type IEnvelope, type IEnvelopeActivity, type IEnvelopeCancelResult, type IEnvelopeDocument, type IEnvelopeDocumentInput, type IEnvelopeDocumentSigner, type IEnvelopeListParams, type IEnvelopeListResponse, type IEnvelopeResendResponse, type IEnvelopeSignerInput, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPolicy, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IPushPreferences, type IRateLimitInfo, type IRenameDocumentResponse, type IRenewDocumentContractPayload, type IResendCostEstimate, type IResendEmailResponse, type IReviewIdentityVerificationPayload, type ISendTokenResult, type ISignFieldEntry, type ISigner, type ISignerCertifiedCopyStatus, type ISignerDocumentListParams, type ISignerIdentityReview, type ISignerIdentityVerification, type ISignerIdentityVerificationSession, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningCurrentSigner, type ISigningDocument, type ISigningProgress, type ISigningReadOptions, type ISigningUrl, type IStartIdentityVerificationPayload, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITerminateDocumentContractPayload, type ITotpEnrollment, type IUpdateEnvelopePayload, type IUpdateFieldPayload, type IUpdateNotificationPolicyPayload, type IUpdateNotificationPreferences, type IUpdatePushPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointCreateResponse, type IWebhookEndpointSecret, type IWebhookEndpointSecretRotation, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type IdentityVerificationImageName, type IdentityVerificationStatus, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationPolicyEvent, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, type PushPreferenceEvent, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookDeliveryEventType, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9585
+ export { ApiError, AssignmentResource, AssinafyClient, AssinafyError, AuthenticationResource, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, DocumentResource, EmbedResource, EnvelopeResource, FieldsResource, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, OAuthError, OAuthResource, SDK_USER_AGENT, SignerDocumentsResource, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9586
+ export type { AccountLogoUploadSource, AnyString, AssignmentDisplaySettings, AssignmentMethod, AssignmentNotificationMethod, AssignmentVerificationMethod, AssinafyClientOptions, ClientConfigInput, DocumentArtifactName, DocumentContractRelationType, DocumentContractStatus, DocumentStatsGranularity, DocumentStatus, DocumentUploadSource, IAcceptTermsResult, IAccountLimits, IAccountSigningFeatures, IAccountTheme, IAccountUsage, IAccountUsageBalance, IAddEnvelopeDocumentPayload, IApiFieldError, IApiKeyResponse, IAssignment, IAssignmentCostSigner, IAssignmentEntry, IAssignmentItem, IAssignmentListParams, IAssignmentListResponse, IAssignmentSigner, IAuthenticateChallenge, IAuthenticatedUser, ICertifiedCopyResendResult, IConfirmSignerDataPayload, IConfirmTotpPayload, ICostEstimate, ICreateAssignmentPayload, ICreateAssignmentResponse, ICreateDocumentFromTemplateOptions, ICreateEnvelopePayload, ICreateFieldPayload, ICreateSignerPayload, ICreateSignerResponse, ICreateTagPayload, ICreateWorkspacePayload, IDeleteTagResponse, IDetachDocumentTagResponse, IDisplaySettings, IDocumentActivity, IDocumentContract, IDocumentContractAmendment, IDocumentContractExternalReference, IDocumentContractInput, IDocumentContractListParams, IDocumentContractListResponse, IDocumentDetailsOptions, IDocumentDetailsResponse, IDocumentEnvelopeRef, IDocumentListItem, IDocumentListParams, IDocumentListResponse, IDocumentRenderOptions, IDocumentSearchParams, IDocumentStatsParams, IDocumentStatsRow, IDocumentStatusInfo, IDocumentUploadOptions, IDocumentUploadResponse, IDocumentVerification, IEmbedOrigin, IEmbedSession, IEnvelope, IEnvelopeActivity, IEnvelopeCancelResult, IEnvelopeDocument, IEnvelopeDocumentInput, IEnvelopeDocumentSigner, IEnvelopeListParams, IEnvelopeListResponse, IEnvelopeResendResponse, IEnvelopeSignerInput, IEstimateAssignmentCostPayload, IFieldDefinition, IFieldType, IFieldValidateMultipleEntry, IFieldValidationMultipleResult, IFieldValidationResponse, IFieldValidationResult, IInlineTag, ILegacyConfirmSignerDataPayload, ILegacyResendCostEstimate, ILegacyUploadSignatureOptions, IListParams, ILoginResponse, IMaskedApiKeyResponse, IMfaMethod, IMfaReauth, IMfaRecoveryCodes, IMfaStatus, INotificationHistoryEntry, INotificationPolicy, INotificationPreferences, IOAuthAuthorizationCallback, IOAuthAuthorizationRequest, IOAuthAuthorizationServerMetadata, IOAuthProtectedResourceMetadata, IOAuthTokenResponse, IOAuthUserInfo, IPage, IPaginatedResponse, IPublicDocumentInfo, IPushPreferences, IRateLimitInfo, IRenameDocumentResponse, IRenewDocumentContractPayload, IResendCostEstimate, IResendEmailResponse, IReviewIdentityVerificationPayload, ISendTokenResult, ISignFieldEntry, ISigner, ISignerCertifiedCopyStatus, ISignerDocumentListParams, ISignerIdentityReview, ISignerIdentityVerification, ISignerIdentityVerificationSession, ISignerListParams, ISignerListResponse, ISignerSelf, ISigningCurrentSigner, ISigningDocument, ISigningProgress, ISigningReadOptions, ISigningUrl, IStartIdentityVerificationPayload, ITag, ITemplateCostSigner, ITemplateDetailsResponse, ITemplateFieldPlacement, ITemplateListItem, ITemplateListParams, ITemplateListResponse, ITemplateRole, ITemplateSigner, ITerminateDocumentContractPayload, ITotpEnrollment, IUpdateEnvelopePayload, IUpdateFieldPayload, IUpdateNotificationPolicyPayload, IUpdateNotificationPreferences, IUpdatePushPreferences, IUpdateSignerPayload, IUpdateTagPayload, IUpdateTemplatePayload, IUpdateWorkspacePayload, IUploadAndRequestSignaturesResult, IUploadAndRequestSignaturesSigner, IUploadSignatureOptions, IWebhookDispatch, IWebhookDispatchListParams, IWebhookEndpoint, IWebhookEndpointCreatePayload, IWebhookEndpointCreateResponse, IWebhookEndpointSecret, IWebhookEndpointSecretRotation, IWebhookEndpointUpdatePayload, IWebhookEventTypeInfo, IWebhookPayload, IWebhookRegisterPayload, IWebhookSubscription, IWhatsAppNotification, IWorkspaceListItem, IWorkspaceListResponse, IWorkspaceResponse, IdentityVerificationImageName, IdentityVerificationStatus, Logger, NotificationPolicyEvent, NotificationSenderType, OAuthScope, PaginatedResult, PaginationMeta, PushPreferenceEvent, SendTokenChannel, SignatureImageType, SignerReference, WebhookDeliveryEventType, WebhookEventType, WebhookHeaders };
package/dist/index.d.ts CHANGED
@@ -42,8 +42,8 @@ type AssignmentMethod = 'virtual' | 'collect';
42
42
  * verification code travels on the notification channel, so `Email` pairs only
43
43
  * with `Email` and `Whatsapp` only with `Whatsapp`. `DigitalCertificate`
44
44
  * and `IdDocumentFaceMatchBasic` carry no OTP and may be announced over either
45
- * channel; `Bypass` may also use the `Bypass` notification, which sends no
46
- * invitation. The SDK rejects an invalid pairing before the request; the API
45
+ * channel; those and `Bypass` may also use the `Bypass` notification, which
46
+ * sends no invitation. The SDK rejects an invalid pairing before the request; the API
47
47
  * answers `400`. `embedded` signers use `Email`, `Whatsapp` or `Bypass`.
48
48
  *
49
49
  * Send neither field to get `Email`/`Email`; send one and the other is
@@ -132,7 +132,7 @@ interface ISignerIdentityReview {
132
132
  * | --- | --- | --- |
133
133
  * | `Email` | An `email`. | 0 credits |
134
134
  * | `Whatsapp` | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
135
- * | `Bypass` | Sends nothing; only with `Bypass` verification (per-account feature). The signer is reached through your app, e.g. an embed session. | — |
135
+ * | `Bypass` | Sends nothing; with `Bypass`, `DigitalCertificate` or `IdDocumentFaceMatchBasic` verification. Your app delivers the link, e.g. an embed session. | — |
136
136
  *
137
137
  * Notifications are charged when the assignment is created and again on every
138
138
  * resend. See {@link AssignmentVerificationMethod} for the pairing rules.
@@ -400,6 +400,8 @@ interface IAssignmentEntry {
400
400
  interface IAssignmentCostSigner {
401
401
  verification_method?: AssignmentVerificationMethod;
402
402
  notification_methods?: AssignmentNotificationMethod[];
403
+ /** The signer's signing step at creation; each `DigitalCertificate` signer needs its own. */
404
+ step?: number;
403
405
  }
404
406
  /**
405
407
  * Official request body for
@@ -679,7 +681,8 @@ interface IDocumentContractInput {
679
681
  currency?: string | null;
680
682
  start_date?: string | null;
681
683
  end_date?: string | null;
682
- auto_renew?: boolean;
684
+ /** Null resets auto-renewal to false, or drops it from a pending amendment's terms. */
685
+ auto_renew?: boolean | null;
683
686
  renewal_term_months?: number | null;
684
687
  notice_period_days?: number | null;
685
688
  owner_id?: string | null;
@@ -1262,13 +1265,15 @@ interface ITemplateSigner {
1262
1265
  step?: number;
1263
1266
  }
1264
1267
  /**
1265
- * Role/channel descriptor used only for template cost estimation. The official
1266
- * schema intentionally omits signer identity and sequential-signing fields.
1268
+ * Role/channel descriptor used only for template cost estimation. It carries no
1269
+ * signer identity; `step` is the role's signing step at creation, which the API
1270
+ * reads to keep each `DigitalCertificate` signer alone in its step.
1267
1271
  */
1268
1272
  interface ITemplateCostSigner {
1269
1273
  role_id: string;
1270
1274
  verification_method?: AssignmentVerificationMethod;
1271
1275
  notification_methods?: AssignmentNotificationMethod[];
1276
+ step?: number;
1272
1277
  }
1273
1278
  /** Options for creating a document from a template. */
1274
1279
  interface ICreateDocumentFromTemplateOptions {
@@ -2843,9 +2848,10 @@ declare class DocumentResource extends BaseResource {
2843
2848
  *
2844
2849
  * @param templateId - The template that would be instantiated.
2845
2850
  * @param signers - One channel descriptor per template role. Cost requests
2846
- * use only `role_id`, `verification_method`, and `notification_methods`;
2847
- * they do not send a signer ID or signing-order step, and editor roles are
2848
- * ignored by the cost calculation.
2851
+ * use `role_id`, `verification_method`, `notification_methods`, and the
2852
+ * role's creation `step`, which the API reads to keep each
2853
+ * `DigitalCertificate` signer alone in its step; they send no signer ID,
2854
+ * and editor roles are ignored by the cost calculation.
2849
2855
  * @param accountId - Override the client's default account ID.
2850
2856
  * @returns An {@link ICostEstimate}: `total_credits`, balances, and a
2851
2857
  * per-line `breakdown` of what the operation would consume:
@@ -4043,9 +4049,10 @@ declare class AssignmentResource extends BaseResource {
4043
4049
  * ```
4044
4050
  *
4045
4051
  * @param documentId - The document the assignment would be created on.
4046
- * @param payload - `method` plus channel-only signer descriptors and/or
4047
- * `collect`-mode `entries`. Create-only fields and signer IDs are not part
4048
- * of this request schema.
4052
+ * @param payload - `method` plus signer channel descriptors and/or
4053
+ * `collect`-mode `entries`. Signer IDs are not part of this request. Send
4054
+ * each signer's creation `step` too: the API keeps every
4055
+ * `DigitalCertificate` signer alone in its step when it estimates.
4049
4056
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
4050
4057
  * line-item `breakdown`, and a `has_sufficient_resources` gate.
4051
4058
  * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
@@ -4067,7 +4074,8 @@ declare class AssignmentResource extends BaseResource {
4067
4074
  * ```
4068
4075
  * @throws {ValidationError} If `documentId` is missing, a `virtual` request
4069
4076
  * has no signer entry, or a `collect` request has no signer entry or no
4070
- * field-placement entry, or combines `DigitalCertificate` with `collect`.
4077
+ * field-placement entry, the signing order is invalid, or the request
4078
+ * combines `DigitalCertificate` with `collect`.
4071
4079
  * The last case has `errors.code ===
4072
4080
  * 'digital_certificate_requires_virtual_method'`.
4073
4081
  * @throws {ApiError} If the API rejects the request.
@@ -8168,7 +8176,8 @@ declare class ContractResource extends BaseResource {
8168
8176
  * @param payload.currency - Three-letter currency; null resets as documented.
8169
8177
  * @param payload.start_date - Start date (`YYYY-MM-DD`), or null.
8170
8178
  * @param payload.end_date - End date (`YYYY-MM-DD`), or null.
8171
- * @param payload.auto_renew - Whether the hourly lifecycle starts a new term.
8179
+ * @param payload.auto_renew - Whether the hourly lifecycle starts a new term;
8180
+ * null resets it to false, or drops it from a pending amendment's terms.
8172
8181
  * @param payload.renewal_term_months - 1–600 months, or null for the default.
8173
8182
  * @param payload.notice_period_days - 0–3650 days, or null to disable notice.
8174
8183
  * @param payload.owner_id - Active workspace member ID, or null.
@@ -9573,4 +9582,5 @@ declare const MAX_LIST_PAGE_SIZE = 50;
9573
9582
 
9574
9583
  declare const SDK_USER_AGENT: string;
9575
9584
 
9576
- export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, type DocumentArtifactName, type DocumentContractRelationType, type DocumentContractStatus, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, EmbedResource, EnvelopeResource, FieldsResource, type IAcceptTermsResult, type IAccountLimits, type IAccountSigningFeatures, type IAccountTheme, type IAccountUsage, type IAccountUsageBalance, type IAddEnvelopeDocumentPayload, type IApiFieldError, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type ICertifiedCopyResendResult, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateEnvelopePayload, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentContract, type IDocumentContractAmendment, type IDocumentContractExternalReference, type IDocumentContractInput, type IDocumentContractListParams, type IDocumentContractListResponse, type IDocumentDetailsOptions, type IDocumentDetailsResponse, type IDocumentEnvelopeRef, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentRenderOptions, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEmbedOrigin, type IEmbedSession, type IEnvelope, type IEnvelopeActivity, type IEnvelopeCancelResult, type IEnvelopeDocument, type IEnvelopeDocumentInput, type IEnvelopeDocumentSigner, type IEnvelopeListParams, type IEnvelopeListResponse, type IEnvelopeResendResponse, type IEnvelopeSignerInput, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPolicy, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IPushPreferences, type IRateLimitInfo, type IRenameDocumentResponse, type IRenewDocumentContractPayload, type IResendCostEstimate, type IResendEmailResponse, type IReviewIdentityVerificationPayload, type ISendTokenResult, type ISignFieldEntry, type ISigner, type ISignerCertifiedCopyStatus, type ISignerDocumentListParams, type ISignerIdentityReview, type ISignerIdentityVerification, type ISignerIdentityVerificationSession, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningCurrentSigner, type ISigningDocument, type ISigningProgress, type ISigningReadOptions, type ISigningUrl, type IStartIdentityVerificationPayload, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITerminateDocumentContractPayload, type ITotpEnrollment, type IUpdateEnvelopePayload, type IUpdateFieldPayload, type IUpdateNotificationPolicyPayload, type IUpdateNotificationPreferences, type IUpdatePushPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointCreateResponse, type IWebhookEndpointSecret, type IWebhookEndpointSecretRotation, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type IdentityVerificationImageName, type IdentityVerificationStatus, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationPolicyEvent, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, type PushPreferenceEvent, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookDeliveryEventType, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9585
+ export { ApiError, AssignmentResource, AssinafyClient, AssinafyError, AuthenticationResource, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, DocumentResource, EmbedResource, EnvelopeResource, FieldsResource, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, OAuthError, OAuthResource, SDK_USER_AGENT, SignerDocumentsResource, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9586
+ export type { AccountLogoUploadSource, AnyString, AssignmentDisplaySettings, AssignmentMethod, AssignmentNotificationMethod, AssignmentVerificationMethod, AssinafyClientOptions, ClientConfigInput, DocumentArtifactName, DocumentContractRelationType, DocumentContractStatus, DocumentStatsGranularity, DocumentStatus, DocumentUploadSource, IAcceptTermsResult, IAccountLimits, IAccountSigningFeatures, IAccountTheme, IAccountUsage, IAccountUsageBalance, IAddEnvelopeDocumentPayload, IApiFieldError, IApiKeyResponse, IAssignment, IAssignmentCostSigner, IAssignmentEntry, IAssignmentItem, IAssignmentListParams, IAssignmentListResponse, IAssignmentSigner, IAuthenticateChallenge, IAuthenticatedUser, ICertifiedCopyResendResult, IConfirmSignerDataPayload, IConfirmTotpPayload, ICostEstimate, ICreateAssignmentPayload, ICreateAssignmentResponse, ICreateDocumentFromTemplateOptions, ICreateEnvelopePayload, ICreateFieldPayload, ICreateSignerPayload, ICreateSignerResponse, ICreateTagPayload, ICreateWorkspacePayload, IDeleteTagResponse, IDetachDocumentTagResponse, IDisplaySettings, IDocumentActivity, IDocumentContract, IDocumentContractAmendment, IDocumentContractExternalReference, IDocumentContractInput, IDocumentContractListParams, IDocumentContractListResponse, IDocumentDetailsOptions, IDocumentDetailsResponse, IDocumentEnvelopeRef, IDocumentListItem, IDocumentListParams, IDocumentListResponse, IDocumentRenderOptions, IDocumentSearchParams, IDocumentStatsParams, IDocumentStatsRow, IDocumentStatusInfo, IDocumentUploadOptions, IDocumentUploadResponse, IDocumentVerification, IEmbedOrigin, IEmbedSession, IEnvelope, IEnvelopeActivity, IEnvelopeCancelResult, IEnvelopeDocument, IEnvelopeDocumentInput, IEnvelopeDocumentSigner, IEnvelopeListParams, IEnvelopeListResponse, IEnvelopeResendResponse, IEnvelopeSignerInput, IEstimateAssignmentCostPayload, IFieldDefinition, IFieldType, IFieldValidateMultipleEntry, IFieldValidationMultipleResult, IFieldValidationResponse, IFieldValidationResult, IInlineTag, ILegacyConfirmSignerDataPayload, ILegacyResendCostEstimate, ILegacyUploadSignatureOptions, IListParams, ILoginResponse, IMaskedApiKeyResponse, IMfaMethod, IMfaReauth, IMfaRecoveryCodes, IMfaStatus, INotificationHistoryEntry, INotificationPolicy, INotificationPreferences, IOAuthAuthorizationCallback, IOAuthAuthorizationRequest, IOAuthAuthorizationServerMetadata, IOAuthProtectedResourceMetadata, IOAuthTokenResponse, IOAuthUserInfo, IPage, IPaginatedResponse, IPublicDocumentInfo, IPushPreferences, IRateLimitInfo, IRenameDocumentResponse, IRenewDocumentContractPayload, IResendCostEstimate, IResendEmailResponse, IReviewIdentityVerificationPayload, ISendTokenResult, ISignFieldEntry, ISigner, ISignerCertifiedCopyStatus, ISignerDocumentListParams, ISignerIdentityReview, ISignerIdentityVerification, ISignerIdentityVerificationSession, ISignerListParams, ISignerListResponse, ISignerSelf, ISigningCurrentSigner, ISigningDocument, ISigningProgress, ISigningReadOptions, ISigningUrl, IStartIdentityVerificationPayload, ITag, ITemplateCostSigner, ITemplateDetailsResponse, ITemplateFieldPlacement, ITemplateListItem, ITemplateListParams, ITemplateListResponse, ITemplateRole, ITemplateSigner, ITerminateDocumentContractPayload, ITotpEnrollment, IUpdateEnvelopePayload, IUpdateFieldPayload, IUpdateNotificationPolicyPayload, IUpdateNotificationPreferences, IUpdatePushPreferences, IUpdateSignerPayload, IUpdateTagPayload, IUpdateTemplatePayload, IUpdateWorkspacePayload, IUploadAndRequestSignaturesResult, IUploadAndRequestSignaturesSigner, IUploadSignatureOptions, IWebhookDispatch, IWebhookDispatchListParams, IWebhookEndpoint, IWebhookEndpointCreatePayload, IWebhookEndpointCreateResponse, IWebhookEndpointSecret, IWebhookEndpointSecretRotation, IWebhookEndpointUpdatePayload, IWebhookEventTypeInfo, IWebhookPayload, IWebhookRegisterPayload, IWebhookSubscription, IWhatsAppNotification, IWorkspaceListItem, IWorkspaceListResponse, IWorkspaceResponse, IdentityVerificationImageName, IdentityVerificationStatus, Logger, NotificationPolicyEvent, NotificationSenderType, OAuthScope, PaginatedResult, PaginationMeta, PushPreferenceEvent, SendTokenChannel, SignatureImageType, SignerReference, WebhookDeliveryEventType, WebhookEventType, WebhookHeaders };
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var import_axios2 = __toESM(require("axios"));
763
763
  // package.json
764
764
  var package_default = {
765
765
  name: "@assinafy/sdk",
766
- version: "3.0.0",
766
+ version: "3.0.2",
767
767
  packageManager: "bun@1.4.4",
768
768
  description: "TypeScript SDK for Assinafy API - Digital signature platform",
769
769
  type: "commonjs",
@@ -835,9 +835,9 @@ var package_default = {
835
835
  "@types/bun": "^1.4.4",
836
836
  "@types/node": "^22.20.5",
837
837
  "@typescript/native": "npm:typescript@^7.0.2",
838
- eslint: "^10.13.0",
838
+ eslint: "^10.14.0",
839
839
  publint: "^0.3.25",
840
- tsup: "^8.5.1",
840
+ tsup: "^9.0.0",
841
841
  typescript: "^6.0.3",
842
842
  "typescript-eslint": "^8.72.1"
843
843
  },
@@ -1122,15 +1122,14 @@ var VERIFICATION_METHODS = /* @__PURE__ */ new Set([
1122
1122
  "IdDocumentFaceMatchBasic",
1123
1123
  "Bypass"
1124
1124
  ]);
1125
- var MESSAGE_CHANNELS = /* @__PURE__ */ new Set(["Email", "Whatsapp"]);
1126
- var NOTIFICATION_METHODS = /* @__PURE__ */ new Set([...MESSAGE_CHANNELS, "Bypass"]);
1125
+ var NOTIFICATION_METHODS = /* @__PURE__ */ new Set(["Email", "Whatsapp", "Bypass"]);
1127
1126
  var EMBEDDED_VERIFICATION_METHODS = /* @__PURE__ */ new Set(["Email", "Whatsapp", "Bypass"]);
1128
1127
  var DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate_requires_virtual_method";
1129
1128
  var ALLOWED_NOTIFICATION_METHODS = {
1130
1129
  Email: /* @__PURE__ */ new Set(["Email"]),
1131
1130
  Whatsapp: /* @__PURE__ */ new Set(["Whatsapp"]),
1132
- DigitalCertificate: MESSAGE_CHANNELS,
1133
- IdDocumentFaceMatchBasic: MESSAGE_CHANNELS,
1131
+ DigitalCertificate: NOTIFICATION_METHODS,
1132
+ IdDocumentFaceMatchBasic: NOTIFICATION_METHODS,
1134
1133
  Bypass: NOTIFICATION_METHODS
1135
1134
  };
1136
1135
  function validateAssignmentSignerOptions(signer, label = "signer") {
@@ -1255,6 +1254,7 @@ function buildAssignmentEstimatePayload(payload) {
1255
1254
  }
1256
1255
  const normalisedSigners = signers.map((signer) => normaliseEstimateSigner(signer));
1257
1256
  validateDigitalCertificateMethod(method, normalisedSigners);
1257
+ validateSigningOrder(normalisedSigners, "assignment cost signers");
1258
1258
  return cleanParams({
1259
1259
  method,
1260
1260
  signers: normalisedSigners,
@@ -1299,7 +1299,8 @@ function normaliseEstimateSigner(signer) {
1299
1299
  validateAssignmentSignerOptions(descriptor);
1300
1300
  return cleanParams({
1301
1301
  verification_method: descriptor.verification_method,
1302
- notification_methods: descriptor.notification_methods
1302
+ notification_methods: descriptor.notification_methods,
1303
+ step: descriptor.step
1303
1304
  });
1304
1305
  }
1305
1306
  function normaliseAssignmentEntries(entries) {
@@ -1676,9 +1677,10 @@ var AssignmentResource = class extends BaseResource {
1676
1677
  * ```
1677
1678
  *
1678
1679
  * @param documentId - The document the assignment would be created on.
1679
- * @param payload - `method` plus channel-only signer descriptors and/or
1680
- * `collect`-mode `entries`. Create-only fields and signer IDs are not part
1681
- * of this request schema.
1680
+ * @param payload - `method` plus signer channel descriptors and/or
1681
+ * `collect`-mode `entries`. Signer IDs are not part of this request. Send
1682
+ * each signer's creation `step` too: the API keeps every
1683
+ * `DigitalCertificate` signer alone in its step when it estimates.
1682
1684
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
1683
1685
  * line-item `breakdown`, and a `has_sufficient_resources` gate.
1684
1686
  * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
@@ -1700,7 +1702,8 @@ var AssignmentResource = class extends BaseResource {
1700
1702
  * ```
1701
1703
  * @throws {ValidationError} If `documentId` is missing, a `virtual` request
1702
1704
  * has no signer entry, or a `collect` request has no signer entry or no
1703
- * field-placement entry, or combines `DigitalCertificate` with `collect`.
1705
+ * field-placement entry, the signing order is invalid, or the request
1706
+ * combines `DigitalCertificate` with `collect`.
1704
1707
  * The last case has `errors.code ===
1705
1708
  * 'digital_certificate_requires_virtual_method'`.
1706
1709
  * @throws {ApiError} If the API rejects the request.
@@ -3088,9 +3091,10 @@ var DocumentResource = class extends BaseResource {
3088
3091
  *
3089
3092
  * @param templateId - The template that would be instantiated.
3090
3093
  * @param signers - One channel descriptor per template role. Cost requests
3091
- * use only `role_id`, `verification_method`, and `notification_methods`;
3092
- * they do not send a signer ID or signing-order step, and editor roles are
3093
- * ignored by the cost calculation.
3094
+ * use `role_id`, `verification_method`, `notification_methods`, and the
3095
+ * role's creation `step`, which the API reads to keep each
3096
+ * `DigitalCertificate` signer alone in its step; they send no signer ID,
3097
+ * and editor roles are ignored by the cost calculation.
3094
3098
  * @param accountId - Override the client's default account ID.
3095
3099
  * @returns An {@link ICostEstimate}: `total_credits`, balances, and a
3096
3100
  * per-line `breakdown` of what the operation would consume:
@@ -3479,6 +3483,7 @@ function normaliseTemplateCostSigners(signers) {
3479
3483
  if (signer.notification_methods !== void 0) {
3480
3484
  descriptor.notification_methods = signer.notification_methods;
3481
3485
  }
3486
+ if (signer.step !== void 0) descriptor.step = signer.step;
3482
3487
  return descriptor;
3483
3488
  });
3484
3489
  return normalised;
@@ -9314,7 +9319,8 @@ var ContractResource = class extends BaseResource {
9314
9319
  * @param payload.currency - Three-letter currency; null resets as documented.
9315
9320
  * @param payload.start_date - Start date (`YYYY-MM-DD`), or null.
9316
9321
  * @param payload.end_date - End date (`YYYY-MM-DD`), or null.
9317
- * @param payload.auto_renew - Whether the hourly lifecycle starts a new term.
9322
+ * @param payload.auto_renew - Whether the hourly lifecycle starts a new term;
9323
+ * null resets it to false, or drops it from a pending amendment's terms.
9318
9324
  * @param payload.renewal_term_months - 1–600 months, or null for the default.
9319
9325
  * @param payload.notice_period_days - 0–3650 days, or null to disable notice.
9320
9326
  * @param payload.owner_id - Active workspace member ID, or null.
@@ -9619,8 +9625,8 @@ function buildContractInput(payload) {
9619
9625
  if (typeof payload.start_date === "string" && typeof payload.end_date === "string" && payload.end_date < payload.start_date) {
9620
9626
  throw new ValidationError("end_date must be on or after start_date");
9621
9627
  }
9622
- if (payload.auto_renew !== void 0 && typeof payload.auto_renew !== "boolean") {
9623
- throw new ValidationError("auto_renew must be a boolean");
9628
+ if (payload.auto_renew !== void 0 && payload.auto_renew !== null && typeof payload.auto_renew !== "boolean") {
9629
+ throw new ValidationError("auto_renew must be a boolean or null");
9624
9630
  }
9625
9631
  validateNullableInteger(payload.renewal_term_months, "renewal_term_months", 1, 600);
9626
9632
  validateNullableInteger(payload.notice_period_days, "notice_period_days", 0, 3650);
package/dist/index.mjs CHANGED
@@ -699,7 +699,7 @@ import axios2 from "axios";
699
699
  // package.json
700
700
  var package_default = {
701
701
  name: "@assinafy/sdk",
702
- version: "3.0.0",
702
+ version: "3.0.2",
703
703
  packageManager: "bun@1.4.4",
704
704
  description: "TypeScript SDK for Assinafy API - Digital signature platform",
705
705
  type: "commonjs",
@@ -771,9 +771,9 @@ var package_default = {
771
771
  "@types/bun": "^1.4.4",
772
772
  "@types/node": "^22.20.5",
773
773
  "@typescript/native": "npm:typescript@^7.0.2",
774
- eslint: "^10.13.0",
774
+ eslint: "^10.14.0",
775
775
  publint: "^0.3.25",
776
- tsup: "^8.5.1",
776
+ tsup: "^9.0.0",
777
777
  typescript: "^6.0.3",
778
778
  "typescript-eslint": "^8.72.1"
779
779
  },
@@ -1058,15 +1058,14 @@ var VERIFICATION_METHODS = /* @__PURE__ */ new Set([
1058
1058
  "IdDocumentFaceMatchBasic",
1059
1059
  "Bypass"
1060
1060
  ]);
1061
- var MESSAGE_CHANNELS = /* @__PURE__ */ new Set(["Email", "Whatsapp"]);
1062
- var NOTIFICATION_METHODS = /* @__PURE__ */ new Set([...MESSAGE_CHANNELS, "Bypass"]);
1061
+ var NOTIFICATION_METHODS = /* @__PURE__ */ new Set(["Email", "Whatsapp", "Bypass"]);
1063
1062
  var EMBEDDED_VERIFICATION_METHODS = /* @__PURE__ */ new Set(["Email", "Whatsapp", "Bypass"]);
1064
1063
  var DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate_requires_virtual_method";
1065
1064
  var ALLOWED_NOTIFICATION_METHODS = {
1066
1065
  Email: /* @__PURE__ */ new Set(["Email"]),
1067
1066
  Whatsapp: /* @__PURE__ */ new Set(["Whatsapp"]),
1068
- DigitalCertificate: MESSAGE_CHANNELS,
1069
- IdDocumentFaceMatchBasic: MESSAGE_CHANNELS,
1067
+ DigitalCertificate: NOTIFICATION_METHODS,
1068
+ IdDocumentFaceMatchBasic: NOTIFICATION_METHODS,
1070
1069
  Bypass: NOTIFICATION_METHODS
1071
1070
  };
1072
1071
  function validateAssignmentSignerOptions(signer, label = "signer") {
@@ -1191,6 +1190,7 @@ function buildAssignmentEstimatePayload(payload) {
1191
1190
  }
1192
1191
  const normalisedSigners = signers.map((signer) => normaliseEstimateSigner(signer));
1193
1192
  validateDigitalCertificateMethod(method, normalisedSigners);
1193
+ validateSigningOrder(normalisedSigners, "assignment cost signers");
1194
1194
  return cleanParams({
1195
1195
  method,
1196
1196
  signers: normalisedSigners,
@@ -1235,7 +1235,8 @@ function normaliseEstimateSigner(signer) {
1235
1235
  validateAssignmentSignerOptions(descriptor);
1236
1236
  return cleanParams({
1237
1237
  verification_method: descriptor.verification_method,
1238
- notification_methods: descriptor.notification_methods
1238
+ notification_methods: descriptor.notification_methods,
1239
+ step: descriptor.step
1239
1240
  });
1240
1241
  }
1241
1242
  function normaliseAssignmentEntries(entries) {
@@ -1612,9 +1613,10 @@ var AssignmentResource = class extends BaseResource {
1612
1613
  * ```
1613
1614
  *
1614
1615
  * @param documentId - The document the assignment would be created on.
1615
- * @param payload - `method` plus channel-only signer descriptors and/or
1616
- * `collect`-mode `entries`. Create-only fields and signer IDs are not part
1617
- * of this request schema.
1616
+ * @param payload - `method` plus signer channel descriptors and/or
1617
+ * `collect`-mode `entries`. Signer IDs are not part of this request. Send
1618
+ * each signer's creation `step` too: the API keeps every
1619
+ * `DigitalCertificate` signer alone in its step when it estimates.
1618
1620
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
1619
1621
  * line-item `breakdown`, and a `has_sufficient_resources` gate.
1620
1622
  * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
@@ -1636,7 +1638,8 @@ var AssignmentResource = class extends BaseResource {
1636
1638
  * ```
1637
1639
  * @throws {ValidationError} If `documentId` is missing, a `virtual` request
1638
1640
  * has no signer entry, or a `collect` request has no signer entry or no
1639
- * field-placement entry, or combines `DigitalCertificate` with `collect`.
1641
+ * field-placement entry, the signing order is invalid, or the request
1642
+ * combines `DigitalCertificate` with `collect`.
1640
1643
  * The last case has `errors.code ===
1641
1644
  * 'digital_certificate_requires_virtual_method'`.
1642
1645
  * @throws {ApiError} If the API rejects the request.
@@ -3024,9 +3027,10 @@ var DocumentResource = class extends BaseResource {
3024
3027
  *
3025
3028
  * @param templateId - The template that would be instantiated.
3026
3029
  * @param signers - One channel descriptor per template role. Cost requests
3027
- * use only `role_id`, `verification_method`, and `notification_methods`;
3028
- * they do not send a signer ID or signing-order step, and editor roles are
3029
- * ignored by the cost calculation.
3030
+ * use `role_id`, `verification_method`, `notification_methods`, and the
3031
+ * role's creation `step`, which the API reads to keep each
3032
+ * `DigitalCertificate` signer alone in its step; they send no signer ID,
3033
+ * and editor roles are ignored by the cost calculation.
3030
3034
  * @param accountId - Override the client's default account ID.
3031
3035
  * @returns An {@link ICostEstimate}: `total_credits`, balances, and a
3032
3036
  * per-line `breakdown` of what the operation would consume:
@@ -3415,6 +3419,7 @@ function normaliseTemplateCostSigners(signers) {
3415
3419
  if (signer.notification_methods !== void 0) {
3416
3420
  descriptor.notification_methods = signer.notification_methods;
3417
3421
  }
3422
+ if (signer.step !== void 0) descriptor.step = signer.step;
3418
3423
  return descriptor;
3419
3424
  });
3420
3425
  return normalised;
@@ -9250,7 +9255,8 @@ var ContractResource = class extends BaseResource {
9250
9255
  * @param payload.currency - Three-letter currency; null resets as documented.
9251
9256
  * @param payload.start_date - Start date (`YYYY-MM-DD`), or null.
9252
9257
  * @param payload.end_date - End date (`YYYY-MM-DD`), or null.
9253
- * @param payload.auto_renew - Whether the hourly lifecycle starts a new term.
9258
+ * @param payload.auto_renew - Whether the hourly lifecycle starts a new term;
9259
+ * null resets it to false, or drops it from a pending amendment's terms.
9254
9260
  * @param payload.renewal_term_months - 1–600 months, or null for the default.
9255
9261
  * @param payload.notice_period_days - 0–3650 days, or null to disable notice.
9256
9262
  * @param payload.owner_id - Active workspace member ID, or null.
@@ -9555,8 +9561,8 @@ function buildContractInput(payload) {
9555
9561
  if (typeof payload.start_date === "string" && typeof payload.end_date === "string" && payload.end_date < payload.start_date) {
9556
9562
  throw new ValidationError("end_date must be on or after start_date");
9557
9563
  }
9558
- if (payload.auto_renew !== void 0 && typeof payload.auto_renew !== "boolean") {
9559
- throw new ValidationError("auto_renew must be a boolean");
9564
+ if (payload.auto_renew !== void 0 && payload.auto_renew !== null && typeof payload.auto_renew !== "boolean") {
9565
+ throw new ValidationError("auto_renew must be a boolean or null");
9560
9566
  }
9561
9567
  validateNullableInteger(payload.renewal_term_months, "renewal_term_months", 1, 600);
9562
9568
  validateNullableInteger(payload.notice_period_days, "notice_period_days", 0, 3650);
@@ -391,6 +391,13 @@ certificate/`collect` combination before assignment creation or cost
391
391
  estimation with `ValidationError.errors.code` set to
392
392
  `digital_certificate_requires_virtual_method`.
393
393
 
394
+ Both cost estimates apply the one-certificate-signer-per-step rule too, and
395
+ the API reads each signer's `step` there although the published estimate
396
+ schemas omit it; signers without a `step` share one step. The SDK forwards
397
+ `step` on assignment and template estimates, so send the creation steps when
398
+ estimating. Assignment estimates check the signing order locally, as creation
399
+ does.
400
+
394
401
  Template role IDs do not reveal which entries are signers, editors or copy
395
402
  receivers. The SDK validates each entry's channel and positive `step`, then
396
403
  lets the API enforce role-aware signing order. The server derives the method:
@@ -627,7 +634,9 @@ the production route is available.
627
634
  answers a retry with `400`.
628
635
  - `Bypass` verification and notification are enabled per account and absent
629
636
  from the published request enums; the SDK accepts them with the pairing the
630
- API applies (Bypass verification with `Email`, `Whatsapp` or `Bypass`).
637
+ API applies: the `Bypass` notification with `Bypass`, `DigitalCertificate` or
638
+ `IdDocumentFaceMatchBasic` verification, and `Bypass` verification with any
639
+ notification.
631
640
  - The embed session exchange route belongs to Assinafy's embed page and is not
632
641
  exposed.
633
642
 
package/docs/README.en.md CHANGED
@@ -1042,8 +1042,8 @@ to `Email`.
1042
1042
  | --- | --- | --- | --- |
1043
1043
  | `Email` *(default)* | One-time code (OTP) by email | `Email` | Free |
1044
1044
  | `Whatsapp` | One-time code (OTP) by WhatsApp | `Whatsapp` | 0.45 credit (the notification), paid plans only |
1045
- | `DigitalCertificate` | The signer signs with their **own ICP-Brasil certificate — A1 or A3 —** through the Web PKI extension, producing a **qualified PAdES signature**; requires `method: 'virtual'` | `Email` **or** `Whatsapp` | 0.5 credits + the notification |
1046
- | `IdDocumentFaceMatchBasic` | Hosted identity-document, face and liveness verification | `Email` **or** `Whatsapp` | Use `estimateCost()` |
1045
+ | `DigitalCertificate` | The signer signs with their **own ICP-Brasil certificate — A1 or A3 —** through the Web PKI extension, producing a **qualified PAdES signature**; requires `method: 'virtual'` | `Email` **or** `Whatsapp` (or `Bypass`) | 0.5 credits + the notification |
1046
+ | `IdDocumentFaceMatchBasic` | Hosted identity-document, face and liveness verification | `Email` **or** `Whatsapp` (or `Bypass`) | Use `estimateCost()` |
1047
1047
  | `Bypass` | No code: your app has already authenticated the signer. Enabled per account by Assinafy | `Email`, `Whatsapp` **or** `Bypass` (sends no invitation) | The notification |
1048
1048
 
1049
1049
  Check what the plan allows before offering a method:
@@ -1097,8 +1097,9 @@ forward them outside the signing flow.
1097
1097
 
1098
1098
  `DigitalCertificate` requires `method: 'virtual'`, the account feature, a CPF
1099
1099
  or CNPJ in the signer's `government_id`, and exactly one certificate signer in
1100
- that signing step. It costs 0.5 credits per certificate signer in addition to
1101
- the selected notification cost. A certificate flow completes the signer's
1100
+ that signing step. Estimates take the same `step` as creation: with two or
1101
+ more certificate signers, give each its own step in both calls. It costs 0.5
1102
+ credits per certificate signer in addition to the selected notification cost. A certificate flow completes the signer's
1102
1103
  virtual item; it cannot submit placed fields through the ordinary `collect`
1103
1104
  signing endpoint.
1104
1105
 
@@ -1124,7 +1125,7 @@ const certificateSigner = await client.signers.update(signerId, {
1124
1125
 
1125
1126
  const certificateCost = await client.assignments.estimateCost(documentId, {
1126
1127
  method: 'virtual',
1127
- signers: [{ verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
1128
+ signers: [{ step: 1, verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
1128
1129
  });
1129
1130
 
1130
1131
  await client.assignments.create(documentId, {
package/docs/README.md CHANGED
@@ -996,8 +996,8 @@ que faltar é inferido. Sem nenhum dos dois, ambos assumem `Email`.
996
996
  | --- | --- | --- | --- |
997
997
  | `Email` *(padrão)* | Código de uso único (OTP) por e-mail | `Email` | Gratuito |
998
998
  | `Whatsapp` | Código de uso único (OTP) por WhatsApp | `Whatsapp` | 0,45 crédito (a notificação), só em planos pagos |
999
- | `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada**; exige `method: 'virtual'` | `Email` **ou** `Whatsapp` | 0,5 crédito + a notificação |
1000
- | `IdDocumentFaceMatchBasic` | Documento de identidade, foto e prova de vida em sessão hospedada | `Email` **ou** `Whatsapp` | Consulte `estimateCost()` |
999
+ | `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada**; exige `method: 'virtual'` | `Email` **ou** `Whatsapp` (ou `Bypass`) | 0,5 crédito + a notificação |
1000
+ | `IdDocumentFaceMatchBasic` | Documento de identidade, foto e prova de vida em sessão hospedada | `Email` **ou** `Whatsapp` (ou `Bypass`) | Consulte `estimateCost()` |
1001
1001
  | `Bypass` | Sem código: seu app já autenticou o signatário. Habilitado por conta pela Assinafy | `Email`, `Whatsapp` **ou** `Bypass` (não envia convite) | A notificação |
1002
1002
 
1003
1003
  Confira o que o plano permite antes de oferecer um método:
@@ -1050,8 +1050,9 @@ nem encaminhe fora do fluxo de assinatura.
1050
1050
 
1051
1051
  `DigitalCertificate` exige `method: 'virtual'`, o recurso **Certificado Digital** na conta (planos
1052
1052
  Standard e Pro), CPF ou CNPJ em `government_id` do signatário, e exatamente **um signatário por
1053
- certificado naquele passo de assinatura**. Custa 0,5 crédito por signatário, além do custo da
1054
- notificação escolhida. O fluxo por certificado conclui o item virtual do signatário; ele não consegue
1053
+ certificado naquele passo de assinatura**. A estimativa recebe o mesmo `step` da criação: com dois
1054
+ ou mais signatários com certificado, dê a cada um o seu passo nas duas chamadas. Custa 0,5 crédito
1055
+ por signatário, além do custo da notificação escolhida. O fluxo por certificado conclui o item virtual do signatário; ele não consegue
1055
1056
  enviar campos posicionados pelo endpoint comum de assinatura `collect`.
1056
1057
 
1057
1058
  O SDK rejeita signatários por certificado em assignments `collect`, tanto em `create()` quanto em
@@ -1074,7 +1075,7 @@ const signatarioCertificado = await client.signers.update(signerId, {
1074
1075
 
1075
1076
  const custoCertificado = await client.assignments.estimateCost(documentId, {
1076
1077
  method: 'virtual',
1077
- signers: [{ verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
1078
+ signers: [{ step: 1, verification_method: 'DigitalCertificate', notification_methods: ['Email'] }],
1078
1079
  });
1079
1080
 
1080
1081
  await client.assignments.create(documentId, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/sdk",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "packageManager": "bun@1.4.4",
5
5
  "description": "TypeScript SDK for Assinafy API - Digital signature platform",
6
6
  "type": "commonjs",
@@ -72,9 +72,9 @@
72
72
  "@types/bun": "^1.4.4",
73
73
  "@types/node": "^22.20.5",
74
74
  "@typescript/native": "npm:typescript@^7.0.2",
75
- "eslint": "^10.13.0",
75
+ "eslint": "^10.14.0",
76
76
  "publint": "^0.3.25",
77
- "tsup": "^8.5.1",
77
+ "tsup": "^9.0.0",
78
78
  "typescript": "^6.0.3",
79
79
  "typescript-eslint": "^8.72.1"
80
80
  },