@kadoa/node-sdk 0.19.2 → 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/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.
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.
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 }; }
@@ -4823,13 +4822,33 @@ var NotificationChannelType = {
4823
4822
  };
4824
4823
 
4825
4824
  // src/domains/notifications/notification-channels.service.ts
4826
- var emailChannelConfigSchema = zod.z.object({
4827
- recipients: zod.z.array(zod.z.email()).min(1, "Recipients are required for email channel"),
4828
- from: zod.z.email().refine(
4829
- (email) => email.endsWith("@kadoa.com"),
4830
- "From email address must end with @kadoa.com"
4831
- ).optional()
4832
- });
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
+ }
4833
4852
  var _NotificationChannelsService = class _NotificationChannelsService {
4834
4853
  constructor(notificationsApi, userService) {
4835
4854
  this.api = notificationsApi;
@@ -4939,16 +4958,7 @@ var _NotificationChannelsService = class _NotificationChannelsService {
4939
4958
  recipients = [user.email];
4940
4959
  }
4941
4960
  const config = esToolkit.merge(defaults, { recipients });
4942
- const result = emailChannelConfigSchema.safeParse(config);
4943
- if (!result.success) {
4944
- throw new KadoaSdkException(`Invalid email channel config`, {
4945
- code: KadoaErrorCode.VALIDATION_ERROR,
4946
- details: {
4947
- issues: result.error.issues
4948
- }
4949
- });
4950
- }
4951
- return result.data;
4961
+ return validateEmailChannelConfig(config);
4952
4962
  }
4953
4963
  async buildSlackChannelConfig(defaults) {
4954
4964
  return defaults;
@@ -5235,7 +5245,7 @@ var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
5235
5245
  var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
5236
5246
 
5237
5247
  // src/version.ts
5238
- var SDK_VERSION = "0.19.2";
5248
+ var SDK_VERSION = "0.19.3";
5239
5249
  var SDK_NAME = "kadoa-node-sdk";
5240
5250
  var SDK_LANGUAGE = "node";
5241
5251
 
@@ -5538,7 +5548,7 @@ async function checkForUpdates() {
5538
5548
  `\u26A0\uFE0F A new version of ${SDK_NAME} is available: ${latestVersion} (current: ${SDK_VERSION}). Update with: npm install ${PACKAGE_NAME}@latest`
5539
5549
  );
5540
5550
  }
5541
- } catch (error) {
5551
+ } catch {
5542
5552
  }
5543
5553
  }
5544
5554
  function isNewerVersion(version1, version2) {