instasign 1.1.10 → 1.1.12

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
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.12] - 2026-04-26
6
+
7
+ ### Added
8
+ - **SignatureType**: `"graphometric"` added to `VALID_SIGN_REQUEST_SIGNATURE_TYPES`. `signRequests.create()` and `envelopes.addAll()` now accept `signatureType: 'graphometric'`.
9
+
10
+ ## [1.1.11] - 2026-03-27
11
+
12
+ ### Added
13
+ - **Envelopes API**: `envelopes.list()` now returns `expirationDate` for sign requests.
14
+
5
15
  ## [1.1.10] - 2026-03-27
6
16
 
7
17
  ### Changed
package/README.md CHANGED
@@ -63,7 +63,7 @@ await instasign.envelopes.addAll({
63
63
  {
64
64
  filename: 'contract.pdf',
65
65
  base64File: '...',
66
- signatureType: 'advanced', // 'otp' | 'advanced' | 'qualified' — defaults to 'otp'
66
+ signatureType: 'advanced', // 'otp' | 'advanced' | 'qualified' | 'graphometric' — defaults to 'otp'
67
67
  }
68
68
  ]
69
69
  });
@@ -81,7 +81,7 @@ Manage individual signature requests.
81
81
  const signRequest = await instasign.signRequests.create({
82
82
  filename: 'contract.pdf',
83
83
  base64File: '...', // base64 encoded file content
84
- signatureType: 'otp', // 'otp' | 'advanced' | 'qualified' — defaults to 'otp'
84
+ signatureType: 'otp', // 'otp' | 'advanced' | 'qualified' | 'graphometric' — defaults to 'otp'
85
85
  });
86
86
 
87
87
  // Retrieve file data
package/dist/index.cjs CHANGED
@@ -254,12 +254,13 @@ var VALID_SIGN_REQUEST_STATUSES = [
254
254
  "queued",
255
255
  "expired"
256
256
  ];
257
- var VALID_SIGN_REQUEST_SIGNATURE_TYPES = ["otp", "advanced", "qualified"];
257
+ var VALID_SIGN_REQUEST_SIGNATURE_TYPES = ["otp", "advanced", "qualified", "graphometric"];
258
258
  var VALID_ENVELOPE_STATUSES = [
259
259
  "pending",
260
260
  "in-progress",
261
261
  "completed",
262
- "canceled"
262
+ "canceled",
263
+ "expired"
263
264
  ];
264
265
  var VALID_ORDER_BY = ["updatedAt", "createdAt"];
265
266
  var VALID_ORDER_DIRECTION = ["asc", "desc"];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts","../../types/src/index.ts"],"sourcesContent":["export * from './resources/Envelopes.js';\nexport * from './resources/SignRequests.js';\nexport * from './resources/Webhooks.js';\nexport * from './instasign.js';\nexport * from './types.js';\nexport * from '@instasign/types';\n\nexport type * from '../types/schema.js';","import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestsToEnvelopeParams,\n type AddSignRequestsToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add sign requests to an envelope\n */\n async addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-requests', params);\n return response.data.result;\n }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types.js';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n this.client.interceptors.request.use(\n (requestConfig) => {\n if (requestConfig.data) {\n requestConfig.data = this._serializeDateInputs(requestConfig.data);\n }\n return requestConfig;\n },\n );\n this.client.interceptors.response.use(\n (response) => {\n if (response.data && response.data.result) {\n response.data.result = this._normalizeParseDates(response.data.result);\n }\n return response;\n },\n );\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n\n private _serializeDateInputs(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (data instanceof Date) {\n return data.toISOString();\n }\n\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._serializeDateInputs(item));\n }\n\n const serialized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n serialized[key] = this._serializeDateInputs(data[key]);\n }\n }\n return serialized;\n }\n\n private _normalizeParseDates(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._normalizeParseDates(item));\n }\n\n if (data.__type === 'Date' && data.iso) {\n return data.iso;\n }\n\n const normalized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n normalized[key] = this._normalizeParseDates(data[key]);\n }\n }\n return normalized;\n }\n}\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\n 'envelope_all_requests_signed',\n 'sign_request_created',\n 'sign_request_signed',\n 'sign_request_expired',\n] as const;\n\nexport type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];\n\nexport type WebhookStatus = 'pending' | 'success' | 'error';\n\nexport type WebhookPayloadMap = {\n 'envelope_created': { envelopeId: string };\n 'envelope_expired': { envelopeId: string };\n 'envelope_all_requests_signed': { envelopeId: string };\n 'sign_request_created': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_signed': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_expired': { requestId: string };\n};\n\nexport const VALID_SIGN_REQUEST_STATUSES = [\n 'pending',\n 'completed',\n 'canceled',\n 'queued',\n 'expired',\n] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_SIGN_REQUEST_SIGNATURE_TYPES = ['otp', 'advanced', 'qualified'] as const;\n\nexport type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'canceled',\n] as const;\n\nexport type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];\n\nexport type SignRequestMetadata = Record<string, unknown>;\nexport type EnvelopeMetadata = Record<string, unknown>;\n\nexport const VALID_ORDER_BY = ['updatedAt', 'createdAt'] as const;\nexport type OrderBy = (typeof VALID_ORDER_BY)[number];\n\nexport const VALID_ORDER_DIRECTION = ['asc', 'desc'] as const;\nexport type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA;AAAA;AAAA;AAAA,EAK7C,MAAM,OAAO,QAA2E;AACpF,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,8BAA8B,MAAM;AAC5E,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,SAA6B,CAAC,GAAoC;AACzE,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,4BAA4B,MAAM;AAC1E,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IAAI,YAAmD;AACzD,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,2BAA2B,EAAE,WAAW,CAAC;AACjF,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SAAS,YAA4D;AACvE,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,gCAAgC,EAAE,WAAW,CAAC;AACtF,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAO,YAA4D;AACrE,UAA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mBAAW,GAAG,IAAI,KAAK,qBAAqB,KAAK,GAAG,CAAC;AAAA,MACzD;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACJ;;;AC/FO,IAAM,4BAA4B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAeO,IAAM,8BAA8B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAIO,IAAM,qCAAqC,CAAC,OAAO,YAAY,WAAW;AAI1E,IAAM,0BAA0B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAOO,IAAM,iBAAiB,CAAC,aAAa,WAAW;AAGhD,IAAM,wBAAwB,CAAC,OAAO,MAAM;","names":["axios"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts","../../types/src/index.ts"],"sourcesContent":["export * from './resources/Envelopes.js';\nexport * from './resources/SignRequests.js';\nexport * from './resources/Webhooks.js';\nexport * from './instasign.js';\nexport * from './types.js';\nexport * from '@instasign/types';\n\nexport type * from '../types/schema.js';","import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestsToEnvelopeParams,\n type AddSignRequestsToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add sign requests to an envelope\n */\n async addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-requests', params);\n return response.data.result;\n }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types.js';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n this.client.interceptors.request.use(\n (requestConfig) => {\n if (requestConfig.data) {\n requestConfig.data = this._serializeDateInputs(requestConfig.data);\n }\n return requestConfig;\n },\n );\n this.client.interceptors.response.use(\n (response) => {\n if (response.data && response.data.result) {\n response.data.result = this._normalizeParseDates(response.data.result);\n }\n return response;\n },\n );\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n\n private _serializeDateInputs(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (data instanceof Date) {\n return data.toISOString();\n }\n\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._serializeDateInputs(item));\n }\n\n const serialized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n serialized[key] = this._serializeDateInputs(data[key]);\n }\n }\n return serialized;\n }\n\n private _normalizeParseDates(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._normalizeParseDates(item));\n }\n\n if (data.__type === 'Date' && data.iso) {\n return data.iso;\n }\n\n const normalized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n normalized[key] = this._normalizeParseDates(data[key]);\n }\n }\n return normalized;\n }\n}\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\n 'envelope_all_requests_signed',\n 'sign_request_created',\n 'sign_request_signed',\n 'sign_request_expired',\n] as const;\n\nexport type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];\n\nexport type WebhookStatus = 'pending' | 'success' | 'error';\n\nexport type WebhookPayloadMap = {\n 'envelope_created': { envelopeId: string };\n 'envelope_expired': { envelopeId: string };\n 'envelope_all_requests_signed': { envelopeId: string };\n 'sign_request_created': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_signed': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_expired': { requestId: string };\n};\n\nexport const VALID_SIGN_REQUEST_STATUSES = [\n 'pending',\n 'completed',\n 'canceled',\n 'queued',\n 'expired',\n] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_SIGN_REQUEST_SIGNATURE_TYPES = ['otp', 'advanced', 'qualified', 'graphometric'] as const;\n\nexport type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'canceled',\n 'expired',\n] as const;\n\nexport type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];\n\nexport type SignRequestMetadata = Record<string, unknown>;\nexport type EnvelopeMetadata = Record<string, unknown>;\n\nexport const VALID_ORDER_BY = ['updatedAt', 'createdAt'] as const;\nexport type OrderBy = (typeof VALID_ORDER_BY)[number];\n\nexport const VALID_ORDER_DIRECTION = ['asc', 'desc'] as const;\nexport type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA;AAAA;AAAA;AAAA,EAK7C,MAAM,OAAO,QAA2E;AACpF,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,8BAA8B,MAAM;AAC5E,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,SAA6B,CAAC,GAAoC;AACzE,UAAM,WAAW,MAAM,KAAK,OAAO,KAAK,4BAA4B,MAAM;AAC1E,WAAO,SAAS,KAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,IAAI,YAAmD;AAC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OAAO,SAAS,SAAU,QAAO;AAE9C,QAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,aAAO,KAAK,IAAI,UAAQ,KAAK,qBAAqB,IAAI,CAAC;AAAA,IAC3D;AAEA,QAAI,KAAK,WAAW,UAAU,KAAK,KAAK;AACpC,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,aAAkB,CAAC;AACzB,eAAW,OAAO,MAAM;AACpB,UAAI,OAAO,UAAU,eAAe,KAAK,MAAM,GAAG,GAAG;AACjD,mBAAW,GAAG,IAAI,KAAK,qBAAqB,KAAK,GAAG,CAAC;AAAA,MACzD;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACJ;;;AC/FO,IAAM,4BAA4B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAeO,IAAM,8BAA8B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAIO,IAAM,qCAAqC,CAAC,OAAO,YAAY,aAAa,cAAc;AAI1F,IAAM,0BAA0B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAOO,IAAM,iBAAiB,CAAC,aAAa,WAAW;AAGhD,IAAM,wBAAwB,CAAC,OAAO,MAAM;","names":["axios"]}
package/dist/index.d.cts CHANGED
@@ -36,7 +36,7 @@ interface paths {
36
36
  };
37
37
  clientReferenceId?: string;
38
38
  /** @enum {string} */
39
- signatureType?: "otp" | "advanced" | "qualified";
39
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
40
40
  /** Format: date-time */
41
41
  expirationDate?: string;
42
42
  }[];
@@ -269,7 +269,7 @@ interface paths {
269
269
  "application/json": {
270
270
  name?: string;
271
271
  /** @enum {string} */
272
- status?: "pending" | "in-progress" | "completed" | "canceled";
272
+ status?: "pending" | "in-progress" | "completed" | "canceled" | "expired";
273
273
  clientReferenceId?: string;
274
274
  signRequests?: string[];
275
275
  /** @enum {string} */
@@ -471,7 +471,7 @@ interface paths {
471
471
  /** Format: date-time */
472
472
  expirationDate?: string;
473
473
  /** @enum {string} */
474
- signatureType?: "otp" | "advanced" | "qualified";
474
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
475
475
  };
476
476
  };
477
477
  };
@@ -612,15 +612,15 @@ interface components {
612
612
  name: string;
613
613
  description?: string;
614
614
  /** @enum {string} */
615
- status: "pending" | "in-progress" | "completed" | "canceled";
615
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
616
616
  clientReferenceId?: string;
617
617
  signRequestsCount: number;
618
618
  signRequests: {
619
619
  requestId: string;
620
620
  /** @enum {string} */
621
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
621
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
622
622
  /** @enum {string} */
623
- signatureType: "otp" | "advanced" | "qualified";
623
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
624
624
  fileName: string;
625
625
  fileUrl: string;
626
626
  signedFileUrl?: string;
@@ -628,6 +628,8 @@ interface components {
628
628
  [key: string]: unknown;
629
629
  };
630
630
  clientReferenceId?: string;
631
+ /** Format: date-time */
632
+ expirationDate?: string;
631
633
  }[];
632
634
  /** Format: date-time */
633
635
  createdAt: string;
@@ -642,15 +644,15 @@ interface components {
642
644
  name: string;
643
645
  description?: string;
644
646
  /** @enum {string} */
645
- status: "pending" | "in-progress" | "completed" | "canceled";
647
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
646
648
  clientReferenceId?: string;
647
649
  signRequestsCount: number;
648
650
  signRequests: {
649
651
  requestId: string;
650
652
  /** @enum {string} */
651
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
653
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
652
654
  /** @enum {string} */
653
- signatureType: "otp" | "advanced" | "qualified";
655
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
654
656
  fileName: string;
655
657
  fileUrl: string;
656
658
  signedFileUrl?: string;
@@ -658,6 +660,8 @@ interface components {
658
660
  [key: string]: unknown;
659
661
  };
660
662
  clientReferenceId?: string;
663
+ /** Format: date-time */
664
+ expirationDate?: string;
661
665
  }[];
662
666
  /** Format: date-time */
663
667
  createdAt: string;
@@ -687,9 +691,9 @@ interface components {
687
691
  SignRequestGetResult: {
688
692
  requestId: string;
689
693
  /** @enum {string} */
690
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
694
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
691
695
  /** @enum {string} */
692
- signatureType?: "otp" | "advanced" | "qualified";
696
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
693
697
  fileName: string;
694
698
  originalFile?: string;
695
699
  signedFile?: string;
@@ -750,9 +754,9 @@ type WebhookPayloadMap = {
750
754
  };
751
755
  declare const VALID_SIGN_REQUEST_STATUSES: readonly ["pending", "completed", "canceled", "queued", "expired"];
752
756
  type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];
753
- declare const VALID_SIGN_REQUEST_SIGNATURE_TYPES: readonly ["otp", "advanced", "qualified"];
757
+ declare const VALID_SIGN_REQUEST_SIGNATURE_TYPES: readonly ["otp", "advanced", "qualified", "graphometric"];
754
758
  type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];
755
- declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "canceled"];
759
+ declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "canceled", "expired"];
756
760
  type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];
757
761
  type SignRequestMetadata = Record<string, unknown>;
758
762
  type EnvelopeMetadata = Record<string, unknown>;
@@ -775,14 +779,19 @@ type DateInput = string | Date;
775
779
  type WithDateInputFields<T, K extends keyof T> = Omit<T, K> & {
776
780
  [P in K]?: DateInput;
777
781
  };
782
+ type WithOverrides<T, O> = Omit<T, keyof O> & O;
778
783
  /** A full envelope with its sign requests */
779
- interface Envelope extends SchemaResult<'EnvelopeGetResult'> {
780
- }
784
+ type Envelope = WithOverrides<SchemaResult<'EnvelopeGetResult'>, {
785
+ status: EnvelopeStatus;
786
+ }>;
781
787
  /** Envelope as returned in a list */
782
- interface EnvelopeListItem extends SchemaResult<'EnvelopeListResult'> {
783
- }
788
+ type EnvelopeListItem = WithOverrides<SchemaResult<'EnvelopeListResult'>, {
789
+ status: EnvelopeStatus;
790
+ }>;
784
791
  type CreateEnvelopeParams = WithDateInputFields<RequestBody<'/functions/envelope:create'>, 'expirationDate'>;
785
- type GetEnvelopesParams = WithDateInputFields<RequestBody<'/functions/envelope:list'>, 'expirationDateStart' | 'expirationDateEnd'>;
792
+ type GetEnvelopesParams = WithOverrides<WithDateInputFields<RequestBody<'/functions/envelope:list'>, 'expirationDateStart' | 'expirationDateEnd'>, {
793
+ status?: EnvelopeStatus;
794
+ }>;
786
795
  type UpdateEnvelopeMetadataParams = RequestBody<'/functions/envelope:update-metadata'>;
787
796
  type RemoveSignRequestFromEnvelopeParams = RequestBody<'/functions/envelope:remove-sign-request'>;
788
797
  type AddSignRequestInput = WithDateInputFields<RequestBody<'/functions/envelope:add-sign-requests'>['signRequests'][number], 'expirationDate'>;
package/dist/index.d.ts CHANGED
@@ -36,7 +36,7 @@ interface paths {
36
36
  };
37
37
  clientReferenceId?: string;
38
38
  /** @enum {string} */
39
- signatureType?: "otp" | "advanced" | "qualified";
39
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
40
40
  /** Format: date-time */
41
41
  expirationDate?: string;
42
42
  }[];
@@ -269,7 +269,7 @@ interface paths {
269
269
  "application/json": {
270
270
  name?: string;
271
271
  /** @enum {string} */
272
- status?: "pending" | "in-progress" | "completed" | "canceled";
272
+ status?: "pending" | "in-progress" | "completed" | "canceled" | "expired";
273
273
  clientReferenceId?: string;
274
274
  signRequests?: string[];
275
275
  /** @enum {string} */
@@ -471,7 +471,7 @@ interface paths {
471
471
  /** Format: date-time */
472
472
  expirationDate?: string;
473
473
  /** @enum {string} */
474
- signatureType?: "otp" | "advanced" | "qualified";
474
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
475
475
  };
476
476
  };
477
477
  };
@@ -612,15 +612,15 @@ interface components {
612
612
  name: string;
613
613
  description?: string;
614
614
  /** @enum {string} */
615
- status: "pending" | "in-progress" | "completed" | "canceled";
615
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
616
616
  clientReferenceId?: string;
617
617
  signRequestsCount: number;
618
618
  signRequests: {
619
619
  requestId: string;
620
620
  /** @enum {string} */
621
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
621
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
622
622
  /** @enum {string} */
623
- signatureType: "otp" | "advanced" | "qualified";
623
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
624
624
  fileName: string;
625
625
  fileUrl: string;
626
626
  signedFileUrl?: string;
@@ -628,6 +628,8 @@ interface components {
628
628
  [key: string]: unknown;
629
629
  };
630
630
  clientReferenceId?: string;
631
+ /** Format: date-time */
632
+ expirationDate?: string;
631
633
  }[];
632
634
  /** Format: date-time */
633
635
  createdAt: string;
@@ -642,15 +644,15 @@ interface components {
642
644
  name: string;
643
645
  description?: string;
644
646
  /** @enum {string} */
645
- status: "pending" | "in-progress" | "completed" | "canceled";
647
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
646
648
  clientReferenceId?: string;
647
649
  signRequestsCount: number;
648
650
  signRequests: {
649
651
  requestId: string;
650
652
  /** @enum {string} */
651
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
653
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
652
654
  /** @enum {string} */
653
- signatureType: "otp" | "advanced" | "qualified";
655
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
654
656
  fileName: string;
655
657
  fileUrl: string;
656
658
  signedFileUrl?: string;
@@ -658,6 +660,8 @@ interface components {
658
660
  [key: string]: unknown;
659
661
  };
660
662
  clientReferenceId?: string;
663
+ /** Format: date-time */
664
+ expirationDate?: string;
661
665
  }[];
662
666
  /** Format: date-time */
663
667
  createdAt: string;
@@ -687,9 +691,9 @@ interface components {
687
691
  SignRequestGetResult: {
688
692
  requestId: string;
689
693
  /** @enum {string} */
690
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
694
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
691
695
  /** @enum {string} */
692
- signatureType?: "otp" | "advanced" | "qualified";
696
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
693
697
  fileName: string;
694
698
  originalFile?: string;
695
699
  signedFile?: string;
@@ -750,9 +754,9 @@ type WebhookPayloadMap = {
750
754
  };
751
755
  declare const VALID_SIGN_REQUEST_STATUSES: readonly ["pending", "completed", "canceled", "queued", "expired"];
752
756
  type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];
753
- declare const VALID_SIGN_REQUEST_SIGNATURE_TYPES: readonly ["otp", "advanced", "qualified"];
757
+ declare const VALID_SIGN_REQUEST_SIGNATURE_TYPES: readonly ["otp", "advanced", "qualified", "graphometric"];
754
758
  type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];
755
- declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "canceled"];
759
+ declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "canceled", "expired"];
756
760
  type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];
757
761
  type SignRequestMetadata = Record<string, unknown>;
758
762
  type EnvelopeMetadata = Record<string, unknown>;
@@ -775,14 +779,19 @@ type DateInput = string | Date;
775
779
  type WithDateInputFields<T, K extends keyof T> = Omit<T, K> & {
776
780
  [P in K]?: DateInput;
777
781
  };
782
+ type WithOverrides<T, O> = Omit<T, keyof O> & O;
778
783
  /** A full envelope with its sign requests */
779
- interface Envelope extends SchemaResult<'EnvelopeGetResult'> {
780
- }
784
+ type Envelope = WithOverrides<SchemaResult<'EnvelopeGetResult'>, {
785
+ status: EnvelopeStatus;
786
+ }>;
781
787
  /** Envelope as returned in a list */
782
- interface EnvelopeListItem extends SchemaResult<'EnvelopeListResult'> {
783
- }
788
+ type EnvelopeListItem = WithOverrides<SchemaResult<'EnvelopeListResult'>, {
789
+ status: EnvelopeStatus;
790
+ }>;
784
791
  type CreateEnvelopeParams = WithDateInputFields<RequestBody<'/functions/envelope:create'>, 'expirationDate'>;
785
- type GetEnvelopesParams = WithDateInputFields<RequestBody<'/functions/envelope:list'>, 'expirationDateStart' | 'expirationDateEnd'>;
792
+ type GetEnvelopesParams = WithOverrides<WithDateInputFields<RequestBody<'/functions/envelope:list'>, 'expirationDateStart' | 'expirationDateEnd'>, {
793
+ status?: EnvelopeStatus;
794
+ }>;
786
795
  type UpdateEnvelopeMetadataParams = RequestBody<'/functions/envelope:update-metadata'>;
787
796
  type RemoveSignRequestFromEnvelopeParams = RequestBody<'/functions/envelope:remove-sign-request'>;
788
797
  type AddSignRequestInput = WithDateInputFields<RequestBody<'/functions/envelope:add-sign-requests'>['signRequests'][number], 'expirationDate'>;
package/dist/index.js CHANGED
@@ -209,12 +209,13 @@ var VALID_SIGN_REQUEST_STATUSES = [
209
209
  "queued",
210
210
  "expired"
211
211
  ];
212
- var VALID_SIGN_REQUEST_SIGNATURE_TYPES = ["otp", "advanced", "qualified"];
212
+ var VALID_SIGN_REQUEST_SIGNATURE_TYPES = ["otp", "advanced", "qualified", "graphometric"];
213
213
  var VALID_ENVELOPE_STATUSES = [
214
214
  "pending",
215
215
  "in-progress",
216
216
  "completed",
217
- "canceled"
217
+ "canceled",
218
+ "expired"
218
219
  ];
219
220
  var VALID_ORDER_BY = ["updatedAt", "createdAt"];
220
221
  var VALID_ORDER_DIRECTION = ["asc", "desc"];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts","../../types/src/index.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestsToEnvelopeParams,\n type AddSignRequestsToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add sign requests to an envelope\n */\n async addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-requests', params);\n return response.data.result;\n }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types.js';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n this.client.interceptors.request.use(\n (requestConfig) => {\n if (requestConfig.data) {\n requestConfig.data = this._serializeDateInputs(requestConfig.data);\n }\n return requestConfig;\n },\n );\n this.client.interceptors.response.use(\n (response) => {\n if (response.data && response.data.result) {\n response.data.result = this._normalizeParseDates(response.data.result);\n }\n return response;\n },\n );\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n\n private _serializeDateInputs(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (data instanceof Date) {\n return data.toISOString();\n }\n\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._serializeDateInputs(item));\n }\n\n const serialized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n serialized[key] = this._serializeDateInputs(data[key]);\n }\n }\n return serialized;\n }\n\n private _normalizeParseDates(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._normalizeParseDates(item));\n }\n\n if (data.__type === 'Date' && data.iso) {\n return data.iso;\n }\n\n const normalized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n normalized[key] = this._normalizeParseDates(data[key]);\n }\n }\n return normalized;\n }\n}\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\n 'envelope_all_requests_signed',\n 'sign_request_created',\n 'sign_request_signed',\n 'sign_request_expired',\n] as const;\n\nexport type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];\n\nexport type WebhookStatus = 'pending' | 'success' | 'error';\n\nexport type WebhookPayloadMap = {\n 'envelope_created': { envelopeId: string };\n 'envelope_expired': { envelopeId: string };\n 'envelope_all_requests_signed': { envelopeId: string };\n 'sign_request_created': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_signed': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_expired': { requestId: string };\n};\n\nexport const VALID_SIGN_REQUEST_STATUSES = [\n 'pending',\n 'completed',\n 'canceled',\n 'queued',\n 'expired',\n] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_SIGN_REQUEST_SIGNATURE_TYPES = ['otp', 'advanced', 'qualified'] as const;\n\nexport type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'canceled',\n] as const;\n\nexport type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];\n\nexport type SignRequestMetadata = Record<string, unknown>;\nexport type EnvelopeMetadata = Record<string, unknown>;\n\nexport const VALID_ORDER_BY = ['updatedAt', 'createdAt'] as const;\nexport type OrderBy = (typeof VALID_ORDER_BY)[number];\n\nexport const VALID_ORDER_DIRECTION = ['asc', 'desc'] as const;\nexport type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];\n"],"mappings":";AAcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA;AAAA;AAAA;AAAA,EAK7C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AAO,KAAK,IAAI,UAAQ,KAAK,qBAAqB,IAAI,CAAC;AAAA,IAC3D;AAEA,UAAM,aAAkB,CAAC;AACzB,eAAW,OAAO,MAAM;AACpB,UAAI,OAAO,UAAU,eAAe,KAAK,MAAM,GAAG,GAAG;AACjD,mBAAW,GAAG,IAAI,KAAK,qBAAqB,KAAK,GAAG,CAAC;AAAA,MACzD;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAAA,EAEQ,qBAAqB,MAAgB;AACzC,QAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAE9C,QAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,aAAO,KAAK,IAAI,UAAQ,KAAK,qBAAqB,IAAI,CAAC;AAAA,IAC3D;AAEA,QAAI,KAAK,WAAW,UAAU,KAAK,KAAK;AACpC,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,aAAkB,CAAC;AACzB,eAAW,OAAO,MAAM;AACpB,UAAI,OAAO,UAAU,eAAe,KAAK,MAAM,GAAG,GAAG;AACjD,mBAAW,GAAG,IAAI,KAAK,qBAAqB,KAAK,GAAG,CAAC;AAAA,MACzD;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACJ;;;AC/FO,IAAM,4BAA4B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAeO,IAAM,8BAA8B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAIO,IAAM,qCAAqC,CAAC,OAAO,YAAY,WAAW;AAI1E,IAAM,0BAA0B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAOO,IAAM,iBAAiB,CAAC,aAAa,WAAW;AAGhD,IAAM,wBAAwB,CAAC,OAAO,MAAM;","names":[]}
1
+ {"version":3,"sources":["../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts","../../types/src/index.ts"],"sourcesContent":["import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestsToEnvelopeParams,\n type AddSignRequestsToEnvelopeResponse,\n type CreateEnvelopeParams,\n type CreateEnvelopeResponse,\n type GetEnvelopesParams,\n type OperationResponse,\n type RemoveSignRequestFromEnvelopeParams,\n type UpdateEnvelopeMetadataParams,\n type UpdateEnvelopeMetadataResponse\n} from '../types.js';\n\nexport class Envelopes {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new envelope\n */\n async create(params: CreateEnvelopeParams): Promise<CreateEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:create', params);\n return response.data.result;\n }\n\n /**\n * List envelopes\n */\n async list(params: GetEnvelopesParams = {}): Promise<Envelope[] | undefined> {\n const response = await this.client.post('/functions/envelope:list', params);\n return response.data.result;\n }\n\n /**\n * Retrieve a single envelope with its sign requests\n */\n async get(envelopeId: string): Promise<Envelope | undefined> {\n const response = await this.client.post('/functions/envelope:get', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Complete an envelope\n */\n async complete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:complete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Delete an envelope\n */\n async delete(envelopeId: string): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:delete', { envelopeId });\n return response.data.result;\n }\n\n /**\n * Update envelope metadata\n */\n async updateMetadata(params: UpdateEnvelopeMetadataParams): Promise<UpdateEnvelopeMetadataResponse | undefined> {\n const response = await this.client.post('/functions/envelope:update-metadata', params);\n return response.data.result;\n }\n\n /**\n * Remove a sign request from an envelope\n */\n async remove(params: RemoveSignRequestFromEnvelopeParams): Promise<OperationResponse | undefined> {\n const response = await this.client.post('/functions/envelope:remove-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add sign requests to an envelope\n */\n async addAll(params: AddSignRequestsToEnvelopeParams): Promise<AddSignRequestsToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-requests', params);\n return response.data.result;\n }\n}","import { AxiosInstance } from 'axios';\nimport {\n type CreateSignRequestParams,\n type CreateSignRequestResponse,\n type CompleteSignRequestParams,\n type CompleteSignRequestResponse,\n type SignRequest,\n} from '../types.js';\n\nexport class SignRequests {\n constructor(private client: AxiosInstance) { }\n\n /**\n * Create a new sign request\n */\n async create(params: CreateSignRequestParams): Promise<CreateSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:create', params);\n return response.data.result;\n }\n\n /**\n * Complete a sign request\n */\n async complete(params: CompleteSignRequestParams): Promise<CompleteSignRequestResponse | undefined> {\n const response = await this.client.post('/functions/sign-request:complete', params);\n return response.data.result;\n }\n\n /**\n * Get the file associated with a sign request\n */\n async get(requestId: string): Promise<SignRequest | undefined> {\n const response = await this.client.post('/functions/sign-request:get', { requestId });\n return response.data.result;\n }\n}","import * as crypto from 'node:crypto';\nimport { WebhookEvent } from '../types.js';\n\nexport class Webhooks {\n constructor(private tolerance: number = 300) { }\n\n /**\n * Verify and parse a webhook event\n */\n public constructEvent(payload: string, signatureHeader: string, webhookSecret: string): WebhookEvent {\n const parts = signatureHeader.split(',');\n const timestamp = parts.find((p) => p.startsWith('t='))?.split('=')[1];\n const signature = parts.find((p) => p.startsWith('v1='))?.split('=')[1];\n\n if (!timestamp || !signature) {\n throw new Error('Invalid signature header');\n }\n\n const now = Math.floor(Date.now() / 1000);\n if (Math.abs(now - parseInt(timestamp)) > this.tolerance) {\n throw new Error('Signature too old');\n }\n\n const signedPayload = `${timestamp}.${payload}`;\n const expectedSignature = crypto\n .createHmac('sha256', webhookSecret)\n .update(signedPayload)\n .digest('hex');\n\n const isValid = crypto.timingSafeEqual(\n Buffer.from(signature),\n Buffer.from(expectedSignature)\n );\n\n if (!isValid) {\n throw new Error('Invalid signature');\n }\n\n return JSON.parse(payload) as WebhookEvent;\n }\n}\n","import axios, { AxiosInstance } from 'axios';\nimport { Envelopes } from './resources/Envelopes.js';\nimport { SignRequests } from './resources/SignRequests.js';\nimport { Webhooks } from './resources/Webhooks.js';\n\nexport interface IInstasignConfig {\n /// Required Instasign API key\n apiKey: string;\n\n /// Optional Parse Server config\n appId?: string;\n restApiKey?: string;\n serverUrl?: string;\n /// Optional webhook signature tolerance in seconds (default 300)\n webhookTolerance?: number;\n}\n\nexport class Instasign {\n private client: AxiosInstance;\n\n public readonly envelopes: Envelopes;\n public readonly signRequests: SignRequests;\n public readonly webhooks: Webhooks;\n\n constructor(config: IInstasignConfig) {\n this.client = axios.create({\n baseURL: config.serverUrl,\n headers: {\n 'X-Parse-APPLICATION-ID': config.appId,\n 'X-Parse-REST-API-KEY': config.restApiKey,\n 'x-api-key': config.apiKey,\n 'Content-Type': 'application/json',\n },\n });\n this.client.interceptors.request.use(\n (requestConfig) => {\n if (requestConfig.data) {\n requestConfig.data = this._serializeDateInputs(requestConfig.data);\n }\n return requestConfig;\n },\n );\n this.client.interceptors.response.use(\n (response) => {\n if (response.data && response.data.result) {\n response.data.result = this._normalizeParseDates(response.data.result);\n }\n return response;\n },\n );\n\n this.envelopes = new Envelopes(this.client);\n this.signRequests = new SignRequests(this.client);\n this.webhooks = new Webhooks(config.webhookTolerance ?? 300);\n }\n\n private _serializeDateInputs(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (data instanceof Date) {\n return data.toISOString();\n }\n\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._serializeDateInputs(item));\n }\n\n const serialized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n serialized[key] = this._serializeDateInputs(data[key]);\n }\n }\n return serialized;\n }\n\n private _normalizeParseDates(data: any): any { // eslint-disable-line @typescript-eslint/no-explicit-any\n if (!data || typeof data !== 'object') return data;\n\n if (Array.isArray(data)) {\n return data.map(item => this._normalizeParseDates(item));\n }\n\n if (data.__type === 'Date' && data.iso) {\n return data.iso;\n }\n\n const normalized: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n normalized[key] = this._normalizeParseDates(data[key]);\n }\n }\n return normalized;\n }\n}\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\n 'envelope_all_requests_signed',\n 'sign_request_created',\n 'sign_request_signed',\n 'sign_request_expired',\n] as const;\n\nexport type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];\n\nexport type WebhookStatus = 'pending' | 'success' | 'error';\n\nexport type WebhookPayloadMap = {\n 'envelope_created': { envelopeId: string };\n 'envelope_expired': { envelopeId: string };\n 'envelope_all_requests_signed': { envelopeId: string };\n 'sign_request_created': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_signed': { requestId: string; status: string; envelopeId?: string };\n 'sign_request_expired': { requestId: string };\n};\n\nexport const VALID_SIGN_REQUEST_STATUSES = [\n 'pending',\n 'completed',\n 'canceled',\n 'queued',\n 'expired',\n] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_SIGN_REQUEST_SIGNATURE_TYPES = ['otp', 'advanced', 'qualified', 'graphometric'] as const;\n\nexport type SignatureType = typeof VALID_SIGN_REQUEST_SIGNATURE_TYPES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'canceled',\n 'expired',\n] as const;\n\nexport type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];\n\nexport type SignRequestMetadata = Record<string, unknown>;\nexport type EnvelopeMetadata = Record<string, unknown>;\n\nexport const VALID_ORDER_BY = ['updatedAt', 'createdAt'] as const;\nexport type OrderBy = (typeof VALID_ORDER_BY)[number];\n\nexport const VALID_ORDER_DIRECTION = ['asc', 'desc'] as const;\nexport type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];\n"],"mappings":";AAcO,IAAM,YAAN,MAAgB;AAAA,EACnB,YAAoB,QAAu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  {
2
2
  "name": "instasign",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Instasign API wrapper",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/types/schema.d.ts CHANGED
@@ -34,7 +34,7 @@ export interface paths {
34
34
  };
35
35
  clientReferenceId?: string;
36
36
  /** @enum {string} */
37
- signatureType?: "otp" | "advanced" | "qualified";
37
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
38
38
  /** Format: date-time */
39
39
  expirationDate?: string;
40
40
  }[];
@@ -267,7 +267,7 @@ export interface paths {
267
267
  "application/json": {
268
268
  name?: string;
269
269
  /** @enum {string} */
270
- status?: "pending" | "in-progress" | "completed" | "canceled";
270
+ status?: "pending" | "in-progress" | "completed" | "canceled" | "expired";
271
271
  clientReferenceId?: string;
272
272
  signRequests?: string[];
273
273
  /** @enum {string} */
@@ -469,7 +469,7 @@ export interface paths {
469
469
  /** Format: date-time */
470
470
  expirationDate?: string;
471
471
  /** @enum {string} */
472
- signatureType?: "otp" | "advanced" | "qualified";
472
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
473
473
  };
474
474
  };
475
475
  };
@@ -610,15 +610,15 @@ export interface components {
610
610
  name: string;
611
611
  description?: string;
612
612
  /** @enum {string} */
613
- status: "pending" | "in-progress" | "completed" | "canceled";
613
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
614
614
  clientReferenceId?: string;
615
615
  signRequestsCount: number;
616
616
  signRequests: {
617
617
  requestId: string;
618
618
  /** @enum {string} */
619
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
619
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
620
620
  /** @enum {string} */
621
- signatureType: "otp" | "advanced" | "qualified";
621
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
622
622
  fileName: string;
623
623
  fileUrl: string;
624
624
  signedFileUrl?: string;
@@ -626,6 +626,8 @@ export interface components {
626
626
  [key: string]: unknown;
627
627
  };
628
628
  clientReferenceId?: string;
629
+ /** Format: date-time */
630
+ expirationDate?: string;
629
631
  }[];
630
632
  /** Format: date-time */
631
633
  createdAt: string;
@@ -640,15 +642,15 @@ export interface components {
640
642
  name: string;
641
643
  description?: string;
642
644
  /** @enum {string} */
643
- status: "pending" | "in-progress" | "completed" | "canceled";
645
+ status: "pending" | "in-progress" | "completed" | "canceled" | "expired";
644
646
  clientReferenceId?: string;
645
647
  signRequestsCount: number;
646
648
  signRequests: {
647
649
  requestId: string;
648
650
  /** @enum {string} */
649
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
651
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
650
652
  /** @enum {string} */
651
- signatureType: "otp" | "advanced" | "qualified";
653
+ signatureType: "otp" | "advanced" | "qualified" | "graphometric";
652
654
  fileName: string;
653
655
  fileUrl: string;
654
656
  signedFileUrl?: string;
@@ -656,6 +658,8 @@ export interface components {
656
658
  [key: string]: unknown;
657
659
  };
658
660
  clientReferenceId?: string;
661
+ /** Format: date-time */
662
+ expirationDate?: string;
659
663
  }[];
660
664
  /** Format: date-time */
661
665
  createdAt: string;
@@ -685,9 +689,9 @@ export interface components {
685
689
  SignRequestGetResult: {
686
690
  requestId: string;
687
691
  /** @enum {string} */
688
- status: "pending" | "completed" | "canceled" | "queued" | "expired";
692
+ status: "pending" | "completed" | "canceled" | "expired" | "queued";
689
693
  /** @enum {string} */
690
- signatureType?: "otp" | "advanced" | "qualified";
694
+ signatureType?: "otp" | "advanced" | "qualified" | "graphometric";
691
695
  fileName: string;
692
696
  originalFile?: string;
693
697
  signedFile?: string;