@kadoa/node-sdk 0.16.1 → 0.17.0

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.js CHANGED
@@ -1338,10 +1338,11 @@ var NotificationsApiAxiosParamCreator = function(configuration) {
1338
1338
  *
1339
1339
  * @summary Retrieve a specific notification channel
1340
1340
  * @param {string} channelId Channel ID
1341
+ * @param {boolean} [includeConfigurations] Include linked notification configurations with workflow information
1341
1342
  * @param {*} [options] Override http request option.
1342
1343
  * @throws {RequiredError}
1343
1344
  */
1344
- v5NotificationsChannelsChannelIdGet: async (channelId, options = {}) => {
1345
+ v5NotificationsChannelsChannelIdGet: async (channelId, includeConfigurations, options = {}) => {
1345
1346
  assertParamExists("v5NotificationsChannelsChannelIdGet", "channelId", channelId);
1346
1347
  const localVarPath = `/v5/notifications/channels/{channelId}`.replace(`{${"channelId"}}`, encodeURIComponent(String(channelId)));
1347
1348
  const localVarUrlObj = new url.URL(localVarPath, DUMMY_BASE_URL);
@@ -1353,6 +1354,9 @@ var NotificationsApiAxiosParamCreator = function(configuration) {
1353
1354
  const localVarHeaderParameter = {};
1354
1355
  const localVarQueryParameter = {};
1355
1356
  await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration);
1357
+ if (includeConfigurations !== void 0) {
1358
+ localVarQueryParameter["includeConfigurations"] = includeConfigurations;
1359
+ }
1356
1360
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1357
1361
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1358
1362
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -1396,10 +1400,11 @@ var NotificationsApiAxiosParamCreator = function(configuration) {
1396
1400
  *
1397
1401
  * @summary Retrieve all notification channels
1398
1402
  * @param {string} [workflowId] Workflow ID (optional, if provided returns channels linked to this workflow)
1403
+ * @param {boolean} [includeConfigurations] Include linked notification configurations with workflow information
1399
1404
  * @param {*} [options] Override http request option.
1400
1405
  * @throws {RequiredError}
1401
1406
  */
1402
- v5NotificationsChannelsGet: async (workflowId, options = {}) => {
1407
+ v5NotificationsChannelsGet: async (workflowId, includeConfigurations, options = {}) => {
1403
1408
  const localVarPath = `/v5/notifications/channels`;
1404
1409
  const localVarUrlObj = new url.URL(localVarPath, DUMMY_BASE_URL);
1405
1410
  let baseOptions;
@@ -1413,6 +1418,9 @@ var NotificationsApiAxiosParamCreator = function(configuration) {
1413
1418
  if (workflowId !== void 0) {
1414
1419
  localVarQueryParameter["workflowId"] = workflowId;
1415
1420
  }
1421
+ if (includeConfigurations !== void 0) {
1422
+ localVarQueryParameter["includeConfigurations"] = includeConfigurations;
1423
+ }
1416
1424
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1417
1425
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1418
1426
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
@@ -1749,11 +1757,12 @@ var NotificationsApiFp = function(configuration) {
1749
1757
  *
1750
1758
  * @summary Retrieve a specific notification channel
1751
1759
  * @param {string} channelId Channel ID
1760
+ * @param {boolean} [includeConfigurations] Include linked notification configurations with workflow information
1752
1761
  * @param {*} [options] Override http request option.
1753
1762
  * @throws {RequiredError}
1754
1763
  */
1755
- async v5NotificationsChannelsChannelIdGet(channelId, options) {
1756
- const localVarAxiosArgs = await localVarAxiosParamCreator.v5NotificationsChannelsChannelIdGet(channelId, options);
1764
+ async v5NotificationsChannelsChannelIdGet(channelId, includeConfigurations, options) {
1765
+ const localVarAxiosArgs = await localVarAxiosParamCreator.v5NotificationsChannelsChannelIdGet(channelId, includeConfigurations, options);
1757
1766
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1758
1767
  const localVarOperationServerBasePath = operationServerMap["NotificationsApi.v5NotificationsChannelsChannelIdGet"]?.[localVarOperationServerIndex]?.url;
1759
1768
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
@@ -1776,11 +1785,12 @@ var NotificationsApiFp = function(configuration) {
1776
1785
  *
1777
1786
  * @summary Retrieve all notification channels
1778
1787
  * @param {string} [workflowId] Workflow ID (optional, if provided returns channels linked to this workflow)
1788
+ * @param {boolean} [includeConfigurations] Include linked notification configurations with workflow information
1779
1789
  * @param {*} [options] Override http request option.
1780
1790
  * @throws {RequiredError}
1781
1791
  */
1782
- async v5NotificationsChannelsGet(workflowId, options) {
1783
- const localVarAxiosArgs = await localVarAxiosParamCreator.v5NotificationsChannelsGet(workflowId, options);
1792
+ async v5NotificationsChannelsGet(workflowId, includeConfigurations, options) {
1793
+ const localVarAxiosArgs = await localVarAxiosParamCreator.v5NotificationsChannelsGet(workflowId, includeConfigurations, options);
1784
1794
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
1785
1795
  const localVarOperationServerBasePath = operationServerMap["NotificationsApi.v5NotificationsChannelsGet"]?.[localVarOperationServerIndex]?.url;
1786
1796
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2__default.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
@@ -1942,7 +1952,7 @@ var NotificationsApi = class extends BaseAPI {
1942
1952
  * @throws {RequiredError}
1943
1953
  */
1944
1954
  v5NotificationsChannelsChannelIdGet(requestParameters, options) {
1945
- return NotificationsApiFp(this.configuration).v5NotificationsChannelsChannelIdGet(requestParameters.channelId, options).then((request) => request(this.axios, this.basePath));
1955
+ return NotificationsApiFp(this.configuration).v5NotificationsChannelsChannelIdGet(requestParameters.channelId, requestParameters.includeConfigurations, options).then((request) => request(this.axios, this.basePath));
1946
1956
  }
1947
1957
  /**
1948
1958
  *
@@ -1962,7 +1972,7 @@ var NotificationsApi = class extends BaseAPI {
1962
1972
  * @throws {RequiredError}
1963
1973
  */
1964
1974
  v5NotificationsChannelsGet(requestParameters = {}, options) {
1965
- return NotificationsApiFp(this.configuration).v5NotificationsChannelsGet(requestParameters.workflowId, options).then((request) => request(this.axios, this.basePath));
1975
+ return NotificationsApiFp(this.configuration).v5NotificationsChannelsGet(requestParameters.workflowId, requestParameters.includeConfigurations, options).then((request) => request(this.axios, this.basePath));
1966
1976
  }
1967
1977
  /**
1968
1978
  *
@@ -3642,6 +3652,7 @@ var Configuration = class {
3642
3652
  this.username = param.username;
3643
3653
  this.password = param.password;
3644
3654
  this.accessToken = param.accessToken;
3655
+ this.awsv4 = param.awsv4;
3645
3656
  this.basePath = param.basePath;
3646
3657
  this.serverIndex = param.serverIndex;
3647
3658
  this.baseOptions = {
@@ -4324,7 +4335,6 @@ var DEFAULT_OPTIONS = {
4324
4335
  maxWaitTime: 3e5,
4325
4336
  navigationMode: "single-page",
4326
4337
  location: { type: "auto" },
4327
- name: "Untitled Workflow",
4328
4338
  bypassPreview: true,
4329
4339
  autoStart: true
4330
4340
  };
@@ -5168,7 +5178,7 @@ var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
5168
5178
  var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
5169
5179
 
5170
5180
  // src/version.ts
5171
- var SDK_VERSION = "0.16.1";
5181
+ var SDK_VERSION = "0.17.0";
5172
5182
  var SDK_NAME = "kadoa-node-sdk";
5173
5183
  var SDK_LANGUAGE = "node";
5174
5184
 
@@ -5184,16 +5194,7 @@ var Realtime = class {
5184
5194
  this.eventListeners = /* @__PURE__ */ new Set();
5185
5195
  this.connectionListeners = /* @__PURE__ */ new Set();
5186
5196
  this.errorListeners = /* @__PURE__ */ new Set();
5187
- if (!config.teamApiKey.startsWith("tk-")) {
5188
- throw new KadoaSdkException(
5189
- "Realtime connection requires a team API key (starting with 'tk-'). Provided key does not appear to be a team API key.",
5190
- {
5191
- code: "AUTH_ERROR",
5192
- details: { providedKeyPrefix: config.teamApiKey.substring(0, 3) }
5193
- }
5194
- );
5195
- }
5196
- this.teamApiKey = config.teamApiKey;
5197
+ this.apiKey = config.apiKey;
5197
5198
  this.heartbeatInterval = config.heartbeatInterval || 1e4;
5198
5199
  this.reconnectDelay = config.reconnectDelay || 5e3;
5199
5200
  this.missedHeartbeatsLimit = config.missedHeartbeatsLimit || 3e4;
@@ -5206,7 +5207,7 @@ var Realtime = class {
5206
5207
  method: "POST",
5207
5208
  headers: {
5208
5209
  "Content-Type": "application/json",
5209
- "x-api-key": `${this.teamApiKey}`,
5210
+ "x-api-key": `${this.apiKey}`,
5210
5211
  "x-sdk-version": SDK_VERSION
5211
5212
  }
5212
5213
  });
@@ -5457,6 +5458,48 @@ function validateAdditionalData(additionalData) {
5457
5458
  }
5458
5459
  }
5459
5460
 
5461
+ // src/runtime/utils/version-check.ts
5462
+ var NPM_REGISTRY_URL = "https://registry.npmjs.org";
5463
+ var PACKAGE_NAME = "@kadoa/node-sdk";
5464
+ async function checkForUpdates() {
5465
+ try {
5466
+ const response = await fetch(`${NPM_REGISTRY_URL}/${PACKAGE_NAME}`, {
5467
+ headers: {
5468
+ Accept: "application/json"
5469
+ }
5470
+ });
5471
+ if (!response.ok) {
5472
+ return;
5473
+ }
5474
+ const data = await response.json();
5475
+ const latestVersion = data["dist-tags"]?.latest;
5476
+ if (!latestVersion) {
5477
+ return;
5478
+ }
5479
+ if (isNewerVersion(latestVersion, SDK_VERSION)) {
5480
+ console.warn(
5481
+ `\u26A0\uFE0F A new version of ${SDK_NAME} is available: ${latestVersion} (current: ${SDK_VERSION}). Update with: npm install ${PACKAGE_NAME}@latest`
5482
+ );
5483
+ }
5484
+ } catch (error) {
5485
+ }
5486
+ }
5487
+ function isNewerVersion(version1, version2) {
5488
+ const v1Parts = version1.split(".").map(Number);
5489
+ const v2Parts = version2.split(".").map(Number);
5490
+ for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
5491
+ const v1Part = v1Parts[i] || 0;
5492
+ const v2Part = v2Parts[i] || 0;
5493
+ if (v1Part > v2Part) {
5494
+ return true;
5495
+ }
5496
+ if (v1Part < v2Part) {
5497
+ return false;
5498
+ }
5499
+ }
5500
+ return false;
5501
+ }
5502
+
5460
5503
  // src/domains/validation/validation-core.service.ts
5461
5504
  var ValidationCoreService = class {
5462
5505
  constructor(client) {
@@ -5739,13 +5782,14 @@ var WorkflowsCoreService = class {
5739
5782
  }
5740
5783
  async create(input) {
5741
5784
  validateAdditionalData(input.additionalData);
5785
+ const domainName = new URL(input.urls[0]).hostname;
5742
5786
  const request = {
5743
5787
  urls: input.urls,
5744
- name: input.name,
5788
+ name: input.name ?? domainName,
5745
5789
  schemaId: input.schemaId,
5746
5790
  description: input.description,
5747
5791
  navigationMode: input.navigationMode,
5748
- entity: input.entity,
5792
+ entity: input.entity ?? "",
5749
5793
  fields: input.fields,
5750
5794
  bypassPreview: input.bypassPreview ?? true,
5751
5795
  tags: input.tags,
@@ -6027,6 +6071,8 @@ var KadoaClient = class {
6027
6071
  if (config.enableRealtime && config.realtimeConfig?.autoConnect !== false) {
6028
6072
  this.connectRealtime();
6029
6073
  }
6074
+ checkForUpdates().catch(() => {
6075
+ });
6030
6076
  }
6031
6077
  /**
6032
6078
  * Get the underlying configuration
@@ -6120,7 +6166,7 @@ var KadoaClient = class {
6120
6166
  */
6121
6167
  connectRealtime() {
6122
6168
  if (!this._realtime) {
6123
- this._realtime = new Realtime({ teamApiKey: this._apiKey });
6169
+ this._realtime = new Realtime({ apiKey: this._apiKey });
6124
6170
  this._realtime.connect();
6125
6171
  }
6126
6172
  return this._realtime;
@@ -6180,6 +6226,8 @@ exports.Realtime = Realtime;
6180
6226
  exports.SchemaBuilder = SchemaBuilder;
6181
6227
  exports.SchemaFieldDataType = SchemaFieldDataType;
6182
6228
  exports.SchemasService = SchemasService;
6229
+ exports.TERMINAL_JOB_STATES = TERMINAL_JOB_STATES;
6230
+ exports.TERMINAL_RUN_STATES = TERMINAL_RUN_STATES;
6183
6231
  exports.UserService = UserService;
6184
6232
  exports.ValidationCoreService = ValidationCoreService;
6185
6233
  exports.ValidationRulesService = ValidationRulesService;