@kadoa/node-sdk 0.19.4-beta.4 → 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 -363
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -364
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
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,11 +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";
|
|
5947
|
-
|
|
6090
|
+
process.env.KADOA_WSS_NEO_API_URI ?? "wss://events.kadoa.com/events/ws";
|
|
5948
6091
|
var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
|
|
5949
6092
|
|
|
5950
6093
|
// src/version.ts
|
|
5951
|
-
var SDK_VERSION = "0.
|
|
6094
|
+
var SDK_VERSION = "0.20.2";
|
|
5952
6095
|
var SDK_NAME = "kadoa-node-sdk";
|
|
5953
6096
|
var SDK_LANGUAGE = "node";
|
|
5954
6097
|
|
|
@@ -5968,7 +6111,6 @@ var Realtime = class {
|
|
|
5968
6111
|
this.heartbeatInterval = config.heartbeatInterval || 1e4;
|
|
5969
6112
|
this.reconnectDelay = config.reconnectDelay || 5e3;
|
|
5970
6113
|
this.missedHeartbeatsLimit = config.missedHeartbeatsLimit || 3e4;
|
|
5971
|
-
this.source = config.source;
|
|
5972
6114
|
}
|
|
5973
6115
|
async connect() {
|
|
5974
6116
|
if (this.isConnecting) return;
|
|
@@ -5983,56 +6125,59 @@ var Realtime = class {
|
|
|
5983
6125
|
}
|
|
5984
6126
|
});
|
|
5985
6127
|
const { access_token, team_id } = await response.json();
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
this.
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
this.socket.
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
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);
|
|
6017
6162
|
}
|
|
6018
|
-
|
|
6163
|
+
} catch (err) {
|
|
6164
|
+
debug5("Failed to parse incoming message: %O", err);
|
|
6019
6165
|
}
|
|
6020
|
-
}
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
this.
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
};
|
|
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
|
+
});
|
|
6036
6181
|
} catch (err) {
|
|
6037
6182
|
debug5("Failed to connect: %O", err);
|
|
6038
6183
|
this.isConnecting = false;
|
|
@@ -6275,11 +6420,10 @@ function isNewerVersion(version1, version2) {
|
|
|
6275
6420
|
// src/domains/validation/validation-core.service.ts
|
|
6276
6421
|
var ValidationCoreService = class {
|
|
6277
6422
|
constructor(client) {
|
|
6278
|
-
this.
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
);
|
|
6423
|
+
this.client = client;
|
|
6424
|
+
}
|
|
6425
|
+
get validationApi() {
|
|
6426
|
+
return this.client.apis.validation;
|
|
6283
6427
|
}
|
|
6284
6428
|
async listWorkflowValidations(filters) {
|
|
6285
6429
|
const response = await this.validationApi.v4DataValidationWorkflowsWorkflowIdJobsJobIdValidationsGet(
|
|
@@ -6381,6 +6525,7 @@ var ValidationCoreService = class {
|
|
|
6381
6525
|
return response.data;
|
|
6382
6526
|
}
|
|
6383
6527
|
async waitUntilCompleted(validationId, options) {
|
|
6528
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
6384
6529
|
const result = await pollUntil(
|
|
6385
6530
|
async () => {
|
|
6386
6531
|
const current = await this.getValidationDetails(validationId);
|
|
@@ -6400,11 +6545,10 @@ var ValidationCoreService = class {
|
|
|
6400
6545
|
};
|
|
6401
6546
|
var ValidationRulesService = class {
|
|
6402
6547
|
constructor(client) {
|
|
6403
|
-
this.
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
);
|
|
6548
|
+
this.client = client;
|
|
6549
|
+
}
|
|
6550
|
+
get validationApi() {
|
|
6551
|
+
return this.client.apis.validation;
|
|
6408
6552
|
}
|
|
6409
6553
|
async listRules(options) {
|
|
6410
6554
|
const response = await this.validationApi.v4DataValidationRulesGet(options);
|
|
@@ -6458,6 +6602,25 @@ var ValidationRulesService = class {
|
|
|
6458
6602
|
}
|
|
6459
6603
|
return response.data.data;
|
|
6460
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
|
+
}
|
|
6461
6624
|
async disableRule(data) {
|
|
6462
6625
|
const response = await this.validationApi.v4DataValidationRulesRuleIdDisablePost(data);
|
|
6463
6626
|
if (response.status !== 200 || response.data.error) {
|
|
@@ -6581,7 +6744,8 @@ var WorkflowsCoreService = class {
|
|
|
6581
6744
|
location: input.location,
|
|
6582
6745
|
autoStart: input.autoStart,
|
|
6583
6746
|
schedules: input.schedules,
|
|
6584
|
-
additionalData: input.additionalData
|
|
6747
|
+
additionalData: input.additionalData,
|
|
6748
|
+
limit: input.limit
|
|
6585
6749
|
};
|
|
6586
6750
|
const response2 = await this.workflowsApi.v4WorkflowsPost({
|
|
6587
6751
|
createWorkflowBody: agenticRequest
|
|
@@ -6603,7 +6767,7 @@ var WorkflowsCoreService = class {
|
|
|
6603
6767
|
schemaId: input.schemaId,
|
|
6604
6768
|
description: input.description,
|
|
6605
6769
|
navigationMode: input.navigationMode,
|
|
6606
|
-
entity: input.entity
|
|
6770
|
+
...input.entity != null && { entity: input.entity },
|
|
6607
6771
|
fields: input.fields,
|
|
6608
6772
|
bypassPreview: input.bypassPreview ?? true,
|
|
6609
6773
|
tags: input.tags,
|
|
@@ -6612,7 +6776,8 @@ var WorkflowsCoreService = class {
|
|
|
6612
6776
|
location: input.location,
|
|
6613
6777
|
autoStart: input.autoStart,
|
|
6614
6778
|
schedules: input.schedules,
|
|
6615
|
-
additionalData: input.additionalData
|
|
6779
|
+
additionalData: input.additionalData,
|
|
6780
|
+
limit: input.limit
|
|
6616
6781
|
};
|
|
6617
6782
|
const response = await this.workflowsApi.v4WorkflowsPost({
|
|
6618
6783
|
createWorkflowBody: request
|
|
@@ -6746,131 +6911,44 @@ var WorkflowsCoreService = class {
|
|
|
6746
6911
|
}
|
|
6747
6912
|
};
|
|
6748
6913
|
|
|
6749
|
-
// src/
|
|
6750
|
-
var
|
|
6751
|
-
constructor(
|
|
6752
|
-
this.
|
|
6753
|
-
this.
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
this.client.baseUrl,
|
|
6760
|
-
this.client.axiosInstance
|
|
6761
|
-
);
|
|
6762
|
-
}
|
|
6763
|
-
return this._api;
|
|
6764
|
-
}
|
|
6765
|
-
async createConfig(body) {
|
|
6766
|
-
const response = await this.api.v4CrawlConfigPost({
|
|
6767
|
-
createCrawlerConfigRequest: body
|
|
6768
|
-
});
|
|
6769
|
-
return response.data;
|
|
6770
|
-
}
|
|
6771
|
-
async getConfig(configId) {
|
|
6772
|
-
const response = await this.api.v4CrawlConfigConfigIdGet({ configId });
|
|
6773
|
-
return response.data;
|
|
6774
|
-
}
|
|
6775
|
-
async deleteConfig(configId) {
|
|
6776
|
-
const response = await this.api.v4CrawlConfigDelete({
|
|
6777
|
-
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 }
|
|
6778
6924
|
});
|
|
6779
|
-
return response.data;
|
|
6780
6925
|
}
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
this.client = client;
|
|
6787
|
-
this._api = null;
|
|
6788
|
-
}
|
|
6789
|
-
get api() {
|
|
6790
|
-
if (!this._api) {
|
|
6791
|
-
this._api = new CrawlerApi(
|
|
6792
|
-
this.client.configuration,
|
|
6793
|
-
this.client.baseUrl,
|
|
6794
|
-
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)
|
|
6795
6931
|
);
|
|
6796
6932
|
}
|
|
6797
|
-
return this.
|
|
6798
|
-
}
|
|
6799
|
-
async start(body) {
|
|
6800
|
-
const response = await this.api.v4CrawlPost({
|
|
6801
|
-
startCrawlerSessionRequest: body
|
|
6802
|
-
});
|
|
6803
|
-
return response.data;
|
|
6804
|
-
}
|
|
6805
|
-
async startWithConfig(body) {
|
|
6806
|
-
const response = await this.api.v4CrawlStartPost({
|
|
6807
|
-
startSessionWithConfigRequest: body
|
|
6808
|
-
});
|
|
6809
|
-
return response.data;
|
|
6933
|
+
return this.cache.get(ApiClass);
|
|
6810
6934
|
}
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
pauseCrawlerSessionRequest: { sessionId }
|
|
6814
|
-
});
|
|
6815
|
-
return response.data;
|
|
6935
|
+
get schemas() {
|
|
6936
|
+
return this.get(SchemasApi);
|
|
6816
6937
|
}
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
resumeCrawlerSessionRequest: { sessionId }
|
|
6820
|
-
});
|
|
6821
|
-
return response.data;
|
|
6822
|
-
}
|
|
6823
|
-
async listSessions(options) {
|
|
6824
|
-
const response = await this.api.v4CrawlSessionsGet({
|
|
6825
|
-
page: options?.page,
|
|
6826
|
-
pageSize: options?.pageSize,
|
|
6827
|
-
userId: options?.userId
|
|
6828
|
-
});
|
|
6829
|
-
return response.data.data ?? [];
|
|
6938
|
+
get validation() {
|
|
6939
|
+
return this.get(DataValidationApi);
|
|
6830
6940
|
}
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
return response.data;
|
|
6941
|
+
get crawler() {
|
|
6942
|
+
return this.get(CrawlerApi);
|
|
6834
6943
|
}
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
sessionId,
|
|
6838
|
-
currentPage: options?.currentPage,
|
|
6839
|
-
pageSize: options?.pageSize
|
|
6840
|
-
});
|
|
6841
|
-
return response.data;
|
|
6944
|
+
get workflows() {
|
|
6945
|
+
return this.get(WorkflowsApi);
|
|
6842
6946
|
}
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
sessionId,
|
|
6846
|
-
pageId,
|
|
6847
|
-
format: options?.format
|
|
6848
|
-
});
|
|
6849
|
-
return response.data;
|
|
6850
|
-
}
|
|
6851
|
-
async getAllSessionData(sessionId, options) {
|
|
6852
|
-
const response = await this.api.v4CrawlSessionIdListGet({
|
|
6853
|
-
sessionId,
|
|
6854
|
-
includeAll: options?.includeAll
|
|
6855
|
-
});
|
|
6856
|
-
return response.data;
|
|
6857
|
-
}
|
|
6858
|
-
async getBucketFile(filenameb64) {
|
|
6859
|
-
const response = await this.api.v4CrawlBucketDataFilenameb64Get({
|
|
6860
|
-
filenameb64
|
|
6861
|
-
});
|
|
6862
|
-
return response.data;
|
|
6947
|
+
get notifications() {
|
|
6948
|
+
return this.get(NotificationsApi);
|
|
6863
6949
|
}
|
|
6864
6950
|
};
|
|
6865
6951
|
|
|
6866
|
-
// src/domains/crawler/crawler.facade.ts
|
|
6867
|
-
function createCrawlerDomain(client) {
|
|
6868
|
-
return {
|
|
6869
|
-
config: new CrawlerConfigService(client),
|
|
6870
|
-
session: new CrawlerSessionService(client)
|
|
6871
|
-
};
|
|
6872
|
-
}
|
|
6873
|
-
|
|
6874
6952
|
// src/domains/validation/validation.facade.ts
|
|
6875
6953
|
function createValidationDomain(core, rules) {
|
|
6876
6954
|
return {
|
|
@@ -6886,121 +6964,154 @@ function createValidationDomain(core, rules) {
|
|
|
6886
6964
|
};
|
|
6887
6965
|
}
|
|
6888
6966
|
|
|
6889
|
-
// src/
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
return config2;
|
|
6914
|
-
});
|
|
6915
|
-
this._axiosInstance.interceptors.response.use(
|
|
6916
|
-
(response) => {
|
|
6917
|
-
if (response.status === 401) {
|
|
6918
|
-
throw new KadoaHttpException("Unauthorized", {
|
|
6919
|
-
code: KadoaErrorCode.AUTH_ERROR,
|
|
6920
|
-
httpStatus: 401
|
|
6921
|
-
});
|
|
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" });
|
|
6922
6991
|
}
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
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
|
|
6930
7071
|
}
|
|
6931
7072
|
}
|
|
6932
|
-
|
|
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
|
+
});
|
|
6933
7079
|
}
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
);
|
|
6940
|
-
const notificationsApi = new NotificationsApi(
|
|
6941
|
-
this.configuration,
|
|
6942
|
-
this.baseUrl,
|
|
6943
|
-
this.axiosInstance
|
|
6944
|
-
);
|
|
6945
|
-
const userService = new UserService(this);
|
|
6946
|
-
const dataFetcherService = new DataFetcherService(workflowsApi);
|
|
6947
|
-
const channelsService = new NotificationChannelsService(
|
|
6948
|
-
notificationsApi,
|
|
6949
|
-
userService
|
|
6950
|
-
);
|
|
6951
|
-
const settingsService = new NotificationSettingsService(notificationsApi);
|
|
6952
|
-
const entityResolverService = new EntityResolverService(this);
|
|
6953
|
-
const workflowsCoreService = new WorkflowsCoreService(workflowsApi);
|
|
6954
|
-
const schemasService = new SchemasService(this);
|
|
6955
|
-
const channelSetupService = new NotificationSetupService(
|
|
6956
|
-
channelsService,
|
|
6957
|
-
settingsService
|
|
6958
|
-
);
|
|
6959
|
-
const coreService = new ValidationCoreService(this);
|
|
6960
|
-
const rulesService = new ValidationRulesService(this);
|
|
6961
|
-
const extractionService = new ExtractionService(
|
|
6962
|
-
workflowsCoreService,
|
|
6963
|
-
dataFetcherService,
|
|
6964
|
-
entityResolverService,
|
|
6965
|
-
channelSetupService,
|
|
6966
|
-
channelsService,
|
|
6967
|
-
settingsService
|
|
6968
|
-
);
|
|
6969
|
-
this._extractionBuilderService = new ExtractionBuilderService(
|
|
6970
|
-
workflowsCoreService,
|
|
6971
|
-
entityResolverService,
|
|
6972
|
-
dataFetcherService,
|
|
6973
|
-
channelSetupService
|
|
6974
|
-
);
|
|
6975
|
-
this.user = userService;
|
|
6976
|
-
this.extraction = extractionService;
|
|
6977
|
-
this.workflow = workflowsCoreService;
|
|
6978
|
-
this.schema = schemasService;
|
|
6979
|
-
this.notification = {
|
|
6980
|
-
channels: channelsService,
|
|
6981
|
-
settings: settingsService,
|
|
6982
|
-
setup: channelSetupService,
|
|
6983
|
-
configure: (options) => channelSetupService.setup(options),
|
|
6984
|
-
setupForWorkflow: (request) => channelSetupService.setupForWorkflow(request),
|
|
6985
|
-
setupForWorkspace: (request) => channelSetupService.setupForWorkspace(request)
|
|
6986
|
-
};
|
|
6987
|
-
this.validation = createValidationDomain(coreService, rulesService);
|
|
6988
|
-
this.crawler = createCrawlerDomain(this);
|
|
6989
|
-
this._realtimeConfig = config.realtimeConfig;
|
|
6990
|
-
if (config.enableRealtime && config.realtimeConfig?.autoConnect !== false) {
|
|
6991
|
-
this.connectRealtime();
|
|
7080
|
+
return {
|
|
7081
|
+
eventId: data.eventId,
|
|
7082
|
+
eventType: data.eventType,
|
|
7083
|
+
...data.workflowId != null && { workflowId: data.workflowId }
|
|
7084
|
+
};
|
|
6992
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;
|
|
6993
7112
|
checkForUpdates().catch(() => {
|
|
6994
7113
|
});
|
|
6995
7114
|
}
|
|
6996
|
-
/**
|
|
6997
|
-
* Get the underlying configuration
|
|
6998
|
-
*
|
|
6999
|
-
* @returns The configuration object
|
|
7000
|
-
*/
|
|
7001
|
-
get configuration() {
|
|
7002
|
-
return this._configuration;
|
|
7003
|
-
}
|
|
7004
7115
|
/**
|
|
7005
7116
|
* Get the axios instance
|
|
7006
7117
|
*
|
|
@@ -7025,14 +7136,6 @@ var KadoaClient = class {
|
|
|
7025
7136
|
get apiKey() {
|
|
7026
7137
|
return this._apiKey;
|
|
7027
7138
|
}
|
|
7028
|
-
/**
|
|
7029
|
-
* Get the timeout value
|
|
7030
|
-
*
|
|
7031
|
-
* @returns The timeout in milliseconds
|
|
7032
|
-
*/
|
|
7033
|
-
get timeout() {
|
|
7034
|
-
return this._timeout;
|
|
7035
|
-
}
|
|
7036
7139
|
/**
|
|
7037
7140
|
* Get the realtime connection (if enabled)
|
|
7038
7141
|
*/
|
|
@@ -7044,35 +7147,6 @@ var KadoaClient = class {
|
|
|
7044
7147
|
*
|
|
7045
7148
|
* @param options - Extraction options including URLs and optional extraction builder
|
|
7046
7149
|
* @returns PreparedExtraction that can be configured with notifications, monitoring, etc.
|
|
7047
|
-
*
|
|
7048
|
-
* @example Auto-detection
|
|
7049
|
-
* ```typescript
|
|
7050
|
-
* const extraction = await client.extract({
|
|
7051
|
-
* urls: ["https://example.com"],
|
|
7052
|
-
* name: "My Extraction"
|
|
7053
|
-
* }).create();
|
|
7054
|
-
* ```
|
|
7055
|
-
*
|
|
7056
|
-
* @example Raw extraction
|
|
7057
|
-
* ```typescript
|
|
7058
|
-
* const extraction = await client.extract({
|
|
7059
|
-
* urls: ["https://example.com"],
|
|
7060
|
-
* name: "My Extraction",
|
|
7061
|
-
* extraction: builder => builder.raw("markdown")
|
|
7062
|
-
* }).create();
|
|
7063
|
-
* ```
|
|
7064
|
-
*
|
|
7065
|
-
* @example Custom schema
|
|
7066
|
-
* ```typescript
|
|
7067
|
-
* const extraction = await client.extract({
|
|
7068
|
-
* urls: ["https://example.com"],
|
|
7069
|
-
* name: "My Extraction",
|
|
7070
|
-
* extraction: builder => builder
|
|
7071
|
-
* .schema("Product")
|
|
7072
|
-
* .field("title", "Product name", "STRING", { example: "Example" })
|
|
7073
|
-
* .field("price", "Product price", "CURRENCY")
|
|
7074
|
-
* }).create();
|
|
7075
|
-
* ```
|
|
7076
7150
|
*/
|
|
7077
7151
|
extract(options) {
|
|
7078
7152
|
return this._extractionBuilderService.extract(options);
|
|
@@ -7081,23 +7155,13 @@ var KadoaClient = class {
|
|
|
7081
7155
|
* Connect to realtime WebSocket server
|
|
7082
7156
|
* Creates a new connection if not already connected
|
|
7083
7157
|
*
|
|
7158
|
+
* @param options - Optional realtime tuning options (heartbeat/reconnect settings)
|
|
7084
7159
|
* @returns The Realtime instance
|
|
7085
7160
|
*/
|
|
7086
|
-
connectRealtime() {
|
|
7161
|
+
async connectRealtime(options) {
|
|
7087
7162
|
if (!this._realtime) {
|
|
7088
|
-
this._realtime = new Realtime({
|
|
7089
|
-
|
|
7090
|
-
...this._realtimeConfig?.reconnectDelay != null && {
|
|
7091
|
-
reconnectDelay: this._realtimeConfig.reconnectDelay
|
|
7092
|
-
},
|
|
7093
|
-
...this._realtimeConfig?.heartbeatInterval != null && {
|
|
7094
|
-
heartbeatInterval: this._realtimeConfig.heartbeatInterval
|
|
7095
|
-
},
|
|
7096
|
-
...this._realtimeConfig?.source && {
|
|
7097
|
-
source: this._realtimeConfig.source
|
|
7098
|
-
}
|
|
7099
|
-
});
|
|
7100
|
-
this._realtime.connect();
|
|
7163
|
+
this._realtime = new Realtime({ apiKey: this._apiKey, ...options });
|
|
7164
|
+
await this._realtime.connect();
|
|
7101
7165
|
}
|
|
7102
7166
|
return this._realtime;
|
|
7103
7167
|
}
|
|
@@ -7136,8 +7200,14 @@ var KadoaClient = class {
|
|
|
7136
7200
|
dispose() {
|
|
7137
7201
|
this.disconnectRealtime();
|
|
7138
7202
|
}
|
|
7203
|
+
/**
|
|
7204
|
+
* Alias for {@link dispose}. Included for common Node.js client ergonomics.
|
|
7205
|
+
*/
|
|
7206
|
+
close() {
|
|
7207
|
+
this.dispose();
|
|
7208
|
+
}
|
|
7139
7209
|
};
|
|
7140
7210
|
|
|
7141
|
-
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 };
|
|
7142
7212
|
//# sourceMappingURL=index.mjs.map
|
|
7143
7213
|
//# sourceMappingURL=index.mjs.map
|