otomato-sdk 2.0.26 → 2.0.28

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.26';
1
+ export const SDK_VERSION = '2.0.28';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -192,19 +192,6 @@ export class Workflow {
192
192
  return this.notes.map(note => note.toJSON());
193
193
  }
194
194
  toJSON() {
195
- // 1. Create a new Workflow instance, copying only the nodes, edges, and notes
196
- const clonedWorkflow = new Workflow(this.name, // same name
197
- [...this.nodes], // shallow copy of nodes
198
- [...this.edges] // shallow copy of edges
199
- );
200
- clonedWorkflow.notes = [...this.notes]; // shallow copy of notes array
201
- // 2. Identify any empty nodes (blockId === 0), then delete them from the clone
202
- const emptyNodes = clonedWorkflow.nodes.filter(node => node.blockId === 0);
203
- for (const emptyNode of emptyNodes) {
204
- clonedWorkflow.deleteNode(emptyNode);
205
- }
206
- // 3. Return JSON using 'this' for top-level info (id, state, etc.),
207
- // but using the clonedWorkflow's nodes, edges, and notes
208
195
  return {
209
196
  id: this.id,
210
197
  name: this.name,
@@ -212,9 +199,9 @@ export class Workflow {
212
199
  dateCreated: this.dateCreated,
213
200
  dateModified: this.dateModified,
214
201
  executionId: this.executionId,
215
- nodes: clonedWorkflow.nodes.map(node => node.toJSON()),
216
- edges: clonedWorkflow.edges.map(edge => edge.toJSON()),
217
- notes: clonedWorkflow.getNotes(),
202
+ nodes: this.nodes.map(node => node.toJSON()),
203
+ edges: this.edges.map(edge => edge.toJSON()),
204
+ notes: this.getNotes(),
218
205
  };
219
206
  }
220
207
  create() {
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.26";
1
+ export declare const SDK_VERSION = "2.0.28";
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.26",
3
+ "version": "2.0.28",
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",