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.
- package/dist/src/constants/Blocks.js +2 -1
- package/dist/src/constants/version.js +1 -1
- package/dist/src/models/Node.js +3 -0
- package/dist/src/models/Workflow.js +48 -0
- package/dist/types/src/constants/Blocks.d.ts +1 -0
- package/dist/types/src/constants/version.d.ts +1 -1
- package/dist/types/src/models/Node.d.ts +1 -0
- package/dist/types/src/models/Workflow.d.ts +14 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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,
|
package/dist/src/models/Node.js
CHANGED
|
@@ -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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
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
|
}
|