@kadoa/node-sdk 0.3.0 → 0.4.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/README.md CHANGED
@@ -16,15 +16,15 @@ pnpm add @kadoa/node-sdk
16
16
  ## Quick Start
17
17
 
18
18
  ```typescript
19
- import { initializeSdk, runExtraction } from '@kadoa/node-sdk';
19
+ import { KadoaClient } from '@kadoa/node-sdk';
20
20
 
21
- // Initialize the SDK
22
- const sdk = initializeSdk({
21
+ // Initialize the client
22
+ const client = new KadoaClient({
23
23
  apiKey: 'your-api-key'
24
24
  });
25
25
 
26
26
  // Run an extraction
27
- const result = await runExtraction(sdk, {
27
+ const result = await client.extraction.run({
28
28
  urls: ['https://example.com'],
29
29
  name: 'My Extraction Workflow'
30
30
  });
@@ -39,7 +39,7 @@ if (result) {
39
39
  ### Basic Configuration
40
40
 
41
41
  ```typescript
42
- const sdk = initializeSdk({
42
+ const client = new KadoaClient({
43
43
  apiKey: 'your-api-key',
44
44
  baseUrl: 'https://api.kadoa.com', // optional
45
45
  timeout: 30000 // optional, in ms
@@ -55,12 +55,12 @@ KADOA_TIMEOUT=30000
55
55
  ```
56
56
 
57
57
  ```typescript
58
- import { initializeSdk } from '@kadoa/node-sdk';
58
+ import { KadoaClient } from '@kadoa/node-sdk';
59
59
  import { config } from 'dotenv';
60
60
 
61
61
  config();
62
62
 
63
- const sdk = initializeSdk({
63
+ const client = new KadoaClient({
64
64
  apiKey: process.env.KADOA_API_KEY!,
65
65
  baseUrl: process.env.KADOA_API_URL,
66
66
  timeout: parseInt(process.env.KADOA_TIMEOUT || '30000')
@@ -70,10 +70,10 @@ const sdk = initializeSdk({
70
70
  ## Event Handling
71
71
 
72
72
  ```typescript
73
- const sdk = initializeSdk({ apiKey: 'your-api-key' });
73
+ const client = new KadoaClient({ apiKey: 'your-api-key' });
74
74
 
75
75
  // Listen to events
76
- sdk.onEvent((event) => {
76
+ client.onEvent((event) => {
77
77
  console.log('Event:', event);
78
78
  });
79
79
 
@@ -87,21 +87,18 @@ sdk.onEvent((event) => {
87
87
 
88
88
  ## API Reference
89
89
 
90
- ### initializeSdk(config)
90
+ ### new KadoaClient(config)
91
91
  - `apiKey` (required): Your Kadoa API key
92
- - `baseUrl` (optional): API base URL
93
- - `timeout` (optional): Request timeout in milliseconds
92
+ - `baseUrl` (optional): API base URL (default: 'https://api.kadoa.com')
93
+ - `timeout` (optional): Request timeout in milliseconds (default: 30000)
94
94
 
95
- Returns an SDK instance with:
96
- - `configuration`: Current configuration
97
- - `axiosInstance`: Configured HTTP client
95
+ Returns a client instance with:
96
+ - `extraction`: Extraction module with `run()` method
98
97
  - `onEvent()`: Subscribe to events
99
98
  - `offEvent()`: Unsubscribe from events
99
+ - `dispose()`: Releases resources and removes all event listeners
100
100
 
101
- ### dispose(sdk)
102
- Releases resources and removes all event listeners.
103
-
104
- ### runExtraction(sdk, options)
101
+ ### client.extraction.run(options)
105
102
  - `urls`: Array of URLs to extract from
106
103
  - `name`: Workflow name
107
104
  - Additional options available in API documentation
package/dist/index.d.mts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { AxiosError, AxiosInstance } from 'axios';
3
3
 
4
+ /**
5
+ * Event payload definitions for entity detection
6
+ */
4
7
  type EntityEventPayloads = {
5
8
  "entity:detected": {
6
9
  /** Name of the detected entity type (e.g., "Product", "Article", "Job Listing") */
@@ -17,6 +20,9 @@ type EntityEventPayloads = {
17
20
  url: string;
18
21
  };
19
22
  };
23
+ /**
24
+ * Event payload definitions for extraction workflow
25
+ */
20
26
  type ExtractionEventPayloads = {
21
27
  "extraction:started": {
22
28
  /** Unique ID of the extraction process */
@@ -61,6 +67,9 @@ type ExtractionEventPayloads = {
61
67
  error?: string;
62
68
  };
63
69
  };
70
+ /**
71
+ * Combined event payload map for all SDK events
72
+ */
64
73
  type EventPayloadMap = EntityEventPayloads & ExtractionEventPayloads;
65
74
 
66
75
  /**
@@ -119,11 +128,57 @@ declare class KadoaSdkException extends Error {
119
128
  readonly code: KadoaErrorCode;
120
129
  readonly details?: Record<string, unknown>;
121
130
  readonly cause?: unknown;
131
+ static readonly ERROR_MESSAGES: {
132
+ readonly CONFIG_ERROR: "Invalid configuration provided";
133
+ readonly AUTH_FAILED: "Authentication failed. Please check your API key";
134
+ readonly RATE_LIMITED: "Rate limit exceeded. Please try again later";
135
+ readonly NETWORK_ERROR: "Network error occurred";
136
+ readonly SERVER_ERROR: "Server error occurred";
137
+ readonly PARSE_ERROR: "Failed to parse response";
138
+ readonly NO_WORKFLOW_ID: "Failed to start extraction process - no ID received";
139
+ readonly WORKFLOW_CREATE_FAILED: "Failed to create workflow";
140
+ readonly WORKFLOW_TIMEOUT: "Workflow processing timed out";
141
+ readonly WORKFLOW_UNEXPECTED_STATUS: "Extraction completed with unexpected status";
142
+ readonly PROGRESS_CHECK_FAILED: "Failed to check extraction progress";
143
+ readonly DATA_FETCH_FAILED: "Failed to retrieve extracted data from workflow";
144
+ readonly NO_URLS: "At least one URL is required for extraction";
145
+ readonly NO_API_KEY: "API key is required for entity detection";
146
+ readonly LINK_REQUIRED: "Link is required for entity field detection";
147
+ readonly NO_PREDICTIONS: "No entity predictions returned from the API";
148
+ readonly EXTRACTION_FAILED: "Data extraction failed for the provided URLs";
149
+ readonly ENTITY_FETCH_FAILED: "Failed to fetch entity fields";
150
+ };
122
151
  constructor(message: string, options?: KadoaSdkExceptionOptions);
123
152
  static from(error: unknown, details?: Record<string, unknown>): KadoaSdkException;
124
153
  toJSON(): Record<string, unknown>;
125
154
  toString(): string;
155
+ toDetailedString(): string;
156
+ static isInstance(error: unknown): error is KadoaSdkException;
157
+ static wrap(error: unknown, extra?: {
158
+ message?: string;
159
+ details?: Record<string, unknown>;
160
+ }): KadoaSdkException;
126
161
  }
162
+ declare const ERROR_MESSAGES: {
163
+ readonly CONFIG_ERROR: "Invalid configuration provided";
164
+ readonly AUTH_FAILED: "Authentication failed. Please check your API key";
165
+ readonly RATE_LIMITED: "Rate limit exceeded. Please try again later";
166
+ readonly NETWORK_ERROR: "Network error occurred";
167
+ readonly SERVER_ERROR: "Server error occurred";
168
+ readonly PARSE_ERROR: "Failed to parse response";
169
+ readonly NO_WORKFLOW_ID: "Failed to start extraction process - no ID received";
170
+ readonly WORKFLOW_CREATE_FAILED: "Failed to create workflow";
171
+ readonly WORKFLOW_TIMEOUT: "Workflow processing timed out";
172
+ readonly WORKFLOW_UNEXPECTED_STATUS: "Extraction completed with unexpected status";
173
+ readonly PROGRESS_CHECK_FAILED: "Failed to check extraction progress";
174
+ readonly DATA_FETCH_FAILED: "Failed to retrieve extracted data from workflow";
175
+ readonly NO_URLS: "At least one URL is required for extraction";
176
+ readonly NO_API_KEY: "API key is required for entity detection";
177
+ readonly LINK_REQUIRED: "Link is required for entity field detection";
178
+ readonly NO_PREDICTIONS: "No entity predictions returned from the API";
179
+ readonly EXTRACTION_FAILED: "Data extraction failed for the provided URLs";
180
+ readonly ENTITY_FETCH_FAILED: "Failed to fetch entity fields";
181
+ };
127
182
 
128
183
  type KadoaHttpExceptionOptions = {
129
184
  httpStatus?: number;
@@ -147,12 +202,14 @@ declare class KadoaHttpException extends KadoaSdkException {
147
202
  details?: Record<string, unknown>;
148
203
  }): KadoaHttpException;
149
204
  toJSON(): Record<string, unknown>;
150
- private static mapStatusToCode;
205
+ toDetailedString(): string;
206
+ static wrap(error: unknown, extra?: {
207
+ message?: string;
208
+ details?: Record<string, unknown>;
209
+ }): KadoaSdkException | KadoaHttpException;
210
+ static mapStatusToCode(errorOrStatus: AxiosError | number): KadoaErrorCode;
151
211
  }
152
212
 
153
- declare function isKadoaSdkException(error: unknown): error is KadoaSdkException;
154
- declare function isKadoaHttpException(error: unknown): error is KadoaHttpException;
155
-
156
213
  /**
157
214
  * Kadoa API
158
215
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -812,48 +869,6 @@ declare const V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum: {
812
869
  };
813
870
  type V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum = typeof V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum[keyof typeof V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum];
814
871
 
815
- interface KadoaSDK {
816
- configuration: Configuration;
817
- axiosInstance: AxiosInstance;
818
- baseUrl: string;
819
- events: KadoaEventEmitter;
820
- emit: <T extends KadoaEventName>(eventName: T, payload: EventPayloadMap[T], source?: string, metadata?: Record<string, unknown>) => void;
821
- onEvent: (listener: (event: AnyKadoaEvent) => void) => void;
822
- offEvent: (listener: (event: AnyKadoaEvent) => void) => void;
823
- }
824
- interface KadoaConfig {
825
- apiKey: string;
826
- baseUrl?: string;
827
- timeout?: number;
828
- }
829
- /**
830
- * Initialize a Kadoa SDK instance
831
- * @param config Configuration options for the Kadoa SDK
832
- * @returns Initialized KadoaSDK instance
833
- *
834
- * @example
835
- * ```typescript
836
- * import { initializeApp } from '@kadoa/sdk';
837
- *
838
- * const sdkInstance = initializeApp({
839
- * apiKey: 'your-api-key'
840
- * });
841
- * ```
842
- */
843
- declare function initializeSdk(config: KadoaConfig): KadoaSDK;
844
- /**
845
- * Dispose of a KadoaApp instance and clean up resources
846
- * @param sdkInstance The KadoaApp instance to dispose
847
- *
848
- * @example
849
- * ```typescript
850
- * const sdkInstance = initializeSdk({ apiKey, enableEvents: true });
851
- * // ... use the sdk
852
- * dispose(sdkInstance); // Clean up when done
853
- * ```
854
- */
855
- declare function dispose(sdkInstance: KadoaSDK): void;
856
-
857
872
  type NavigationMode = (typeof WorkflowWithExistingSchemaNavigationModeEnum)[keyof typeof WorkflowWithExistingSchemaNavigationModeEnum];
858
873
  interface ExtractionConfig {
859
874
  urls: string[];
@@ -876,12 +891,115 @@ interface ExtractionResult {
876
891
  }
877
892
 
878
893
  /**
879
- * Run extraction workflow using dynamic entity detection
894
+ * ExtractionModule provides extraction-related functionality
895
+ */
896
+ declare class ExtractionModule {
897
+ private readonly runExtractionCommand;
898
+ constructor(client: KadoaClient);
899
+ /**
900
+ * Run extraction workflow using dynamic entity detection
901
+ *
902
+ * @param options Extraction configuration options
903
+ * @returns ExtractionResult containing workflow ID, workflow details, and extracted data
904
+ *
905
+ * @example
906
+ * ```typescript
907
+ * const result = await client.extraction.run({
908
+ * urls: ['https://example.com'],
909
+ * name: 'My Extraction'
910
+ * });
911
+ * ```
912
+ */
913
+ run(options: ExtractionOptions): Promise<ExtractionResult>;
914
+ }
915
+
916
+ interface KadoaClientConfig {
917
+ apiKey: string;
918
+ baseUrl?: string;
919
+ timeout?: number;
920
+ }
921
+ /**
922
+ * KadoaClient provides an object-oriented interface to the Kadoa SDK
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * import { KadoaClient } from '@kadoa/sdk';
927
+ *
928
+ * const client = new KadoaClient({
929
+ * apiKey: 'your-api-key'
930
+ * });
880
931
  *
881
- * @param sdkInstance The Kadoa SDK instance
882
- * @param options Extraction configuration options
883
- * @returns ExtractionResult containing workflow ID, workflow details, and extracted data
932
+ * const result = await client.extraction.run({
933
+ * urls: ['https://example.com'],
934
+ * name: 'My Extraction'
935
+ * });
936
+ * ```
884
937
  */
885
- declare function runExtraction(sdkInstance: KadoaSDK, options: ExtractionOptions): Promise<ExtractionResult>;
938
+ declare class KadoaClient {
939
+ private readonly _configuration;
940
+ private readonly _axiosInstance;
941
+ private readonly _baseUrl;
942
+ private readonly _timeout;
943
+ private readonly _events;
944
+ readonly extraction: ExtractionModule;
945
+ constructor(config: KadoaClientConfig);
946
+ /**
947
+ * Register an event listener
948
+ *
949
+ * @param listener Function to handle events
950
+ */
951
+ onEvent(listener: (event: AnyKadoaEvent) => void): void;
952
+ /**
953
+ * Remove an event listener
954
+ *
955
+ * @param listener Function to remove from event handlers
956
+ */
957
+ offEvent(listener: (event: AnyKadoaEvent) => void): void;
958
+ /**
959
+ * Emit an event
960
+ * @internal
961
+ *
962
+ * @param eventName The name of the event
963
+ * @param payload The event payload
964
+ * @param source Optional source identifier
965
+ * @param metadata Optional metadata
966
+ */
967
+ emit<T extends KadoaEventName>(eventName: T, payload: EventPayloadMap[T], source?: string, metadata?: Record<string, unknown>): void;
968
+ /**
969
+ * Get the underlying configuration
970
+ *
971
+ * @returns The configuration object
972
+ */
973
+ get configuration(): Configuration;
974
+ /**
975
+ * Get the axios instance
976
+ *
977
+ * @returns The axios instance
978
+ */
979
+ get axiosInstance(): AxiosInstance;
980
+ /**
981
+ * Get the base URL
982
+ *
983
+ * @returns The base URL
984
+ */
985
+ get baseUrl(): string;
986
+ /**
987
+ * Get the timeout value
988
+ *
989
+ * @returns The timeout in milliseconds
990
+ */
991
+ get timeout(): number;
992
+ /**
993
+ * Get the event emitter
994
+ * @internal
995
+ *
996
+ * @returns The event emitter
997
+ */
998
+ get events(): KadoaEventEmitter;
999
+ /**
1000
+ * Dispose of the client and clean up resources
1001
+ */
1002
+ dispose(): void;
1003
+ }
886
1004
 
887
- export { type ExtractionOptions, type ExtractionResult, type KadoaConfig, type KadoaErrorCode, type KadoaEvent, KadoaEventEmitter, KadoaHttpException, type KadoaSDK, KadoaSdkException, dispose, initializeSdk, isKadoaHttpException, isKadoaSdkException, runExtraction };
1005
+ export { ERROR_MESSAGES, type ExtractionOptions, type ExtractionResult, KadoaClient, type KadoaClientConfig, type KadoaErrorCode, type KadoaEvent, KadoaEventEmitter, KadoaHttpException, KadoaSdkException };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { AxiosError, AxiosInstance } from 'axios';
3
3
 
4
+ /**
5
+ * Event payload definitions for entity detection
6
+ */
4
7
  type EntityEventPayloads = {
5
8
  "entity:detected": {
6
9
  /** Name of the detected entity type (e.g., "Product", "Article", "Job Listing") */
@@ -17,6 +20,9 @@ type EntityEventPayloads = {
17
20
  url: string;
18
21
  };
19
22
  };
23
+ /**
24
+ * Event payload definitions for extraction workflow
25
+ */
20
26
  type ExtractionEventPayloads = {
21
27
  "extraction:started": {
22
28
  /** Unique ID of the extraction process */
@@ -61,6 +67,9 @@ type ExtractionEventPayloads = {
61
67
  error?: string;
62
68
  };
63
69
  };
70
+ /**
71
+ * Combined event payload map for all SDK events
72
+ */
64
73
  type EventPayloadMap = EntityEventPayloads & ExtractionEventPayloads;
65
74
 
66
75
  /**
@@ -119,11 +128,57 @@ declare class KadoaSdkException extends Error {
119
128
  readonly code: KadoaErrorCode;
120
129
  readonly details?: Record<string, unknown>;
121
130
  readonly cause?: unknown;
131
+ static readonly ERROR_MESSAGES: {
132
+ readonly CONFIG_ERROR: "Invalid configuration provided";
133
+ readonly AUTH_FAILED: "Authentication failed. Please check your API key";
134
+ readonly RATE_LIMITED: "Rate limit exceeded. Please try again later";
135
+ readonly NETWORK_ERROR: "Network error occurred";
136
+ readonly SERVER_ERROR: "Server error occurred";
137
+ readonly PARSE_ERROR: "Failed to parse response";
138
+ readonly NO_WORKFLOW_ID: "Failed to start extraction process - no ID received";
139
+ readonly WORKFLOW_CREATE_FAILED: "Failed to create workflow";
140
+ readonly WORKFLOW_TIMEOUT: "Workflow processing timed out";
141
+ readonly WORKFLOW_UNEXPECTED_STATUS: "Extraction completed with unexpected status";
142
+ readonly PROGRESS_CHECK_FAILED: "Failed to check extraction progress";
143
+ readonly DATA_FETCH_FAILED: "Failed to retrieve extracted data from workflow";
144
+ readonly NO_URLS: "At least one URL is required for extraction";
145
+ readonly NO_API_KEY: "API key is required for entity detection";
146
+ readonly LINK_REQUIRED: "Link is required for entity field detection";
147
+ readonly NO_PREDICTIONS: "No entity predictions returned from the API";
148
+ readonly EXTRACTION_FAILED: "Data extraction failed for the provided URLs";
149
+ readonly ENTITY_FETCH_FAILED: "Failed to fetch entity fields";
150
+ };
122
151
  constructor(message: string, options?: KadoaSdkExceptionOptions);
123
152
  static from(error: unknown, details?: Record<string, unknown>): KadoaSdkException;
124
153
  toJSON(): Record<string, unknown>;
125
154
  toString(): string;
155
+ toDetailedString(): string;
156
+ static isInstance(error: unknown): error is KadoaSdkException;
157
+ static wrap(error: unknown, extra?: {
158
+ message?: string;
159
+ details?: Record<string, unknown>;
160
+ }): KadoaSdkException;
126
161
  }
162
+ declare const ERROR_MESSAGES: {
163
+ readonly CONFIG_ERROR: "Invalid configuration provided";
164
+ readonly AUTH_FAILED: "Authentication failed. Please check your API key";
165
+ readonly RATE_LIMITED: "Rate limit exceeded. Please try again later";
166
+ readonly NETWORK_ERROR: "Network error occurred";
167
+ readonly SERVER_ERROR: "Server error occurred";
168
+ readonly PARSE_ERROR: "Failed to parse response";
169
+ readonly NO_WORKFLOW_ID: "Failed to start extraction process - no ID received";
170
+ readonly WORKFLOW_CREATE_FAILED: "Failed to create workflow";
171
+ readonly WORKFLOW_TIMEOUT: "Workflow processing timed out";
172
+ readonly WORKFLOW_UNEXPECTED_STATUS: "Extraction completed with unexpected status";
173
+ readonly PROGRESS_CHECK_FAILED: "Failed to check extraction progress";
174
+ readonly DATA_FETCH_FAILED: "Failed to retrieve extracted data from workflow";
175
+ readonly NO_URLS: "At least one URL is required for extraction";
176
+ readonly NO_API_KEY: "API key is required for entity detection";
177
+ readonly LINK_REQUIRED: "Link is required for entity field detection";
178
+ readonly NO_PREDICTIONS: "No entity predictions returned from the API";
179
+ readonly EXTRACTION_FAILED: "Data extraction failed for the provided URLs";
180
+ readonly ENTITY_FETCH_FAILED: "Failed to fetch entity fields";
181
+ };
127
182
 
128
183
  type KadoaHttpExceptionOptions = {
129
184
  httpStatus?: number;
@@ -147,12 +202,14 @@ declare class KadoaHttpException extends KadoaSdkException {
147
202
  details?: Record<string, unknown>;
148
203
  }): KadoaHttpException;
149
204
  toJSON(): Record<string, unknown>;
150
- private static mapStatusToCode;
205
+ toDetailedString(): string;
206
+ static wrap(error: unknown, extra?: {
207
+ message?: string;
208
+ details?: Record<string, unknown>;
209
+ }): KadoaSdkException | KadoaHttpException;
210
+ static mapStatusToCode(errorOrStatus: AxiosError | number): KadoaErrorCode;
151
211
  }
152
212
 
153
- declare function isKadoaSdkException(error: unknown): error is KadoaSdkException;
154
- declare function isKadoaHttpException(error: unknown): error is KadoaHttpException;
155
-
156
213
  /**
157
214
  * Kadoa API
158
215
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -812,48 +869,6 @@ declare const V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum: {
812
869
  };
813
870
  type V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum = typeof V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum[keyof typeof V4WorkflowsWorkflowIdGet200ResponseSchemaTypeEnum];
814
871
 
815
- interface KadoaSDK {
816
- configuration: Configuration;
817
- axiosInstance: AxiosInstance;
818
- baseUrl: string;
819
- events: KadoaEventEmitter;
820
- emit: <T extends KadoaEventName>(eventName: T, payload: EventPayloadMap[T], source?: string, metadata?: Record<string, unknown>) => void;
821
- onEvent: (listener: (event: AnyKadoaEvent) => void) => void;
822
- offEvent: (listener: (event: AnyKadoaEvent) => void) => void;
823
- }
824
- interface KadoaConfig {
825
- apiKey: string;
826
- baseUrl?: string;
827
- timeout?: number;
828
- }
829
- /**
830
- * Initialize a Kadoa SDK instance
831
- * @param config Configuration options for the Kadoa SDK
832
- * @returns Initialized KadoaSDK instance
833
- *
834
- * @example
835
- * ```typescript
836
- * import { initializeApp } from '@kadoa/sdk';
837
- *
838
- * const sdkInstance = initializeApp({
839
- * apiKey: 'your-api-key'
840
- * });
841
- * ```
842
- */
843
- declare function initializeSdk(config: KadoaConfig): KadoaSDK;
844
- /**
845
- * Dispose of a KadoaApp instance and clean up resources
846
- * @param sdkInstance The KadoaApp instance to dispose
847
- *
848
- * @example
849
- * ```typescript
850
- * const sdkInstance = initializeSdk({ apiKey, enableEvents: true });
851
- * // ... use the sdk
852
- * dispose(sdkInstance); // Clean up when done
853
- * ```
854
- */
855
- declare function dispose(sdkInstance: KadoaSDK): void;
856
-
857
872
  type NavigationMode = (typeof WorkflowWithExistingSchemaNavigationModeEnum)[keyof typeof WorkflowWithExistingSchemaNavigationModeEnum];
858
873
  interface ExtractionConfig {
859
874
  urls: string[];
@@ -876,12 +891,115 @@ interface ExtractionResult {
876
891
  }
877
892
 
878
893
  /**
879
- * Run extraction workflow using dynamic entity detection
894
+ * ExtractionModule provides extraction-related functionality
895
+ */
896
+ declare class ExtractionModule {
897
+ private readonly runExtractionCommand;
898
+ constructor(client: KadoaClient);
899
+ /**
900
+ * Run extraction workflow using dynamic entity detection
901
+ *
902
+ * @param options Extraction configuration options
903
+ * @returns ExtractionResult containing workflow ID, workflow details, and extracted data
904
+ *
905
+ * @example
906
+ * ```typescript
907
+ * const result = await client.extraction.run({
908
+ * urls: ['https://example.com'],
909
+ * name: 'My Extraction'
910
+ * });
911
+ * ```
912
+ */
913
+ run(options: ExtractionOptions): Promise<ExtractionResult>;
914
+ }
915
+
916
+ interface KadoaClientConfig {
917
+ apiKey: string;
918
+ baseUrl?: string;
919
+ timeout?: number;
920
+ }
921
+ /**
922
+ * KadoaClient provides an object-oriented interface to the Kadoa SDK
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * import { KadoaClient } from '@kadoa/sdk';
927
+ *
928
+ * const client = new KadoaClient({
929
+ * apiKey: 'your-api-key'
930
+ * });
880
931
  *
881
- * @param sdkInstance The Kadoa SDK instance
882
- * @param options Extraction configuration options
883
- * @returns ExtractionResult containing workflow ID, workflow details, and extracted data
932
+ * const result = await client.extraction.run({
933
+ * urls: ['https://example.com'],
934
+ * name: 'My Extraction'
935
+ * });
936
+ * ```
884
937
  */
885
- declare function runExtraction(sdkInstance: KadoaSDK, options: ExtractionOptions): Promise<ExtractionResult>;
938
+ declare class KadoaClient {
939
+ private readonly _configuration;
940
+ private readonly _axiosInstance;
941
+ private readonly _baseUrl;
942
+ private readonly _timeout;
943
+ private readonly _events;
944
+ readonly extraction: ExtractionModule;
945
+ constructor(config: KadoaClientConfig);
946
+ /**
947
+ * Register an event listener
948
+ *
949
+ * @param listener Function to handle events
950
+ */
951
+ onEvent(listener: (event: AnyKadoaEvent) => void): void;
952
+ /**
953
+ * Remove an event listener
954
+ *
955
+ * @param listener Function to remove from event handlers
956
+ */
957
+ offEvent(listener: (event: AnyKadoaEvent) => void): void;
958
+ /**
959
+ * Emit an event
960
+ * @internal
961
+ *
962
+ * @param eventName The name of the event
963
+ * @param payload The event payload
964
+ * @param source Optional source identifier
965
+ * @param metadata Optional metadata
966
+ */
967
+ emit<T extends KadoaEventName>(eventName: T, payload: EventPayloadMap[T], source?: string, metadata?: Record<string, unknown>): void;
968
+ /**
969
+ * Get the underlying configuration
970
+ *
971
+ * @returns The configuration object
972
+ */
973
+ get configuration(): Configuration;
974
+ /**
975
+ * Get the axios instance
976
+ *
977
+ * @returns The axios instance
978
+ */
979
+ get axiosInstance(): AxiosInstance;
980
+ /**
981
+ * Get the base URL
982
+ *
983
+ * @returns The base URL
984
+ */
985
+ get baseUrl(): string;
986
+ /**
987
+ * Get the timeout value
988
+ *
989
+ * @returns The timeout in milliseconds
990
+ */
991
+ get timeout(): number;
992
+ /**
993
+ * Get the event emitter
994
+ * @internal
995
+ *
996
+ * @returns The event emitter
997
+ */
998
+ get events(): KadoaEventEmitter;
999
+ /**
1000
+ * Dispose of the client and clean up resources
1001
+ */
1002
+ dispose(): void;
1003
+ }
886
1004
 
887
- export { type ExtractionOptions, type ExtractionResult, type KadoaConfig, type KadoaErrorCode, type KadoaEvent, KadoaEventEmitter, KadoaHttpException, type KadoaSDK, KadoaSdkException, dispose, initializeSdk, isKadoaHttpException, isKadoaSdkException, runExtraction };
1005
+ export { ERROR_MESSAGES, type ExtractionOptions, type ExtractionResult, KadoaClient, type KadoaClientConfig, type KadoaErrorCode, type KadoaEvent, KadoaEventEmitter, KadoaHttpException, KadoaSdkException };