instasign 1.1.3 → 1.1.4
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 +3 -0
- package/dist/index.cjs +33 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +198 -131
- package/dist/index.d.ts +198 -131
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/schema.d.ts +124 -111
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.1.4] - 2026-03-01
|
|
6
|
+
- **Type Safety**: Improved internal type synchronization with compile-time schema validation against the OpenAPI specification.
|
|
7
|
+
|
|
5
8
|
## [1.1.3] - 2026-03-01
|
|
6
9
|
- **Improved Type Precision**: Refactored resource types (Envelopes, SignRequests) to be derived directly from the OpenAPI schema using new utility types (`ResponseResult`, `RequestBody`).
|
|
7
10
|
- **Read-only Resources**: The `envelopes`, `signRequests`, and `webhooks` properties on the `Instasign` class are now `readonly`.
|
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,11 @@ __export(index_exports, {
|
|
|
33
33
|
Envelopes: () => Envelopes,
|
|
34
34
|
Instasign: () => Instasign,
|
|
35
35
|
SignRequests: () => SignRequests,
|
|
36
|
+
VALID_ENVELOPE_STATUSES: () => VALID_ENVELOPE_STATUSES,
|
|
37
|
+
VALID_ORDER_BY: () => VALID_ORDER_BY,
|
|
38
|
+
VALID_ORDER_DIRECTION: () => VALID_ORDER_DIRECTION,
|
|
39
|
+
VALID_SIGN_REQUEST_STATUSES: () => VALID_SIGN_REQUEST_STATUSES,
|
|
40
|
+
VALID_WEBHOOK_EVENT_TYPES: () => VALID_WEBHOOK_EVENT_TYPES,
|
|
36
41
|
Webhooks: () => Webhooks
|
|
37
42
|
});
|
|
38
43
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -191,11 +196,39 @@ var Instasign = class {
|
|
|
191
196
|
this.webhooks = new Webhooks(config.webhookTolerance ?? 300);
|
|
192
197
|
}
|
|
193
198
|
};
|
|
199
|
+
|
|
200
|
+
// ../types/src/index.ts
|
|
201
|
+
var VALID_WEBHOOK_EVENT_TYPES = [
|
|
202
|
+
"envelope_created",
|
|
203
|
+
"envelope_expired",
|
|
204
|
+
"sign_request_created",
|
|
205
|
+
"sign_request_signed",
|
|
206
|
+
"sign_request_expired"
|
|
207
|
+
];
|
|
208
|
+
var VALID_SIGN_REQUEST_STATUSES = [
|
|
209
|
+
"pending",
|
|
210
|
+
"completed",
|
|
211
|
+
"canceled",
|
|
212
|
+
"queued"
|
|
213
|
+
];
|
|
214
|
+
var VALID_ENVELOPE_STATUSES = [
|
|
215
|
+
"pending",
|
|
216
|
+
"in-progress",
|
|
217
|
+
"completed",
|
|
218
|
+
"cancelled"
|
|
219
|
+
];
|
|
220
|
+
var VALID_ORDER_BY = ["updatedAt", "createdAt"];
|
|
221
|
+
var VALID_ORDER_DIRECTION = ["asc", "desc"];
|
|
194
222
|
// Annotate the CommonJS export names for ESM import in node:
|
|
195
223
|
0 && (module.exports = {
|
|
196
224
|
Envelopes,
|
|
197
225
|
Instasign,
|
|
198
226
|
SignRequests,
|
|
227
|
+
VALID_ENVELOPE_STATUSES,
|
|
228
|
+
VALID_ORDER_BY,
|
|
229
|
+
VALID_ORDER_DIRECTION,
|
|
230
|
+
VALID_SIGN_REQUEST_STATUSES,
|
|
231
|
+
VALID_WEBHOOK_EVENT_TYPES,
|
|
199
232
|
Webhooks
|
|
200
233
|
});
|
|
201
234
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/resources/Envelopes.ts","../src/resources/SignRequests.ts","../src/resources/Webhooks.ts","../src/instasign.ts"],"sourcesContent":["\n\nexport * from './resources/Envelopes.js';\nexport * from './resources/SignRequests.js';\nexport * from './resources/Webhooks.js';\nexport * from './types.js';\n\nexport type * from '../types/schema.js';\nexport type * from './types/index.js';\n\nexport * from './instasign.js';","import { AxiosInstance } from 'axios';\nimport {\n Envelope,\n type AddSignRequestToEnvelopeParams,\n type AddSignRequestToEnvelopeResponse,\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 removeSignRequest(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 a sign request to an envelope\n */\n async addSignRequest(params: AddSignRequestToEnvelopeParams): Promise<AddSignRequestToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add multiple sign requests to an envelope\n */\n // async addSignRequests(params: AddSignRequestToEnvelopeParams[]): Promise<AddSignRequestToEnvelopeResponse[] | undefined> {\n // // TODO(ciro): must be implemented on back-end\n // const response = await this.client.post('/functions/addMultipleSignRequestsToEnvelope', 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';\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\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\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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AAK,MAAM,OAAO;AAAA,EAC7B;AACJ;;;ACxCA,mBAAqC;AAiB9B,IAAM,YAAN,MAAgB;AAAA,EACX;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,YAAY,QAA0B;AAClC,SAAK,SAAS,aAAAA,QAAM,OAAO;AAAA,MACvB,SAAS,OAAO;AAAA,MAChB,SAAS;AAAA,QACL,0BAA0B,OAAO;AAAA,QACjC,wBAAwB,OAAO;AAAA,QAC/B,aAAa,OAAO;AAAA,QACpB,gBAAgB;AAAA,MACpB;AAAA,IACJ,CAAC;AAED,SAAK,YAAY,IAAI,UAAU,KAAK,MAAM;AAC1C,SAAK,eAAe,IAAI,aAAa,KAAK,MAAM;AAChD,SAAK,WAAW,IAAI,SAAS,OAAO,oBAAoB,GAAG;AAAA,EAC/D;AACJ;","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 AddSignRequestToEnvelopeParams,\n type AddSignRequestToEnvelopeResponse,\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 removeSignRequest(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 a sign request to an envelope\n */\n async addSignRequest(params: AddSignRequestToEnvelopeParams): Promise<AddSignRequestToEnvelopeResponse | undefined> {\n const response = await this.client.post('/functions/envelope:add-sign-request', params);\n return response.data.result;\n }\n\n /**\n * Add multiple sign requests to an envelope\n */\n // async addSignRequests(params: AddSignRequestToEnvelopeParams[]): Promise<AddSignRequestToEnvelopeResponse[] | undefined> {\n // // TODO(ciro): must be implemented on back-end\n // const response = await this.client.post('/functions/addMultipleSignRequestsToEnvelope', 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\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\n","export const VALID_WEBHOOK_EVENT_TYPES = [\n 'envelope_created',\n 'envelope_expired',\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 '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] as const;\n\nexport type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];\n\nexport const VALID_ENVELOPE_STATUSES = [\n 'pending',\n 'in-progress',\n 'completed',\n 'cancelled',\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;AAA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1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { WebhookEventType, WebhookPayloadMap } from './webhook.types.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -45,11 +44,7 @@ interface paths {
|
|
|
45
44
|
};
|
|
46
45
|
content: {
|
|
47
46
|
"application/json": {
|
|
48
|
-
result:
|
|
49
|
-
requestId: string;
|
|
50
|
-
signUrl: string;
|
|
51
|
-
envelopeSignUrl?: string;
|
|
52
|
-
};
|
|
47
|
+
result: components["schemas"]["EnvelopeAddSignRequestResult"];
|
|
53
48
|
};
|
|
54
49
|
};
|
|
55
50
|
};
|
|
@@ -93,10 +88,7 @@ interface paths {
|
|
|
93
88
|
};
|
|
94
89
|
content: {
|
|
95
90
|
"application/json": {
|
|
96
|
-
result:
|
|
97
|
-
success: boolean;
|
|
98
|
-
message: string;
|
|
99
|
-
};
|
|
91
|
+
result: components["schemas"]["EnvelopeCompleteResult"];
|
|
100
92
|
};
|
|
101
93
|
};
|
|
102
94
|
};
|
|
@@ -147,9 +139,7 @@ interface paths {
|
|
|
147
139
|
};
|
|
148
140
|
content: {
|
|
149
141
|
"application/json": {
|
|
150
|
-
result:
|
|
151
|
-
envelopeId: string;
|
|
152
|
-
};
|
|
142
|
+
result: components["schemas"]["EnvelopeCreateResult"];
|
|
153
143
|
};
|
|
154
144
|
};
|
|
155
145
|
};
|
|
@@ -193,9 +183,7 @@ interface paths {
|
|
|
193
183
|
};
|
|
194
184
|
content: {
|
|
195
185
|
"application/json": {
|
|
196
|
-
result:
|
|
197
|
-
success: boolean;
|
|
198
|
-
};
|
|
186
|
+
result: components["schemas"]["EnvelopeDeleteResult"];
|
|
199
187
|
};
|
|
200
188
|
};
|
|
201
189
|
};
|
|
@@ -240,34 +228,7 @@ interface paths {
|
|
|
240
228
|
};
|
|
241
229
|
content: {
|
|
242
230
|
"application/json": {
|
|
243
|
-
result:
|
|
244
|
-
envelopeId: string;
|
|
245
|
-
name: string;
|
|
246
|
-
description?: string;
|
|
247
|
-
/** @enum {string} */
|
|
248
|
-
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
249
|
-
clientReferenceId?: string;
|
|
250
|
-
signRequestsCount: number;
|
|
251
|
-
signRequests: {
|
|
252
|
-
requestId: string;
|
|
253
|
-
/** @enum {string} */
|
|
254
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
255
|
-
fileName: string;
|
|
256
|
-
fileUrl: string;
|
|
257
|
-
signedFileUrl?: string;
|
|
258
|
-
metadata: {
|
|
259
|
-
[key: string]: unknown;
|
|
260
|
-
};
|
|
261
|
-
clientReferenceId?: string;
|
|
262
|
-
}[];
|
|
263
|
-
/** Format: date-time */
|
|
264
|
-
createdAt: string;
|
|
265
|
-
/** Format: date-time */
|
|
266
|
-
updatedAt: string;
|
|
267
|
-
/** Format: date-time */
|
|
268
|
-
expirationDate?: string;
|
|
269
|
-
signUrl?: string;
|
|
270
|
-
};
|
|
231
|
+
result: components["schemas"]["EnvelopeGetResult"];
|
|
271
232
|
};
|
|
272
233
|
};
|
|
273
234
|
};
|
|
@@ -324,34 +285,7 @@ interface paths {
|
|
|
324
285
|
};
|
|
325
286
|
content: {
|
|
326
287
|
"application/json": {
|
|
327
|
-
result:
|
|
328
|
-
envelopeId: string;
|
|
329
|
-
name: string;
|
|
330
|
-
description?: string;
|
|
331
|
-
/** @enum {string} */
|
|
332
|
-
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
333
|
-
clientReferenceId?: string;
|
|
334
|
-
signRequestsCount: number;
|
|
335
|
-
signRequests: {
|
|
336
|
-
requestId: string;
|
|
337
|
-
/** @enum {string} */
|
|
338
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
339
|
-
fileName: string;
|
|
340
|
-
fileUrl: string;
|
|
341
|
-
signedFileUrl?: string;
|
|
342
|
-
metadata: {
|
|
343
|
-
[key: string]: unknown;
|
|
344
|
-
};
|
|
345
|
-
clientReferenceId?: string;
|
|
346
|
-
}[];
|
|
347
|
-
/** Format: date-time */
|
|
348
|
-
createdAt: string;
|
|
349
|
-
/** Format: date-time */
|
|
350
|
-
updatedAt: string;
|
|
351
|
-
/** Format: date-time */
|
|
352
|
-
expirationDate?: string;
|
|
353
|
-
signUrl?: string;
|
|
354
|
-
}[];
|
|
288
|
+
result: components["schemas"]["EnvelopeListResult"][];
|
|
355
289
|
};
|
|
356
290
|
};
|
|
357
291
|
};
|
|
@@ -396,10 +330,7 @@ interface paths {
|
|
|
396
330
|
};
|
|
397
331
|
content: {
|
|
398
332
|
"application/json": {
|
|
399
|
-
result:
|
|
400
|
-
success: boolean;
|
|
401
|
-
message: string;
|
|
402
|
-
};
|
|
333
|
+
result: components["schemas"]["EnvelopeRemoveSignRequestResult"];
|
|
403
334
|
};
|
|
404
335
|
};
|
|
405
336
|
};
|
|
@@ -446,12 +377,7 @@ interface paths {
|
|
|
446
377
|
};
|
|
447
378
|
content: {
|
|
448
379
|
"application/json": {
|
|
449
|
-
result:
|
|
450
|
-
envelopeId: string;
|
|
451
|
-
metadata: {
|
|
452
|
-
[key: string]: unknown;
|
|
453
|
-
};
|
|
454
|
-
};
|
|
380
|
+
result: components["schemas"]["EnvelopeUpdateMetadataResult"];
|
|
455
381
|
};
|
|
456
382
|
};
|
|
457
383
|
};
|
|
@@ -496,9 +422,7 @@ interface paths {
|
|
|
496
422
|
};
|
|
497
423
|
content: {
|
|
498
424
|
"application/json": {
|
|
499
|
-
result:
|
|
500
|
-
signedFileUrl: string;
|
|
501
|
-
};
|
|
425
|
+
result: components["schemas"]["SignRequestCompleteResult"];
|
|
502
426
|
};
|
|
503
427
|
};
|
|
504
428
|
};
|
|
@@ -550,10 +474,7 @@ interface paths {
|
|
|
550
474
|
};
|
|
551
475
|
content: {
|
|
552
476
|
"application/json": {
|
|
553
|
-
result:
|
|
554
|
-
requestId: string;
|
|
555
|
-
signUrl: string;
|
|
556
|
-
};
|
|
477
|
+
result: components["schemas"]["SignRequestCreateResult"];
|
|
557
478
|
};
|
|
558
479
|
};
|
|
559
480
|
};
|
|
@@ -597,22 +518,7 @@ interface paths {
|
|
|
597
518
|
};
|
|
598
519
|
content: {
|
|
599
520
|
"application/json": {
|
|
600
|
-
result:
|
|
601
|
-
requestId: string;
|
|
602
|
-
/** @enum {string} */
|
|
603
|
-
status: "pending" | "completed" | "canceled" | "queued";
|
|
604
|
-
fileName: string;
|
|
605
|
-
originalFile: string;
|
|
606
|
-
signedFile?: string;
|
|
607
|
-
metadata?: {
|
|
608
|
-
[key: string]: unknown;
|
|
609
|
-
};
|
|
610
|
-
clientReferenceId?: string;
|
|
611
|
-
/** Format: date-time */
|
|
612
|
-
createdAt: string;
|
|
613
|
-
/** Format: date-time */
|
|
614
|
-
updatedAt: string;
|
|
615
|
-
};
|
|
521
|
+
result: components["schemas"]["SignRequestGetResult"];
|
|
616
522
|
};
|
|
617
523
|
};
|
|
618
524
|
};
|
|
@@ -659,12 +565,7 @@ interface paths {
|
|
|
659
565
|
};
|
|
660
566
|
content: {
|
|
661
567
|
"application/json": {
|
|
662
|
-
result:
|
|
663
|
-
requestId: string;
|
|
664
|
-
metadata: {
|
|
665
|
-
[key: string]: unknown;
|
|
666
|
-
};
|
|
667
|
-
};
|
|
568
|
+
result: components["schemas"]["SignRequestUpdateMetadataResult"];
|
|
668
569
|
};
|
|
669
570
|
};
|
|
670
571
|
};
|
|
@@ -679,7 +580,118 @@ interface paths {
|
|
|
679
580
|
}
|
|
680
581
|
type webhooks = Record<string, never>;
|
|
681
582
|
interface components {
|
|
682
|
-
schemas:
|
|
583
|
+
schemas: {
|
|
584
|
+
EnvelopeAddSignRequestResult: {
|
|
585
|
+
requestId: string;
|
|
586
|
+
signUrl: string;
|
|
587
|
+
envelopeSignUrl?: string;
|
|
588
|
+
};
|
|
589
|
+
EnvelopeCompleteResult: {
|
|
590
|
+
success: boolean;
|
|
591
|
+
message: string;
|
|
592
|
+
};
|
|
593
|
+
EnvelopeCreateResult: {
|
|
594
|
+
envelopeId: string;
|
|
595
|
+
};
|
|
596
|
+
EnvelopeDeleteResult: {
|
|
597
|
+
success: boolean;
|
|
598
|
+
};
|
|
599
|
+
EnvelopeGetResult: {
|
|
600
|
+
envelopeId: string;
|
|
601
|
+
name: string;
|
|
602
|
+
description?: string;
|
|
603
|
+
/** @enum {string} */
|
|
604
|
+
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
605
|
+
clientReferenceId?: string;
|
|
606
|
+
signRequestsCount: number;
|
|
607
|
+
signRequests: {
|
|
608
|
+
requestId: string;
|
|
609
|
+
/** @enum {string} */
|
|
610
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
611
|
+
fileName: string;
|
|
612
|
+
fileUrl: string;
|
|
613
|
+
signedFileUrl?: string;
|
|
614
|
+
metadata: {
|
|
615
|
+
[key: string]: unknown;
|
|
616
|
+
};
|
|
617
|
+
clientReferenceId?: string;
|
|
618
|
+
}[];
|
|
619
|
+
/** Format: date-time */
|
|
620
|
+
createdAt: string;
|
|
621
|
+
/** Format: date-time */
|
|
622
|
+
updatedAt: string;
|
|
623
|
+
/** Format: date-time */
|
|
624
|
+
expirationDate?: string;
|
|
625
|
+
signUrl?: string;
|
|
626
|
+
};
|
|
627
|
+
EnvelopeListResult: {
|
|
628
|
+
envelopeId: string;
|
|
629
|
+
name: string;
|
|
630
|
+
description?: string;
|
|
631
|
+
/** @enum {string} */
|
|
632
|
+
status: "pending" | "in-progress" | "completed" | "cancelled";
|
|
633
|
+
clientReferenceId?: string;
|
|
634
|
+
signRequestsCount: number;
|
|
635
|
+
signRequests: {
|
|
636
|
+
requestId: string;
|
|
637
|
+
/** @enum {string} */
|
|
638
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
639
|
+
fileName: string;
|
|
640
|
+
fileUrl: string;
|
|
641
|
+
signedFileUrl?: string;
|
|
642
|
+
metadata: {
|
|
643
|
+
[key: string]: unknown;
|
|
644
|
+
};
|
|
645
|
+
clientReferenceId?: string;
|
|
646
|
+
}[];
|
|
647
|
+
/** Format: date-time */
|
|
648
|
+
createdAt: string;
|
|
649
|
+
/** Format: date-time */
|
|
650
|
+
updatedAt: string;
|
|
651
|
+
/** Format: date-time */
|
|
652
|
+
expirationDate?: string;
|
|
653
|
+
signUrl?: string;
|
|
654
|
+
};
|
|
655
|
+
EnvelopeRemoveSignRequestResult: {
|
|
656
|
+
success: boolean;
|
|
657
|
+
message: string;
|
|
658
|
+
};
|
|
659
|
+
EnvelopeUpdateMetadataResult: {
|
|
660
|
+
envelopeId: string;
|
|
661
|
+
metadata: {
|
|
662
|
+
[key: string]: unknown;
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
SignRequestCompleteResult: {
|
|
666
|
+
signedFileUrl: string;
|
|
667
|
+
};
|
|
668
|
+
SignRequestCreateResult: {
|
|
669
|
+
requestId: string;
|
|
670
|
+
signUrl: string;
|
|
671
|
+
};
|
|
672
|
+
SignRequestGetResult: {
|
|
673
|
+
requestId: string;
|
|
674
|
+
/** @enum {string} */
|
|
675
|
+
status: "pending" | "completed" | "canceled" | "queued";
|
|
676
|
+
fileName: string;
|
|
677
|
+
originalFile: string;
|
|
678
|
+
signedFile?: string;
|
|
679
|
+
metadata?: {
|
|
680
|
+
[key: string]: unknown;
|
|
681
|
+
};
|
|
682
|
+
clientReferenceId?: string;
|
|
683
|
+
/** Format: date-time */
|
|
684
|
+
createdAt: string;
|
|
685
|
+
/** Format: date-time */
|
|
686
|
+
updatedAt: string;
|
|
687
|
+
};
|
|
688
|
+
SignRequestUpdateMetadataResult: {
|
|
689
|
+
requestId: string;
|
|
690
|
+
metadata: {
|
|
691
|
+
[key: string]: unknown;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
};
|
|
683
695
|
responses: never;
|
|
684
696
|
parameters: never;
|
|
685
697
|
requestBodies: never;
|
|
@@ -689,6 +701,43 @@ interface components {
|
|
|
689
701
|
type $defs = Record<string, never>;
|
|
690
702
|
type operations = Record<string, never>;
|
|
691
703
|
|
|
704
|
+
declare const VALID_WEBHOOK_EVENT_TYPES: readonly ["envelope_created", "envelope_expired", "sign_request_created", "sign_request_signed", "sign_request_expired"];
|
|
705
|
+
type WebhookEventType = typeof VALID_WEBHOOK_EVENT_TYPES[number];
|
|
706
|
+
type WebhookStatus = 'pending' | 'success' | 'error';
|
|
707
|
+
type WebhookPayloadMap = {
|
|
708
|
+
'envelope_created': {
|
|
709
|
+
envelopeId: string;
|
|
710
|
+
};
|
|
711
|
+
'envelope_expired': {
|
|
712
|
+
envelopeId: string;
|
|
713
|
+
};
|
|
714
|
+
'sign_request_created': {
|
|
715
|
+
requestId: string;
|
|
716
|
+
status: string;
|
|
717
|
+
envelopeId?: string;
|
|
718
|
+
};
|
|
719
|
+
'sign_request_signed': {
|
|
720
|
+
requestId: string;
|
|
721
|
+
status: string;
|
|
722
|
+
envelopeId?: string;
|
|
723
|
+
};
|
|
724
|
+
'sign_request_expired': {
|
|
725
|
+
requestId: string;
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
declare const VALID_SIGN_REQUEST_STATUSES: readonly ["pending", "completed", "canceled", "queued"];
|
|
729
|
+
type SignRequestStatus = typeof VALID_SIGN_REQUEST_STATUSES[number];
|
|
730
|
+
declare const VALID_ENVELOPE_STATUSES: readonly ["pending", "in-progress", "completed", "cancelled"];
|
|
731
|
+
type EnvelopeStatus = typeof VALID_ENVELOPE_STATUSES[number];
|
|
732
|
+
type SignRequestMetadata = Record<string, unknown>;
|
|
733
|
+
type EnvelopeMetadata = Record<string, unknown>;
|
|
734
|
+
declare const VALID_ORDER_BY: readonly ["updatedAt", "createdAt"];
|
|
735
|
+
type OrderBy = (typeof VALID_ORDER_BY)[number];
|
|
736
|
+
declare const VALID_ORDER_DIRECTION: readonly ["asc", "desc"];
|
|
737
|
+
type OrderDirection = (typeof VALID_ORDER_DIRECTION)[number];
|
|
738
|
+
|
|
739
|
+
/** Extract a named component schema from the OpenAPI definition */
|
|
740
|
+
type SchemaResult<N extends keyof components['schemas']> = components['schemas'][N];
|
|
692
741
|
interface OperationResponse {
|
|
693
742
|
success?: boolean;
|
|
694
743
|
message?: string;
|
|
@@ -697,27 +746,45 @@ interface OperationResponse {
|
|
|
697
746
|
type ResponseResult<P extends keyof paths> = NonNullable<NonNullable<paths[P]['post']['responses']>[200]['content']>['application/json']['result'];
|
|
698
747
|
/** Extract the request body type from a Cloud Function */
|
|
699
748
|
type RequestBody<P extends keyof paths> = NonNullable<NonNullable<paths[P]['post']['requestBody']>['content']>['application/json'];
|
|
700
|
-
|
|
701
749
|
/** A full envelope with its sign requests */
|
|
702
|
-
|
|
750
|
+
interface Envelope extends SchemaResult<'EnvelopeGetResult'> {
|
|
751
|
+
}
|
|
703
752
|
/** Envelope as returned in a list */
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
753
|
+
interface EnvelopeListItem extends SchemaResult<'EnvelopeListResult'> {
|
|
754
|
+
}
|
|
755
|
+
interface CreateEnvelopeParams extends RequestBody<'/functions/envelope:create'> {
|
|
756
|
+
}
|
|
757
|
+
interface GetEnvelopesParams extends RequestBody<'/functions/envelope:list'> {
|
|
758
|
+
}
|
|
759
|
+
interface UpdateEnvelopeMetadataParams extends RequestBody<'/functions/envelope:update-metadata'> {
|
|
760
|
+
}
|
|
761
|
+
interface RemoveSignRequestFromEnvelopeParams extends RequestBody<'/functions/envelope:remove-sign-request'> {
|
|
762
|
+
}
|
|
763
|
+
interface AddSignRequestToEnvelopeParams extends RequestBody<'/functions/envelope:add-sign-request'> {
|
|
764
|
+
}
|
|
765
|
+
interface CreateEnvelopeResponse extends ResponseResult<'/functions/envelope:create'> {
|
|
766
|
+
}
|
|
767
|
+
interface UpdateEnvelopeMetadataResponse extends ResponseResult<'/functions/envelope:update-metadata'> {
|
|
768
|
+
}
|
|
769
|
+
interface AddSignRequestToEnvelopeResponse extends ResponseResult<'/functions/envelope:add-sign-request'> {
|
|
770
|
+
}
|
|
714
771
|
/** A single sign request */
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
772
|
+
interface SignRequest extends SchemaResult<'SignRequestGetResult'> {
|
|
773
|
+
}
|
|
774
|
+
interface CreateSignRequestParams extends RequestBody<'/functions/sign-request:create'> {
|
|
775
|
+
}
|
|
776
|
+
interface CompleteSignRequestParams extends RequestBody<'/functions/sign-request:complete'> {
|
|
777
|
+
}
|
|
778
|
+
interface GetFileFromRequestIdParams extends RequestBody<'/functions/sign-request:get'> {
|
|
779
|
+
}
|
|
780
|
+
interface UpdateSignRequestMetadataParams extends RequestBody<'/functions/sign-request:update-metadata'> {
|
|
781
|
+
}
|
|
782
|
+
interface CreateSignRequestResponse extends ResponseResult<'/functions/sign-request:create'> {
|
|
783
|
+
}
|
|
784
|
+
interface CompleteSignRequestResponse extends ResponseResult<'/functions/sign-request:complete'> {
|
|
785
|
+
}
|
|
786
|
+
interface UpdateSignRequestMetadataResponse extends ResponseResult<'/functions/sign-request:update-metadata'> {
|
|
787
|
+
}
|
|
721
788
|
type WebhookEvent = {
|
|
722
789
|
[T in WebhookEventType]: {
|
|
723
790
|
eventType: T;
|
|
@@ -817,4 +884,4 @@ declare class Instasign {
|
|
|
817
884
|
constructor(config: IInstasignConfig);
|
|
818
885
|
}
|
|
819
886
|
|
|
820
|
-
export { type $defs, type AddSignRequestToEnvelopeParams, type AddSignRequestToEnvelopeResponse, type CompleteSignRequestParams, type CompleteSignRequestResponse, type CreateEnvelopeParams, type CreateEnvelopeResponse, type CreateSignRequestParams, type CreateSignRequestResponse, type Envelope, type EnvelopeCreatedEvent, type EnvelopeExpiredEvent, type EnvelopeListItem, Envelopes, type GetEnvelopesParams, type IInstasignConfig, Instasign, type OperationResponse, type RemoveSignRequestFromEnvelopeParams, type RequestBody, type ResponseResult, type SignRequest, type SignRequestCreatedEvent, type SignRequestExpiredEvent, type SignRequestSignedEvent, SignRequests, type UpdateEnvelopeMetadataParams, type UpdateEnvelopeMetadataResponse, type WebhookEvent, Webhooks, type components, type operations, type paths, type webhooks };
|
|
887
|
+
export { type $defs, type AddSignRequestToEnvelopeParams, type AddSignRequestToEnvelopeResponse, type CompleteSignRequestParams, type CompleteSignRequestResponse, type CreateEnvelopeParams, type CreateEnvelopeResponse, type CreateSignRequestParams, type CreateSignRequestResponse, type Envelope, type EnvelopeCreatedEvent, type EnvelopeExpiredEvent, type EnvelopeListItem, type EnvelopeMetadata, type EnvelopeStatus, Envelopes, type GetEnvelopesParams, type GetFileFromRequestIdParams, type IInstasignConfig, Instasign, type OperationResponse, type OrderBy, type OrderDirection, type RemoveSignRequestFromEnvelopeParams, type RequestBody, type ResponseResult, type SchemaResult, type SignRequest, type SignRequestCreatedEvent, type SignRequestExpiredEvent, type SignRequestMetadata, type SignRequestSignedEvent, type SignRequestStatus, SignRequests, type UpdateEnvelopeMetadataParams, type UpdateEnvelopeMetadataResponse, type UpdateSignRequestMetadataParams, type UpdateSignRequestMetadataResponse, VALID_ENVELOPE_STATUSES, VALID_ORDER_BY, VALID_ORDER_DIRECTION, VALID_SIGN_REQUEST_STATUSES, VALID_WEBHOOK_EVENT_TYPES, type WebhookEvent, type WebhookEventType, type WebhookPayloadMap, type WebhookStatus, Webhooks, type components, type operations, type paths, type webhooks };
|