@kadoa/node-sdk 0.19.1 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.global.js +9 -31
- package/dist/browser/index.global.js.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +49 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -5617,6 +5617,7 @@ declare class ListWorkflowsRequest implements WorkflowsApiV4WorkflowsGetRequest
|
|
|
5617
5617
|
}
|
|
5618
5618
|
type CreateWorkflowRequest = WorkflowWithExistingSchema;
|
|
5619
5619
|
type CreateWorkflowWithCustomSchemaRequest = WorkflowWithEntityAndFields;
|
|
5620
|
+
|
|
5620
5621
|
/**
|
|
5621
5622
|
* Workflow response with SDK-curated enum types.
|
|
5622
5623
|
* Remaps generated enum fields to prevent type leakage.
|
|
@@ -6382,7 +6383,7 @@ declare class ExtractionBuilderService {
|
|
|
6382
6383
|
get workflowId(): string;
|
|
6383
6384
|
get jobId(): string;
|
|
6384
6385
|
constructor(workflowsCoreService: WorkflowsCoreService, entityResolverService: EntityResolverService, dataFetcherService: DataFetcherService, notificationSetupService: NotificationSetupService);
|
|
6385
|
-
extract({ urls, name, description, navigationMode, extraction, additionalData, bypassPreview, }: ExtractOptions): PreparedExtraction;
|
|
6386
|
+
extract({ urls, name, description, navigationMode, extraction, additionalData, bypassPreview, userPrompt, interval, schedules, location, }: ExtractOptions): PreparedExtraction;
|
|
6386
6387
|
withNotifications(options: Omit<NotificationOptions, "workflowId">): PreparedExtraction;
|
|
6387
6388
|
withMonitoring(options: WorkflowMonitoringConfig): PreparedExtraction;
|
|
6388
6389
|
bypassPreview(): PreparedExtraction;
|
package/dist/index.d.ts
CHANGED
|
@@ -5617,6 +5617,7 @@ declare class ListWorkflowsRequest implements WorkflowsApiV4WorkflowsGetRequest
|
|
|
5617
5617
|
}
|
|
5618
5618
|
type CreateWorkflowRequest = WorkflowWithExistingSchema;
|
|
5619
5619
|
type CreateWorkflowWithCustomSchemaRequest = WorkflowWithEntityAndFields;
|
|
5620
|
+
|
|
5620
5621
|
/**
|
|
5621
5622
|
* Workflow response with SDK-curated enum types.
|
|
5622
5623
|
* Remaps generated enum fields to prevent type leakage.
|
|
@@ -6382,7 +6383,7 @@ declare class ExtractionBuilderService {
|
|
|
6382
6383
|
get workflowId(): string;
|
|
6383
6384
|
get jobId(): string;
|
|
6384
6385
|
constructor(workflowsCoreService: WorkflowsCoreService, entityResolverService: EntityResolverService, dataFetcherService: DataFetcherService, notificationSetupService: NotificationSetupService);
|
|
6385
|
-
extract({ urls, name, description, navigationMode, extraction, additionalData, bypassPreview, }: ExtractOptions): PreparedExtraction;
|
|
6386
|
+
extract({ urls, name, description, navigationMode, extraction, additionalData, bypassPreview, userPrompt, interval, schedules, location, }: ExtractOptions): PreparedExtraction;
|
|
6386
6387
|
withNotifications(options: Omit<NotificationOptions, "workflowId">): PreparedExtraction;
|
|
6387
6388
|
withMonitoring(options: WorkflowMonitoringConfig): PreparedExtraction;
|
|
6388
6389
|
bypassPreview(): PreparedExtraction;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var url = require('url');
|
|
|
5
5
|
var createDebug = require('debug');
|
|
6
6
|
var esToolkit = require('es-toolkit');
|
|
7
7
|
var assert = require('assert');
|
|
8
|
-
var zod = require('zod');
|
|
9
8
|
var uuid = require('uuid');
|
|
10
9
|
|
|
11
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -4598,7 +4597,11 @@ var ExtractionBuilderService = class {
|
|
|
4598
4597
|
navigationMode,
|
|
4599
4598
|
extraction,
|
|
4600
4599
|
additionalData,
|
|
4601
|
-
bypassPreview
|
|
4600
|
+
bypassPreview,
|
|
4601
|
+
userPrompt,
|
|
4602
|
+
interval,
|
|
4603
|
+
schedules,
|
|
4604
|
+
location
|
|
4602
4605
|
}) {
|
|
4603
4606
|
let entity = "ai-detection";
|
|
4604
4607
|
if (extraction) {
|
|
@@ -4610,6 +4613,9 @@ var ExtractionBuilderService = class {
|
|
|
4610
4613
|
entity = builtSchema.entityName ? { name: builtSchema.entityName, fields: builtSchema.fields } : { fields: builtSchema.fields };
|
|
4611
4614
|
}
|
|
4612
4615
|
}
|
|
4616
|
+
if (userPrompt) {
|
|
4617
|
+
this._userPrompt = userPrompt;
|
|
4618
|
+
}
|
|
4613
4619
|
this._options = {
|
|
4614
4620
|
urls,
|
|
4615
4621
|
name,
|
|
@@ -4617,7 +4623,11 @@ var ExtractionBuilderService = class {
|
|
|
4617
4623
|
navigationMode: navigationMode || "single-page",
|
|
4618
4624
|
entity,
|
|
4619
4625
|
bypassPreview: bypassPreview ?? false,
|
|
4620
|
-
additionalData
|
|
4626
|
+
additionalData,
|
|
4627
|
+
userPrompt,
|
|
4628
|
+
interval,
|
|
4629
|
+
schedules,
|
|
4630
|
+
location
|
|
4621
4631
|
};
|
|
4622
4632
|
return this;
|
|
4623
4633
|
}
|
|
@@ -4679,15 +4689,12 @@ var ExtractionBuilderService = class {
|
|
|
4679
4689
|
fields: typeof entity === "object" && "fields" in entity ? entity.fields : []
|
|
4680
4690
|
};
|
|
4681
4691
|
} else {
|
|
4682
|
-
resolvedEntity = await this.entityResolverService.resolveEntity(
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
selectorMode: useSelectorMode
|
|
4689
|
-
}
|
|
4690
|
-
);
|
|
4692
|
+
resolvedEntity = await this.entityResolverService.resolveEntity(entity, {
|
|
4693
|
+
link: urls[0],
|
|
4694
|
+
location: this._options.location,
|
|
4695
|
+
navigationMode,
|
|
4696
|
+
selectorMode: useSelectorMode
|
|
4697
|
+
});
|
|
4691
4698
|
}
|
|
4692
4699
|
const workflow = await this.workflowsCoreService.create({
|
|
4693
4700
|
urls,
|
|
@@ -4815,13 +4822,33 @@ var NotificationChannelType = {
|
|
|
4815
4822
|
};
|
|
4816
4823
|
|
|
4817
4824
|
// src/domains/notifications/notification-channels.service.ts
|
|
4818
|
-
var
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
"
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
+
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
4826
|
+
function validateEmailChannelConfig(config) {
|
|
4827
|
+
const issues = [];
|
|
4828
|
+
if (!config.recipients?.length) {
|
|
4829
|
+
issues.push({ message: "Recipients are required for email channel" });
|
|
4830
|
+
} else {
|
|
4831
|
+
for (const email of config.recipients) {
|
|
4832
|
+
if (!EMAIL_REGEX.test(email)) {
|
|
4833
|
+
issues.push({ message: `Invalid email address: ${email}` });
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
if (config.from !== void 0) {
|
|
4838
|
+
if (!EMAIL_REGEX.test(config.from)) {
|
|
4839
|
+
issues.push({ message: `Invalid from email address: ${config.from}` });
|
|
4840
|
+
} else if (!config.from.endsWith("@kadoa.com")) {
|
|
4841
|
+
issues.push({ message: "From email address must end with @kadoa.com" });
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
if (issues.length > 0) {
|
|
4845
|
+
throw new KadoaSdkException("Invalid email channel config", {
|
|
4846
|
+
code: KadoaErrorCode.VALIDATION_ERROR,
|
|
4847
|
+
details: { issues }
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
return config;
|
|
4851
|
+
}
|
|
4825
4852
|
var _NotificationChannelsService = class _NotificationChannelsService {
|
|
4826
4853
|
constructor(notificationsApi, userService) {
|
|
4827
4854
|
this.api = notificationsApi;
|
|
@@ -4931,16 +4958,7 @@ var _NotificationChannelsService = class _NotificationChannelsService {
|
|
|
4931
4958
|
recipients = [user.email];
|
|
4932
4959
|
}
|
|
4933
4960
|
const config = esToolkit.merge(defaults, { recipients });
|
|
4934
|
-
|
|
4935
|
-
if (!result.success) {
|
|
4936
|
-
throw new KadoaSdkException(`Invalid email channel config`, {
|
|
4937
|
-
code: KadoaErrorCode.VALIDATION_ERROR,
|
|
4938
|
-
details: {
|
|
4939
|
-
issues: result.error.issues
|
|
4940
|
-
}
|
|
4941
|
-
});
|
|
4942
|
-
}
|
|
4943
|
-
return result.data;
|
|
4961
|
+
return validateEmailChannelConfig(config);
|
|
4944
4962
|
}
|
|
4945
4963
|
async buildSlackChannelConfig(defaults) {
|
|
4946
4964
|
return defaults;
|
|
@@ -5227,7 +5245,7 @@ var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
|
|
|
5227
5245
|
var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
|
|
5228
5246
|
|
|
5229
5247
|
// src/version.ts
|
|
5230
|
-
var SDK_VERSION = "0.19.
|
|
5248
|
+
var SDK_VERSION = "0.19.3";
|
|
5231
5249
|
var SDK_NAME = "kadoa-node-sdk";
|
|
5232
5250
|
var SDK_LANGUAGE = "node";
|
|
5233
5251
|
|
|
@@ -5530,7 +5548,7 @@ async function checkForUpdates() {
|
|
|
5530
5548
|
`\u26A0\uFE0F A new version of ${SDK_NAME} is available: ${latestVersion} (current: ${SDK_VERSION}). Update with: npm install ${PACKAGE_NAME}@latest`
|
|
5531
5549
|
);
|
|
5532
5550
|
}
|
|
5533
|
-
} catch
|
|
5551
|
+
} catch {
|
|
5534
5552
|
}
|
|
5535
5553
|
}
|
|
5536
5554
|
function isNewerVersion(version1, version2) {
|