@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.js
CHANGED
|
@@ -3614,7 +3614,7 @@ var WorkflowsApiAxiosParamCreator = function(configuration) {
|
|
|
3614
3614
|
};
|
|
3615
3615
|
},
|
|
3616
3616
|
/**
|
|
3617
|
-
* Resumes a paused, preview, or error workflow.
|
|
3617
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
3618
3618
|
* @summary Resume a workflow
|
|
3619
3619
|
* @param {string} workflowId The ID of the workflow to resume
|
|
3620
3620
|
* @param {*} [options] Override http request option.
|
|
@@ -4065,7 +4065,7 @@ var WorkflowsApiFp = function(configuration) {
|
|
|
4065
4065
|
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios3__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
4066
4066
|
},
|
|
4067
4067
|
/**
|
|
4068
|
-
* Resumes a paused, preview, or error workflow.
|
|
4068
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
4069
4069
|
* @summary Resume a workflow
|
|
4070
4070
|
* @param {string} workflowId The ID of the workflow to resume
|
|
4071
4071
|
* @param {*} [options] Override http request option.
|
|
@@ -4300,7 +4300,7 @@ var WorkflowsApi = class extends BaseAPI {
|
|
|
4300
4300
|
return WorkflowsApiFp(this.configuration).v4WorkflowsWorkflowIdPausePut(requestParameters.workflowId, options).then((request) => request(this.axios, this.basePath));
|
|
4301
4301
|
}
|
|
4302
4302
|
/**
|
|
4303
|
-
* Resumes a paused, preview, or error workflow.
|
|
4303
|
+
* Resumes/Activates a paused, preview, or error workflow.
|
|
4304
4304
|
* @summary Resume a workflow
|
|
4305
4305
|
* @param {WorkflowsApiV4WorkflowsWorkflowIdResumePutRequest} requestParameters Request parameters.
|
|
4306
4306
|
* @param {*} [options] Override http request option.
|
|
@@ -4409,6 +4409,122 @@ var DataFieldDataTypeEnum = {
|
|
|
4409
4409
|
Array: "ARRAY"
|
|
4410
4410
|
};
|
|
4411
4411
|
|
|
4412
|
+
// src/domains/crawler/crawler.acl.ts
|
|
4413
|
+
var PageStatus = {
|
|
4414
|
+
Done: "DONE",
|
|
4415
|
+
Crawling: "CRAWLING",
|
|
4416
|
+
Pending: "PENDING"
|
|
4417
|
+
};
|
|
4418
|
+
|
|
4419
|
+
// src/domains/crawler/crawler-config.service.ts
|
|
4420
|
+
var CrawlerConfigService = class {
|
|
4421
|
+
constructor(client) {
|
|
4422
|
+
this.client = client;
|
|
4423
|
+
}
|
|
4424
|
+
get api() {
|
|
4425
|
+
return this.client.apis.crawler;
|
|
4426
|
+
}
|
|
4427
|
+
async createConfig(body) {
|
|
4428
|
+
const response = await this.api.v4CrawlConfigPost({
|
|
4429
|
+
createCrawlerConfigRequest: body
|
|
4430
|
+
});
|
|
4431
|
+
return response.data;
|
|
4432
|
+
}
|
|
4433
|
+
async getConfig(configId) {
|
|
4434
|
+
const response = await this.api.v4CrawlConfigConfigIdGet({ configId });
|
|
4435
|
+
return response.data;
|
|
4436
|
+
}
|
|
4437
|
+
async deleteConfig(configId) {
|
|
4438
|
+
const response = await this.api.v4CrawlConfigDelete({
|
|
4439
|
+
deleteCrawlerConfigRequest: { configId }
|
|
4440
|
+
});
|
|
4441
|
+
return response.data;
|
|
4442
|
+
}
|
|
4443
|
+
};
|
|
4444
|
+
|
|
4445
|
+
// src/domains/crawler/crawler-session.service.ts
|
|
4446
|
+
var CrawlerSessionService = class {
|
|
4447
|
+
constructor(client) {
|
|
4448
|
+
this.client = client;
|
|
4449
|
+
}
|
|
4450
|
+
get api() {
|
|
4451
|
+
return this.client.apis.crawler;
|
|
4452
|
+
}
|
|
4453
|
+
async start(body) {
|
|
4454
|
+
const response = await this.api.v4CrawlPost({
|
|
4455
|
+
startCrawlerSessionRequest: body
|
|
4456
|
+
});
|
|
4457
|
+
return response.data;
|
|
4458
|
+
}
|
|
4459
|
+
async startWithConfig(body) {
|
|
4460
|
+
const response = await this.api.v4CrawlStartPost({
|
|
4461
|
+
startSessionWithConfigRequest: body
|
|
4462
|
+
});
|
|
4463
|
+
return response.data;
|
|
4464
|
+
}
|
|
4465
|
+
async pause(sessionId) {
|
|
4466
|
+
const response = await this.api.v4CrawlPausePost({
|
|
4467
|
+
pauseCrawlerSessionRequest: { sessionId }
|
|
4468
|
+
});
|
|
4469
|
+
return response.data;
|
|
4470
|
+
}
|
|
4471
|
+
async resume(sessionId) {
|
|
4472
|
+
const response = await this.api.v4CrawlResumePost({
|
|
4473
|
+
resumeCrawlerSessionRequest: { sessionId }
|
|
4474
|
+
});
|
|
4475
|
+
return response.data;
|
|
4476
|
+
}
|
|
4477
|
+
async listSessions(options) {
|
|
4478
|
+
const response = await this.api.v4CrawlSessionsGet({
|
|
4479
|
+
page: options?.page,
|
|
4480
|
+
pageSize: options?.pageSize,
|
|
4481
|
+
userId: options?.userId
|
|
4482
|
+
});
|
|
4483
|
+
return response.data.data ?? [];
|
|
4484
|
+
}
|
|
4485
|
+
async getSessionStatus(sessionId) {
|
|
4486
|
+
const response = await this.api.v4CrawlSessionIdStatusGet({ sessionId });
|
|
4487
|
+
return response.data;
|
|
4488
|
+
}
|
|
4489
|
+
async getPages(sessionId, options) {
|
|
4490
|
+
const response = await this.api.v4CrawlSessionIdPagesGet({
|
|
4491
|
+
sessionId,
|
|
4492
|
+
currentPage: options?.currentPage,
|
|
4493
|
+
pageSize: options?.pageSize
|
|
4494
|
+
});
|
|
4495
|
+
return response.data;
|
|
4496
|
+
}
|
|
4497
|
+
async getPage(sessionId, pageId, options) {
|
|
4498
|
+
const response = await this.api.v4CrawlSessionIdPagesPageIdGet({
|
|
4499
|
+
sessionId,
|
|
4500
|
+
pageId,
|
|
4501
|
+
format: options?.format
|
|
4502
|
+
});
|
|
4503
|
+
return response.data;
|
|
4504
|
+
}
|
|
4505
|
+
async getAllSessionData(sessionId, options) {
|
|
4506
|
+
const response = await this.api.v4CrawlSessionIdListGet({
|
|
4507
|
+
sessionId,
|
|
4508
|
+
includeAll: options?.includeAll
|
|
4509
|
+
});
|
|
4510
|
+
return response.data;
|
|
4511
|
+
}
|
|
4512
|
+
async getBucketFile(filenameb64) {
|
|
4513
|
+
const response = await this.api.v4CrawlBucketDataFilenameb64Get({
|
|
4514
|
+
filenameb64
|
|
4515
|
+
});
|
|
4516
|
+
return response.data;
|
|
4517
|
+
}
|
|
4518
|
+
};
|
|
4519
|
+
|
|
4520
|
+
// src/domains/crawler/crawler.facade.ts
|
|
4521
|
+
function createCrawlerDomain(client) {
|
|
4522
|
+
return {
|
|
4523
|
+
config: new CrawlerConfigService(client),
|
|
4524
|
+
session: new CrawlerSessionService(client)
|
|
4525
|
+
};
|
|
4526
|
+
}
|
|
4527
|
+
|
|
4412
4528
|
// src/domains/extraction/extraction.acl.ts
|
|
4413
4529
|
var FetchDataOptions = class {
|
|
4414
4530
|
};
|
|
@@ -4529,7 +4645,6 @@ var DataFetcherService = class {
|
|
|
4529
4645
|
|
|
4530
4646
|
// src/runtime/exceptions/base.exception.ts
|
|
4531
4647
|
var KadoaErrorCode = {
|
|
4532
|
-
AUTH_ERROR: "AUTH_ERROR",
|
|
4533
4648
|
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
4534
4649
|
BAD_REQUEST: "BAD_REQUEST",
|
|
4535
4650
|
NOT_FOUND: "NOT_FOUND",
|
|
@@ -4649,8 +4764,7 @@ var KadoaHttpException = class _KadoaHttpException extends KadoaSdkException {
|
|
|
4649
4764
|
endpoint: url,
|
|
4650
4765
|
method,
|
|
4651
4766
|
responseBody: error.response?.data,
|
|
4652
|
-
details: extra?.details
|
|
4653
|
-
cause: error
|
|
4767
|
+
details: extra?.details
|
|
4654
4768
|
});
|
|
4655
4769
|
}
|
|
4656
4770
|
toJSON() {
|
|
@@ -4836,7 +4950,10 @@ var SchemaBuilder = _SchemaBuilder;
|
|
|
4836
4950
|
var debug = logger.schemas;
|
|
4837
4951
|
var SchemasService = class {
|
|
4838
4952
|
constructor(client) {
|
|
4839
|
-
this.
|
|
4953
|
+
this.client = client;
|
|
4954
|
+
}
|
|
4955
|
+
get schemasApi() {
|
|
4956
|
+
return this.client.apis.schemas;
|
|
4840
4957
|
}
|
|
4841
4958
|
/**
|
|
4842
4959
|
* Create a schema builder with fluent API and inline create support.
|
|
@@ -5406,15 +5523,18 @@ var ExtractionBuilderService = class {
|
|
|
5406
5523
|
selectorMode: useSelectorMode
|
|
5407
5524
|
});
|
|
5408
5525
|
}
|
|
5526
|
+
const hasSchemaId = typeof entity === "object" && "schemaId" in entity && entity.schemaId;
|
|
5409
5527
|
const workflow = await this.workflowsCoreService.create({
|
|
5410
5528
|
urls,
|
|
5411
5529
|
name,
|
|
5412
5530
|
description,
|
|
5413
5531
|
navigationMode,
|
|
5414
5532
|
monitoring: this._monitoringOptions,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5533
|
+
...hasSchemaId ? {
|
|
5534
|
+
schemaId: entity.schemaId,
|
|
5535
|
+
entity: resolvedEntity.entity,
|
|
5536
|
+
fields: resolvedEntity.fields
|
|
5537
|
+
} : { entity: resolvedEntity.entity, fields: resolvedEntity.fields },
|
|
5418
5538
|
autoStart: false,
|
|
5419
5539
|
interval: this._options.interval,
|
|
5420
5540
|
schedules: this._options.schedules,
|
|
@@ -5607,11 +5727,14 @@ var _NotificationChannelsService = class _NotificationChannelsService {
|
|
|
5607
5727
|
}
|
|
5608
5728
|
async createChannel(type, config) {
|
|
5609
5729
|
const payload = await this.buildPayload(
|
|
5610
|
-
esToolkit.merge(
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5730
|
+
esToolkit.merge(
|
|
5731
|
+
{
|
|
5732
|
+
name: _NotificationChannelsService.DEFAULT_CHANNEL_NAME,
|
|
5733
|
+
channelType: type,
|
|
5734
|
+
config: {}
|
|
5735
|
+
},
|
|
5736
|
+
config || {}
|
|
5737
|
+
)
|
|
5615
5738
|
);
|
|
5616
5739
|
const response = await this.api.v5NotificationsChannelsPost({
|
|
5617
5740
|
v5NotificationsChannelsPostRequest: payload
|
|
@@ -5717,6 +5840,19 @@ var NotificationSettingsService = class {
|
|
|
5717
5840
|
async listAllEvents() {
|
|
5718
5841
|
return Object.values(V5NotificationsSettingsGetEventTypeEnum);
|
|
5719
5842
|
}
|
|
5843
|
+
async updateSettings(settingsId, data) {
|
|
5844
|
+
const response = await this.api.v5NotificationsSettingsSettingsIdPut({
|
|
5845
|
+
settingsId,
|
|
5846
|
+
v5NotificationsSettingsSettingsIdPutRequest: data
|
|
5847
|
+
});
|
|
5848
|
+
const settings = response.data.data?.settings;
|
|
5849
|
+
if (!settings) {
|
|
5850
|
+
throw KadoaHttpException.wrap(response, {
|
|
5851
|
+
message: "Failed to update notification settings"
|
|
5852
|
+
});
|
|
5853
|
+
}
|
|
5854
|
+
return settings;
|
|
5855
|
+
}
|
|
5720
5856
|
async deleteSettings(settingsId) {
|
|
5721
5857
|
const response = await this.api.v5NotificationsSettingsSettingsIdDelete({
|
|
5722
5858
|
settingsId
|
|
@@ -5737,20 +5873,10 @@ var NotificationSetupService = class {
|
|
|
5737
5873
|
this.settingsService = settingsService;
|
|
5738
5874
|
}
|
|
5739
5875
|
/**
|
|
5740
|
-
* Setup notification settings for a specific workflow
|
|
5876
|
+
* Setup notification settings for a specific workflow.
|
|
5877
|
+
* Creates channels and settings for the specified events.
|
|
5741
5878
|
*/
|
|
5742
5879
|
async setupForWorkflow(requestData) {
|
|
5743
|
-
const existingSettings = await this.settingsService.listSettings({
|
|
5744
|
-
workflowId: requestData.workflowId
|
|
5745
|
-
});
|
|
5746
|
-
if (existingSettings.length > 0) {
|
|
5747
|
-
throw new KadoaSdkException("Settings already exist", {
|
|
5748
|
-
code: KadoaErrorCode.BAD_REQUEST,
|
|
5749
|
-
details: {
|
|
5750
|
-
workflowId: requestData.workflowId
|
|
5751
|
-
}
|
|
5752
|
-
});
|
|
5753
|
-
}
|
|
5754
5880
|
return this.setup({
|
|
5755
5881
|
workflowId: requestData.workflowId,
|
|
5756
5882
|
events: requestData.events,
|
|
@@ -5798,8 +5924,24 @@ var NotificationSetupService = class {
|
|
|
5798
5924
|
channels: channelIds
|
|
5799
5925
|
}
|
|
5800
5926
|
);
|
|
5927
|
+
const existingSettings = await this.settingsService.listSettings({
|
|
5928
|
+
workflowId: requestData.workflowId
|
|
5929
|
+
});
|
|
5801
5930
|
const newSettings = await Promise.all(
|
|
5802
5931
|
eventTypes.map(async (eventType) => {
|
|
5932
|
+
const existing = existingSettings.find(
|
|
5933
|
+
(s) => s.eventType === eventType
|
|
5934
|
+
);
|
|
5935
|
+
if (existing?.id) {
|
|
5936
|
+
const existingChannelIds = (existing.channels || []).map((c) => c.id).filter(Boolean);
|
|
5937
|
+
const mergedChannelIds = [
|
|
5938
|
+
.../* @__PURE__ */ new Set([...existingChannelIds, ...channelIds])
|
|
5939
|
+
];
|
|
5940
|
+
return await this.settingsService.updateSettings(existing.id, {
|
|
5941
|
+
channelIds: mergedChannelIds,
|
|
5942
|
+
enabled: existing.enabled ?? true
|
|
5943
|
+
});
|
|
5944
|
+
}
|
|
5803
5945
|
return await this.settingsService.createSettings({
|
|
5804
5946
|
workflowId: requestData.workflowId,
|
|
5805
5947
|
channelIds,
|
|
@@ -5932,9 +6074,10 @@ var NotificationSetupService = class {
|
|
|
5932
6074
|
});
|
|
5933
6075
|
return existingChannel;
|
|
5934
6076
|
}
|
|
6077
|
+
const { name: _, ...channelConfig } = config;
|
|
5935
6078
|
const channel = await this.channelsService.createChannel(channelType, {
|
|
5936
6079
|
name: channelName,
|
|
5937
|
-
config
|
|
6080
|
+
config: channelConfig
|
|
5938
6081
|
});
|
|
5939
6082
|
debug4("Created channel with custom config %O", {
|
|
5940
6083
|
workflowId,
|
|
@@ -5952,11 +6095,11 @@ var NotificationSetupService = class {
|
|
|
5952
6095
|
// src/runtime/config/constants.ts
|
|
5953
6096
|
var PUBLIC_API_URI = process.env.KADOA_PUBLIC_API_URI ?? "https://api.kadoa.com";
|
|
5954
6097
|
var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
|
|
5955
|
-
|
|
6098
|
+
process.env.KADOA_WSS_NEO_API_URI ?? "wss://events.kadoa.com/events/ws";
|
|
5956
6099
|
var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
|
|
5957
6100
|
|
|
5958
6101
|
// src/version.ts
|
|
5959
|
-
var SDK_VERSION = "0.
|
|
6102
|
+
var SDK_VERSION = "0.20.2";
|
|
5960
6103
|
var SDK_NAME = "kadoa-node-sdk";
|
|
5961
6104
|
var SDK_LANGUAGE = "node";
|
|
5962
6105
|
|
|
@@ -5976,7 +6119,6 @@ var Realtime = class {
|
|
|
5976
6119
|
this.heartbeatInterval = config.heartbeatInterval || 1e4;
|
|
5977
6120
|
this.reconnectDelay = config.reconnectDelay || 5e3;
|
|
5978
6121
|
this.missedHeartbeatsLimit = config.missedHeartbeatsLimit || 3e4;
|
|
5979
|
-
this.source = config.source;
|
|
5980
6122
|
}
|
|
5981
6123
|
async connect() {
|
|
5982
6124
|
if (this.isConnecting) return;
|
|
@@ -5991,56 +6133,59 @@ var Realtime = class {
|
|
|
5991
6133
|
}
|
|
5992
6134
|
});
|
|
5993
6135
|
const { access_token, team_id } = await response.json();
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
this.
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
this.socket.
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6136
|
+
await new Promise((resolve, reject) => {
|
|
6137
|
+
this.socket = new WebSocket(
|
|
6138
|
+
`${WSS_API_URI}?access_token=${access_token}`
|
|
6139
|
+
);
|
|
6140
|
+
this.socket.onopen = () => {
|
|
6141
|
+
this.isConnecting = false;
|
|
6142
|
+
this.lastHeartbeat = Date.now();
|
|
6143
|
+
if (this.socket?.readyState === WebSocket.OPEN) {
|
|
6144
|
+
this.socket.send(
|
|
6145
|
+
JSON.stringify({
|
|
6146
|
+
action: "subscribe",
|
|
6147
|
+
channel: team_id
|
|
6148
|
+
})
|
|
6149
|
+
);
|
|
6150
|
+
debug5("Connected to WebSocket");
|
|
6151
|
+
this.notifyConnectionListeners(true);
|
|
6152
|
+
}
|
|
6153
|
+
this.startHeartbeatCheck();
|
|
6154
|
+
resolve();
|
|
6155
|
+
};
|
|
6156
|
+
this.socket.onmessage = (event) => {
|
|
6157
|
+
try {
|
|
6158
|
+
const data = JSON.parse(event.data);
|
|
6159
|
+
if (data.type === "heartbeat") {
|
|
6160
|
+
this.handleHeartbeat();
|
|
6161
|
+
} else {
|
|
6162
|
+
if (data?.id) {
|
|
6163
|
+
fetch(`${REALTIME_API_URI}/api/v1/events/ack`, {
|
|
6164
|
+
method: "POST",
|
|
6165
|
+
headers: { "Content-Type": "application/json" },
|
|
6166
|
+
body: JSON.stringify({ id: data.id })
|
|
6167
|
+
});
|
|
6168
|
+
}
|
|
6169
|
+
this.notifyEventListeners(data);
|
|
6025
6170
|
}
|
|
6026
|
-
|
|
6171
|
+
} catch (err) {
|
|
6172
|
+
debug5("Failed to parse incoming message: %O", err);
|
|
6027
6173
|
}
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
this.
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
};
|
|
6174
|
+
};
|
|
6175
|
+
this.socket.onclose = () => {
|
|
6176
|
+
debug5("WebSocket disconnected. Attempting to reconnect...");
|
|
6177
|
+
this.isConnecting = false;
|
|
6178
|
+
this.stopHeartbeatCheck();
|
|
6179
|
+
this.notifyConnectionListeners(false, "Connection closed");
|
|
6180
|
+
setTimeout(() => this.connect(), this.reconnectDelay);
|
|
6181
|
+
};
|
|
6182
|
+
this.socket.onerror = (error) => {
|
|
6183
|
+
debug5("WebSocket error: %O", error);
|
|
6184
|
+
this.isConnecting = false;
|
|
6185
|
+
this.notifyErrorListeners(error);
|
|
6186
|
+
reject(error);
|
|
6187
|
+
};
|
|
6188
|
+
});
|
|
6044
6189
|
} catch (err) {
|
|
6045
6190
|
debug5("Failed to connect: %O", err);
|
|
6046
6191
|
this.isConnecting = false;
|
|
@@ -6283,11 +6428,10 @@ function isNewerVersion(version1, version2) {
|
|
|
6283
6428
|
// src/domains/validation/validation-core.service.ts
|
|
6284
6429
|
var ValidationCoreService = class {
|
|
6285
6430
|
constructor(client) {
|
|
6286
|
-
this.
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
);
|
|
6431
|
+
this.client = client;
|
|
6432
|
+
}
|
|
6433
|
+
get validationApi() {
|
|
6434
|
+
return this.client.apis.validation;
|
|
6291
6435
|
}
|
|
6292
6436
|
async listWorkflowValidations(filters) {
|
|
6293
6437
|
const response = await this.validationApi.v4DataValidationWorkflowsWorkflowIdJobsJobIdValidationsGet(
|
|
@@ -6389,6 +6533,7 @@ var ValidationCoreService = class {
|
|
|
6389
6533
|
return response.data;
|
|
6390
6534
|
}
|
|
6391
6535
|
async waitUntilCompleted(validationId, options) {
|
|
6536
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
6392
6537
|
const result = await pollUntil(
|
|
6393
6538
|
async () => {
|
|
6394
6539
|
const current = await this.getValidationDetails(validationId);
|
|
@@ -6408,11 +6553,10 @@ var ValidationCoreService = class {
|
|
|
6408
6553
|
};
|
|
6409
6554
|
var ValidationRulesService = class {
|
|
6410
6555
|
constructor(client) {
|
|
6411
|
-
this.
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
);
|
|
6556
|
+
this.client = client;
|
|
6557
|
+
}
|
|
6558
|
+
get validationApi() {
|
|
6559
|
+
return this.client.apis.validation;
|
|
6416
6560
|
}
|
|
6417
6561
|
async listRules(options) {
|
|
6418
6562
|
const response = await this.validationApi.v4DataValidationRulesGet(options);
|
|
@@ -6466,6 +6610,25 @@ var ValidationRulesService = class {
|
|
|
6466
6610
|
}
|
|
6467
6611
|
return response.data.data;
|
|
6468
6612
|
}
|
|
6613
|
+
async deleteRule(data) {
|
|
6614
|
+
const response = await this.validationApi.v4DataValidationRulesRuleIdDelete(
|
|
6615
|
+
{
|
|
6616
|
+
ruleId: data.ruleId,
|
|
6617
|
+
...data.workflowId != null && {
|
|
6618
|
+
deleteRuleWithReason: {
|
|
6619
|
+
workflowId: data.workflowId,
|
|
6620
|
+
...data.reason != null && { reason: data.reason }
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
}
|
|
6624
|
+
);
|
|
6625
|
+
if (response.status !== 200 || response.data.error) {
|
|
6626
|
+
throw KadoaHttpException.wrap(response.data, {
|
|
6627
|
+
message: response.data.message || "Failed to delete validation rule"
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
return response.data;
|
|
6631
|
+
}
|
|
6469
6632
|
async disableRule(data) {
|
|
6470
6633
|
const response = await this.validationApi.v4DataValidationRulesRuleIdDisablePost(data);
|
|
6471
6634
|
if (response.status !== 200 || response.data.error) {
|
|
@@ -6589,7 +6752,8 @@ var WorkflowsCoreService = class {
|
|
|
6589
6752
|
location: input.location,
|
|
6590
6753
|
autoStart: input.autoStart,
|
|
6591
6754
|
schedules: input.schedules,
|
|
6592
|
-
additionalData: input.additionalData
|
|
6755
|
+
additionalData: input.additionalData,
|
|
6756
|
+
limit: input.limit
|
|
6593
6757
|
};
|
|
6594
6758
|
const response2 = await this.workflowsApi.v4WorkflowsPost({
|
|
6595
6759
|
createWorkflowBody: agenticRequest
|
|
@@ -6611,7 +6775,7 @@ var WorkflowsCoreService = class {
|
|
|
6611
6775
|
schemaId: input.schemaId,
|
|
6612
6776
|
description: input.description,
|
|
6613
6777
|
navigationMode: input.navigationMode,
|
|
6614
|
-
entity: input.entity
|
|
6778
|
+
...input.entity != null && { entity: input.entity },
|
|
6615
6779
|
fields: input.fields,
|
|
6616
6780
|
bypassPreview: input.bypassPreview ?? true,
|
|
6617
6781
|
tags: input.tags,
|
|
@@ -6620,7 +6784,8 @@ var WorkflowsCoreService = class {
|
|
|
6620
6784
|
location: input.location,
|
|
6621
6785
|
autoStart: input.autoStart,
|
|
6622
6786
|
schedules: input.schedules,
|
|
6623
|
-
additionalData: input.additionalData
|
|
6787
|
+
additionalData: input.additionalData,
|
|
6788
|
+
limit: input.limit
|
|
6624
6789
|
};
|
|
6625
6790
|
const response = await this.workflowsApi.v4WorkflowsPost({
|
|
6626
6791
|
createWorkflowBody: request
|
|
@@ -6754,131 +6919,44 @@ var WorkflowsCoreService = class {
|
|
|
6754
6919
|
}
|
|
6755
6920
|
};
|
|
6756
6921
|
|
|
6757
|
-
// src/
|
|
6758
|
-
var
|
|
6759
|
-
constructor(
|
|
6760
|
-
this.
|
|
6761
|
-
this.
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
this.client.baseUrl,
|
|
6768
|
-
this.client.axiosInstance
|
|
6769
|
-
);
|
|
6770
|
-
}
|
|
6771
|
-
return this._api;
|
|
6772
|
-
}
|
|
6773
|
-
async createConfig(body) {
|
|
6774
|
-
const response = await this.api.v4CrawlConfigPost({
|
|
6775
|
-
createCrawlerConfigRequest: body
|
|
6776
|
-
});
|
|
6777
|
-
return response.data;
|
|
6778
|
-
}
|
|
6779
|
-
async getConfig(configId) {
|
|
6780
|
-
const response = await this.api.v4CrawlConfigConfigIdGet({ configId });
|
|
6781
|
-
return response.data;
|
|
6782
|
-
}
|
|
6783
|
-
async deleteConfig(configId) {
|
|
6784
|
-
const response = await this.api.v4CrawlConfigDelete({
|
|
6785
|
-
deleteCrawlerConfigRequest: { configId }
|
|
6922
|
+
// src/client/api-registry.ts
|
|
6923
|
+
var ApiRegistry = class {
|
|
6924
|
+
constructor(apiKey, baseUrl, axios2, headers) {
|
|
6925
|
+
this.baseUrl = baseUrl;
|
|
6926
|
+
this.axios = axios2;
|
|
6927
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
6928
|
+
this.configuration = new Configuration({
|
|
6929
|
+
apiKey,
|
|
6930
|
+
basePath: baseUrl,
|
|
6931
|
+
baseOptions: { headers }
|
|
6786
6932
|
});
|
|
6787
|
-
return response.data;
|
|
6788
6933
|
}
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
this.client = client;
|
|
6795
|
-
this._api = null;
|
|
6796
|
-
}
|
|
6797
|
-
get api() {
|
|
6798
|
-
if (!this._api) {
|
|
6799
|
-
this._api = new CrawlerApi(
|
|
6800
|
-
this.client.configuration,
|
|
6801
|
-
this.client.baseUrl,
|
|
6802
|
-
this.client.axiosInstance
|
|
6934
|
+
get(ApiClass) {
|
|
6935
|
+
if (!this.cache.has(ApiClass)) {
|
|
6936
|
+
this.cache.set(
|
|
6937
|
+
ApiClass,
|
|
6938
|
+
new ApiClass(this.configuration, this.baseUrl, this.axios)
|
|
6803
6939
|
);
|
|
6804
6940
|
}
|
|
6805
|
-
return this.
|
|
6806
|
-
}
|
|
6807
|
-
async start(body) {
|
|
6808
|
-
const response = await this.api.v4CrawlPost({
|
|
6809
|
-
startCrawlerSessionRequest: body
|
|
6810
|
-
});
|
|
6811
|
-
return response.data;
|
|
6812
|
-
}
|
|
6813
|
-
async startWithConfig(body) {
|
|
6814
|
-
const response = await this.api.v4CrawlStartPost({
|
|
6815
|
-
startSessionWithConfigRequest: body
|
|
6816
|
-
});
|
|
6817
|
-
return response.data;
|
|
6941
|
+
return this.cache.get(ApiClass);
|
|
6818
6942
|
}
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
pauseCrawlerSessionRequest: { sessionId }
|
|
6822
|
-
});
|
|
6823
|
-
return response.data;
|
|
6943
|
+
get schemas() {
|
|
6944
|
+
return this.get(SchemasApi);
|
|
6824
6945
|
}
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
resumeCrawlerSessionRequest: { sessionId }
|
|
6828
|
-
});
|
|
6829
|
-
return response.data;
|
|
6830
|
-
}
|
|
6831
|
-
async listSessions(options) {
|
|
6832
|
-
const response = await this.api.v4CrawlSessionsGet({
|
|
6833
|
-
page: options?.page,
|
|
6834
|
-
pageSize: options?.pageSize,
|
|
6835
|
-
userId: options?.userId
|
|
6836
|
-
});
|
|
6837
|
-
return response.data.data ?? [];
|
|
6946
|
+
get validation() {
|
|
6947
|
+
return this.get(DataValidationApi);
|
|
6838
6948
|
}
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
return response.data;
|
|
6949
|
+
get crawler() {
|
|
6950
|
+
return this.get(CrawlerApi);
|
|
6842
6951
|
}
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
sessionId,
|
|
6846
|
-
currentPage: options?.currentPage,
|
|
6847
|
-
pageSize: options?.pageSize
|
|
6848
|
-
});
|
|
6849
|
-
return response.data;
|
|
6952
|
+
get workflows() {
|
|
6953
|
+
return this.get(WorkflowsApi);
|
|
6850
6954
|
}
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
sessionId,
|
|
6854
|
-
pageId,
|
|
6855
|
-
format: options?.format
|
|
6856
|
-
});
|
|
6857
|
-
return response.data;
|
|
6858
|
-
}
|
|
6859
|
-
async getAllSessionData(sessionId, options) {
|
|
6860
|
-
const response = await this.api.v4CrawlSessionIdListGet({
|
|
6861
|
-
sessionId,
|
|
6862
|
-
includeAll: options?.includeAll
|
|
6863
|
-
});
|
|
6864
|
-
return response.data;
|
|
6865
|
-
}
|
|
6866
|
-
async getBucketFile(filenameb64) {
|
|
6867
|
-
const response = await this.api.v4CrawlBucketDataFilenameb64Get({
|
|
6868
|
-
filenameb64
|
|
6869
|
-
});
|
|
6870
|
-
return response.data;
|
|
6955
|
+
get notifications() {
|
|
6956
|
+
return this.get(NotificationsApi);
|
|
6871
6957
|
}
|
|
6872
6958
|
};
|
|
6873
6959
|
|
|
6874
|
-
// src/domains/crawler/crawler.facade.ts
|
|
6875
|
-
function createCrawlerDomain(client) {
|
|
6876
|
-
return {
|
|
6877
|
-
config: new CrawlerConfigService(client),
|
|
6878
|
-
session: new CrawlerSessionService(client)
|
|
6879
|
-
};
|
|
6880
|
-
}
|
|
6881
|
-
|
|
6882
6960
|
// src/domains/validation/validation.facade.ts
|
|
6883
6961
|
function createValidationDomain(core, rules) {
|
|
6884
6962
|
return {
|
|
@@ -6894,121 +6972,154 @@ function createValidationDomain(core, rules) {
|
|
|
6894
6972
|
};
|
|
6895
6973
|
}
|
|
6896
6974
|
|
|
6897
|
-
// src/
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
return config2;
|
|
6922
|
-
});
|
|
6923
|
-
this._axiosInstance.interceptors.response.use(
|
|
6924
|
-
(response) => {
|
|
6925
|
-
if (response.status === 401) {
|
|
6926
|
-
throw new KadoaHttpException("Unauthorized", {
|
|
6927
|
-
code: KadoaErrorCode.AUTH_ERROR,
|
|
6928
|
-
httpStatus: 401
|
|
6929
|
-
});
|
|
6975
|
+
// src/client/wiring.ts
|
|
6976
|
+
function createSdkHeaders() {
|
|
6977
|
+
return {
|
|
6978
|
+
"User-Agent": `${SDK_NAME}/${SDK_VERSION}`,
|
|
6979
|
+
"X-SDK-Version": SDK_VERSION,
|
|
6980
|
+
"X-SDK-Language": SDK_LANGUAGE
|
|
6981
|
+
};
|
|
6982
|
+
}
|
|
6983
|
+
function createAxiosInstance(params) {
|
|
6984
|
+
const axiosInstance = globalAxios3__default.default.create({
|
|
6985
|
+
timeout: params.timeout,
|
|
6986
|
+
headers: params.headers
|
|
6987
|
+
});
|
|
6988
|
+
axiosInstance.interceptors.request.use((config) => {
|
|
6989
|
+
config.headers["x-request-id"] = uuid.v4();
|
|
6990
|
+
return config;
|
|
6991
|
+
});
|
|
6992
|
+
axiosInstance.interceptors.response.use(
|
|
6993
|
+
(response) => response,
|
|
6994
|
+
(error) => {
|
|
6995
|
+
if (error instanceof globalAxios3.AxiosError) {
|
|
6996
|
+
const status = error.response?.status;
|
|
6997
|
+
if (status === 401 || status === 403) {
|
|
6998
|
+
throw KadoaHttpException.wrap(error, { message: "Unauthorized" });
|
|
6930
6999
|
}
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
7000
|
+
}
|
|
7001
|
+
throw KadoaHttpException.wrap(error);
|
|
7002
|
+
}
|
|
7003
|
+
);
|
|
7004
|
+
return axiosInstance;
|
|
7005
|
+
}
|
|
7006
|
+
function createClientDomains(params) {
|
|
7007
|
+
const { client } = params;
|
|
7008
|
+
const userService = new UserService(client);
|
|
7009
|
+
const dataFetcherService = new DataFetcherService(client.apis.workflows);
|
|
7010
|
+
const channelsService = new NotificationChannelsService(
|
|
7011
|
+
client.apis.notifications,
|
|
7012
|
+
userService
|
|
7013
|
+
);
|
|
7014
|
+
const settingsService = new NotificationSettingsService(
|
|
7015
|
+
client.apis.notifications
|
|
7016
|
+
);
|
|
7017
|
+
const entityResolverService = new EntityResolverService(client);
|
|
7018
|
+
const workflowsCoreService = new WorkflowsCoreService(client.apis.workflows);
|
|
7019
|
+
const schemasService = new SchemasService(client);
|
|
7020
|
+
const channelSetupService = new NotificationSetupService(
|
|
7021
|
+
channelsService,
|
|
7022
|
+
settingsService
|
|
7023
|
+
);
|
|
7024
|
+
const coreService = new ValidationCoreService(client);
|
|
7025
|
+
const rulesService = new ValidationRulesService(client);
|
|
7026
|
+
const extractionService = new ExtractionService(
|
|
7027
|
+
workflowsCoreService,
|
|
7028
|
+
dataFetcherService,
|
|
7029
|
+
entityResolverService,
|
|
7030
|
+
channelSetupService,
|
|
7031
|
+
channelsService,
|
|
7032
|
+
settingsService
|
|
7033
|
+
);
|
|
7034
|
+
const extractionBuilderService = new ExtractionBuilderService(
|
|
7035
|
+
workflowsCoreService,
|
|
7036
|
+
entityResolverService,
|
|
7037
|
+
dataFetcherService,
|
|
7038
|
+
channelSetupService
|
|
7039
|
+
);
|
|
7040
|
+
const notification = createNotificationDomain({
|
|
7041
|
+
notificationsApi: client.apis.notifications,
|
|
7042
|
+
channelsService,
|
|
7043
|
+
settingsService,
|
|
7044
|
+
channelSetupService
|
|
7045
|
+
});
|
|
7046
|
+
const validation = createValidationDomain(coreService, rulesService);
|
|
7047
|
+
const crawler = createCrawlerDomain(client);
|
|
7048
|
+
return {
|
|
7049
|
+
extractionBuilderService,
|
|
7050
|
+
extraction: extractionService,
|
|
7051
|
+
workflow: workflowsCoreService,
|
|
7052
|
+
notification,
|
|
7053
|
+
schema: schemasService,
|
|
7054
|
+
user: userService,
|
|
7055
|
+
validation,
|
|
7056
|
+
crawler
|
|
7057
|
+
};
|
|
7058
|
+
}
|
|
7059
|
+
function createNotificationDomain(params) {
|
|
7060
|
+
const {
|
|
7061
|
+
notificationsApi,
|
|
7062
|
+
channelsService,
|
|
7063
|
+
settingsService,
|
|
7064
|
+
channelSetupService
|
|
7065
|
+
} = params;
|
|
7066
|
+
return {
|
|
7067
|
+
channels: channelsService,
|
|
7068
|
+
settings: settingsService,
|
|
7069
|
+
setup: channelSetupService,
|
|
7070
|
+
configure: (options) => channelSetupService.setup(options),
|
|
7071
|
+
setupForWorkflow: (request) => channelSetupService.setupForWorkflow(request),
|
|
7072
|
+
setupForWorkspace: (request) => channelSetupService.setupForWorkspace(request),
|
|
7073
|
+
testNotification: async (request) => {
|
|
7074
|
+
const response = await notificationsApi.v5NotificationsTestPost({
|
|
7075
|
+
v5NotificationsTestPostRequest: {
|
|
7076
|
+
eventType: request.eventType,
|
|
7077
|
+
...request.workflowId != null && {
|
|
7078
|
+
workflowId: request.workflowId
|
|
6938
7079
|
}
|
|
6939
7080
|
}
|
|
6940
|
-
|
|
7081
|
+
});
|
|
7082
|
+
const data = response.data.data;
|
|
7083
|
+
if (!data?.eventId || !data?.eventType) {
|
|
7084
|
+
throw KadoaHttpException.wrap(response, {
|
|
7085
|
+
message: "Failed to test notification"
|
|
7086
|
+
});
|
|
6941
7087
|
}
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
);
|
|
6948
|
-
const notificationsApi = new NotificationsApi(
|
|
6949
|
-
this.configuration,
|
|
6950
|
-
this.baseUrl,
|
|
6951
|
-
this.axiosInstance
|
|
6952
|
-
);
|
|
6953
|
-
const userService = new UserService(this);
|
|
6954
|
-
const dataFetcherService = new DataFetcherService(workflowsApi);
|
|
6955
|
-
const channelsService = new NotificationChannelsService(
|
|
6956
|
-
notificationsApi,
|
|
6957
|
-
userService
|
|
6958
|
-
);
|
|
6959
|
-
const settingsService = new NotificationSettingsService(notificationsApi);
|
|
6960
|
-
const entityResolverService = new EntityResolverService(this);
|
|
6961
|
-
const workflowsCoreService = new WorkflowsCoreService(workflowsApi);
|
|
6962
|
-
const schemasService = new SchemasService(this);
|
|
6963
|
-
const channelSetupService = new NotificationSetupService(
|
|
6964
|
-
channelsService,
|
|
6965
|
-
settingsService
|
|
6966
|
-
);
|
|
6967
|
-
const coreService = new ValidationCoreService(this);
|
|
6968
|
-
const rulesService = new ValidationRulesService(this);
|
|
6969
|
-
const extractionService = new ExtractionService(
|
|
6970
|
-
workflowsCoreService,
|
|
6971
|
-
dataFetcherService,
|
|
6972
|
-
entityResolverService,
|
|
6973
|
-
channelSetupService,
|
|
6974
|
-
channelsService,
|
|
6975
|
-
settingsService
|
|
6976
|
-
);
|
|
6977
|
-
this._extractionBuilderService = new ExtractionBuilderService(
|
|
6978
|
-
workflowsCoreService,
|
|
6979
|
-
entityResolverService,
|
|
6980
|
-
dataFetcherService,
|
|
6981
|
-
channelSetupService
|
|
6982
|
-
);
|
|
6983
|
-
this.user = userService;
|
|
6984
|
-
this.extraction = extractionService;
|
|
6985
|
-
this.workflow = workflowsCoreService;
|
|
6986
|
-
this.schema = schemasService;
|
|
6987
|
-
this.notification = {
|
|
6988
|
-
channels: channelsService,
|
|
6989
|
-
settings: settingsService,
|
|
6990
|
-
setup: channelSetupService,
|
|
6991
|
-
configure: (options) => channelSetupService.setup(options),
|
|
6992
|
-
setupForWorkflow: (request) => channelSetupService.setupForWorkflow(request),
|
|
6993
|
-
setupForWorkspace: (request) => channelSetupService.setupForWorkspace(request)
|
|
6994
|
-
};
|
|
6995
|
-
this.validation = createValidationDomain(coreService, rulesService);
|
|
6996
|
-
this.crawler = createCrawlerDomain(this);
|
|
6997
|
-
this._realtimeConfig = config.realtimeConfig;
|
|
6998
|
-
if (config.enableRealtime && config.realtimeConfig?.autoConnect !== false) {
|
|
6999
|
-
this.connectRealtime();
|
|
7088
|
+
return {
|
|
7089
|
+
eventId: data.eventId,
|
|
7090
|
+
eventType: data.eventType,
|
|
7091
|
+
...data.workflowId != null && { workflowId: data.workflowId }
|
|
7092
|
+
};
|
|
7000
7093
|
}
|
|
7094
|
+
};
|
|
7095
|
+
}
|
|
7096
|
+
|
|
7097
|
+
// src/client/kadoa-client.ts
|
|
7098
|
+
var KadoaClient = class {
|
|
7099
|
+
constructor(config) {
|
|
7100
|
+
this._baseUrl = config.baseUrl ?? PUBLIC_API_URI;
|
|
7101
|
+
this._apiKey = config.apiKey;
|
|
7102
|
+
const timeout = config.timeout ?? 3e4;
|
|
7103
|
+
const headers = createSdkHeaders();
|
|
7104
|
+
this._axiosInstance = createAxiosInstance({ timeout, headers });
|
|
7105
|
+
this.apis = new ApiRegistry(
|
|
7106
|
+
this._apiKey,
|
|
7107
|
+
this._baseUrl,
|
|
7108
|
+
this._axiosInstance,
|
|
7109
|
+
headers
|
|
7110
|
+
);
|
|
7111
|
+
const domains = createClientDomains({ client: this });
|
|
7112
|
+
this.user = domains.user;
|
|
7113
|
+
this.extraction = domains.extraction;
|
|
7114
|
+
this.workflow = domains.workflow;
|
|
7115
|
+
this.schema = domains.schema;
|
|
7116
|
+
this.notification = domains.notification;
|
|
7117
|
+
this.validation = domains.validation;
|
|
7118
|
+
this.crawler = domains.crawler;
|
|
7119
|
+
this._extractionBuilderService = domains.extractionBuilderService;
|
|
7001
7120
|
checkForUpdates().catch(() => {
|
|
7002
7121
|
});
|
|
7003
7122
|
}
|
|
7004
|
-
/**
|
|
7005
|
-
* Get the underlying configuration
|
|
7006
|
-
*
|
|
7007
|
-
* @returns The configuration object
|
|
7008
|
-
*/
|
|
7009
|
-
get configuration() {
|
|
7010
|
-
return this._configuration;
|
|
7011
|
-
}
|
|
7012
7123
|
/**
|
|
7013
7124
|
* Get the axios instance
|
|
7014
7125
|
*
|
|
@@ -7033,14 +7144,6 @@ var KadoaClient = class {
|
|
|
7033
7144
|
get apiKey() {
|
|
7034
7145
|
return this._apiKey;
|
|
7035
7146
|
}
|
|
7036
|
-
/**
|
|
7037
|
-
* Get the timeout value
|
|
7038
|
-
*
|
|
7039
|
-
* @returns The timeout in milliseconds
|
|
7040
|
-
*/
|
|
7041
|
-
get timeout() {
|
|
7042
|
-
return this._timeout;
|
|
7043
|
-
}
|
|
7044
7147
|
/**
|
|
7045
7148
|
* Get the realtime connection (if enabled)
|
|
7046
7149
|
*/
|
|
@@ -7052,35 +7155,6 @@ var KadoaClient = class {
|
|
|
7052
7155
|
*
|
|
7053
7156
|
* @param options - Extraction options including URLs and optional extraction builder
|
|
7054
7157
|
* @returns PreparedExtraction that can be configured with notifications, monitoring, etc.
|
|
7055
|
-
*
|
|
7056
|
-
* @example Auto-detection
|
|
7057
|
-
* ```typescript
|
|
7058
|
-
* const extraction = await client.extract({
|
|
7059
|
-
* urls: ["https://example.com"],
|
|
7060
|
-
* name: "My Extraction"
|
|
7061
|
-
* }).create();
|
|
7062
|
-
* ```
|
|
7063
|
-
*
|
|
7064
|
-
* @example Raw extraction
|
|
7065
|
-
* ```typescript
|
|
7066
|
-
* const extraction = await client.extract({
|
|
7067
|
-
* urls: ["https://example.com"],
|
|
7068
|
-
* name: "My Extraction",
|
|
7069
|
-
* extraction: builder => builder.raw("markdown")
|
|
7070
|
-
* }).create();
|
|
7071
|
-
* ```
|
|
7072
|
-
*
|
|
7073
|
-
* @example Custom schema
|
|
7074
|
-
* ```typescript
|
|
7075
|
-
* const extraction = await client.extract({
|
|
7076
|
-
* urls: ["https://example.com"],
|
|
7077
|
-
* name: "My Extraction",
|
|
7078
|
-
* extraction: builder => builder
|
|
7079
|
-
* .schema("Product")
|
|
7080
|
-
* .field("title", "Product name", "STRING", { example: "Example" })
|
|
7081
|
-
* .field("price", "Product price", "CURRENCY")
|
|
7082
|
-
* }).create();
|
|
7083
|
-
* ```
|
|
7084
7158
|
*/
|
|
7085
7159
|
extract(options) {
|
|
7086
7160
|
return this._extractionBuilderService.extract(options);
|
|
@@ -7089,23 +7163,13 @@ var KadoaClient = class {
|
|
|
7089
7163
|
* Connect to realtime WebSocket server
|
|
7090
7164
|
* Creates a new connection if not already connected
|
|
7091
7165
|
*
|
|
7166
|
+
* @param options - Optional realtime tuning options (heartbeat/reconnect settings)
|
|
7092
7167
|
* @returns The Realtime instance
|
|
7093
7168
|
*/
|
|
7094
|
-
connectRealtime() {
|
|
7169
|
+
async connectRealtime(options) {
|
|
7095
7170
|
if (!this._realtime) {
|
|
7096
|
-
this._realtime = new Realtime({
|
|
7097
|
-
|
|
7098
|
-
...this._realtimeConfig?.reconnectDelay != null && {
|
|
7099
|
-
reconnectDelay: this._realtimeConfig.reconnectDelay
|
|
7100
|
-
},
|
|
7101
|
-
...this._realtimeConfig?.heartbeatInterval != null && {
|
|
7102
|
-
heartbeatInterval: this._realtimeConfig.heartbeatInterval
|
|
7103
|
-
},
|
|
7104
|
-
...this._realtimeConfig?.source && {
|
|
7105
|
-
source: this._realtimeConfig.source
|
|
7106
|
-
}
|
|
7107
|
-
});
|
|
7108
|
-
this._realtime.connect();
|
|
7171
|
+
this._realtime = new Realtime({ apiKey: this._apiKey, ...options });
|
|
7172
|
+
await this._realtime.connect();
|
|
7109
7173
|
}
|
|
7110
7174
|
return this._realtime;
|
|
7111
7175
|
}
|
|
@@ -7144,8 +7208,16 @@ var KadoaClient = class {
|
|
|
7144
7208
|
dispose() {
|
|
7145
7209
|
this.disconnectRealtime();
|
|
7146
7210
|
}
|
|
7211
|
+
/**
|
|
7212
|
+
* Alias for {@link dispose}. Included for common Node.js client ergonomics.
|
|
7213
|
+
*/
|
|
7214
|
+
close() {
|
|
7215
|
+
this.dispose();
|
|
7216
|
+
}
|
|
7147
7217
|
};
|
|
7148
7218
|
|
|
7219
|
+
exports.CrawlerConfigService = CrawlerConfigService;
|
|
7220
|
+
exports.CrawlerSessionService = CrawlerSessionService;
|
|
7149
7221
|
exports.DataFetcherService = DataFetcherService;
|
|
7150
7222
|
exports.ERROR_MESSAGES = ERROR_MESSAGES;
|
|
7151
7223
|
exports.EntityResolverService = EntityResolverService;
|
|
@@ -7160,6 +7232,7 @@ exports.NotificationChannelsService = NotificationChannelsService;
|
|
|
7160
7232
|
exports.NotificationSettingsEventTypeEnum = V5NotificationsSettingsGetEventTypeEnum;
|
|
7161
7233
|
exports.NotificationSettingsService = NotificationSettingsService;
|
|
7162
7234
|
exports.NotificationSetupService = NotificationSetupService;
|
|
7235
|
+
exports.PageStatus = PageStatus;
|
|
7163
7236
|
exports.Realtime = Realtime;
|
|
7164
7237
|
exports.SchemaBuilder = SchemaBuilder;
|
|
7165
7238
|
exports.SchemaFieldDataType = SchemaFieldDataType;
|
|
@@ -7170,6 +7243,7 @@ exports.UserService = UserService;
|
|
|
7170
7243
|
exports.ValidationCoreService = ValidationCoreService;
|
|
7171
7244
|
exports.ValidationRulesService = ValidationRulesService;
|
|
7172
7245
|
exports.WorkflowsCoreService = WorkflowsCoreService;
|
|
7246
|
+
exports.createCrawlerDomain = createCrawlerDomain;
|
|
7173
7247
|
exports.pollUntil = pollUntil;
|
|
7174
7248
|
exports.validateAdditionalData = validateAdditionalData;
|
|
7175
7249
|
//# sourceMappingURL=index.js.map
|