otomato-sdk 2.0.93 → 2.0.95

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.
@@ -3379,7 +3379,7 @@ export const ACTIONS = {
3379
3379
  },
3380
3380
  "MATHEMATICS": {
3381
3381
  "description": "Perform basic mathematical operations between two numbers",
3382
- "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/mathematics.png",
3382
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/mathematics.svg",
3383
3383
  "MATHEMATICS": {
3384
3384
  "name": "Mathematics",
3385
3385
  "type": 6,
@@ -3594,6 +3594,7 @@ export const ACTIONS = {
3594
3594
  "TELEGRAM": {
3595
3595
  "description": "Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.",
3596
3596
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/telegram.jpeg",
3597
+ "comingSoon": true,
3597
3598
  "SEND_MESSAGE": {
3598
3599
  "name": "Send message",
3599
3600
  "type": 0,
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '2.0.93';
1
+ export const SDK_VERSION = '2.0.95';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -55,6 +55,9 @@ export class Node {
55
55
  getRef() {
56
56
  return this.ref;
57
57
  }
58
+ setRef(ref) {
59
+ this.ref = ref;
60
+ }
58
61
  getParentInfo() {
59
62
  return this.parentInfo;
60
63
  }
@@ -427,6 +427,54 @@ export class Workflow {
427
427
  getEndNodePositions() {
428
428
  return getEndNodePositions(this);
429
429
  }
430
+ /**
431
+ * Validates all internal variable references in node parameters.
432
+ * An internal variable reference is a string that starts with "nodeMap." followed by a node ref.
433
+ * Example: "nodeMap.1.output.amount" references node with ref "1"
434
+ *
435
+ * @returns Array of invalid parameter references with their node and parameter info
436
+ */
437
+ validateInternalVariables() {
438
+ const invalidReferences = [];
439
+ // Helper function to check if a value contains an internal variable reference
440
+ const checkValue = (value, nodeRef, nodeType, paramKey) => {
441
+ if (typeof value === 'string' && value.includes('nodeMap.')) {
442
+ // Extract the referenced node ref from the variable
443
+ // Example: from "nodeMap.1.output.amount" extract "1"
444
+ const match = value.match(/nodeMap\.(\d+)/);
445
+ if (match) {
446
+ const referencedNodeRef = match[1];
447
+ // Check if the referenced node exists in the workflow
448
+ const referencedNode = this.getNode(referencedNodeRef);
449
+ if (!referencedNode) {
450
+ invalidReferences.push({
451
+ nodeRef,
452
+ nodeType,
453
+ parameterKey: paramKey,
454
+ parameterValue: value,
455
+ referencedNodeRef
456
+ });
457
+ }
458
+ }
459
+ }
460
+ else if (typeof value === 'object' && value !== null) {
461
+ // Recursively check nested objects and arrays
462
+ Object.entries(value).forEach(([key, val]) => {
463
+ checkValue(val, nodeRef, nodeType, `${paramKey}.${key}`);
464
+ });
465
+ }
466
+ };
467
+ // Go through all nodes and their parameters
468
+ this.nodes.forEach(node => {
469
+ const parameters = node.getParameters();
470
+ if (parameters) {
471
+ Object.entries(parameters).forEach(([key, value]) => {
472
+ checkValue(value, node.getRef(), node.class, key);
473
+ });
474
+ }
475
+ });
476
+ return invalidReferences;
477
+ }
430
478
  static async fromJSON(json) {
431
479
  const workflow = new Workflow(json.name);
432
480
  workflow.id = json.id || null;
@@ -1567,6 +1567,7 @@ export declare const ACTIONS: {
1567
1567
  TELEGRAM: {
1568
1568
  description: string;
1569
1569
  image: string;
1570
+ comingSoon: boolean;
1570
1571
  SEND_MESSAGE: {
1571
1572
  name: string;
1572
1573
  type: number;
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.93";
1
+ export declare const SDK_VERSION = "2.0.95";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
@@ -52,6 +52,7 @@ export declare abstract class Node {
52
52
  setParams(key: string, value: any): void;
53
53
  setPosition(x: number, y: number): void;
54
54
  getRef(): string;
55
+ setRef(ref: string): void;
55
56
  getParentInfo(): ParentInfo | undefined;
56
57
  getState(): NodeState;
57
58
  protected setParameter(key: string, value: any): void;
@@ -122,5 +122,19 @@ export declare class Workflow {
122
122
  x: number;
123
123
  y: number;
124
124
  }[];
125
+ /**
126
+ * Validates all internal variable references in node parameters.
127
+ * An internal variable reference is a string that starts with "nodeMap." followed by a node ref.
128
+ * Example: "nodeMap.1.output.amount" references node with ref "1"
129
+ *
130
+ * @returns Array of invalid parameter references with their node and parameter info
131
+ */
132
+ validateInternalVariables(): Array<{
133
+ nodeRef: string;
134
+ nodeType: string;
135
+ parameterKey: string;
136
+ parameterValue: string;
137
+ referencedNodeRef: string;
138
+ }>;
125
139
  static fromJSON(json: any): Promise<Workflow>;
126
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "2.0.93",
3
+ "version": "2.0.95",
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",