@kadoa/node-sdk 0.22.0 → 0.24.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/browser/index.global.js +8 -8
- package/dist/browser/index.global.js.map +1 -1
- package/dist/index.d.mts +83 -16
- package/dist/index.d.ts +83 -16
- package/dist/index.js +69 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -385,13 +385,9 @@ type MonitoredFieldOperatorEnum = typeof MonitoredFieldOperatorEnum[keyof typeof
|
|
|
385
385
|
*/
|
|
386
386
|
interface MonitoringConfig {
|
|
387
387
|
/**
|
|
388
|
-
*
|
|
388
|
+
* Fields to monitor (at least one required)
|
|
389
389
|
*/
|
|
390
|
-
'
|
|
391
|
-
/**
|
|
392
|
-
* Fields to monitor
|
|
393
|
-
*/
|
|
394
|
-
'fields'?: Array<MonitoredField>;
|
|
390
|
+
'fields': Array<MonitoredField>;
|
|
395
391
|
/**
|
|
396
392
|
* Notification channels
|
|
397
393
|
*/
|
|
@@ -1182,10 +1178,38 @@ interface CreateCrawlerConfigRequestBlueprintInner {
|
|
|
1182
1178
|
interface CreateCrawlerConfigRequestCrawlMethod {
|
|
1183
1179
|
[key: string]: any;
|
|
1184
1180
|
/**
|
|
1185
|
-
*
|
|
1181
|
+
* Worker selection mode. \'auto\' (default) picks cheapest compatible worker, \'browser\' forces browser.
|
|
1186
1182
|
*/
|
|
1187
|
-
'
|
|
1183
|
+
'mode'?: CreateCrawlerConfigRequestCrawlMethodModeEnum;
|
|
1184
|
+
/**
|
|
1185
|
+
* Explicit Scrape V2 worker override. BrightData is blocked in crawler runtime.
|
|
1186
|
+
*/
|
|
1187
|
+
'worker'?: CreateCrawlerConfigRequestCrawlMethodWorkerEnum;
|
|
1188
|
+
/**
|
|
1189
|
+
* Explicit proxy routing override for Scrape V2
|
|
1190
|
+
*/
|
|
1191
|
+
'proxy'?: CreateCrawlerConfigRequestCrawlMethodProxyEnum;
|
|
1188
1192
|
}
|
|
1193
|
+
declare const CreateCrawlerConfigRequestCrawlMethodModeEnum: {
|
|
1194
|
+
readonly Auto: "auto";
|
|
1195
|
+
readonly Browser: "browser";
|
|
1196
|
+
};
|
|
1197
|
+
type CreateCrawlerConfigRequestCrawlMethodModeEnum = typeof CreateCrawlerConfigRequestCrawlMethodModeEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodModeEnum];
|
|
1198
|
+
declare const CreateCrawlerConfigRequestCrawlMethodWorkerEnum: {
|
|
1199
|
+
readonly Auto: "auto";
|
|
1200
|
+
readonly CurlCffi: "curl-cffi";
|
|
1201
|
+
readonly Patchright: "patchright";
|
|
1202
|
+
readonly Camoufox: "camoufox";
|
|
1203
|
+
readonly Brightdata: "brightdata";
|
|
1204
|
+
};
|
|
1205
|
+
type CreateCrawlerConfigRequestCrawlMethodWorkerEnum = typeof CreateCrawlerConfigRequestCrawlMethodWorkerEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodWorkerEnum];
|
|
1206
|
+
declare const CreateCrawlerConfigRequestCrawlMethodProxyEnum: {
|
|
1207
|
+
readonly Auto: "auto";
|
|
1208
|
+
readonly Dc: "dc";
|
|
1209
|
+
readonly Resi: "resi";
|
|
1210
|
+
readonly Isp: "isp";
|
|
1211
|
+
};
|
|
1212
|
+
type CreateCrawlerConfigRequestCrawlMethodProxyEnum = typeof CreateCrawlerConfigRequestCrawlMethodProxyEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodProxyEnum];
|
|
1189
1213
|
|
|
1190
1214
|
/**
|
|
1191
1215
|
* Kadoa API
|
|
@@ -4137,6 +4161,10 @@ interface V4ChangesGet200ResponseChangesInner {
|
|
|
4137
4161
|
* URL where the change was detected
|
|
4138
4162
|
*/
|
|
4139
4163
|
'url'?: string;
|
|
4164
|
+
/**
|
|
4165
|
+
* AI-generated one-sentence summary of the data change. Null if generation failed, feature is disabled, or change predates the feature.
|
|
4166
|
+
*/
|
|
4167
|
+
'summary'?: string | null;
|
|
4140
4168
|
/**
|
|
4141
4169
|
* URL of the screenshot taken when the change was detected
|
|
4142
4170
|
*/
|
|
@@ -5742,13 +5770,9 @@ type V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInnerOperatorEnum =
|
|
|
5742
5770
|
*/
|
|
5743
5771
|
|
|
5744
5772
|
/**
|
|
5745
|
-
* The
|
|
5773
|
+
* The monitoring config for the workflow
|
|
5746
5774
|
*/
|
|
5747
5775
|
interface V4WorkflowsWorkflowIdMetadataPutRequestMonitoring {
|
|
5748
|
-
/**
|
|
5749
|
-
* Whether monitoring is enabled for the workflow
|
|
5750
|
-
*/
|
|
5751
|
-
'enabled'?: boolean;
|
|
5752
5776
|
'fields'?: Array<V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInner>;
|
|
5753
5777
|
'conditions'?: V4WorkflowsWorkflowIdMetadataPutRequestMonitoringConditions;
|
|
5754
5778
|
}
|
|
@@ -10367,13 +10391,31 @@ declare class ApiRegistry {
|
|
|
10367
10391
|
get notifications(): NotificationsApi;
|
|
10368
10392
|
}
|
|
10369
10393
|
|
|
10394
|
+
interface TeamInfo {
|
|
10395
|
+
id: string;
|
|
10396
|
+
name: string;
|
|
10397
|
+
memberRole: string;
|
|
10398
|
+
adminEmail: string | null;
|
|
10399
|
+
}
|
|
10400
|
+
interface BearerAuthOptions {
|
|
10401
|
+
bearerToken: string;
|
|
10402
|
+
}
|
|
10370
10403
|
interface KadoaClientStatus {
|
|
10371
10404
|
baseUrl: string;
|
|
10372
10405
|
user: KadoaUser;
|
|
10373
10406
|
realtimeConnected: boolean;
|
|
10374
10407
|
}
|
|
10375
10408
|
interface KadoaClientConfig {
|
|
10376
|
-
|
|
10409
|
+
/**
|
|
10410
|
+
* Team API key (`tk-...`). Required unless `bearerToken` is provided.
|
|
10411
|
+
*/
|
|
10412
|
+
apiKey?: string;
|
|
10413
|
+
/**
|
|
10414
|
+
* = JWT for Bearer auth. When set, requests send
|
|
10415
|
+
* `Authorization: Bearer <token>` instead of `x-api-key`.
|
|
10416
|
+
* Use {@link KadoaClient.setBearerToken} to update after refresh.
|
|
10417
|
+
*/
|
|
10418
|
+
bearerToken?: string;
|
|
10377
10419
|
/**
|
|
10378
10420
|
* Override the base URL for the public API.
|
|
10379
10421
|
*
|
|
@@ -10422,6 +10464,7 @@ declare class KadoaClient {
|
|
|
10422
10464
|
private readonly _axiosInstance;
|
|
10423
10465
|
private readonly _baseUrl;
|
|
10424
10466
|
private readonly _apiKey;
|
|
10467
|
+
private _bearerToken;
|
|
10425
10468
|
private _realtime?;
|
|
10426
10469
|
private readonly _extractionBuilderService;
|
|
10427
10470
|
readonly apis: ApiRegistry;
|
|
@@ -10448,9 +10491,15 @@ declare class KadoaClient {
|
|
|
10448
10491
|
/**
|
|
10449
10492
|
* Get the API key
|
|
10450
10493
|
*
|
|
10451
|
-
* @returns The API key
|
|
10494
|
+
* @returns The API key (empty string when using Bearer auth)
|
|
10452
10495
|
*/
|
|
10453
10496
|
get apiKey(): string;
|
|
10497
|
+
/**
|
|
10498
|
+
* Update the Bearer token used for authentication.
|
|
10499
|
+
* Call this after a Supabase JWT refresh so that subsequent requests
|
|
10500
|
+
* use the new token.
|
|
10501
|
+
*/
|
|
10502
|
+
setBearerToken(token: string): void;
|
|
10454
10503
|
/**
|
|
10455
10504
|
* Get the realtime connection (if enabled)
|
|
10456
10505
|
*/
|
|
@@ -10486,6 +10535,24 @@ declare class KadoaClient {
|
|
|
10486
10535
|
* @returns The status of the client
|
|
10487
10536
|
*/
|
|
10488
10537
|
status(): Promise<KadoaClientStatus>;
|
|
10538
|
+
/**
|
|
10539
|
+
* List all teams accessible to the authenticated user.
|
|
10540
|
+
*
|
|
10541
|
+
* When called with a Bearer token (Supabase JWT), returns all teams the
|
|
10542
|
+
* human user belongs to. Without it, falls back to x-api-key auth which
|
|
10543
|
+
* only returns teams the service account (API key) belongs to.
|
|
10544
|
+
*/
|
|
10545
|
+
listTeams(opts?: BearerAuthOptions): Promise<TeamInfo[]>;
|
|
10546
|
+
/**
|
|
10547
|
+
* Switch the active team for this session.
|
|
10548
|
+
*
|
|
10549
|
+
* Calls `POST /v5/auth/active-team` which updates the server-side
|
|
10550
|
+
* session→team mapping. Subsequent requests with the same JWT are
|
|
10551
|
+
* automatically scoped to the new team — no token refresh needed.
|
|
10552
|
+
*
|
|
10553
|
+
* @param teamId - The team ID to switch to (must be a team the user belongs to)
|
|
10554
|
+
*/
|
|
10555
|
+
setActiveTeam(teamId: string): Promise<void>;
|
|
10489
10556
|
/**
|
|
10490
10557
|
* Dispose of the client and clean up resources
|
|
10491
10558
|
*/
|
|
@@ -10653,4 +10720,4 @@ declare class KadoaHttpException extends KadoaSdkException {
|
|
|
10653
10720
|
static mapStatusToCode(errorOrStatus: AxiosError | number): KadoaErrorCode;
|
|
10654
10721
|
}
|
|
10655
10722
|
|
|
10656
|
-
export { type ArtifactOptions, type BlueprintItem, type BulkApproveRulesRequest, type BulkApproveRulesResponseData, type BulkDeleteRulesRequest, type BulkDeleteRulesResponseData, type Category, type ChannelConfig, type ChannelSetupRequestConfig, type CrawlMethod, type CrawlerConfig, CrawlerConfigService, type CrawlerDomain, type CrawlerExtractionOptions, type CrawlerSession, CrawlerSessionService, type CreateChannelRequest, type CreateConfigRequest, type CreateSchemaRequest, type CreateSettingsRequest, type CreateWorkflowInput, type CreateWorkflowRequest, type CreateWorkflowWithCustomSchemaRequest, type CreatedExtraction, DataFetcherService, type DataFieldFor, type DataPagination, DataSortOrder, type DataType, type DataTypeNotRequiringExample, type DataTypeRequiringExample, type DeleteAllRulesRequest, type DeleteAllRulesResponseData, type DeleteConfigRequest, type DeleteConfigResult, type DisableRuleRequest, ERROR_MESSAGES, type EmailChannelConfig, EntityResolverService, type ExtractOptions, ExtractionBuilderService, type ExtractionOptions, type ExtractionResult, ExtractionService, FetchDataOptions, type FetchDataResult, type FieldExample, type FieldOptions, type FieldOptionsWithExample, type FieldOptionsWithoutExample, type FieldType, type FinishedExtraction, type GenerateRuleRequest, type GenerateRulesRequest, type GetAllDataOptions, type GetAnomaliesByRuleResponse, type GetAnomalyRulePageResponse, type GetBucketFileOptions, type GetJobResponse, type GetPageOptions, type GetPagesOptions, type GetValidationResponse, type GetWorkflowResponse, type JobId, JobStateEnum, type JobWaitOptions, KadoaClient, type KadoaClientConfig, type KadoaClientStatus, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, ListChannelsRequest, ListRulesRequest, type ListRulesResponse, type ListSessionsOptions, type ListSessionsResult, ListSettingsRequest, type ListValidationsResponse, ListWorkflowValidationsRequest, ListWorkflowsRequest, type LocationConfig, type MetadataKey, type MonitoringConfig, type MonitoringField, type MonitoringOperator, MonitoringStatus, type NavigationMode, type NavigationOptions, type NotificationChannel, type NotificationChannelConfig, NotificationChannelType, NotificationChannelsService, type NotificationDomain, type NotificationOptions, type NotificationSettings, type NotificationSettingsEventType, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, type NotificationSetupRequestChannels, NotificationSetupService, type PageContent, PageStatus, type PaginationInfo, type PollingOptions, type PreparedExtraction, type RawFormat, Realtime, type RealtimeConfig, type RealtimeEvent, ResponseFormat, type Rule, RuleStatus, RuleType, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleValidationResponse, SchemaBuilder, type SchemaField as SchemaDefinitionField, type SchemaField$1 as SchemaField, SchemaFieldDataType, type SchemaResponse, SchemasService, type SessionDataItem, type SessionDataList, type SessionOperationResult, type SessionPage, type SessionPagesResult, type SessionStatus, type SetupWorkflowNotificationSettingsRequest, type SetupWorkspaceNotificationSettingsRequest, type SlackChannelConfig, type StartCrawlRequest, type StartSessionResult, type StartWithConfigRequest, type SubmitExtractionResult, type SubmittedExtraction, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, type TestNotificationRequest, type TestNotificationResult, type ToggleValidationResponse, UpdateInterval, type UpdateSchemaRequest, type UpdateWorkflowRequest, type UpdateWorkflowResponse, UserService, ValidationCoreService, type ValidationDomain, ValidationRulesService, ValidationStrategy, type WaitForReadyOptions, type WaitOptions, type WebhookChannelConfig, type WebhookChannelConfigAuth, type WebhookHttpMethod, type WebsocketChannelConfig, type WorkflowDataResponse, type WorkflowDetailsResponse, WorkflowDisplayStateEnum, type WorkflowId, type WorkflowInterval, type WorkflowMonitoringConfig, type WorkflowResponse, WorkflowState, WorkflowStateEnum, type WorkflowsApiInterface, WorkflowsCoreService, createCrawlerDomain, pollUntil, validateAdditionalData };
|
|
10723
|
+
export { type ArtifactOptions, type BearerAuthOptions, type BlueprintItem, type BulkApproveRulesRequest, type BulkApproveRulesResponseData, type BulkDeleteRulesRequest, type BulkDeleteRulesResponseData, type Category, type ChannelConfig, type ChannelSetupRequestConfig, type CrawlMethod, type CrawlerConfig, CrawlerConfigService, type CrawlerDomain, type CrawlerExtractionOptions, type CrawlerSession, CrawlerSessionService, type CreateChannelRequest, type CreateConfigRequest, type CreateSchemaRequest, type CreateSettingsRequest, type CreateWorkflowInput, type CreateWorkflowRequest, type CreateWorkflowWithCustomSchemaRequest, type CreatedExtraction, DataFetcherService, type DataFieldFor, type DataPagination, DataSortOrder, type DataType, type DataTypeNotRequiringExample, type DataTypeRequiringExample, type DeleteAllRulesRequest, type DeleteAllRulesResponseData, type DeleteConfigRequest, type DeleteConfigResult, type DisableRuleRequest, ERROR_MESSAGES, type EmailChannelConfig, EntityResolverService, type ExtractOptions, ExtractionBuilderService, type ExtractionOptions, type ExtractionResult, ExtractionService, FetchDataOptions, type FetchDataResult, type FieldExample, type FieldOptions, type FieldOptionsWithExample, type FieldOptionsWithoutExample, type FieldType, type FinishedExtraction, type GenerateRuleRequest, type GenerateRulesRequest, type GetAllDataOptions, type GetAnomaliesByRuleResponse, type GetAnomalyRulePageResponse, type GetBucketFileOptions, type GetJobResponse, type GetPageOptions, type GetPagesOptions, type GetValidationResponse, type GetWorkflowResponse, type JobId, JobStateEnum, type JobWaitOptions, KadoaClient, type KadoaClientConfig, type KadoaClientStatus, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, ListChannelsRequest, ListRulesRequest, type ListRulesResponse, type ListSessionsOptions, type ListSessionsResult, ListSettingsRequest, type ListValidationsResponse, ListWorkflowValidationsRequest, ListWorkflowsRequest, type LocationConfig, type MetadataKey, type MonitoringConfig, type MonitoringField, type MonitoringOperator, MonitoringStatus, type NavigationMode, type NavigationOptions, type NotificationChannel, type NotificationChannelConfig, NotificationChannelType, NotificationChannelsService, type NotificationDomain, type NotificationOptions, type NotificationSettings, type NotificationSettingsEventType, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, type NotificationSetupRequestChannels, NotificationSetupService, type PageContent, PageStatus, type PaginationInfo, type PollingOptions, type PreparedExtraction, type RawFormat, Realtime, type RealtimeConfig, type RealtimeEvent, ResponseFormat, type Rule, RuleStatus, RuleType, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleValidationResponse, SchemaBuilder, type SchemaField as SchemaDefinitionField, type SchemaField$1 as SchemaField, SchemaFieldDataType, type SchemaResponse, SchemasService, type SessionDataItem, type SessionDataList, type SessionOperationResult, type SessionPage, type SessionPagesResult, type SessionStatus, type SetupWorkflowNotificationSettingsRequest, type SetupWorkspaceNotificationSettingsRequest, type SlackChannelConfig, type StartCrawlRequest, type StartSessionResult, type StartWithConfigRequest, type SubmitExtractionResult, type SubmittedExtraction, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, type TeamInfo, type TestNotificationRequest, type TestNotificationResult, type ToggleValidationResponse, UpdateInterval, type UpdateSchemaRequest, type UpdateWorkflowRequest, type UpdateWorkflowResponse, UserService, ValidationCoreService, type ValidationDomain, ValidationRulesService, ValidationStrategy, type WaitForReadyOptions, type WaitOptions, type WebhookChannelConfig, type WebhookChannelConfigAuth, type WebhookHttpMethod, type WebsocketChannelConfig, type WorkflowDataResponse, type WorkflowDetailsResponse, WorkflowDisplayStateEnum, type WorkflowId, type WorkflowInterval, type WorkflowMonitoringConfig, type WorkflowResponse, WorkflowState, WorkflowStateEnum, type WorkflowsApiInterface, WorkflowsCoreService, createCrawlerDomain, pollUntil, validateAdditionalData };
|
package/dist/index.d.ts
CHANGED
|
@@ -385,13 +385,9 @@ type MonitoredFieldOperatorEnum = typeof MonitoredFieldOperatorEnum[keyof typeof
|
|
|
385
385
|
*/
|
|
386
386
|
interface MonitoringConfig {
|
|
387
387
|
/**
|
|
388
|
-
*
|
|
388
|
+
* Fields to monitor (at least one required)
|
|
389
389
|
*/
|
|
390
|
-
'
|
|
391
|
-
/**
|
|
392
|
-
* Fields to monitor
|
|
393
|
-
*/
|
|
394
|
-
'fields'?: Array<MonitoredField>;
|
|
390
|
+
'fields': Array<MonitoredField>;
|
|
395
391
|
/**
|
|
396
392
|
* Notification channels
|
|
397
393
|
*/
|
|
@@ -1182,10 +1178,38 @@ interface CreateCrawlerConfigRequestBlueprintInner {
|
|
|
1182
1178
|
interface CreateCrawlerConfigRequestCrawlMethod {
|
|
1183
1179
|
[key: string]: any;
|
|
1184
1180
|
/**
|
|
1185
|
-
*
|
|
1181
|
+
* Worker selection mode. \'auto\' (default) picks cheapest compatible worker, \'browser\' forces browser.
|
|
1186
1182
|
*/
|
|
1187
|
-
'
|
|
1183
|
+
'mode'?: CreateCrawlerConfigRequestCrawlMethodModeEnum;
|
|
1184
|
+
/**
|
|
1185
|
+
* Explicit Scrape V2 worker override. BrightData is blocked in crawler runtime.
|
|
1186
|
+
*/
|
|
1187
|
+
'worker'?: CreateCrawlerConfigRequestCrawlMethodWorkerEnum;
|
|
1188
|
+
/**
|
|
1189
|
+
* Explicit proxy routing override for Scrape V2
|
|
1190
|
+
*/
|
|
1191
|
+
'proxy'?: CreateCrawlerConfigRequestCrawlMethodProxyEnum;
|
|
1188
1192
|
}
|
|
1193
|
+
declare const CreateCrawlerConfigRequestCrawlMethodModeEnum: {
|
|
1194
|
+
readonly Auto: "auto";
|
|
1195
|
+
readonly Browser: "browser";
|
|
1196
|
+
};
|
|
1197
|
+
type CreateCrawlerConfigRequestCrawlMethodModeEnum = typeof CreateCrawlerConfigRequestCrawlMethodModeEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodModeEnum];
|
|
1198
|
+
declare const CreateCrawlerConfigRequestCrawlMethodWorkerEnum: {
|
|
1199
|
+
readonly Auto: "auto";
|
|
1200
|
+
readonly CurlCffi: "curl-cffi";
|
|
1201
|
+
readonly Patchright: "patchright";
|
|
1202
|
+
readonly Camoufox: "camoufox";
|
|
1203
|
+
readonly Brightdata: "brightdata";
|
|
1204
|
+
};
|
|
1205
|
+
type CreateCrawlerConfigRequestCrawlMethodWorkerEnum = typeof CreateCrawlerConfigRequestCrawlMethodWorkerEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodWorkerEnum];
|
|
1206
|
+
declare const CreateCrawlerConfigRequestCrawlMethodProxyEnum: {
|
|
1207
|
+
readonly Auto: "auto";
|
|
1208
|
+
readonly Dc: "dc";
|
|
1209
|
+
readonly Resi: "resi";
|
|
1210
|
+
readonly Isp: "isp";
|
|
1211
|
+
};
|
|
1212
|
+
type CreateCrawlerConfigRequestCrawlMethodProxyEnum = typeof CreateCrawlerConfigRequestCrawlMethodProxyEnum[keyof typeof CreateCrawlerConfigRequestCrawlMethodProxyEnum];
|
|
1189
1213
|
|
|
1190
1214
|
/**
|
|
1191
1215
|
* Kadoa API
|
|
@@ -4137,6 +4161,10 @@ interface V4ChangesGet200ResponseChangesInner {
|
|
|
4137
4161
|
* URL where the change was detected
|
|
4138
4162
|
*/
|
|
4139
4163
|
'url'?: string;
|
|
4164
|
+
/**
|
|
4165
|
+
* AI-generated one-sentence summary of the data change. Null if generation failed, feature is disabled, or change predates the feature.
|
|
4166
|
+
*/
|
|
4167
|
+
'summary'?: string | null;
|
|
4140
4168
|
/**
|
|
4141
4169
|
* URL of the screenshot taken when the change was detected
|
|
4142
4170
|
*/
|
|
@@ -5742,13 +5770,9 @@ type V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInnerOperatorEnum =
|
|
|
5742
5770
|
*/
|
|
5743
5771
|
|
|
5744
5772
|
/**
|
|
5745
|
-
* The
|
|
5773
|
+
* The monitoring config for the workflow
|
|
5746
5774
|
*/
|
|
5747
5775
|
interface V4WorkflowsWorkflowIdMetadataPutRequestMonitoring {
|
|
5748
|
-
/**
|
|
5749
|
-
* Whether monitoring is enabled for the workflow
|
|
5750
|
-
*/
|
|
5751
|
-
'enabled'?: boolean;
|
|
5752
5776
|
'fields'?: Array<V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInner>;
|
|
5753
5777
|
'conditions'?: V4WorkflowsWorkflowIdMetadataPutRequestMonitoringConditions;
|
|
5754
5778
|
}
|
|
@@ -10367,13 +10391,31 @@ declare class ApiRegistry {
|
|
|
10367
10391
|
get notifications(): NotificationsApi;
|
|
10368
10392
|
}
|
|
10369
10393
|
|
|
10394
|
+
interface TeamInfo {
|
|
10395
|
+
id: string;
|
|
10396
|
+
name: string;
|
|
10397
|
+
memberRole: string;
|
|
10398
|
+
adminEmail: string | null;
|
|
10399
|
+
}
|
|
10400
|
+
interface BearerAuthOptions {
|
|
10401
|
+
bearerToken: string;
|
|
10402
|
+
}
|
|
10370
10403
|
interface KadoaClientStatus {
|
|
10371
10404
|
baseUrl: string;
|
|
10372
10405
|
user: KadoaUser;
|
|
10373
10406
|
realtimeConnected: boolean;
|
|
10374
10407
|
}
|
|
10375
10408
|
interface KadoaClientConfig {
|
|
10376
|
-
|
|
10409
|
+
/**
|
|
10410
|
+
* Team API key (`tk-...`). Required unless `bearerToken` is provided.
|
|
10411
|
+
*/
|
|
10412
|
+
apiKey?: string;
|
|
10413
|
+
/**
|
|
10414
|
+
* = JWT for Bearer auth. When set, requests send
|
|
10415
|
+
* `Authorization: Bearer <token>` instead of `x-api-key`.
|
|
10416
|
+
* Use {@link KadoaClient.setBearerToken} to update after refresh.
|
|
10417
|
+
*/
|
|
10418
|
+
bearerToken?: string;
|
|
10377
10419
|
/**
|
|
10378
10420
|
* Override the base URL for the public API.
|
|
10379
10421
|
*
|
|
@@ -10422,6 +10464,7 @@ declare class KadoaClient {
|
|
|
10422
10464
|
private readonly _axiosInstance;
|
|
10423
10465
|
private readonly _baseUrl;
|
|
10424
10466
|
private readonly _apiKey;
|
|
10467
|
+
private _bearerToken;
|
|
10425
10468
|
private _realtime?;
|
|
10426
10469
|
private readonly _extractionBuilderService;
|
|
10427
10470
|
readonly apis: ApiRegistry;
|
|
@@ -10448,9 +10491,15 @@ declare class KadoaClient {
|
|
|
10448
10491
|
/**
|
|
10449
10492
|
* Get the API key
|
|
10450
10493
|
*
|
|
10451
|
-
* @returns The API key
|
|
10494
|
+
* @returns The API key (empty string when using Bearer auth)
|
|
10452
10495
|
*/
|
|
10453
10496
|
get apiKey(): string;
|
|
10497
|
+
/**
|
|
10498
|
+
* Update the Bearer token used for authentication.
|
|
10499
|
+
* Call this after a Supabase JWT refresh so that subsequent requests
|
|
10500
|
+
* use the new token.
|
|
10501
|
+
*/
|
|
10502
|
+
setBearerToken(token: string): void;
|
|
10454
10503
|
/**
|
|
10455
10504
|
* Get the realtime connection (if enabled)
|
|
10456
10505
|
*/
|
|
@@ -10486,6 +10535,24 @@ declare class KadoaClient {
|
|
|
10486
10535
|
* @returns The status of the client
|
|
10487
10536
|
*/
|
|
10488
10537
|
status(): Promise<KadoaClientStatus>;
|
|
10538
|
+
/**
|
|
10539
|
+
* List all teams accessible to the authenticated user.
|
|
10540
|
+
*
|
|
10541
|
+
* When called with a Bearer token (Supabase JWT), returns all teams the
|
|
10542
|
+
* human user belongs to. Without it, falls back to x-api-key auth which
|
|
10543
|
+
* only returns teams the service account (API key) belongs to.
|
|
10544
|
+
*/
|
|
10545
|
+
listTeams(opts?: BearerAuthOptions): Promise<TeamInfo[]>;
|
|
10546
|
+
/**
|
|
10547
|
+
* Switch the active team for this session.
|
|
10548
|
+
*
|
|
10549
|
+
* Calls `POST /v5/auth/active-team` which updates the server-side
|
|
10550
|
+
* session→team mapping. Subsequent requests with the same JWT are
|
|
10551
|
+
* automatically scoped to the new team — no token refresh needed.
|
|
10552
|
+
*
|
|
10553
|
+
* @param teamId - The team ID to switch to (must be a team the user belongs to)
|
|
10554
|
+
*/
|
|
10555
|
+
setActiveTeam(teamId: string): Promise<void>;
|
|
10489
10556
|
/**
|
|
10490
10557
|
* Dispose of the client and clean up resources
|
|
10491
10558
|
*/
|
|
@@ -10653,4 +10720,4 @@ declare class KadoaHttpException extends KadoaSdkException {
|
|
|
10653
10720
|
static mapStatusToCode(errorOrStatus: AxiosError | number): KadoaErrorCode;
|
|
10654
10721
|
}
|
|
10655
10722
|
|
|
10656
|
-
export { type ArtifactOptions, type BlueprintItem, type BulkApproveRulesRequest, type BulkApproveRulesResponseData, type BulkDeleteRulesRequest, type BulkDeleteRulesResponseData, type Category, type ChannelConfig, type ChannelSetupRequestConfig, type CrawlMethod, type CrawlerConfig, CrawlerConfigService, type CrawlerDomain, type CrawlerExtractionOptions, type CrawlerSession, CrawlerSessionService, type CreateChannelRequest, type CreateConfigRequest, type CreateSchemaRequest, type CreateSettingsRequest, type CreateWorkflowInput, type CreateWorkflowRequest, type CreateWorkflowWithCustomSchemaRequest, type CreatedExtraction, DataFetcherService, type DataFieldFor, type DataPagination, DataSortOrder, type DataType, type DataTypeNotRequiringExample, type DataTypeRequiringExample, type DeleteAllRulesRequest, type DeleteAllRulesResponseData, type DeleteConfigRequest, type DeleteConfigResult, type DisableRuleRequest, ERROR_MESSAGES, type EmailChannelConfig, EntityResolverService, type ExtractOptions, ExtractionBuilderService, type ExtractionOptions, type ExtractionResult, ExtractionService, FetchDataOptions, type FetchDataResult, type FieldExample, type FieldOptions, type FieldOptionsWithExample, type FieldOptionsWithoutExample, type FieldType, type FinishedExtraction, type GenerateRuleRequest, type GenerateRulesRequest, type GetAllDataOptions, type GetAnomaliesByRuleResponse, type GetAnomalyRulePageResponse, type GetBucketFileOptions, type GetJobResponse, type GetPageOptions, type GetPagesOptions, type GetValidationResponse, type GetWorkflowResponse, type JobId, JobStateEnum, type JobWaitOptions, KadoaClient, type KadoaClientConfig, type KadoaClientStatus, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, ListChannelsRequest, ListRulesRequest, type ListRulesResponse, type ListSessionsOptions, type ListSessionsResult, ListSettingsRequest, type ListValidationsResponse, ListWorkflowValidationsRequest, ListWorkflowsRequest, type LocationConfig, type MetadataKey, type MonitoringConfig, type MonitoringField, type MonitoringOperator, MonitoringStatus, type NavigationMode, type NavigationOptions, type NotificationChannel, type NotificationChannelConfig, NotificationChannelType, NotificationChannelsService, type NotificationDomain, type NotificationOptions, type NotificationSettings, type NotificationSettingsEventType, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, type NotificationSetupRequestChannels, NotificationSetupService, type PageContent, PageStatus, type PaginationInfo, type PollingOptions, type PreparedExtraction, type RawFormat, Realtime, type RealtimeConfig, type RealtimeEvent, ResponseFormat, type Rule, RuleStatus, RuleType, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleValidationResponse, SchemaBuilder, type SchemaField as SchemaDefinitionField, type SchemaField$1 as SchemaField, SchemaFieldDataType, type SchemaResponse, SchemasService, type SessionDataItem, type SessionDataList, type SessionOperationResult, type SessionPage, type SessionPagesResult, type SessionStatus, type SetupWorkflowNotificationSettingsRequest, type SetupWorkspaceNotificationSettingsRequest, type SlackChannelConfig, type StartCrawlRequest, type StartSessionResult, type StartWithConfigRequest, type SubmitExtractionResult, type SubmittedExtraction, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, type TestNotificationRequest, type TestNotificationResult, type ToggleValidationResponse, UpdateInterval, type UpdateSchemaRequest, type UpdateWorkflowRequest, type UpdateWorkflowResponse, UserService, ValidationCoreService, type ValidationDomain, ValidationRulesService, ValidationStrategy, type WaitForReadyOptions, type WaitOptions, type WebhookChannelConfig, type WebhookChannelConfigAuth, type WebhookHttpMethod, type WebsocketChannelConfig, type WorkflowDataResponse, type WorkflowDetailsResponse, WorkflowDisplayStateEnum, type WorkflowId, type WorkflowInterval, type WorkflowMonitoringConfig, type WorkflowResponse, WorkflowState, WorkflowStateEnum, type WorkflowsApiInterface, WorkflowsCoreService, createCrawlerDomain, pollUntil, validateAdditionalData };
|
|
10723
|
+
export { type ArtifactOptions, type BearerAuthOptions, type BlueprintItem, type BulkApproveRulesRequest, type BulkApproveRulesResponseData, type BulkDeleteRulesRequest, type BulkDeleteRulesResponseData, type Category, type ChannelConfig, type ChannelSetupRequestConfig, type CrawlMethod, type CrawlerConfig, CrawlerConfigService, type CrawlerDomain, type CrawlerExtractionOptions, type CrawlerSession, CrawlerSessionService, type CreateChannelRequest, type CreateConfigRequest, type CreateSchemaRequest, type CreateSettingsRequest, type CreateWorkflowInput, type CreateWorkflowRequest, type CreateWorkflowWithCustomSchemaRequest, type CreatedExtraction, DataFetcherService, type DataFieldFor, type DataPagination, DataSortOrder, type DataType, type DataTypeNotRequiringExample, type DataTypeRequiringExample, type DeleteAllRulesRequest, type DeleteAllRulesResponseData, type DeleteConfigRequest, type DeleteConfigResult, type DisableRuleRequest, ERROR_MESSAGES, type EmailChannelConfig, EntityResolverService, type ExtractOptions, ExtractionBuilderService, type ExtractionOptions, type ExtractionResult, ExtractionService, FetchDataOptions, type FetchDataResult, type FieldExample, type FieldOptions, type FieldOptionsWithExample, type FieldOptionsWithoutExample, type FieldType, type FinishedExtraction, type GenerateRuleRequest, type GenerateRulesRequest, type GetAllDataOptions, type GetAnomaliesByRuleResponse, type GetAnomalyRulePageResponse, type GetBucketFileOptions, type GetJobResponse, type GetPageOptions, type GetPagesOptions, type GetValidationResponse, type GetWorkflowResponse, type JobId, JobStateEnum, type JobWaitOptions, KadoaClient, type KadoaClientConfig, type KadoaClientStatus, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, ListChannelsRequest, ListRulesRequest, type ListRulesResponse, type ListSessionsOptions, type ListSessionsResult, ListSettingsRequest, type ListValidationsResponse, ListWorkflowValidationsRequest, ListWorkflowsRequest, type LocationConfig, type MetadataKey, type MonitoringConfig, type MonitoringField, type MonitoringOperator, MonitoringStatus, type NavigationMode, type NavigationOptions, type NotificationChannel, type NotificationChannelConfig, NotificationChannelType, NotificationChannelsService, type NotificationDomain, type NotificationOptions, type NotificationSettings, type NotificationSettingsEventType, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, type NotificationSetupRequestChannels, NotificationSetupService, type PageContent, PageStatus, type PaginationInfo, type PollingOptions, type PreparedExtraction, type RawFormat, Realtime, type RealtimeConfig, type RealtimeEvent, ResponseFormat, type Rule, RuleStatus, RuleType, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleValidationResponse, SchemaBuilder, type SchemaField as SchemaDefinitionField, type SchemaField$1 as SchemaField, SchemaFieldDataType, type SchemaResponse, SchemasService, type SessionDataItem, type SessionDataList, type SessionOperationResult, type SessionPage, type SessionPagesResult, type SessionStatus, type SetupWorkflowNotificationSettingsRequest, type SetupWorkspaceNotificationSettingsRequest, type SlackChannelConfig, type StartCrawlRequest, type StartSessionResult, type StartWithConfigRequest, type SubmitExtractionResult, type SubmittedExtraction, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, type TeamInfo, type TestNotificationRequest, type TestNotificationResult, type ToggleValidationResponse, UpdateInterval, type UpdateSchemaRequest, type UpdateWorkflowRequest, type UpdateWorkflowResponse, UserService, ValidationCoreService, type ValidationDomain, ValidationRulesService, ValidationStrategy, type WaitForReadyOptions, type WaitOptions, type WebhookChannelConfig, type WebhookChannelConfigAuth, type WebhookHttpMethod, type WebsocketChannelConfig, type WorkflowDataResponse, type WorkflowDetailsResponse, WorkflowDisplayStateEnum, type WorkflowId, type WorkflowInterval, type WorkflowMonitoringConfig, type WorkflowResponse, WorkflowState, WorkflowStateEnum, type WorkflowsApiInterface, WorkflowsCoreService, createCrawlerDomain, pollUntil, validateAdditionalData };
|
package/dist/index.js
CHANGED
|
@@ -6209,7 +6209,7 @@ process.env.KADOA_WSS_NEO_API_URI ?? "wss://events.kadoa.com/events/ws";
|
|
|
6209
6209
|
var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
|
|
6210
6210
|
|
|
6211
6211
|
// src/version.ts
|
|
6212
|
-
var SDK_VERSION = "0.
|
|
6212
|
+
var SDK_VERSION = "0.24.0";
|
|
6213
6213
|
var SDK_NAME = "kadoa-node-sdk";
|
|
6214
6214
|
var SDK_LANGUAGE = "node";
|
|
6215
6215
|
|
|
@@ -7184,11 +7184,27 @@ function createNotificationDomain(params) {
|
|
|
7184
7184
|
// src/client/kadoa-client.ts
|
|
7185
7185
|
var KadoaClient = class {
|
|
7186
7186
|
constructor(config) {
|
|
7187
|
+
if (!config.apiKey && !config.bearerToken) {
|
|
7188
|
+
throw new KadoaSdkException(
|
|
7189
|
+
"Either apiKey or bearerToken must be provided",
|
|
7190
|
+
{ code: "VALIDATION_ERROR" }
|
|
7191
|
+
);
|
|
7192
|
+
}
|
|
7187
7193
|
this._baseUrl = config.baseUrl ?? PUBLIC_API_URI;
|
|
7188
|
-
this._apiKey = config.apiKey;
|
|
7194
|
+
this._apiKey = config.apiKey ?? "";
|
|
7195
|
+
this._bearerToken = config.bearerToken;
|
|
7189
7196
|
const timeout = config.timeout ?? 3e4;
|
|
7190
7197
|
const headers = createSdkHeaders();
|
|
7191
7198
|
this._axiosInstance = createAxiosInstance({ timeout, headers });
|
|
7199
|
+
this._axiosInstance.interceptors.request.use((reqConfig) => {
|
|
7200
|
+
if (this._bearerToken) {
|
|
7201
|
+
if (!reqConfig.headers["Authorization"]) {
|
|
7202
|
+
reqConfig.headers["Authorization"] = `Bearer ${this._bearerToken}`;
|
|
7203
|
+
}
|
|
7204
|
+
delete reqConfig.headers["x-api-key"];
|
|
7205
|
+
}
|
|
7206
|
+
return reqConfig;
|
|
7207
|
+
});
|
|
7192
7208
|
this.apis = new ApiRegistry(
|
|
7193
7209
|
this._apiKey,
|
|
7194
7210
|
this._baseUrl,
|
|
@@ -7226,11 +7242,19 @@ var KadoaClient = class {
|
|
|
7226
7242
|
/**
|
|
7227
7243
|
* Get the API key
|
|
7228
7244
|
*
|
|
7229
|
-
* @returns The API key
|
|
7245
|
+
* @returns The API key (empty string when using Bearer auth)
|
|
7230
7246
|
*/
|
|
7231
7247
|
get apiKey() {
|
|
7232
7248
|
return this._apiKey;
|
|
7233
7249
|
}
|
|
7250
|
+
/**
|
|
7251
|
+
* Update the Bearer token used for authentication.
|
|
7252
|
+
* Call this after a Supabase JWT refresh so that subsequent requests
|
|
7253
|
+
* use the new token.
|
|
7254
|
+
*/
|
|
7255
|
+
setBearerToken(token) {
|
|
7256
|
+
this._bearerToken = token;
|
|
7257
|
+
}
|
|
7234
7258
|
/**
|
|
7235
7259
|
* Get the realtime connection (if enabled)
|
|
7236
7260
|
*/
|
|
@@ -7254,6 +7278,12 @@ var KadoaClient = class {
|
|
|
7254
7278
|
* @returns The Realtime instance
|
|
7255
7279
|
*/
|
|
7256
7280
|
async connectRealtime(options) {
|
|
7281
|
+
if (!this._apiKey) {
|
|
7282
|
+
throw new KadoaSdkException(
|
|
7283
|
+
"Realtime requires an API key. Bearer-only auth is not supported for WebSocket connections.",
|
|
7284
|
+
{ code: "VALIDATION_ERROR" }
|
|
7285
|
+
);
|
|
7286
|
+
}
|
|
7257
7287
|
if (!this._realtime) {
|
|
7258
7288
|
this._realtime = new Realtime({ apiKey: this._apiKey, ...options });
|
|
7259
7289
|
await this._realtime.connect();
|
|
@@ -7289,6 +7319,42 @@ var KadoaClient = class {
|
|
|
7289
7319
|
realtimeConnected: this.isRealtimeConnected()
|
|
7290
7320
|
};
|
|
7291
7321
|
}
|
|
7322
|
+
/**
|
|
7323
|
+
* List all teams accessible to the authenticated user.
|
|
7324
|
+
*
|
|
7325
|
+
* When called with a Bearer token (Supabase JWT), returns all teams the
|
|
7326
|
+
* human user belongs to. Without it, falls back to x-api-key auth which
|
|
7327
|
+
* only returns teams the service account (API key) belongs to.
|
|
7328
|
+
*/
|
|
7329
|
+
async listTeams(opts) {
|
|
7330
|
+
const headers = opts?.bearerToken ? { Authorization: `Bearer ${opts.bearerToken}` } : void 0;
|
|
7331
|
+
const response = await this._axiosInstance.get("/v5/user", {
|
|
7332
|
+
baseURL: this._baseUrl,
|
|
7333
|
+
...headers && { headers }
|
|
7334
|
+
});
|
|
7335
|
+
return response.data?.teams ?? [];
|
|
7336
|
+
}
|
|
7337
|
+
/**
|
|
7338
|
+
* Switch the active team for this session.
|
|
7339
|
+
*
|
|
7340
|
+
* Calls `POST /v5/auth/active-team` which updates the server-side
|
|
7341
|
+
* session→team mapping. Subsequent requests with the same JWT are
|
|
7342
|
+
* automatically scoped to the new team — no token refresh needed.
|
|
7343
|
+
*
|
|
7344
|
+
* @param teamId - The team ID to switch to (must be a team the user belongs to)
|
|
7345
|
+
*/
|
|
7346
|
+
async setActiveTeam(teamId) {
|
|
7347
|
+
if (!teamId?.trim()) {
|
|
7348
|
+
throw new KadoaSdkException("teamId is required", {
|
|
7349
|
+
code: "VALIDATION_ERROR"
|
|
7350
|
+
});
|
|
7351
|
+
}
|
|
7352
|
+
await this._axiosInstance.post(
|
|
7353
|
+
"/v5/auth/active-team",
|
|
7354
|
+
{ teamId },
|
|
7355
|
+
{ baseURL: this._baseUrl }
|
|
7356
|
+
);
|
|
7357
|
+
}
|
|
7292
7358
|
/**
|
|
7293
7359
|
* Dispose of the client and clean up resources
|
|
7294
7360
|
*/
|