@chaindoc_io/server-sdk
Advanced tools
+28
-167
@@ -8,109 +8,40 @@ # Changelog | ||
| ## [2.0.0-alpha.13] - 2026-04-14 | ||
| ## [2.0.0] - 2026-04-23 | ||
| ### Added | ||
| - **`ContractPreferredPaymentMethodType`** type (`card` | `bank_transfer`). | ||
| - **`paymentMethodRequired`** and **`preferredPaymentMethodType`** fields on `Contract`, `CreateContractParams`, and `PaymentSetupParams` — control whether a payment method must be set up for invoice checkout and which method is preferred. | ||
| - **`ContractSendParams`** type and optional `params` argument on `contracts.send(contractId, params?)` — allows passing `messageToSigners`, `deadline`, and `isKycRequired` when sending a contract for signing. | ||
| Major release expanding the SDK to cover contracts, invoices, transactions, templates, and webhook verification. Identifiers are now UUID-only across all public resources, and webhook delivery follows a canonical signed envelope format. KYC is no longer exposed as an SDK module — it is handled by the signer inside the Chaindoc embedded flow and enforced by the backend at signing time. | ||
| --- | ||
| ### Breaking Changes | ||
| ## [2.0.0-alpha.12] - 2026-04-13 | ||
| - **UUID-only identifiers**. All public resource identifiers are UUIDs. Numeric `id` fields were removed from `Document`, `DocumentVersion`, `Signer`, `SignatureRequest`, `SignatureRequestStatus`, and `ApiKeyInfo`. Also removed: `Document.userId`, `Document.coreTeamId`, `Document.currentVersionId`, `SignatureRequest.userId`, `SignerUser.id`, `ApiKeyInfo.userId`, `HealthCheckResponse.userId`. | ||
| - **Simplified `Signer` type**. Now `{ id (UUID), email, signatureHash, signedAt, hasSigned, signer }`. | ||
| - **`SignatureRequestResponse`** now matches the actual backend shape (`success`, `requestId`, `signatureRequest`, `message`). | ||
| - **KYC module removed**. `client.kyc`, `ShareKycParams`, `KycData`, `ShareKycResponse`, `Recipient.shareToken`, and the `kyc.shared` webhook event are gone. | ||
| - **`GetSignaturesResponse.items`** now correctly typed as `SavedSignature[]` (saved signature images), not `SignatureRequest[]`. The misplaced `totalPending` / `totalCompleted` / `totalExpired` counters moved to `GetMyRequestsResponse`. | ||
| - **Webhook delivery contract** switched to canonical headers (`X-Chaindoc-Event`, `X-Chaindoc-Signature`, `X-Chaindoc-Delivery-Id`, `X-Chaindoc-Timestamp`), envelope `{ id, type, createdAt, data }`, and signature format `v1=HMAC-SHA256(timestamp.body)`. | ||
| ### Removed (breaking within alpha) | ||
| - **`client.kyc`** module — KYC sharing via API key has been deprecated. KYC is now always performed by the signer inside the Chaindoc embedded flow and enforced by the backend at signing time. | ||
| - **`ShareKycParams`**, **`KycData`**, **`ShareKycResponse`** types. | ||
| - **`Recipient.shareToken`** field — no longer needed, backend handles KYC at signing time. | ||
| - **`kyc.shared`** webhook event type. | ||
| ### Added | ||
| ### Changed | ||
| - **Docs**: README, `ADVANCED_USAGE.md`, `API_REFERENCE.md` updated to reflect the new KYC model and the refreshed public-api snapshot. | ||
| - **`signatures.createRequest` docs**: updated to describe that signers complete KYC in-flow, no longer via `shareToken`. | ||
| - **Contracts module** (`client.contracts.*`) — full lifecycle: `create`, `list`, `get`, `getStatus`, `getActivities`, `addPaymentSetup`, `setupRecurring`, `linkPaymentMethod`, `send`, `cancel`, `terminate`. Types: `Contract`, `ContractStatus`, `PaymentTermResponse`, `ContractSigner`, `CreateContractParams`, `ContractSendParams`, `ContractListResponse`, `ContractStatusResponse`, `ContractActivitiesResponse`, `ContractActionResponse`, `ContractSendResponse`, `ContractPreferredPaymentMethodType`. | ||
| - **Contract signing policy** — `ContractSigningMethod`, `ContractSignerSource`, `ContractSigningPolicy` types. `signingPolicy` on `Contract`, `CreateContractParams`, `ContractStatusResponse`; `signingSource` and `status` on signers. | ||
| - **Payment controls on contracts** — `paymentMethodRequired` and `preferredPaymentMethodType` on `Contract`, `CreateContractParams`, and `PaymentSetupParams`. | ||
| - **Invoices module** (`client.invoices.*`) — `create`, `list`, `get`, `send`, `charge`, manual mark-paid. Types: `Invoice`, `InvoiceStatus`, `InvoiceType`, and request/response envelopes. | ||
| - **Transactions module** (`client.transactions.*`) — contract-scoped list and direct lookup by UUID. Types: `Transaction`, `TransactionStatus`. | ||
| - **Templates runtime API** (`client.templates.*`) — create draft documents from published templates, send rendered documents for signing, create template-backed contracts. Types: `CreateDocumentFromTemplateParams`, `CreateTemplateSignatureRequestParams`, `CreateContractFromTemplateParams`, `TemplateSlotAssignment`, `TemplateContractSlotAssignment`, `TemplateSlotSigningMethod`, and `signerVariables` for per-signer variable injection. | ||
| - **Webhooks module** — `Chaindoc.webhooks.verify(rawBody, signature, timestamp, secret)` with timing-safe HMAC-SHA256 verification and replay protection, plus `Chaindoc.webhooks.parse(rawBody)` for envelope parsing without verification. Types: `WebhookEventType`, `WebhookEnvelope<T>`, `WebhookVerificationResult`. | ||
| - **Contract and billing webhook events** — `contract.created`, `contract.status_changed`, `contract.signed`, `contract.cancelled`, `contract.terminated`, `invoice.created`, `invoice.sent`, `invoice.paid`, `invoice.cancelled`, `transaction.created`, `transaction.updated`. | ||
| - **Signature request fields** — `SignatureRequestField` and `SignatureRequestFieldType` for placing signature, initials, date, text, and checkbox fields with normalized coordinates; `fields` on `CreateSignatureRequestParams`. | ||
| - **Document signing method** — `DocumentSigningMethod` (`embedded` | `delegated`) and `signingMethod` on `Recipient`. | ||
| - **Saved signatures** — `SavedSignature` type for images stored on the user account (`hash`, `createdAt`, `updatedAt`, optional `imageMedia`). | ||
| - **Embedded contract signing** — `CreateEmbeddedSessionParams.metadata.contractId`; the backend auto-resolves `documentId` and `signatureRequestId`. | ||
| - **Public API snapshot** at `references/public-api.snapshot.json` plus `scripts/sync-openapi-snapshot.mjs` to keep the SDK and backend types aligned. | ||
| - **Test suite** — integration-style unit tests for contracts, invoices, templates, transactions, signatures, webhooks, and a public API contract test. | ||
| --- | ||
| ## [2.0.0-alpha.11] - 2026-04-11 | ||
| ### Added | ||
| - **`SavedSignature`** type for saved signature images stored on the user account (`hash`, `createdAt`, `updatedAt`, optional `imageMedia`). | ||
| - **`totalPending` / `totalCompleted` / `totalExpired`** optional fields on `GetMyRequestsResponse`. | ||
| ### Fixed | ||
| - **`GetSignaturesResponse.items`** now correctly typed as `SavedSignature[]` instead of `SignatureRequest[]` — the saved-signatures endpoint returns signature images, not signing requests. | ||
| - **`GetSignaturesResponse`**: removed `totalPending` / `totalCompleted` / `totalExpired` — those counts belong to the requests listing, not saved signatures. | ||
| --- | ||
| - **Environment URLs**: Replaced build-time `process.env` injection with hardcoded safe defaults so the SDK no longer ships with `undefined` URLs when env vars are missing at build time. | ||
| ## [2.0.0-alpha.10] - 2026-04-10 | ||
| ### Added | ||
| - **`signerVariables`** on `TemplateContractSlotAssignment` — allow per-signer variable injection when creating contracts from templates. | ||
| --- | ||
| ## [2.0.0-alpha.9] - 2026-04-10 | ||
| ### Added | ||
| - **Document signing method**: `DocumentSigningMethod` type (`embedded` | `delegated`) and `signingMethod` field on `Recipient`. | ||
| - **Signature request fields**: `SignatureRequestField` type and `SignatureRequestFieldType` for placing signature, initials, date, text, and checkbox fields with normalized coordinates. | ||
| - **`fields`** on `CreateSignatureRequestParams` for passing pre-placed signing fields. | ||
| - **Signatures test suite**: New `signatures.test.ts` covering signature request creation flows. | ||
| --- | ||
| ## [2.0.0-alpha.8] - 2026-04-10 | ||
| ### Added | ||
| - **Template slot signing options**: `signingMethod` and `signerVariables` fields on `TemplateSlotAssignment` for per-slot signing mode and variable injection. | ||
| - **`TemplateSlotSigningMethod`** type alias for template document signing. | ||
| - **`signingPolicy`** on `CreateContractFromTemplateParams` for template-backed contracts. | ||
| --- | ||
| ## [2.0.0-alpha.7] - 2026-04-08 | ||
| ### Added | ||
| - **Contract signing policy types**: `ContractSigningMethod`, `ContractSignerSource`, `ContractSigningPolicy` — support for embedded vs delegated signing flows. | ||
| - **`signingPolicy`** field on `Contract`, `CreateContractParams`, and `ContractStatusResponse`. | ||
| - **`signingSource`** field on `ContractSigner` and status response signers. | ||
| - **`status`** field on status response signers. | ||
| --- | ||
| ## [2.0.0-alpha.6] - 2026-04-03 | ||
| ### Added | ||
| - **Templates runtime API**: `client.templates.*` for creating draft documents from published templates, sending rendered documents for signing, and creating template-backed contracts. | ||
| - **Template runtime types**: `CreateDocumentFromTemplateParams`, `CreateTemplateSignatureRequestParams`, `CreateContractFromTemplateParams`, and typed response envelopes. | ||
| - **Invoices API**: `client.invoices.*` for create, list, get, send, charge, and manual mark-paid flows on contract invoices. | ||
| - **Transactions API**: `client.transactions.*` for contract-scoped transaction lists and direct transaction lookup by UUID. | ||
| - **Invoice and transaction types**: `Invoice`, `Transaction`, `InvoiceStatus`, `InvoiceType`, `TransactionStatus`, and related request/response helpers. | ||
| - **Invoice and transaction webhook event types**: `invoice.created`, `invoice.sent`, `invoice.paid`, `invoice.cancelled`, `transaction.created`, `transaction.updated`. | ||
| ### Changed | ||
| - **Documentation sync**: README, getting-started, and advanced usage now document template runtime flows, contract billing lifecycle, and canonical webhook verification flow. | ||
| ## [2.0.0-alpha.4] - 2026-04-03 | ||
| - Documentation (README, `GETTING_STARTED.md`, `API_REFERENCE.md`, `ADVANCED_USAGE.md`) rewritten to cover contracts, invoices, templates, canonical webhook verification, and the updated signing flow. | ||
| ### Breaking Changes | ||
| - **UUID-only identifiers**: All public resource identifiers are now UUIDs. Numeric `id` fields have been removed from all response types (`Document`, `DocumentVersion`, `Signer`, `SignatureRequest`, `SignatureRequestStatus`, `ApiKeyInfo`). | ||
| - **Removed fields**: `Document.userId`, `Document.coreTeamId`, `Document.currentVersionId`, `SignatureRequest.userId`, `SignerUser.id`, `ApiKeyInfo.userId`, `HealthCheckResponse.userId` have been removed from public types. | ||
| - **Simplified `Signer` type**: Now returns `id` (UUID), `email`, `signatureHash`, `signedAt`, `hasSigned`, `signer` only. | ||
| - **`SignatureRequestResponse`**: Now matches actual backend response shape (`success`, `requestId`, `signatureRequest`, `message`). | ||
| ### Added | ||
| - **Contracts API**: Full contract lifecycle via `client.contracts.*` — create, list, get, getStatus, getActivities, addPaymentSetup, send, cancel, terminate. | ||
| - **Contract types**: `Contract`, `ContractStatus`, `PaymentTermResponse`, `ContractSigner`, `CreateContractParams`, `ContractListResponse`, `ContractStatusResponse`, `ContractActivitiesResponse`, `ContractActionResponse`, `ContractSendResponse`. | ||
| - **Contract webhook events**: `contract.created`, `contract.status_changed`, `contract.signed`, `contract.cancelled`, `contract.terminated`. | ||
| - **Embedded contract signing**: `CreateEmbeddedSessionParams.metadata.contractId` — pass a contractId and the backend auto-resolves documentId and signatureRequestId. | ||
| - **Webhook verification helper**: `Chaindoc.webhooks.verify(rawBody, signature, timestamp, secret)` with timing-safe HMAC-SHA256 verification and replay protection. | ||
| - **`Chaindoc.webhooks.parse(rawBody)`**: Parse webhook envelope without signature verification. | ||
| - **Typed webhook events**: `WebhookEventType`, `WebhookEnvelope<T>`, `WebhookVerificationResult` types. | ||
| ### Fixed | ||
| - **Environment URLs**: Replaced build-time `process.env` injection with hardcoded safe defaults. SDK no longer ships with `undefined` URLs if env vars are missing during build. | ||
| ### Changed | ||
| - **Webhook contract alignment**: Backend now uses canonical headers (`X-Chaindoc-Event`, `X-Chaindoc-Signature`, `X-Chaindoc-Delivery-Id`, `X-Chaindoc-Timestamp`), envelope format (`{id, type, createdAt, data}`), and signature format (`v1=HMAC-SHA256(timestamp.body)`). | ||
| --- | ||
@@ -137,73 +68,3 @@ | ||
| ## [0.1.0-alpha.7] - 2024-12-09 | ||
| ### Changed | ||
| - Updated API documentation to reflect changes in staging and development environment URLs | ||
| - Ensured consistency across README, API reference, and getting started guide | ||
| ## [0.1.0-alpha.6] - 2024-12-08 | ||
| ### Changed | ||
| - Updated documentation to reflect new environment configuration options | ||
| - Replaced `baseUrl` with `environment` in examples and API reference | ||
| - Introduced `ChaindocEnvironment` type to standardize environment handling | ||
| ## [0.1.0-alpha.5] - 2024-12-07 | ||
| ### Added | ||
| - LICENSE file (MIT) | ||
| - Updated .gitignore with comprehensive rules | ||
| - Created documentation files structure (`docs/` folder) | ||
| ## [0.1.0-alpha.4] - 2024-12-06 | ||
| ### Changed | ||
| - Enhanced README.md with version and license badges | ||
| - Updated README.md to include license details and support information | ||
| ## [0.1.0-alpha.3] - 2024-12-05 | ||
| ### Added | ||
| - Advanced usage documentation (`docs/ADVANCED_USAGE.md`) | ||
| - Document workflows and versioning guide | ||
| - Webhook handling documentation | ||
| - Rate limiting and retry documentation | ||
| ## [0.1.0-alpha.2] - 2024-12-04 | ||
| ### Added | ||
| - API Reference documentation (`docs/API_REFERENCE.md`) | ||
| - Getting Started guide (`docs/GETTING_STARTED.md`) | ||
| - Express.js and Next.js integration examples | ||
| ## [0.1.0-alpha.1] - 2024-12-03 | ||
| ### Added | ||
| - Initial SDK implementation | ||
| - Core `Chaindoc` class with configuration options | ||
| - HTTP client with retry logic and exponential backoff | ||
| - `ChaindocError` class for error handling | ||
| #### Modules | ||
| - **Documents**: Create, update, verify documents on blockchain | ||
| - **Signatures**: Create signature requests, track status, sign documents | ||
| - **Embedded**: Create embedded sessions for frontend signing integration | ||
| - **Media**: Upload media files (PDF, DOC, images, videos) | ||
| - **KYC**: Share KYC data via Sumsub integration | ||
| #### Features | ||
| - TypeScript support with full type definitions | ||
| - Dual format output (CommonJS + ESM) | ||
| - Zero runtime dependencies (uses Node.js 18+ native APIs) | ||
| - Automatic retry with exponential backoff and jitter | ||
| - Request timeout handling | ||
| - Multi-environment support (production, staging, development) | ||
| [1.0.0]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.7...v1.0.0 | ||
| [0.1.0-alpha.7]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7 | ||
| [0.1.0-alpha.6]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.5...v0.1.0-alpha.6 | ||
| [0.1.0-alpha.5]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.4...v0.1.0-alpha.5 | ||
| [0.1.0-alpha.4]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4 | ||
| [0.1.0-alpha.3]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.2...v0.1.0-alpha.3 | ||
| [0.1.0-alpha.2]: https://github.com/ChaindocIO/server-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2 | ||
| [0.1.0-alpha.1]: https://github.com/ChaindocIO/server-sdk/releases/tag/v0.1.0-alpha.1 | ||
| [2.0.0]: https://github.com/ChaindocIO/server-sdk/compare/v1.0.0...v2.0.0 | ||
| [1.0.0]: https://github.com/ChaindocIO/server-sdk/releases/tag/v1.0.0 |
+5
-3
| { | ||
| "name": "@chaindoc_io/server-sdk", | ||
| "version": "2.0.0-alpha.13", | ||
| "version": "2.0.0", | ||
| "description": "Server-side SDK for Chaindoc API - document management, signatures, and embedded sessions", | ||
@@ -43,4 +43,6 @@ "main": "./dist/index.cjs", | ||
| "nodejs", | ||
| "kyc", | ||
| "embedded-signing" | ||
| "embedded-signing", | ||
| "contracts", | ||
| "invoices", | ||
| "templates" | ||
| ], | ||
@@ -47,0 +49,0 @@ "author": "Chaindoc Team <dev@chaindoc.io>", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
-33.33%187392
-2.27%