@korala/api-client 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { DocumentsResource } from './resources/documents.js';
2
2
  import { FieldsResource } from './resources/fields.js';
3
+ import { SessionsResource } from './resources/sessions.js';
3
4
  import { SignaturesResource } from './resources/signatures.js';
4
5
  import { SignersResource } from './resources/signers.js';
5
6
  import { TemplatesResource } from './resources/templates.js';
6
7
  import { WebhooksResource } from './resources/webhooks.js';
8
+ import { WorkflowsResource } from './resources/workflows.js';
7
9
  export interface KoralaClientConfig {
8
10
  apiKeyId: string;
9
11
  apiSecret: string;
@@ -17,6 +19,8 @@ export declare class KoralaClient {
17
19
  readonly signatures: SignaturesResource;
18
20
  readonly templates: TemplatesResource;
19
21
  readonly webhooks: WebhooksResource;
22
+ readonly workflows: WorkflowsResource;
23
+ readonly sessions: SessionsResource;
20
24
  private readonly http;
21
25
  constructor(config: KoralaClientConfig);
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD,q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BAAgB,CAAC;IAC3C,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAC7C,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,MAAM,EAAE,kBAAkB;CAiBvC"}
package/dist/client.js CHANGED
@@ -4,10 +4,12 @@ exports.KoralaClient = void 0;
4
4
  const http_js_1 = require("./http.js");
5
5
  const documents_js_1 = require("./resources/documents.js");
6
6
  const fields_js_1 = require("./resources/fields.js");
7
+ const sessions_js_1 = require("./resources/sessions.js");
7
8
  const signatures_js_1 = require("./resources/signatures.js");
8
9
  const signers_js_1 = require("./resources/signers.js");
9
10
  const templates_js_1 = require("./resources/templates.js");
10
11
  const webhooks_js_1 = require("./resources/webhooks.js");
12
+ const workflows_js_1 = require("./resources/workflows.js");
11
13
  const DEFAULT_BASE_URL = 'https://api.korala.ai/api/v1';
12
14
  const DEFAULT_TIMEOUT = 30000;
13
15
  class KoralaClient {
@@ -17,6 +19,8 @@ class KoralaClient {
17
19
  signatures;
18
20
  templates;
19
21
  webhooks;
22
+ workflows;
23
+ sessions;
20
24
  http;
21
25
  constructor(config) {
22
26
  this.http = new http_js_1.HttpClient({
@@ -31,6 +35,8 @@ class KoralaClient {
31
35
  this.signatures = new signatures_js_1.SignaturesResource(this.http);
32
36
  this.templates = new templates_js_1.TemplatesResource(this.http);
33
37
  this.webhooks = new webhooks_js_1.WebhooksResource(this.http);
38
+ this.workflows = new workflows_js_1.WorkflowsResource(this.http);
39
+ this.sessions = new sessions_js_1.SessionsResource(this.http);
34
40
  }
35
41
  }
36
42
  exports.KoralaClient = KoralaClient;
package/dist/http.d.ts CHANGED
@@ -8,10 +8,10 @@ export declare class HttpClient {
8
8
  private readonly config;
9
9
  private readonly hashedSecret;
10
10
  constructor(config: HttpClientConfig);
11
- request<T>(method: string, path: string, body?: unknown): Promise<T>;
11
+ request<T>(method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
12
12
  private handleError;
13
13
  get<T>(path: string): Promise<T>;
14
- post<T>(path: string, body?: unknown): Promise<T>;
14
+ post<T>(path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
15
15
  patch<T>(path: string, body?: unknown): Promise<T>;
16
16
  delete<T>(path: string): Promise<T>;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,UAAU;IAGT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAET,MAAM,EAAE,gBAAgB;IAK/C,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;YAkE5D,WAAW;IAmCzB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAGpC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,UAAU;IAGT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAET,MAAM,EAAE,gBAAgB;IAK/C,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,OAAO,CAAC,CAAC,CAAC;YAmEC,WAAW;IAmCzB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhC,IAAI,CAAC,CAAC,EACJ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,OAAO,CAAC,CAAC,CAAC;IAIb,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAGpC"}
package/dist/http.js CHANGED
@@ -12,7 +12,7 @@ class HttpClient {
12
12
  // Hash the secret to match how the server stores and verifies signatures
13
13
  this.hashedSecret = (0, internal_1.hashSecret)(config.apiSecret);
14
14
  }
15
- async request(method, path, body) {
15
+ async request(method, path, body, extraHeaders) {
16
16
  const url = `${this.config.baseUrl}${path}`;
17
17
  const bodyString = body ? JSON.stringify(body) : undefined;
18
18
  // Extract the path from baseUrl to get the full API path for signing
@@ -21,6 +21,7 @@ class HttpClient {
21
21
  const authHeaders = (0, auth_1.signRequest)({ method, path: fullPath, body: bodyString }, this.config.apiKeyId, this.hashedSecret);
22
22
  const headers = {
23
23
  ...authHeaders,
24
+ ...extraHeaders,
24
25
  };
25
26
  // Only set Content-Type if there's a body
26
27
  if (bodyString) {
@@ -87,8 +88,8 @@ class HttpClient {
87
88
  get(path) {
88
89
  return this.request('GET', path);
89
90
  }
90
- post(path, body) {
91
- return this.request('POST', path, body);
91
+ post(path, body, extraHeaders) {
92
+ return this.request('POST', path, body, extraHeaders);
92
93
  }
93
94
  patch(path, body) {
94
95
  return this.request('PATCH', path, body);
package/dist/index.d.ts CHANGED
@@ -1,8 +1,13 @@
1
- export type { AddFieldDto, AddSignerDto, AuditEventDto, CreateDocumentFromTemplateDto, CreateSignerRoleDto, CreateTemplateDto, CreateTemplateFieldDto, CreateTemplateUploadUrlDto, CreateUploadUrlDto, CreateWebhookDto, DocumentCompletedEventData, DocumentCreatedEventData, DocumentDeclinedEventData, DocumentDto, DocumentFailedEventData, DocumentSentEventData, DocumentSignedEventData, DocumentViewedEventData, DocumentVoidedEventData, FieldDto, GenerateDocumentDto, GeneratedDocumentDto, SignerDto, TemplateDto, TemplateFieldDto, TemplateSignerRoleDto, TemplateUploadUrlResponseDto, TemplateWithDetailsDto, TestEventData, UpdateSignerRoleDto, UpdateTemplateDto, UpdateTemplateFieldDto, UpdateWebhookDto, UploadUrlResponseDto, WebhookDeliveryDto, WebhookDto, WebhookEventData, WebhookPayloadDto, WebhookWithSecretDto, } from '@korala/public-dtos';
2
- export { AuthMethod, DocumentStatus, FieldType, SignerRole, SignerStatus, WebhookDeliveryStatus, WebhookEventType, } from '@korala/public-dtos';
1
+ export type { AddFieldDto, AddSignerDto, AuditEventDto, CreateDocumentFromTemplateDto, CreateSignerRoleDto, CreateTemplateDto, CreateTemplateFieldDto, CreateTemplateUploadUrlDto, CreateUploadUrlDto, CreateWebhookDto, CreateWorkflowDefinitionDto, DocumentCompletedEventData, DocumentCreatedEventData, DocumentDeclinedEventData, DocumentDto, DocumentFailedEventData, DocumentSentEventData, DocumentSignedEventData, DocumentViewedEventData, DocumentVoidedEventData, FieldDto, GenerateDocumentDto, GeneratedDocumentDto, PaginatedSessionsDto, PaginatedWorkflowDefinitionsDto, PaginatedWorkflowRunsDto, SessionAccessDto, SessionCheckDto, SessionCheckMatchDto, SessionConfigurationDto, SessionDetailDto, SessionDto, SessionParticipantDto, SessionWorkflowBindingDto, SessionWorkflowDto, SignerDto, StartSessionWorkflowResponseDto, StartWorkflowRunDto, StartWorkflowRunResponseDto, TemplateDto, TemplateFieldDto, TemplateSignerRoleDto, TemplateUploadUrlResponseDto, TemplateWithDetailsDto, TestEventData, UpdateSignerRoleDto, UpdateTemplateDto, UpdateTemplateFieldDto, UpdateWebhookDto, UpdateWorkflowDefinitionDto, UploadUrlResponseDto, WebhookDeliveryDto, WebhookDto, WebhookPayloadDto, WebhookWithSecretDto, WorkflowDefinitionDto, WorkflowRunDto, WorkflowRunWithStepsDto, WorkflowStepRunDto, } from '@korala/public-dtos';
2
+ export { AuthMethod, CheckBlockingMode, CheckKind, CheckStatus, DocumentStatus, FieldType, SessionParticipantRole, SessionResolution, SessionStatus, SessionWorkflowStatus, SignerRole, SignerStatus, SubjectKind, WebhookDeliveryStatus, WebhookEventType, WorkflowRunStatus, WorkflowStepType, } from '@korala/public-dtos';
3
3
  export { KoralaClient, type KoralaClientConfig } from './client.js';
4
4
  export type { ValidationError } from './errors.js';
5
5
  export { KoralaError, KoralaValidationError } from './errors.js';
6
+ export type { CreateSessionConfigurationOptions, CreateSessionOptions, CreateSessionParticipantOptions, ListSessionsOptions, ResolveSessionOptions, SessionWorkflowBindingOptions, UpdateSessionConfigurationOptions, } from './resources/sessions.js';
7
+ export type { ListWorkflowRunsOptions, ListWorkflowsOptions, } from './resources/workflows.js';
8
+ import type { DocumentCompletedEventData, DocumentCreatedEventData, DocumentDeclinedEventData, DocumentFailedEventData, DocumentSentEventData, DocumentSignedEventData, DocumentViewedEventData, DocumentVoidedEventData, TestEventData } from '@korala/public-dtos';
9
+ /** Union of all webhook event data types */
10
+ export type WebhookEventData = DocumentCreatedEventData | DocumentSentEventData | DocumentViewedEventData | DocumentSignedEventData | DocumentCompletedEventData | DocumentFailedEventData | DocumentVoidedEventData | DocumentDeclinedEventData | TestEventData;
6
11
  export type { VerifyWebhookOptions } from './webhooks/verify.js';
7
12
  export { verifyWebhookSignature } from './webhooks/verify.js';
8
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAEV,WAAW,EAEX,YAAY,EACZ,aAAa,EAEb,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAE1B,kBAAkB,EAElB,gBAAgB,EAEhB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAEV,WAAW,EAEX,YAAY,EACZ,aAAa,EAEb,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAE1B,kBAAkB,EAElB,gBAAgB,EAEhB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EAEpB,oBAAoB,EACpB,+BAA+B,EAC/B,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,SAAS,EACT,+BAA+B,EAC/B,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,cAAc,EACd,SAAS,EACT,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EACV,iCAAiC,EACjC,oBAAoB,EACpB,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GACxB,wBAAwB,GACxB,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,0BAA0B,GAC1B,uBAAuB,GACvB,uBAAuB,GACvB,yBAAyB,GACzB,aAAa,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,16 +1,26 @@
1
1
  "use strict";
2
2
  // Client
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.verifyWebhookSignature = exports.KoralaValidationError = exports.KoralaError = exports.KoralaClient = exports.WebhookEventType = exports.WebhookDeliveryStatus = exports.SignerStatus = exports.SignerRole = exports.FieldType = exports.DocumentStatus = exports.AuthMethod = void 0;
4
+ exports.verifyWebhookSignature = exports.KoralaValidationError = exports.KoralaError = exports.KoralaClient = exports.WorkflowStepType = exports.WorkflowRunStatus = exports.WebhookEventType = exports.WebhookDeliveryStatus = exports.SubjectKind = exports.SignerStatus = exports.SignerRole = exports.SessionWorkflowStatus = exports.SessionStatus = exports.SessionResolution = exports.SessionParticipantRole = exports.FieldType = exports.DocumentStatus = exports.CheckStatus = exports.CheckKind = exports.CheckBlockingMode = exports.AuthMethod = void 0;
5
5
  // Re-export enums as values (not just types)
6
6
  var public_dtos_1 = require("@korala/public-dtos");
7
7
  Object.defineProperty(exports, "AuthMethod", { enumerable: true, get: function () { return public_dtos_1.AuthMethod; } });
8
+ Object.defineProperty(exports, "CheckBlockingMode", { enumerable: true, get: function () { return public_dtos_1.CheckBlockingMode; } });
9
+ Object.defineProperty(exports, "CheckKind", { enumerable: true, get: function () { return public_dtos_1.CheckKind; } });
10
+ Object.defineProperty(exports, "CheckStatus", { enumerable: true, get: function () { return public_dtos_1.CheckStatus; } });
8
11
  Object.defineProperty(exports, "DocumentStatus", { enumerable: true, get: function () { return public_dtos_1.DocumentStatus; } });
9
12
  Object.defineProperty(exports, "FieldType", { enumerable: true, get: function () { return public_dtos_1.FieldType; } });
13
+ Object.defineProperty(exports, "SessionParticipantRole", { enumerable: true, get: function () { return public_dtos_1.SessionParticipantRole; } });
14
+ Object.defineProperty(exports, "SessionResolution", { enumerable: true, get: function () { return public_dtos_1.SessionResolution; } });
15
+ Object.defineProperty(exports, "SessionStatus", { enumerable: true, get: function () { return public_dtos_1.SessionStatus; } });
16
+ Object.defineProperty(exports, "SessionWorkflowStatus", { enumerable: true, get: function () { return public_dtos_1.SessionWorkflowStatus; } });
10
17
  Object.defineProperty(exports, "SignerRole", { enumerable: true, get: function () { return public_dtos_1.SignerRole; } });
11
18
  Object.defineProperty(exports, "SignerStatus", { enumerable: true, get: function () { return public_dtos_1.SignerStatus; } });
19
+ Object.defineProperty(exports, "SubjectKind", { enumerable: true, get: function () { return public_dtos_1.SubjectKind; } });
12
20
  Object.defineProperty(exports, "WebhookDeliveryStatus", { enumerable: true, get: function () { return public_dtos_1.WebhookDeliveryStatus; } });
13
21
  Object.defineProperty(exports, "WebhookEventType", { enumerable: true, get: function () { return public_dtos_1.WebhookEventType; } });
22
+ Object.defineProperty(exports, "WorkflowRunStatus", { enumerable: true, get: function () { return public_dtos_1.WorkflowRunStatus; } });
23
+ Object.defineProperty(exports, "WorkflowStepType", { enumerable: true, get: function () { return public_dtos_1.WorkflowStepType; } });
14
24
  var client_js_1 = require("./client.js");
15
25
  Object.defineProperty(exports, "KoralaClient", { enumerable: true, get: function () { return client_js_1.KoralaClient; } });
16
26
  // Errors
@@ -12,6 +12,8 @@ export declare class DocumentsResource {
12
12
  }): Promise<DocumentDto>;
13
13
  void(documentId: string): Promise<DocumentDto>;
14
14
  getAuditTrail(documentId: string): Promise<AuditEventDto[]>;
15
- bulkSign(data: BulkSignRequestDto): Promise<BulkSignResponseDto>;
15
+ bulkSign(data: BulkSignRequestDto, options?: {
16
+ clientIp?: string;
17
+ }): Promise<BulkSignResponseDto>;
16
18
  }
17
19
  //# sourceMappingURL=documents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/resources/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIxE,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvD,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAI9B,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI7C,I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Q,CACN,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9B,OAAO,CAAC,mBAAmB,CAAC;CAUhC"}
@@ -27,8 +27,11 @@ class DocumentsResource {
27
27
  getAuditTrail(documentId) {
28
28
  return this.http.get(`/documents/${documentId}/audit-trail`);
29
29
  }
30
- bulkSign(data) {
31
- return this.http.post('/documents/bulk-sign', data);
30
+ bulkSign(data, options) {
31
+ const headers = options?.clientIp
32
+ ? { 'X-Client-IP': options.clientIp }
33
+ : undefined;
34
+ return this.http.post('/documents/bulk-sign', data, headers);
32
35
  }
33
36
  }
34
37
  exports.DocumentsResource = DocumentsResource;
@@ -0,0 +1,77 @@
1
+ import type { PaginatedSessionsDto, SessionConfigurationDto, SessionDetailDto, SessionParticipantRole, SessionWorkflowBindingDto, SubjectKind } from '@korala/public-dtos';
2
+ import type { HttpClient } from '../http.js';
3
+ export interface CreateSessionParticipantOptions {
4
+ role: SessionParticipantRole;
5
+ displayName?: string;
6
+ externalParticipantId?: string;
7
+ data?: Record<string, unknown>;
8
+ metadata?: Record<string, unknown>;
9
+ }
10
+ export interface SessionWorkflowBindingOptions extends Pick<SessionWorkflowBindingDto, 'workflowSlug' | 'participantRoles' | 'outputKey' | 'context' | 'maxAttempts'> {
11
+ }
12
+ export interface CreateSessionOptions {
13
+ externalUserId: string;
14
+ configurationSlug: string;
15
+ context?: Record<string, unknown>;
16
+ metadata?: Record<string, unknown>;
17
+ participants?: CreateSessionParticipantOptions[];
18
+ expiresInMinutes?: number;
19
+ redirectUrl?: string;
20
+ }
21
+ export interface ListSessionsOptions {
22
+ page?: number;
23
+ limit?: number;
24
+ externalUserId?: string;
25
+ status?: string;
26
+ resolution?: string;
27
+ }
28
+ export interface ResolveSessionOptions {
29
+ resolution: 'approved' | 'rejected';
30
+ reason?: string;
31
+ }
32
+ export interface CreateSessionConfigurationOptions {
33
+ name: string;
34
+ slug: string;
35
+ description?: string;
36
+ workflowSlugs?: string[];
37
+ workflowBindings?: SessionWorkflowBindingOptions[];
38
+ subjectKind?: SubjectKind;
39
+ isVerification?: boolean;
40
+ autoResolve?: boolean;
41
+ finalManualReviewRequired?: boolean;
42
+ defaultExpiresInMinutes?: number;
43
+ defaultRedirectUrl?: string;
44
+ }
45
+ export interface UpdateSessionConfigurationOptions {
46
+ name?: string;
47
+ description?: string;
48
+ workflowSlugs?: string[];
49
+ workflowBindings?: SessionWorkflowBindingOptions[];
50
+ subjectKind?: SubjectKind;
51
+ isVerification?: boolean;
52
+ autoResolve?: boolean;
53
+ finalManualReviewRequired?: boolean;
54
+ defaultExpiresInMinutes?: number;
55
+ defaultRedirectUrl?: string;
56
+ isActive?: boolean;
57
+ }
58
+ export declare class SessionsResource {
59
+ private readonly http;
60
+ constructor(http: HttpClient);
61
+ create(data: CreateSessionOptions): Promise<SessionDetailDto>;
62
+ list(options?: ListSessionsOptions): Promise<PaginatedSessionsDto>;
63
+ get(id: string): Promise<SessionDetailDto>;
64
+ expire(id: string): Promise<void>;
65
+ resolve(id: string, data: ResolveSessionOptions): Promise<SessionDetailDto>;
66
+ resubmit(sessionId: string, sessionWorkflowId: string): Promise<SessionDetailDto>;
67
+ getDocumentUrl(sessionId: string, sessionWorkflowId: string): Promise<{
68
+ url: string;
69
+ mimeType: string | null;
70
+ }>;
71
+ createConfiguration(data: CreateSessionConfigurationOptions): Promise<SessionConfigurationDto>;
72
+ listConfigurations(): Promise<SessionConfigurationDto[]>;
73
+ getConfiguration(slug: string): Promise<SessionConfigurationDto>;
74
+ updateConfiguration(slug: string, data: UpdateSessionConfigurationOptions): Promise<SessionConfigurationDto>;
75
+ deleteConfiguration(slug: string): Promise<void>;
76
+ }
77
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/resources/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,u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,IAAI,CAAC;IAIjC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI3E,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,gBAAgB,CAAC;IAM5B,cAAc,CACZ,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAQpD,mBAAmB,CACjB,IAAI,EAAE,iCAAiC,GACtC,OAAO,CAAC,uBAAuB,CAAC;IAOnC,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAIxD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAMhE,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iCAAiC,GACtC,OAAO,CAAC,uBAAuB,CAAC;IAOnC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionsResource = void 0;
4
+ class SessionsResource {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ create(data) {
10
+ return this.http.post('/sessions', data);
11
+ }
12
+ list(options) {
13
+ const params = new URLSearchParams();
14
+ if (options?.page)
15
+ params.set('page', String(options.page));
16
+ if (options?.limit)
17
+ params.set('limit', String(options.limit));
18
+ if (options?.externalUserId)
19
+ params.set('externalUserId', options.externalUserId);
20
+ if (options?.status)
21
+ params.set('status', options.status);
22
+ if (options?.resolution)
23
+ params.set('resolution', options.resolution);
24
+ const qs = params.toString();
25
+ return this.http.get(`/sessions${qs ? `?${qs}` : ''}`);
26
+ }
27
+ get(id) {
28
+ return this.http.get(`/sessions/${id}`);
29
+ }
30
+ expire(id) {
31
+ return this.http.post(`/sessions/${id}/expire`);
32
+ }
33
+ resolve(id, data) {
34
+ return this.http.post(`/sessions/${id}/resolve`, data);
35
+ }
36
+ resubmit(sessionId, sessionWorkflowId) {
37
+ return this.http.post(`/sessions/${sessionId}/workflows/${sessionWorkflowId}/resubmit`);
38
+ }
39
+ getDocumentUrl(sessionId, sessionWorkflowId) {
40
+ return this.http.get(`/sessions/${sessionId}/workflows/${sessionWorkflowId}/document`);
41
+ }
42
+ // ---- Session Configurations ----
43
+ createConfiguration(data) {
44
+ return this.http.post('/session-configurations', data);
45
+ }
46
+ listConfigurations() {
47
+ return this.http.get('/session-configurations');
48
+ }
49
+ getConfiguration(slug) {
50
+ return this.http.get(`/session-configurations/${slug}`);
51
+ }
52
+ updateConfiguration(slug, data) {
53
+ return this.http.patch(`/session-configurations/${slug}`, data);
54
+ }
55
+ deleteConfiguration(slug) {
56
+ return this.http.delete(`/session-configurations/${slug}`);
57
+ }
58
+ }
59
+ exports.SessionsResource = SessionsResource;
@@ -1,10 +1,12 @@
1
- import type { CreateDocumentFromTemplateDto, CreateSignerRoleDto, CreateTemplateDto, CreateTemplateFieldDto, CreateTemplateUploadUrlDto, DetectedMergeFieldDto, DocumentDto, GenerateDocumentDto, GeneratedDocumentDto, TemplateDto, TemplateFieldDto, TemplateSignerRoleDto, TemplateUploadUrlResponseDto, TemplateWithDetailsDto, UpdateSignerRoleDto, UpdateTemplateDto, UpdateTemplateFieldDto } from '@korala/public-dtos';
1
+ import type { ConfirmReplaceTemplateFileDto, CreateDocumentFromTemplateDto, CreateSignerRoleDto, CreateTemplateDto, CreateTemplateFieldDto, CreateTemplateUploadUrlDto, DetectedMergeFieldDto, DocumentDto, GenerateDocumentDto, GeneratedDocumentDto, ReplaceTemplateFileDto, ReplaceTemplateFileResponseDto, TemplateDto, TemplateFieldDto, TemplateSignerRoleDto, TemplateUploadUrlResponseDto, TemplateWithDetailsDto, UpdateSignerRoleDto, UpdateTemplateDto, UpdateTemplateFieldDto } from '@korala/public-dtos';
2
2
  import type { HttpClient } from '../http.js';
3
3
  export declare class TemplatesResource {
4
4
  private readonly http;
5
5
  constructor(http: HttpClient);
6
6
  createUploadUrl(data: CreateTemplateUploadUrlDto): Promise<TemplateUploadUrlResponseDto>;
7
7
  confirmUpload(templateId: string, data: CreateTemplateDto): Promise<TemplateDto>;
8
+ replaceFile(templateId: string, data: ReplaceTemplateFileDto): Promise<ReplaceTemplateFileResponseDto>;
9
+ confirmReplaceFile(templateId: string, data: ConfirmReplaceTemplateFileDto): Promise<TemplateDto>;
8
10
  list(): Promise<TemplateDto[]>;
9
11
  get(templateId: string): Promise<TemplateWithDetailsDto>;
10
12
  update(templateId: string, data: UpdateTemplateDto): Promise<TemplateDto>;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAI7C,eAAe,CACb,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,4BAA4B,CAAC;IAOxC,aAAa,CACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,WAAW,CAAC;IAOvB,IAAI,IAAI,OAAO,CAAC,WAAW,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CAAC;IAMzC,aAAa,CACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAOjC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAMpE,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAOjC,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnE,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,gBAAgB,CAAC;IAO5B,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI1D,WAAW,CACT,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,gBAAgB,CAAC;IAO5B,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/D,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAQpE,cAAc,CACZ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,WAAW,CAAC;IASvB,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,oBAAoB,CAAC;CAMjC"}
@@ -13,6 +13,12 @@ class TemplatesResource {
13
13
  confirmUpload(templateId, data) {
14
14
  return this.http.post(`/templates/${templateId}/confirm`, data);
15
15
  }
16
+ replaceFile(templateId, data) {
17
+ return this.http.post(`/templates/${templateId}/replace-file`, data);
18
+ }
19
+ confirmReplaceFile(templateId, data) {
20
+ return this.http.post(`/templates/${templateId}/confirm-replace`, data);
21
+ }
16
22
  list() {
17
23
  return this.http.get('/templates');
18
24
  }
@@ -0,0 +1,32 @@
1
+ import type { CreateWorkflowDefinitionDto, PaginatedWorkflowDefinitionsDto, PaginatedWorkflowRunsDto, StartWorkflowRunDto, StartWorkflowRunResponseDto, UpdateWorkflowDefinitionDto, WorkflowDefinitionDto, WorkflowRunWithStepsDto, WorkflowStepRunDto } from '@korala/public-dtos';
2
+ import type { HttpClient } from '../http.js';
3
+ export interface ListWorkflowsOptions {
4
+ page?: number;
5
+ limit?: number;
6
+ includePublic?: boolean;
7
+ }
8
+ export interface ListWorkflowRunsOptions {
9
+ workflowDefinitionId?: string;
10
+ page?: number;
11
+ limit?: number;
12
+ }
13
+ export declare class WorkflowsResource {
14
+ private readonly http;
15
+ constructor(http: HttpClient);
16
+ create(data: CreateWorkflowDefinitionDto): Promise<WorkflowDefinitionDto>;
17
+ list(options?: ListWorkflowsOptions): Promise<PaginatedWorkflowDefinitionsDto>;
18
+ get(slug: string): Promise<WorkflowDefinitionDto>;
19
+ update(slug: string, data: UpdateWorkflowDefinitionDto): Promise<WorkflowDefinitionDto>;
20
+ delete(slug: string): Promise<void>;
21
+ startRun(slug: string, data?: StartWorkflowRunDto): Promise<StartWorkflowRunResponseDto>;
22
+ listRuns(options?: ListWorkflowRunsOptions): Promise<PaginatedWorkflowRunsDto>;
23
+ getRun(runId: string): Promise<WorkflowRunWithStepsDto>;
24
+ confirmUpload(runId: string): Promise<WorkflowRunWithStepsDto>;
25
+ getRunSteps(runId: string): Promise<WorkflowStepRunDto[]>;
26
+ submitReview(runId: string, data: {
27
+ action: 'approve' | 'reject';
28
+ editedData?: Record<string, unknown>;
29
+ reason?: string;
30
+ }): Promise<WorkflowRunWithStepsDto>;
31
+ }
32
+ //# sourceMappingURL=workflows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/resources/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O,CAAC,uBAAuB,CAAC;IAIvD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAM9D,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAMzD,YAAY,CACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GACA,OAAO,CAAC,uBAAuB,CAAC;CAMpC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowsResource = void 0;
4
+ class WorkflowsResource {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ create(data) {
10
+ return this.http.post('/workflows', data);
11
+ }
12
+ list(options) {
13
+ const params = new URLSearchParams();
14
+ if (options?.page)
15
+ params.set('page', String(options.page));
16
+ if (options?.limit)
17
+ params.set('limit', String(options.limit));
18
+ if (options?.includePublic !== undefined)
19
+ params.set('includePublic', String(options.includePublic));
20
+ const qs = params.toString();
21
+ return this.http.get(`/workflows${qs ? `?${qs}` : ''}`);
22
+ }
23
+ get(slug) {
24
+ return this.http.get(`/workflows/${slug}`);
25
+ }
26
+ update(slug, data) {
27
+ return this.http.patch(`/workflows/${slug}`, data);
28
+ }
29
+ delete(slug) {
30
+ return this.http.delete(`/workflows/${slug}`);
31
+ }
32
+ startRun(slug, data) {
33
+ return this.http.post(`/workflows/${slug}/run`, data);
34
+ }
35
+ listRuns(options) {
36
+ const params = new URLSearchParams();
37
+ if (options?.workflowDefinitionId)
38
+ params.set('workflowDefinitionId', options.workflowDefinitionId);
39
+ if (options?.page)
40
+ params.set('page', String(options.page));
41
+ if (options?.limit)
42
+ params.set('limit', String(options.limit));
43
+ const qs = params.toString();
44
+ return this.http.get(`/workflows/runs${qs ? `?${qs}` : ''}`);
45
+ }
46
+ getRun(runId) {
47
+ return this.http.get(`/workflows/runs/${runId}`);
48
+ }
49
+ confirmUpload(runId) {
50
+ return this.http.post(`/workflows/runs/${runId}/confirm`);
51
+ }
52
+ getRunSteps(runId) {
53
+ return this.http.get(`/workflows/runs/${runId}/steps`);
54
+ }
55
+ submitReview(runId, data) {
56
+ return this.http.post(`/workflows/runs/${runId}/review`, data);
57
+ }
58
+ }
59
+ exports.WorkflowsResource = WorkflowsResource;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Webhook event data types.
3
+ *
4
+ * These are not generated from OpenAPI because the WebhookPayloadDto.data
5
+ * field is a generic object in the spec. These types mirror the event data
6
+ * classes defined in the API (apps/api/src/webhooks/dto/index.ts).
7
+ */
8
+ export interface DocumentCreatedEventData {
9
+ documentId: string;
10
+ name: string;
11
+ status: string;
12
+ sandbox: boolean;
13
+ }
14
+ export interface DocumentSentEventData {
15
+ documentId: string;
16
+ name: string;
17
+ signerCount: number;
18
+ sandbox: boolean;
19
+ }
20
+ export interface DocumentViewedEventData {
21
+ documentId: string;
22
+ signerId: string;
23
+ signerEmail?: string | null;
24
+ signerExternalId?: string | null;
25
+ sandbox: boolean;
26
+ }
27
+ export interface DocumentSignedEventData {
28
+ documentId: string;
29
+ signerId: string;
30
+ signerEmail?: string | null;
31
+ signerExternalId?: string | null;
32
+ /** Whether all signers have now signed */
33
+ allSigned: boolean;
34
+ sandbox: boolean;
35
+ }
36
+ export interface DocumentCompletedEventData {
37
+ documentId: string;
38
+ name: string;
39
+ /** ISO 8601 timestamp */
40
+ completedAt: string;
41
+ signerCount: number;
42
+ sandbox: boolean;
43
+ }
44
+ export interface DocumentFailedEventData {
45
+ documentId: string;
46
+ error: string;
47
+ sandbox: boolean;
48
+ }
49
+ export interface DocumentVoidedEventData {
50
+ documentId: string;
51
+ name: string;
52
+ sandbox: boolean;
53
+ }
54
+ export interface DocumentDeclinedEventData {
55
+ documentId: string;
56
+ signerId: string;
57
+ signerEmail?: string | null;
58
+ signerExternalId?: string | null;
59
+ reason?: string | null;
60
+ sandbox: boolean;
61
+ }
62
+ export interface TestEventData {
63
+ message: string;
64
+ }
65
+ /** Union of all webhook event data types */
66
+ export type WebhookEventData =
67
+ | DocumentCreatedEventData
68
+ | DocumentSentEventData
69
+ | DocumentViewedEventData
70
+ | DocumentSignedEventData
71
+ | DocumentCompletedEventData
72
+ | DocumentFailedEventData
73
+ | DocumentVoidedEventData
74
+ | DocumentDeclinedEventData
75
+ | TestEventData;
76
+ //# sourceMappingURL=webhook-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-events.d.ts","sourceRoot":"","sources":["../src/webhook-events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GACxB,wBAAwB,GACxB,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,0BAA0B,GAC1B,uBAAuB,GACvB,uBAAuB,GACvB,yBAAyB,GACzB,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Webhook event data types.
4
+ *
5
+ * These are not generated from OpenAPI because the WebhookPayloadDto.data
6
+ * field is a generic object in the spec. These types mirror the event data
7
+ * classes defined in the API (apps/api/src/webhooks/dto/index.ts).
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korala/api-client",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript API client for Korala document signing API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.korala.ai",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@korala/auth": "^1.1.0",
33
- "@korala/public-dtos": "^1.1.0"
33
+ "@korala/public-dtos": "^1.3.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "^5.9.3"