@kadoa/node-sdk 0.19.4-beta.3 → 0.20.2
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 +8 -13
- package/dist/browser/index.global.js +9 -9
- package/dist/browser/index.global.js.map +1 -1
- package/dist/index.d.mts +3175 -1035
- package/dist/index.d.ts +3175 -1035
- package/dist/index.js +437 -362
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -363
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3606,7 +3606,7 @@ var WorkflowsApiAxiosParamCreator = function(configuration) {
|
|
|
3606
3606
|
};
|
|
3607
3607
|
},
|
|
3608
3608
|
/**
|
|
3609
|
-
* Resumes a paused, preview, or error workflow.
|
|
3609
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
3610
3610
|
* @summary Resume a workflow
|
|
3611
3611
|
* @param {string} workflowId The ID of the workflow to resume
|
|
3612
3612
|
* @param {*} [options] Override http request option.
|
|
@@ -4057,7 +4057,7 @@ var WorkflowsApiFp = function(configuration) {
|
|
|
4057
4057
|
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios3, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
4058
4058
|
},
|
|
4059
4059
|
/**
|
|
4060
|
-
* Resumes a paused, preview, or error workflow.
|
|
4060
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
4061
4061
|
* @summary Resume a workflow
|
|
4062
4062
|
* @param {string} workflowId The ID of the workflow to resume
|
|
4063
4063
|
* @param {*} [options] Override http request option.
|
|
@@ -4292,7 +4292,7 @@ var WorkflowsApi = class extends BaseAPI {
|
|
|
4292
4292
|
return WorkflowsApiFp(this.configuration).v4WorkflowsWorkflowIdPausePut(requestParameters.workflowId, options).then((request) => request(this.axios, this.basePath));
|
|
4293
4293
|
}
|
|
4294
4294
|
/**
|
|
4295
|
-
* Resumes a paused, preview, or error workflow.
|
|
4295
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
4296
4296
|
* @summary Resume a workflow
|
|
4297
4297
|
* @param {WorkflowsApiV4WorkflowsWorkflowIdResumePutRequest} requestParameters Request parameters.
|
|
4298
4298
|
* @param {*} [options] Override http request option.
|
|
@@ -4401,6 +4401,122 @@ var DataFieldDataTypeEnum = {
|
|
|
4401
4401
|
Array: "ARRAY"
|
|
4402
4402
|
};
|
|
4403
4403
|
|
|
4404
|
+
// src/domains/crawler/crawler.acl.ts
|
|
4405
|
+
var PageStatus = {
|
|
4406
|
+
Done: "DONE",
|
|
4407
|
+
Crawling: "CRAWLING",
|
|
4408
|
+
Pending: "PENDING"
|
|
4409
|
+
};
|
|
4410
|
+
|
|
4411
|
+
// src/domains/crawler/crawler-config.service.ts
|
|
4412
|
+
var CrawlerConfigService = class {
|
|
4413
|
+
constructor(client) {
|
|
4414
|
+
this.client = client;
|
|
4415
|
+
}
|
|
4416
|
+
get api() {
|
|
4417
|
+
return this.client.apis.crawler;
|
|
4418
|
+
}
|
|
4419
|
+
async createConfig(body) {
|
|
4420
|
+
const response = await this.api.v4CrawlConfigPost({
|
|
4421
|
+
createCrawlerConfigRequest: body
|
|
4422
|
+
});
|
|
4423
|
+
return response.data;
|
|
4424
|
+
}
|
|
4425
|
+
async getConfig(configId) {
|
|
4426
|
+
const response = await this.api.v4CrawlConfigConfigIdGet({ configId });
|
|
4427
|
+
return response.data;
|
|
4428
|
+
}
|
|
4429
|
+
async deleteConfig(configId) {
|
|
4430
|
+
const response = await this.api.v4CrawlConfigDelete({
|
|
4431
|
+
deleteCrawlerConfigRequest: { configId }
|
|
4432
|
+
});
|
|
4433
|
+
return response.data;
|
|
4434
|
+
}
|
|
4435
|
+
};
|
|
4436
|
+
|
|
4437
|
+
// src/domains/crawler/crawler-session.service.ts
|
|
4438
|
+
var CrawlerSessionService = class {
|
|
4439
|
+
constructor(client) {
|
|
4440
|
+
this.client = client;
|
|
4441
|
+
}
|
|
4442
|
+
get api() {
|
|
4443
|
+
return this.client.apis.crawler;
|
|
4444
|
+
}
|
|
4445
|
+
async start(body) {
|
|
4446
|
+
const response = await this.api.v4CrawlPost({
|
|
4447
|
+
startCrawlerSessionRequest: body
|
|
4448
|
+
});
|
|
4449
|
+
return response.data;
|
|
4450
|
+
}
|
|
4451
|
+
async startWithConfig(body) {
|
|
4452
|
+
const response = await this.api.v4CrawlStartPost({
|
|
4453
|
+
startSessionWithConfigRequest: body
|
|
4454
|
+
});
|
|
4455
|
+
return response.data;
|
|
4456
|
+
}
|
|
4457
|
+
async pause(sessionId) {
|
|
4458
|
+
const response = await this.api.v4CrawlPausePost({
|
|
4459
|
+
pauseCrawlerSessionRequest: { sessionId }
|
|
4460
|
+
});
|
|
4461
|
+
return response.data;
|
|
4462
|
+
}
|
|
4463
|
+
async resume(sessionId) {
|
|
4464
|
+
const response = await this.api.v4CrawlResumePost({
|
|
4465
|
+
resumeCrawlerSessionRequest: { sessionId }
|
|
4466
|
+
});
|
|
4467
|
+
return response.data;
|
|
4468
|
+
}
|
|
4469
|
+
async listSessions(options) {
|
|
4470
|
+
const response = await this.api.v4CrawlSessionsGet({
|
|
4471
|
+
page: options?.page,
|
|
4472
|
+
pageSize: options?.pageSize,
|
|
4473
|
+
userId: options?.userId
|
|
4474
|
+
});
|
|
4475
|
+
return response.data.data ?? [];
|
|
4476
|
+
}
|
|
4477
|
+
async getSessionStatus(sessionId) {
|
|
4478
|
+
const response = await this.api.v4CrawlSessionIdStatusGet({ sessionId });
|
|
4479
|
+
return response.data;
|
|
4480
|
+
}
|
|
4481
|
+
async getPages(sessionId, options) {
|
|
4482
|
+
const response = await this.api.v4CrawlSessionIdPagesGet({
|
|
4483
|
+
sessionId,
|
|
4484
|
+
currentPage: options?.currentPage,
|
|
4485
|
+
pageSize: options?.pageSize
|
|
4486
|
+
});
|
|
4487
|
+
return response.data;
|
|
4488
|
+
}
|
|
4489
|
+
async getPage(sessionId, pageId, options) {
|
|
4490
|
+
const response = await this.api.v4CrawlSessionIdPagesPageIdGet({
|
|
4491
|
+
sessionId,
|
|
4492
|
+
pageId,
|
|
4493
|
+
format: options?.format
|
|
4494
|
+
});
|
|
4495
|
+
return response.data;
|
|
4496
|
+
}
|
|
4497
|
+
async getAllSessionData(sessionId, options) {
|
|
4498
|
+
const response = await this.api.v4CrawlSessionIdListGet({
|
|
4499
|
+
sessionId,
|
|
4500
|
+
includeAll: options?.includeAll
|
|
4501
|
+
});
|
|
4502
|
+
return response.data;
|
|
4503
|
+
}
|
|
4504
|
+
async getBucketFile(filenameb64) {
|
|
4505
|
+
const response = await this.api.v4CrawlBucketDataFilenameb64Get({
|
|
4506
|
+
filenameb64
|
|
4507
|
+
});
|
|
4508
|
+
return response.data;
|
|
4509
|
+
}
|
|
4510
|
+
};
|
|
4511
|
+
|
|
4512
|
+
// src/domains/crawler/crawler.facade.ts
|
|
4513
|
+
function createCrawlerDomain(client) {
|
|
4514
|
+
return {
|
|
4515
|
+
config: new CrawlerConfigService(client),
|
|
4516
|
+
session: new CrawlerSessionService(client)
|
|
4517
|
+
};
|
|
4518
|
+
}
|
|
4519
|
+
|
|
4404
4520
|
// src/domains/extraction/extraction.acl.ts
|
|
4405
4521
|
var FetchDataOptions = class {
|
|
4406
4522
|
};
|
|
@@ -4521,7 +4637,6 @@ var DataFetcherService = class {
|
|
|
4521
4637
|
|
|
4522
4638
|
// src/runtime/exceptions/base.exception.ts
|
|
4523
4639
|
var KadoaErrorCode = {
|
|
4524
|
-
AUTH_ERROR: "AUTH_ERROR",
|
|
4525
4640
|
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
4526
4641
|
BAD_REQUEST: "BAD_REQUEST",
|
|
4527
4642
|
NOT_FOUND: "NOT_FOUND",
|
|
@@ -4641,8 +4756,7 @@ var KadoaHttpException = class _KadoaHttpException extends KadoaSdkException {
|
|
|
4641
4756
|
endpoint: url,
|
|
4642
4757
|
method,
|
|
4643
4758
|
responseBody: error.response?.data,
|
|
4644
|
-
details: extra?.details
|
|
4645
|
-
cause: error
|
|
4759
|
+
details: extra?.details
|
|
4646
4760
|
});
|
|
4647
4761
|
}
|
|
4648
4762
|
toJSON() {
|
|
@@ -4828,7 +4942,10 @@ var SchemaBuilder = _SchemaBuilder;
|
|
|
4828
4942
|
var debug = logger.schemas;
|
|
4829
4943
|
var SchemasService = class {
|
|
4830
4944
|
constructor(client) {
|
|
4831
|
-
this.
|
|
4945
|
+
this.client = client;
|
|
4946
|
+
}
|
|
4947
|
+
get schemasApi() {
|
|
4948
|
+
return this.client.apis.schemas;
|
|
4832
4949
|
}
|
|
4833
4950
|
/**
|
|
4834
4951
|
* Create a schema builder with fluent API and inline create support.
|
|
@@ -5398,15 +5515,18 @@ var ExtractionBuilderService = class {
|
|
|
5398
5515
|
selectorMode: useSelectorMode
|
|
5399
5516
|
});
|
|
5400
5517
|
}
|
|
5518
|
+
const hasSchemaId = typeof entity === "object" && "schemaId" in entity && entity.schemaId;
|
|
5401
5519
|
const workflow = await this.workflowsCoreService.create({
|
|
5402
5520
|
urls,
|
|
5403
5521
|
name,
|
|
5404
5522
|
description,
|
|
5405
5523
|
navigationMode,
|
|
5406
5524
|
monitoring: this._monitoringOptions,
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5525
|
+
...hasSchemaId ? {
|
|
5526
|
+
schemaId: entity.schemaId,
|
|
5527
|
+
entity: resolvedEntity.entity,
|
|
5528
|
+
fields: resolvedEntity.fields
|
|
5529
|
+
} : { entity: resolvedEntity.entity, fields: resolvedEntity.fields },
|
|
5410
5530
|
autoStart: false,
|
|
5411
5531
|
interval: this._options.interval,
|
|
5412
5532
|
schedules: this._options.schedules,
|
|
@@ -5599,11 +5719,14 @@ var _NotificationChannelsService = class _NotificationChannelsService {
|
|
|
5599
5719
|
}
|
|
5600
5720
|
async createChannel(type, config) {
|
|
5601
5721
|
const payload = await this.buildPayload(
|
|
5602
|
-
merge(
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5722
|
+
merge(
|
|
5723
|
+
{
|
|
5724
|
+
name: _NotificationChannelsService.DEFAULT_CHANNEL_NAME,
|
|
5725
|
+
channelType: type,
|
|
5726
|
+
config: {}
|
|
5727
|
+
},
|
|
5728
|
+
config || {}
|
|
5729
|
+
)
|
|
5607
5730
|
);
|
|
5608
5731
|
const response = await this.api.v5NotificationsChannelsPost({
|
|
5609
5732
|
v5NotificationsChannelsPostRequest: payload
|
|
@@ -5709,6 +5832,19 @@ var NotificationSettingsService = class {
|
|
|
5709
5832
|
async listAllEvents() {
|
|
5710
5833
|
return Object.values(V5NotificationsSettingsGetEventTypeEnum);
|
|
5711
5834
|
}
|
|
5835
|
+
async updateSettings(settingsId, data) {
|
|
5836
|
+
const response = await this.api.v5NotificationsSettingsSettingsIdPut({
|
|
5837
|
+
settingsId,
|
|
5838
|
+
v5NotificationsSettingsSettingsIdPutRequest: data
|
|
5839
|
+
});
|
|
5840
|
+
const settings = response.data.data?.settings;
|
|
5841
|
+
if (!settings) {
|
|
5842
|
+
throw KadoaHttpException.wrap(response, {
|
|
5843
|
+
message: "Failed to update notification settings"
|
|
5844
|
+
});
|
|
5845
|
+
}
|
|
5846
|
+
return settings;
|
|
5847
|
+
}
|
|
5712
5848
|
async deleteSettings(settingsId) {
|
|
5713
5849
|
const response = await this.api.v5NotificationsSettingsSettingsIdDelete({
|
|
5714
5850
|
settingsId
|
|
@@ -5729,20 +5865,10 @@ var NotificationSetupService = class {
|
|
|
5729
5865
|
this.settingsService = settingsService;
|
|
5730
5866
|
}
|
|
5731
5867
|
/**
|
|
5732
|
-
* Setup notification settings for a specific workflow
|
|
5868
|
+
* Setup notification settings for a specific workflow.
|
|
5869
|
+
* Creates channels and settings for the specified events.
|
|
5733
5870
|
*/
|
|
5734
5871
|
async setupForWorkflow(requestData) {
|
|
5735
|
-
const existingSettings = await this.settingsService.listSettings({
|
|
5736
|
-
workflowId: requestData.workflowId
|
|
5737
|
-
});
|
|
5738
|
-
if (existingSettings.length > 0) {
|
|
5739
|
-
throw new KadoaSdkException("Settings already exist", {
|
|
5740
|
-
code: KadoaErrorCode.BAD_REQUEST,
|
|
5741
|
-
details: {
|
|
5742
|
-
workflowId: requestData.workflowId
|
|
5743
|
-
}
|
|
5744
|
-
});
|
|
5745
|
-
}
|
|
5746
5872
|
return this.setup({
|
|
5747
5873
|
workflowId: requestData.workflowId,
|
|
5748
5874
|
events: requestData.events,
|
|
@@ -5790,8 +5916,24 @@ var NotificationSetupService = class {
|
|
|
5790
5916
|
channels: channelIds
|
|
5791
5917
|
}
|
|
5792
5918
|
);
|
|
5919
|
+
const existingSettings = await this.settingsService.listSettings({
|
|
5920
|
+
workflowId: requestData.workflowId
|
|
5921
|
+
});
|
|
5793
5922
|
const newSettings = await Promise.all(
|
|
5794
5923
|
eventTypes.map(async (eventType) => {
|
|
5924
|
+
const existing = existingSettings.find(
|
|
5925
|
+
(s) => s.eventType === eventType
|
|
5926
|
+
);
|
|
5927
|
+
if (existing?.id) {
|
|
5928
|
+
const existingChannelIds = (existing.channels || []).map((c) => c.id).filter(Boolean);
|
|
5929
|
+
const mergedChannelIds = [
|
|
5930
|
+
.../* @__PURE__ */ new Set([...existingChannelIds, ...channelIds])
|
|
5931
|
+
];
|
|
5932
|
+
return await this.settingsService.updateSettings(existing.id, {
|
|
5933
|
+
channelIds: mergedChannelIds,
|
|
5934
|
+
enabled: existing.enabled ?? true
|
|
5935
|
+
});
|
|
5936
|
+
}
|
|
5795
5937
|
return await this.settingsService.createSettings({
|
|
5796
5938
|
workflowId: requestData.workflowId,
|
|
5797
5939
|
channelIds,
|
|
@@ -5924,9 +6066,10 @@ var NotificationSetupService = class {
|
|
|
5924
6066
|
});
|
|
5925
6067
|
return existingChannel;
|
|
5926
6068
|
}
|
|
6069
|
+
const { name: _, ...channelConfig } = config;
|
|
5927
6070
|
const channel = await this.channelsService.createChannel(channelType, {
|
|
5928
6071
|
name: channelName,
|
|
5929
|
-
config
|
|
6072
|
+
config: channelConfig
|
|
5930
6073
|
});
|
|
5931
6074
|
debug4("Created channel with custom config %O", {
|
|
5932
6075
|
workflowId,
|
|
@@ -5944,10 +6087,11 @@ var NotificationSetupService = class {
|
|
|
5944
6087
|
// src/runtime/config/constants.ts
|
|
5945
6088
|
var PUBLIC_API_URI = process.env.KADOA_PUBLIC_API_URI ?? "https://api.kadoa.com";
|
|
5946
6089
|
var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
|
|
6090
|
+
process.env.KADOA_WSS_NEO_API_URI ?? "wss://events.kadoa.com/events/ws";
|
|
5947
6091
|
var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
|
|
5948
6092
|
|
|
5949
6093
|
// src/version.ts
|
|
5950
|
-
var SDK_VERSION = "0.
|
|
6094
|
+
var SDK_VERSION = "0.20.2";
|
|
5951
6095
|
var SDK_NAME = "kadoa-node-sdk";
|
|
5952
6096
|
var SDK_LANGUAGE = "node";
|
|
5953
6097
|
|
|
@@ -5967,7 +6111,6 @@ var Realtime = class {
|
|
|
5967
6111
|
this.heartbeatInterval = config.heartbeatInterval || 1e4;
|
|
5968
6112
|
this.reconnectDelay = config.reconnectDelay || 5e3;
|
|
5969
6113
|
this.missedHeartbeatsLimit = config.missedHeartbeatsLimit || 3e4;
|
|
5970
|
-
this.source = config.source;
|
|
5971
6114
|
}
|
|
5972
6115
|
async connect() {
|
|
5973
6116
|
if (this.isConnecting) return;
|
|
@@ -5982,56 +6125,59 @@ var Realtime = class {
|
|
|
5982
6125
|
}
|
|
5983
6126
|
});
|
|
5984
6127
|
const { access_token, team_id } = await response.json();
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
this.
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
this.socket.
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6128
|
+
await new Promise((resolve, reject) => {
|
|
6129
|
+
this.socket = new WebSocket(
|
|
6130
|
+
`${WSS_API_URI}?access_token=${access_token}`
|
|
6131
|
+
);
|
|
6132
|
+
this.socket.onopen = () => {
|
|
6133
|
+
this.isConnecting = false;
|
|
6134
|
+
this.lastHeartbeat = Date.now();
|
|
6135
|
+
if (this.socket?.readyState === WebSocket.OPEN) {
|
|
6136
|
+
this.socket.send(
|
|
6137
|
+
JSON.stringify({
|
|
6138
|
+
action: "subscribe",
|
|
6139
|
+
channel: team_id
|
|
6140
|
+
})
|
|
6141
|
+
);
|
|
6142
|
+
debug5("Connected to WebSocket");
|
|
6143
|
+
this.notifyConnectionListeners(true);
|
|
6144
|
+
}
|
|
6145
|
+
this.startHeartbeatCheck();
|
|
6146
|
+
resolve();
|
|
6147
|
+
};
|
|
6148
|
+
this.socket.onmessage = (event) => {
|
|
6149
|
+
try {
|
|
6150
|
+
const data = JSON.parse(event.data);
|
|
6151
|
+
if (data.type === "heartbeat") {
|
|
6152
|
+
this.handleHeartbeat();
|
|
6153
|
+
} else {
|
|
6154
|
+
if (data?.id) {
|
|
6155
|
+
fetch(`${REALTIME_API_URI}/api/v1/events/ack`, {
|
|
6156
|
+
method: "POST",
|
|
6157
|
+
headers: { "Content-Type": "application/json" },
|
|
6158
|
+
body: JSON.stringify({ id: data.id })
|
|
6159
|
+
});
|
|
6160
|
+
}
|
|
6161
|
+
this.notifyEventListeners(data);
|
|
6016
6162
|
}
|
|
6017
|
-
|
|
6163
|
+
} catch (err) {
|
|
6164
|
+
debug5("Failed to parse incoming message: %O", err);
|
|
6018
6165
|
}
|
|
6019
|
-
}
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
this.
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
};
|
|
6166
|
+
};
|
|
6167
|
+
this.socket.onclose = () => {
|
|
6168
|
+
debug5("WebSocket disconnected. Attempting to reconnect...");
|
|
6169
|
+
this.isConnecting = false;
|
|
6170
|
+
this.stopHeartbeatCheck();
|
|
6171
|
+
this.notifyConnectionListeners(false, "Connection closed");
|
|
6172
|
+
setTimeout(() => this.connect(), this.reconnectDelay);
|
|
6173
|
+
};
|
|
6174
|
+
this.socket.onerror = (error) => {
|
|
6175
|
+
debug5("WebSocket error: %O", error);
|
|
6176
|
+
this.isConnecting = false;
|
|
6177
|
+
this.notifyErrorListeners(error);
|
|
6178
|
+
reject(error);
|
|
6179
|
+
};
|
|
6180
|
+
});
|
|
6035
6181
|
} catch (err) {
|
|
6036
6182
|
debug5("Failed to connect: %O", err);
|
|
6037
6183
|
this.isConnecting = false;
|
|
@@ -6274,11 +6420,10 @@ function isNewerVersion(version1, version2) {
|
|
|
6274
6420
|
// src/domains/validation/validation-core.service.ts
|
|
6275
6421
|
var ValidationCoreService = class {
|
|
6276
6422
|
constructor(client) {
|
|
6277
|
-
this.
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
);
|
|
6423
|
+
this.client = client;
|
|
6424
|
+
}
|
|
6425
|
+
get validationApi() {
|
|
6426
|
+
return this.client.apis.validation;
|
|
6282
6427
|
}
|
|
6283
6428
|
async listWorkflowValidations(filters) {
|
|
6284
6429
|
const response = await this.validationApi.v4DataValidationWorkflowsWorkflowIdJobsJobIdValidationsGet(
|
|
@@ -6380,6 +6525,7 @@ var ValidationCoreService = class {
|
|
|
6380
6525
|
return response.data;
|
|
6381
6526
|
}
|
|
6382
6527
|
async waitUntilCompleted(validationId, options) {
|
|
6528
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
6383
6529
|
const result = await pollUntil(
|
|
6384
6530
|
async () => {
|
|
6385
6531
|
const current = await this.getValidationDetails(validationId);
|
|
@@ -6399,11 +6545,10 @@ var ValidationCoreService = class {
|
|
|
6399
6545
|
};
|
|
6400
6546
|
var ValidationRulesService = class {
|
|
6401
6547
|
constructor(client) {
|
|
6402
|
-
this.
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
);
|
|
6548
|
+
this.client = client;
|
|
6549
|
+
}
|
|
6550
|
+
get validationApi() {
|
|
6551
|
+
return this.client.apis.validation;
|
|
6407
6552
|
}
|
|
6408
6553
|
async listRules(options) {
|
|
6409
6554
|
const response = await this.validationApi.v4DataValidationRulesGet(options);
|
|
@@ -6457,6 +6602,25 @@ var ValidationRulesService = class {
|
|
|
6457
6602
|
}
|
|
6458
6603
|
return response.data.data;
|
|
6459
6604
|
}
|
|
6605
|
+
async deleteRule(data) {
|
|
6606
|
+
const response = await this.validationApi.v4DataValidationRulesRuleIdDelete(
|
|
6607
|
+
{
|
|
6608
|
+
ruleId: data.ruleId,
|
|
6609
|
+
...data.workflowId != null && {
|
|
6610
|
+
deleteRuleWithReason: {
|
|
6611
|
+
workflowId: data.workflowId,
|
|
6612
|
+
...data.reason != null && { reason: data.reason }
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
);
|
|
6617
|
+
if (response.status !== 200 || response.data.error) {
|
|
6618
|
+
throw KadoaHttpException.wrap(response.data, {
|
|
6619
|
+
message: response.data.message || "Failed to delete validation rule"
|
|
6620
|
+
});
|
|
6621
|
+
}
|
|
6622
|
+
return response.data;
|
|
6623
|
+
}
|
|
6460
6624
|
async disableRule(data) {
|
|
6461
6625
|
const response = await this.validationApi.v4DataValidationRulesRuleIdDisablePost(data);
|
|
6462
6626
|
if (response.status !== 200 || response.data.error) {
|
|
@@ -6580,7 +6744,8 @@ var WorkflowsCoreService = class {
|
|
|
6580
6744
|
location: input.location,
|
|
6581
6745
|
autoStart: input.autoStart,
|
|
6582
6746
|
schedules: input.schedules,
|
|
6583
|
-
additionalData: input.additionalData
|
|
6747
|
+
additionalData: input.additionalData,
|
|
6748
|
+
limit: input.limit
|
|
6584
6749
|
};
|
|
6585
6750
|
const response2 = await this.workflowsApi.v4WorkflowsPost({
|
|
6586
6751
|
createWorkflowBody: agenticRequest
|
|
@@ -6602,7 +6767,7 @@ var WorkflowsCoreService = class {
|
|
|
6602
6767
|
schemaId: input.schemaId,
|
|
6603
6768
|
description: input.description,
|
|
6604
6769
|
navigationMode: input.navigationMode,
|
|
6605
|
-
entity: input.entity
|
|
6770
|
+
...input.entity != null && { entity: input.entity },
|
|
6606
6771
|
fields: input.fields,
|
|
6607
6772
|
bypassPreview: input.bypassPreview ?? true,
|
|
6608
6773
|
tags: input.tags,
|
|
@@ -6611,7 +6776,8 @@ var WorkflowsCoreService = class {
|
|
|
6611
6776
|
location: input.location,
|
|
6612
6777
|
autoStart: input.autoStart,
|
|
6613
6778
|
schedules: input.schedules,
|
|
6614
|
-
additionalData: input.additionalData
|
|
6779
|
+
additionalData: input.additionalData,
|
|
6780
|
+
limit: input.limit
|
|
6615
6781
|
};
|
|
6616
6782
|
const response = await this.workflowsApi.v4WorkflowsPost({
|
|
6617
6783
|
createWorkflowBody: request
|
|
@@ -6745,131 +6911,44 @@ var WorkflowsCoreService = class {
|
|
|
6745
6911
|
}
|
|
6746
6912
|
};
|
|
6747
6913
|
|
|
6748
|
-
// src/
|
|
6749
|
-
var
|
|
6750
|
-
constructor(
|
|
6751
|
-
this.
|
|
6752
|
-
this.
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
this.client.baseUrl,
|
|
6759
|
-
this.client.axiosInstance
|
|
6760
|
-
);
|
|
6761
|
-
}
|
|
6762
|
-
return this._api;
|
|
6763
|
-
}
|
|
6764
|
-
async createConfig(body) {
|
|
6765
|
-
const response = await this.api.v4CrawlConfigPost({
|
|
6766
|
-
createCrawlerConfigRequest: body
|
|
6767
|
-
});
|
|
6768
|
-
return response.data;
|
|
6769
|
-
}
|
|
6770
|
-
async getConfig(configId) {
|
|
6771
|
-
const response = await this.api.v4CrawlConfigConfigIdGet({ configId });
|
|
6772
|
-
return response.data;
|
|
6773
|
-
}
|
|
6774
|
-
async deleteConfig(configId) {
|
|
6775
|
-
const response = await this.api.v4CrawlConfigDelete({
|
|
6776
|
-
deleteCrawlerConfigRequest: { configId }
|
|
6914
|
+
// src/client/api-registry.ts
|
|
6915
|
+
var ApiRegistry = class {
|
|
6916
|
+
constructor(apiKey, baseUrl, axios2, headers) {
|
|
6917
|
+
this.baseUrl = baseUrl;
|
|
6918
|
+
this.axios = axios2;
|
|
6919
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
6920
|
+
this.configuration = new Configuration({
|
|
6921
|
+
apiKey,
|
|
6922
|
+
basePath: baseUrl,
|
|
6923
|
+
baseOptions: { headers }
|
|
6777
6924
|
});
|
|
6778
|
-
return response.data;
|
|
6779
|
-
}
|
|
6780
|
-
};
|
|
6781
|
-
|
|
6782
|
-
// src/domains/crawler/crawler-session.service.ts
|
|
6783
|
-
var CrawlerSessionService = class {
|
|
6784
|
-
constructor(client) {
|
|
6785
|
-
this.client = client;
|
|
6786
|
-
this._api = null;
|
|
6787
6925
|
}
|
|
6788
|
-
get
|
|
6789
|
-
if (!this.
|
|
6790
|
-
this.
|
|
6791
|
-
|
|
6792
|
-
this.
|
|
6793
|
-
this.client.axiosInstance
|
|
6926
|
+
get(ApiClass) {
|
|
6927
|
+
if (!this.cache.has(ApiClass)) {
|
|
6928
|
+
this.cache.set(
|
|
6929
|
+
ApiClass,
|
|
6930
|
+
new ApiClass(this.configuration, this.baseUrl, this.axios)
|
|
6794
6931
|
);
|
|
6795
6932
|
}
|
|
6796
|
-
return this.
|
|
6797
|
-
}
|
|
6798
|
-
async start(body) {
|
|
6799
|
-
const response = await this.api.v4CrawlPost({
|
|
6800
|
-
startCrawlerSessionRequest: body
|
|
6801
|
-
});
|
|
6802
|
-
return response.data;
|
|
6803
|
-
}
|
|
6804
|
-
async startWithConfig(body) {
|
|
6805
|
-
const response = await this.api.v4CrawlStartPost({
|
|
6806
|
-
startSessionWithConfigRequest: body
|
|
6807
|
-
});
|
|
6808
|
-
return response.data;
|
|
6809
|
-
}
|
|
6810
|
-
async pause(sessionId) {
|
|
6811
|
-
const response = await this.api.v4CrawlPausePost({
|
|
6812
|
-
pauseCrawlerSessionRequest: { sessionId }
|
|
6813
|
-
});
|
|
6814
|
-
return response.data;
|
|
6815
|
-
}
|
|
6816
|
-
async resume(sessionId) {
|
|
6817
|
-
const response = await this.api.v4CrawlResumePost({
|
|
6818
|
-
resumeCrawlerSessionRequest: { sessionId }
|
|
6819
|
-
});
|
|
6820
|
-
return response.data;
|
|
6821
|
-
}
|
|
6822
|
-
async listSessions(options) {
|
|
6823
|
-
const response = await this.api.v4CrawlSessionsGet({
|
|
6824
|
-
page: options?.page,
|
|
6825
|
-
pageSize: options?.pageSize,
|
|
6826
|
-
userId: options?.userId
|
|
6827
|
-
});
|
|
6828
|
-
return response.data.data ?? [];
|
|
6933
|
+
return this.cache.get(ApiClass);
|
|
6829
6934
|
}
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
return response.data;
|
|
6935
|
+
get schemas() {
|
|
6936
|
+
return this.get(SchemasApi);
|
|
6833
6937
|
}
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
sessionId,
|
|
6837
|
-
currentPage: options?.currentPage,
|
|
6838
|
-
pageSize: options?.pageSize
|
|
6839
|
-
});
|
|
6840
|
-
return response.data;
|
|
6938
|
+
get validation() {
|
|
6939
|
+
return this.get(DataValidationApi);
|
|
6841
6940
|
}
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
sessionId,
|
|
6845
|
-
pageId,
|
|
6846
|
-
format: options?.format
|
|
6847
|
-
});
|
|
6848
|
-
return response.data;
|
|
6941
|
+
get crawler() {
|
|
6942
|
+
return this.get(CrawlerApi);
|
|
6849
6943
|
}
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
sessionId,
|
|
6853
|
-
includeAll: options?.includeAll
|
|
6854
|
-
});
|
|
6855
|
-
return response.data;
|
|
6944
|
+
get workflows() {
|
|
6945
|
+
return this.get(WorkflowsApi);
|
|
6856
6946
|
}
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
filenameb64
|
|
6860
|
-
});
|
|
6861
|
-
return response.data;
|
|
6947
|
+
get notifications() {
|
|
6948
|
+
return this.get(NotificationsApi);
|
|
6862
6949
|
}
|
|
6863
6950
|
};
|
|
6864
6951
|
|
|
6865
|
-
// src/domains/crawler/crawler.facade.ts
|
|
6866
|
-
function createCrawlerDomain(client) {
|
|
6867
|
-
return {
|
|
6868
|
-
config: new CrawlerConfigService(client),
|
|
6869
|
-
session: new CrawlerSessionService(client)
|
|
6870
|
-
};
|
|
6871
|
-
}
|
|
6872
|
-
|
|
6873
6952
|
// src/domains/validation/validation.facade.ts
|
|
6874
6953
|
function createValidationDomain(core, rules) {
|
|
6875
6954
|
return {
|
|
@@ -6885,121 +6964,154 @@ function createValidationDomain(core, rules) {
|
|
|
6885
6964
|
};
|
|
6886
6965
|
}
|
|
6887
6966
|
|
|
6888
|
-
// src/
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
return config2;
|
|
6913
|
-
});
|
|
6914
|
-
this._axiosInstance.interceptors.response.use(
|
|
6915
|
-
(response) => {
|
|
6916
|
-
if (response.status === 401) {
|
|
6917
|
-
throw new KadoaHttpException("Unauthorized", {
|
|
6918
|
-
code: KadoaErrorCode.AUTH_ERROR,
|
|
6919
|
-
httpStatus: 401
|
|
6920
|
-
});
|
|
6967
|
+
// src/client/wiring.ts
|
|
6968
|
+
function createSdkHeaders() {
|
|
6969
|
+
return {
|
|
6970
|
+
"User-Agent": `${SDK_NAME}/${SDK_VERSION}`,
|
|
6971
|
+
"X-SDK-Version": SDK_VERSION,
|
|
6972
|
+
"X-SDK-Language": SDK_LANGUAGE
|
|
6973
|
+
};
|
|
6974
|
+
}
|
|
6975
|
+
function createAxiosInstance(params) {
|
|
6976
|
+
const axiosInstance = globalAxios3.create({
|
|
6977
|
+
timeout: params.timeout,
|
|
6978
|
+
headers: params.headers
|
|
6979
|
+
});
|
|
6980
|
+
axiosInstance.interceptors.request.use((config) => {
|
|
6981
|
+
config.headers["x-request-id"] = v4();
|
|
6982
|
+
return config;
|
|
6983
|
+
});
|
|
6984
|
+
axiosInstance.interceptors.response.use(
|
|
6985
|
+
(response) => response,
|
|
6986
|
+
(error) => {
|
|
6987
|
+
if (error instanceof AxiosError) {
|
|
6988
|
+
const status = error.response?.status;
|
|
6989
|
+
if (status === 401 || status === 403) {
|
|
6990
|
+
throw KadoaHttpException.wrap(error, { message: "Unauthorized" });
|
|
6921
6991
|
}
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6992
|
+
}
|
|
6993
|
+
throw KadoaHttpException.wrap(error);
|
|
6994
|
+
}
|
|
6995
|
+
);
|
|
6996
|
+
return axiosInstance;
|
|
6997
|
+
}
|
|
6998
|
+
function createClientDomains(params) {
|
|
6999
|
+
const { client } = params;
|
|
7000
|
+
const userService = new UserService(client);
|
|
7001
|
+
const dataFetcherService = new DataFetcherService(client.apis.workflows);
|
|
7002
|
+
const channelsService = new NotificationChannelsService(
|
|
7003
|
+
client.apis.notifications,
|
|
7004
|
+
userService
|
|
7005
|
+
);
|
|
7006
|
+
const settingsService = new NotificationSettingsService(
|
|
7007
|
+
client.apis.notifications
|
|
7008
|
+
);
|
|
7009
|
+
const entityResolverService = new EntityResolverService(client);
|
|
7010
|
+
const workflowsCoreService = new WorkflowsCoreService(client.apis.workflows);
|
|
7011
|
+
const schemasService = new SchemasService(client);
|
|
7012
|
+
const channelSetupService = new NotificationSetupService(
|
|
7013
|
+
channelsService,
|
|
7014
|
+
settingsService
|
|
7015
|
+
);
|
|
7016
|
+
const coreService = new ValidationCoreService(client);
|
|
7017
|
+
const rulesService = new ValidationRulesService(client);
|
|
7018
|
+
const extractionService = new ExtractionService(
|
|
7019
|
+
workflowsCoreService,
|
|
7020
|
+
dataFetcherService,
|
|
7021
|
+
entityResolverService,
|
|
7022
|
+
channelSetupService,
|
|
7023
|
+
channelsService,
|
|
7024
|
+
settingsService
|
|
7025
|
+
);
|
|
7026
|
+
const extractionBuilderService = new ExtractionBuilderService(
|
|
7027
|
+
workflowsCoreService,
|
|
7028
|
+
entityResolverService,
|
|
7029
|
+
dataFetcherService,
|
|
7030
|
+
channelSetupService
|
|
7031
|
+
);
|
|
7032
|
+
const notification = createNotificationDomain({
|
|
7033
|
+
notificationsApi: client.apis.notifications,
|
|
7034
|
+
channelsService,
|
|
7035
|
+
settingsService,
|
|
7036
|
+
channelSetupService
|
|
7037
|
+
});
|
|
7038
|
+
const validation = createValidationDomain(coreService, rulesService);
|
|
7039
|
+
const crawler = createCrawlerDomain(client);
|
|
7040
|
+
return {
|
|
7041
|
+
extractionBuilderService,
|
|
7042
|
+
extraction: extractionService,
|
|
7043
|
+
workflow: workflowsCoreService,
|
|
7044
|
+
notification,
|
|
7045
|
+
schema: schemasService,
|
|
7046
|
+
user: userService,
|
|
7047
|
+
validation,
|
|
7048
|
+
crawler
|
|
7049
|
+
};
|
|
7050
|
+
}
|
|
7051
|
+
function createNotificationDomain(params) {
|
|
7052
|
+
const {
|
|
7053
|
+
notificationsApi,
|
|
7054
|
+
channelsService,
|
|
7055
|
+
settingsService,
|
|
7056
|
+
channelSetupService
|
|
7057
|
+
} = params;
|
|
7058
|
+
return {
|
|
7059
|
+
channels: channelsService,
|
|
7060
|
+
settings: settingsService,
|
|
7061
|
+
setup: channelSetupService,
|
|
7062
|
+
configure: (options) => channelSetupService.setup(options),
|
|
7063
|
+
setupForWorkflow: (request) => channelSetupService.setupForWorkflow(request),
|
|
7064
|
+
setupForWorkspace: (request) => channelSetupService.setupForWorkspace(request),
|
|
7065
|
+
testNotification: async (request) => {
|
|
7066
|
+
const response = await notificationsApi.v5NotificationsTestPost({
|
|
7067
|
+
v5NotificationsTestPostRequest: {
|
|
7068
|
+
eventType: request.eventType,
|
|
7069
|
+
...request.workflowId != null && {
|
|
7070
|
+
workflowId: request.workflowId
|
|
6929
7071
|
}
|
|
6930
7072
|
}
|
|
6931
|
-
|
|
7073
|
+
});
|
|
7074
|
+
const data = response.data.data;
|
|
7075
|
+
if (!data?.eventId || !data?.eventType) {
|
|
7076
|
+
throw KadoaHttpException.wrap(response, {
|
|
7077
|
+
message: "Failed to test notification"
|
|
7078
|
+
});
|
|
6932
7079
|
}
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
);
|
|
6939
|
-
const notificationsApi = new NotificationsApi(
|
|
6940
|
-
this.configuration,
|
|
6941
|
-
this.baseUrl,
|
|
6942
|
-
this.axiosInstance
|
|
6943
|
-
);
|
|
6944
|
-
const userService = new UserService(this);
|
|
6945
|
-
const dataFetcherService = new DataFetcherService(workflowsApi);
|
|
6946
|
-
const channelsService = new NotificationChannelsService(
|
|
6947
|
-
notificationsApi,
|
|
6948
|
-
userService
|
|
6949
|
-
);
|
|
6950
|
-
const settingsService = new NotificationSettingsService(notificationsApi);
|
|
6951
|
-
const entityResolverService = new EntityResolverService(this);
|
|
6952
|
-
const workflowsCoreService = new WorkflowsCoreService(workflowsApi);
|
|
6953
|
-
const schemasService = new SchemasService(this);
|
|
6954
|
-
const channelSetupService = new NotificationSetupService(
|
|
6955
|
-
channelsService,
|
|
6956
|
-
settingsService
|
|
6957
|
-
);
|
|
6958
|
-
const coreService = new ValidationCoreService(this);
|
|
6959
|
-
const rulesService = new ValidationRulesService(this);
|
|
6960
|
-
const extractionService = new ExtractionService(
|
|
6961
|
-
workflowsCoreService,
|
|
6962
|
-
dataFetcherService,
|
|
6963
|
-
entityResolverService,
|
|
6964
|
-
channelSetupService,
|
|
6965
|
-
channelsService,
|
|
6966
|
-
settingsService
|
|
6967
|
-
);
|
|
6968
|
-
this._extractionBuilderService = new ExtractionBuilderService(
|
|
6969
|
-
workflowsCoreService,
|
|
6970
|
-
entityResolverService,
|
|
6971
|
-
dataFetcherService,
|
|
6972
|
-
channelSetupService
|
|
6973
|
-
);
|
|
6974
|
-
this.user = userService;
|
|
6975
|
-
this.extraction = extractionService;
|
|
6976
|
-
this.workflow = workflowsCoreService;
|
|
6977
|
-
this.schema = schemasService;
|
|
6978
|
-
this.notification = {
|
|
6979
|
-
channels: channelsService,
|
|
6980
|
-
settings: settingsService,
|
|
6981
|
-
setup: channelSetupService,
|
|
6982
|
-
configure: (options) => channelSetupService.setup(options),
|
|
6983
|
-
setupForWorkflow: (request) => channelSetupService.setupForWorkflow(request),
|
|
6984
|
-
setupForWorkspace: (request) => channelSetupService.setupForWorkspace(request)
|
|
6985
|
-
};
|
|
6986
|
-
this.validation = createValidationDomain(coreService, rulesService);
|
|
6987
|
-
this.crawler = createCrawlerDomain(this);
|
|
6988
|
-
this._realtimeConfig = config.realtimeConfig;
|
|
6989
|
-
if (config.enableRealtime && config.realtimeConfig?.autoConnect !== false) {
|
|
6990
|
-
this.connectRealtime();
|
|
7080
|
+
return {
|
|
7081
|
+
eventId: data.eventId,
|
|
7082
|
+
eventType: data.eventType,
|
|
7083
|
+
...data.workflowId != null && { workflowId: data.workflowId }
|
|
7084
|
+
};
|
|
6991
7085
|
}
|
|
7086
|
+
};
|
|
7087
|
+
}
|
|
7088
|
+
|
|
7089
|
+
// src/client/kadoa-client.ts
|
|
7090
|
+
var KadoaClient = class {
|
|
7091
|
+
constructor(config) {
|
|
7092
|
+
this._baseUrl = config.baseUrl ?? PUBLIC_API_URI;
|
|
7093
|
+
this._apiKey = config.apiKey;
|
|
7094
|
+
const timeout = config.timeout ?? 3e4;
|
|
7095
|
+
const headers = createSdkHeaders();
|
|
7096
|
+
this._axiosInstance = createAxiosInstance({ timeout, headers });
|
|
7097
|
+
this.apis = new ApiRegistry(
|
|
7098
|
+
this._apiKey,
|
|
7099
|
+
this._baseUrl,
|
|
7100
|
+
this._axiosInstance,
|
|
7101
|
+
headers
|
|
7102
|
+
);
|
|
7103
|
+
const domains = createClientDomains({ client: this });
|
|
7104
|
+
this.user = domains.user;
|
|
7105
|
+
this.extraction = domains.extraction;
|
|
7106
|
+
this.workflow = domains.workflow;
|
|
7107
|
+
this.schema = domains.schema;
|
|
7108
|
+
this.notification = domains.notification;
|
|
7109
|
+
this.validation = domains.validation;
|
|
7110
|
+
this.crawler = domains.crawler;
|
|
7111
|
+
this._extractionBuilderService = domains.extractionBuilderService;
|
|
6992
7112
|
checkForUpdates().catch(() => {
|
|
6993
7113
|
});
|
|
6994
7114
|
}
|
|
6995
|
-
/**
|
|
6996
|
-
* Get the underlying configuration
|
|
6997
|
-
*
|
|
6998
|
-
* @returns The configuration object
|
|
6999
|
-
*/
|
|
7000
|
-
get configuration() {
|
|
7001
|
-
return this._configuration;
|
|
7002
|
-
}
|
|
7003
7115
|
/**
|
|
7004
7116
|
* Get the axios instance
|
|
7005
7117
|
*
|
|
@@ -7024,14 +7136,6 @@ var KadoaClient = class {
|
|
|
7024
7136
|
get apiKey() {
|
|
7025
7137
|
return this._apiKey;
|
|
7026
7138
|
}
|
|
7027
|
-
/**
|
|
7028
|
-
* Get the timeout value
|
|
7029
|
-
*
|
|
7030
|
-
* @returns The timeout in milliseconds
|
|
7031
|
-
*/
|
|
7032
|
-
get timeout() {
|
|
7033
|
-
return this._timeout;
|
|
7034
|
-
}
|
|
7035
7139
|
/**
|
|
7036
7140
|
* Get the realtime connection (if enabled)
|
|
7037
7141
|
*/
|
|
@@ -7043,35 +7147,6 @@ var KadoaClient = class {
|
|
|
7043
7147
|
*
|
|
7044
7148
|
* @param options - Extraction options including URLs and optional extraction builder
|
|
7045
7149
|
* @returns PreparedExtraction that can be configured with notifications, monitoring, etc.
|
|
7046
|
-
*
|
|
7047
|
-
* @example Auto-detection
|
|
7048
|
-
* ```typescript
|
|
7049
|
-
* const extraction = await client.extract({
|
|
7050
|
-
* urls: ["https://example.com"],
|
|
7051
|
-
* name: "My Extraction"
|
|
7052
|
-
* }).create();
|
|
7053
|
-
* ```
|
|
7054
|
-
*
|
|
7055
|
-
* @example Raw extraction
|
|
7056
|
-
* ```typescript
|
|
7057
|
-
* const extraction = await client.extract({
|
|
7058
|
-
* urls: ["https://example.com"],
|
|
7059
|
-
* name: "My Extraction",
|
|
7060
|
-
* extraction: builder => builder.raw("markdown")
|
|
7061
|
-
* }).create();
|
|
7062
|
-
* ```
|
|
7063
|
-
*
|
|
7064
|
-
* @example Custom schema
|
|
7065
|
-
* ```typescript
|
|
7066
|
-
* const extraction = await client.extract({
|
|
7067
|
-
* urls: ["https://example.com"],
|
|
7068
|
-
* name: "My Extraction",
|
|
7069
|
-
* extraction: builder => builder
|
|
7070
|
-
* .schema("Product")
|
|
7071
|
-
* .field("title", "Product name", "STRING", { example: "Example" })
|
|
7072
|
-
* .field("price", "Product price", "CURRENCY")
|
|
7073
|
-
* }).create();
|
|
7074
|
-
* ```
|
|
7075
7150
|
*/
|
|
7076
7151
|
extract(options) {
|
|
7077
7152
|
return this._extractionBuilderService.extract(options);
|
|
@@ -7080,23 +7155,13 @@ var KadoaClient = class {
|
|
|
7080
7155
|
* Connect to realtime WebSocket server
|
|
7081
7156
|
* Creates a new connection if not already connected
|
|
7082
7157
|
*
|
|
7158
|
+
* @param options - Optional realtime tuning options (heartbeat/reconnect settings)
|
|
7083
7159
|
* @returns The Realtime instance
|
|
7084
7160
|
*/
|
|
7085
|
-
connectRealtime() {
|
|
7161
|
+
async connectRealtime(options) {
|
|
7086
7162
|
if (!this._realtime) {
|
|
7087
|
-
this._realtime = new Realtime({
|
|
7088
|
-
|
|
7089
|
-
...this._realtimeConfig?.reconnectDelay != null && {
|
|
7090
|
-
reconnectDelay: this._realtimeConfig.reconnectDelay
|
|
7091
|
-
},
|
|
7092
|
-
...this._realtimeConfig?.heartbeatInterval != null && {
|
|
7093
|
-
heartbeatInterval: this._realtimeConfig.heartbeatInterval
|
|
7094
|
-
},
|
|
7095
|
-
...this._realtimeConfig?.source && {
|
|
7096
|
-
source: this._realtimeConfig.source
|
|
7097
|
-
}
|
|
7098
|
-
});
|
|
7099
|
-
this._realtime.connect();
|
|
7163
|
+
this._realtime = new Realtime({ apiKey: this._apiKey, ...options });
|
|
7164
|
+
await this._realtime.connect();
|
|
7100
7165
|
}
|
|
7101
7166
|
return this._realtime;
|
|
7102
7167
|
}
|
|
@@ -7135,8 +7200,14 @@ var KadoaClient = class {
|
|
|
7135
7200
|
dispose() {
|
|
7136
7201
|
this.disconnectRealtime();
|
|
7137
7202
|
}
|
|
7203
|
+
/**
|
|
7204
|
+
* Alias for {@link dispose}. Included for common Node.js client ergonomics.
|
|
7205
|
+
*/
|
|
7206
|
+
close() {
|
|
7207
|
+
this.dispose();
|
|
7208
|
+
}
|
|
7138
7209
|
};
|
|
7139
7210
|
|
|
7140
|
-
export { DataFetcherService, ERROR_MESSAGES, EntityResolverService, ExtractionBuilderService, ExtractionService, FetchDataOptions, KadoaClient, KadoaHttpException, KadoaSdkException, NotificationChannelType, NotificationChannelsService, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, NotificationSetupService, Realtime, SchemaBuilder, SchemaFieldDataType, SchemasService, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, UserService, ValidationCoreService, ValidationRulesService, WorkflowsCoreService, pollUntil, validateAdditionalData };
|
|
7211
|
+
export { CrawlerConfigService, CrawlerSessionService, DataFetcherService, ERROR_MESSAGES, EntityResolverService, ExtractionBuilderService, ExtractionService, FetchDataOptions, KadoaClient, KadoaHttpException, KadoaSdkException, NotificationChannelType, NotificationChannelsService, V5NotificationsSettingsGetEventTypeEnum as NotificationSettingsEventTypeEnum, NotificationSettingsService, NotificationSetupService, PageStatus, Realtime, SchemaBuilder, SchemaFieldDataType, SchemasService, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, UserService, ValidationCoreService, ValidationRulesService, WorkflowsCoreService, createCrawlerDomain, pollUntil, validateAdditionalData };
|
|
7141
7212
|
//# sourceMappingURL=index.mjs.map
|
|
7142
7213
|
//# sourceMappingURL=index.mjs.map
|