otomato-sdk 2.0.97 → 2.0.99

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.
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '2.0.97';
1
+ export const SDK_VERSION = '2.0.99';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -20,7 +20,7 @@ export class Action extends Node {
20
20
  state: json.state,
21
21
  });
22
22
  for (const [key, value] of Object.entries(json.parameters)) {
23
- if (!value) {
23
+ if (value === undefined || value === null) {
24
24
  continue;
25
25
  }
26
26
  switch (key) {
@@ -35,7 +35,7 @@ export class Action extends Node {
35
35
  for (const abiKey in abiParameters) {
36
36
  const enrichedParameter = enriched.block.parameters.find((param) => param.key === `abiParams.${abiKey}`);
37
37
  const paramType = enrichedParameter ? enrichedParameter.type : null;
38
- if (!abiParameters[abiKey] || !paramType)
38
+ if (abiParameters[abiKey] === undefined || abiParameters[abiKey] === null || paramType === null)
39
39
  continue;
40
40
  if (typeIsNumber(paramType) && typeof abiParameters[abiKey] === 'string' && abiParameters[abiKey].endsWith('n')) {
41
41
  action.setParams(abiKey, BigInt(abiParameters[abiKey].slice(0, -1)));
@@ -93,7 +93,7 @@ export class Node {
93
93
  if (validateType(param.type, value)) {
94
94
  this.parameters[key].value = value;
95
95
  }
96
- else if (!value || value === "") {
96
+ else if (value === undefined || value === null || value === "") {
97
97
  this.parameters[key].value = null;
98
98
  }
99
99
  else {
@@ -36,7 +36,7 @@ export class Trigger extends Node {
36
36
  state: json.state,
37
37
  });
38
38
  for (const [key, value] of Object.entries(json.parameters)) {
39
- if (!value) {
39
+ if (value === undefined || value === null) {
40
40
  continue;
41
41
  }
42
42
  switch (key) {
@@ -57,7 +57,7 @@ export class Trigger extends Node {
57
57
  for (const abiKey in abiParameters) {
58
58
  const enrichedParameter = enriched.block.parameters.find((param) => param.key === `abiParams.${abiKey}`);
59
59
  const paramType = enrichedParameter ? enrichedParameter.type : null;
60
- if (!abiParameters[abiKey] || !paramType)
60
+ if (abiParameters[abiKey] === undefined || abiParameters[abiKey] === null || paramType === null)
61
61
  continue;
62
62
  if (typeIsNumber(paramType) && typeof abiParameters[abiKey] === 'string' && abiParameters[abiKey].endsWith('n')) {
63
63
  trigger.setParams(abiKey, BigInt(abiParameters[abiKey].slice(0, -1)));
@@ -34,6 +34,9 @@ export class Workflow {
34
34
  if (typeof settings.period !== 'number' || settings.period <= 0) {
35
35
  throw new Error('Polling settings must include a positive period value');
36
36
  }
37
+ if (typeof settings.limit !== 'number' || settings.limit <= 0) {
38
+ throw new Error('Polling settings must include a positive limit value');
39
+ }
37
40
  }
38
41
  else if (settings.loopingType === WORKFLOW_LOOPING_TYPES.SUBSCRIPTION) {
39
42
  if (typeof settings.timeout !== 'number' || settings.timeout <= 0) {
@@ -6,6 +6,7 @@ export type WorkflowLoopingType = typeof WORKFLOW_LOOPING_TYPES[keyof typeof WOR
6
6
  export interface PollingSettings {
7
7
  loopingType: typeof WORKFLOW_LOOPING_TYPES.POLLING;
8
8
  period: number;
9
+ limit: number;
9
10
  }
10
11
  export interface SubscriptionSettings {
11
12
  loopingType: typeof WORKFLOW_LOOPING_TYPES.SUBSCRIPTION;
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.97";
1
+ export declare const SDK_VERSION = "2.0.99";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "2.0.97",
3
+ "version": "2.0.99",
4
4
  "description": "An SDK for building and managing automations on Otomato",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/types/src/index.d.ts",