@gravity-platform/flow 1.1.3

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.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -0
  3. package/dist/ClientStorage/index.d.ts +2 -0
  4. package/dist/ClientStorage/index.d.ts.map +1 -0
  5. package/dist/ClientStorage/index.js +6 -0
  6. package/dist/ClientStorage/index.js.map +1 -0
  7. package/dist/ClientStorage/node/executor.d.ts +7 -0
  8. package/dist/ClientStorage/node/executor.d.ts.map +1 -0
  9. package/dist/ClientStorage/node/executor.js +32 -0
  10. package/dist/ClientStorage/node/executor.js.map +1 -0
  11. package/dist/ClientStorage/node/index.d.ts +10 -0
  12. package/dist/ClientStorage/node/index.d.ts.map +1 -0
  13. package/dist/ClientStorage/node/index.js +64 -0
  14. package/dist/ClientStorage/node/index.js.map +1 -0
  15. package/dist/ClientStorage/util/types.d.ts +12 -0
  16. package/dist/ClientStorage/util/types.d.ts.map +1 -0
  17. package/dist/ClientStorage/util/types.js +3 -0
  18. package/dist/ClientStorage/util/types.js.map +1 -0
  19. package/dist/Code/executor.d.ts +24 -0
  20. package/dist/Code/executor.d.ts.map +1 -0
  21. package/dist/Code/executor.js +70 -0
  22. package/dist/Code/executor.js.map +1 -0
  23. package/dist/Code/index.d.ts +14 -0
  24. package/dist/Code/index.d.ts.map +1 -0
  25. package/dist/Code/index.js +79 -0
  26. package/dist/Code/index.js.map +1 -0
  27. package/dist/Code/utils/hashUtils.d.ts +18 -0
  28. package/dist/Code/utils/hashUtils.d.ts.map +1 -0
  29. package/dist/Code/utils/hashUtils.js +40 -0
  30. package/dist/Code/utils/hashUtils.js.map +1 -0
  31. package/dist/Context/executor.d.ts +16 -0
  32. package/dist/Context/executor.d.ts.map +1 -0
  33. package/dist/Context/executor.js +47 -0
  34. package/dist/Context/executor.js.map +1 -0
  35. package/dist/Context/index.d.ts +14 -0
  36. package/dist/Context/index.d.ts.map +1 -0
  37. package/dist/Context/index.js +45 -0
  38. package/dist/Context/index.js.map +1 -0
  39. package/dist/FieldValidator/executor.d.ts +40 -0
  40. package/dist/FieldValidator/executor.d.ts.map +1 -0
  41. package/dist/FieldValidator/executor.js +152 -0
  42. package/dist/FieldValidator/executor.js.map +1 -0
  43. package/dist/FieldValidator/index.d.ts +18 -0
  44. package/dist/FieldValidator/index.d.ts.map +1 -0
  45. package/dist/FieldValidator/index.js +80 -0
  46. package/dist/FieldValidator/index.js.map +1 -0
  47. package/dist/FieldValidator/utils/types.d.ts +25 -0
  48. package/dist/FieldValidator/utils/types.d.ts.map +1 -0
  49. package/dist/FieldValidator/utils/types.js +7 -0
  50. package/dist/FieldValidator/utils/types.js.map +1 -0
  51. package/dist/IfElse/executor.d.ts +24 -0
  52. package/dist/IfElse/executor.d.ts.map +1 -0
  53. package/dist/IfElse/executor.js +54 -0
  54. package/dist/IfElse/executor.js.map +1 -0
  55. package/dist/IfElse/index.d.ts +14 -0
  56. package/dist/IfElse/index.d.ts.map +1 -0
  57. package/dist/IfElse/index.js +61 -0
  58. package/dist/IfElse/index.js.map +1 -0
  59. package/dist/Loop/executor.d.ts +45 -0
  60. package/dist/Loop/executor.d.ts.map +1 -0
  61. package/dist/Loop/executor.js +182 -0
  62. package/dist/Loop/executor.js.map +1 -0
  63. package/dist/Loop/index.d.ts +15 -0
  64. package/dist/Loop/index.d.ts.map +1 -0
  65. package/dist/Loop/index.js +92 -0
  66. package/dist/Loop/index.js.map +1 -0
  67. package/dist/Loop/utils/index.d.ts +5 -0
  68. package/dist/Loop/utils/index.d.ts.map +1 -0
  69. package/dist/Loop/utils/index.js +21 -0
  70. package/dist/Loop/utils/index.js.map +1 -0
  71. package/dist/Loop/utils/types.d.ts +24 -0
  72. package/dist/Loop/utils/types.d.ts.map +1 -0
  73. package/dist/Loop/utils/types.js +6 -0
  74. package/dist/Loop/utils/types.js.map +1 -0
  75. package/dist/MCP/node/executor.d.ts +14 -0
  76. package/dist/MCP/node/executor.d.ts.map +1 -0
  77. package/dist/MCP/node/executor.js +99 -0
  78. package/dist/MCP/node/executor.js.map +1 -0
  79. package/dist/MCP/node/index.d.ts +10 -0
  80. package/dist/MCP/node/index.d.ts.map +1 -0
  81. package/dist/MCP/node/index.js +73 -0
  82. package/dist/MCP/node/index.js.map +1 -0
  83. package/dist/MCP/util/types.d.ts +62 -0
  84. package/dist/MCP/util/types.d.ts.map +1 -0
  85. package/dist/MCP/util/types.js +6 -0
  86. package/dist/MCP/util/types.js.map +1 -0
  87. package/dist/Note/executor.d.ts +16 -0
  88. package/dist/Note/executor.d.ts.map +1 -0
  89. package/dist/Note/executor.js +20 -0
  90. package/dist/Note/executor.js.map +1 -0
  91. package/dist/Note/index.d.ts +14 -0
  92. package/dist/Note/index.d.ts.map +1 -0
  93. package/dist/Note/index.js +82 -0
  94. package/dist/Note/index.js.map +1 -0
  95. package/dist/Relay/executor.d.ts +15 -0
  96. package/dist/Relay/executor.d.ts.map +1 -0
  97. package/dist/Relay/executor.js +68 -0
  98. package/dist/Relay/executor.js.map +1 -0
  99. package/dist/Relay/index.d.ts +15 -0
  100. package/dist/Relay/index.d.ts.map +1 -0
  101. package/dist/Relay/index.js +58 -0
  102. package/dist/Relay/index.js.map +1 -0
  103. package/dist/SendObject/index.d.ts +2 -0
  104. package/dist/SendObject/index.d.ts.map +1 -0
  105. package/dist/SendObject/index.js +6 -0
  106. package/dist/SendObject/index.js.map +1 -0
  107. package/dist/SendObject/node/executor.d.ts +7 -0
  108. package/dist/SendObject/node/executor.d.ts.map +1 -0
  109. package/dist/SendObject/node/executor.js +57 -0
  110. package/dist/SendObject/node/executor.js.map +1 -0
  111. package/dist/SendObject/node/index.d.ts +10 -0
  112. package/dist/SendObject/node/index.d.ts.map +1 -0
  113. package/dist/SendObject/node/index.js +64 -0
  114. package/dist/SendObject/node/index.js.map +1 -0
  115. package/dist/SendObject/service/publishObject.d.ts +21 -0
  116. package/dist/SendObject/service/publishObject.d.ts.map +1 -0
  117. package/dist/SendObject/service/publishObject.js +55 -0
  118. package/dist/SendObject/service/publishObject.js.map +1 -0
  119. package/dist/SendObject/util/types.d.ts +11 -0
  120. package/dist/SendObject/util/types.d.ts.map +1 -0
  121. package/dist/SendObject/util/types.js +3 -0
  122. package/dist/SendObject/util/types.js.map +1 -0
  123. package/dist/Suggestions/executor.d.ts +36 -0
  124. package/dist/Suggestions/executor.d.ts.map +1 -0
  125. package/dist/Suggestions/executor.js +116 -0
  126. package/dist/Suggestions/executor.js.map +1 -0
  127. package/dist/Suggestions/index.d.ts +14 -0
  128. package/dist/Suggestions/index.d.ts.map +1 -0
  129. package/dist/Suggestions/index.js +75 -0
  130. package/dist/Suggestions/index.js.map +1 -0
  131. package/dist/UMAP/executor.d.ts +20 -0
  132. package/dist/UMAP/executor.d.ts.map +1 -0
  133. package/dist/UMAP/executor.js +103 -0
  134. package/dist/UMAP/executor.js.map +1 -0
  135. package/dist/UMAP/index.d.ts +14 -0
  136. package/dist/UMAP/index.d.ts.map +1 -0
  137. package/dist/UMAP/index.js +91 -0
  138. package/dist/UMAP/index.js.map +1 -0
  139. package/dist/index.d.ts +3 -0
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +75 -0
  142. package/dist/index.js.map +1 -0
  143. package/dist/shared/platform.d.ts +14 -0
  144. package/dist/shared/platform.d.ts.map +1 -0
  145. package/dist/shared/platform.js +24 -0
  146. package/dist/shared/platform.js.map +1 -0
  147. package/package.json +26 -0
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ /**
3
+ * Loop node implementation for GravityWorkflow
4
+ *
5
+ * State machine-based implementation that processes items one at a time.
6
+ * Waits for continue signals to advance through the array.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LoopNode = void 0;
10
+ const platform_1 = require("../shared/platform");
11
+ class LoopNode extends platform_1.CallbackNode {
12
+ constructor() {
13
+ super("Loop");
14
+ }
15
+ /**
16
+ * Validate the Loop configuration
17
+ */
18
+ async validateConfig(config) {
19
+ return { success: true };
20
+ }
21
+ /**
22
+ * Initialize state for the loop
23
+ */
24
+ initializeState(inputs) {
25
+ // Initialize with empty state - items will come from resolved config in handleEvent
26
+ this.logger.info(`Loop: initializeState called`);
27
+ return {
28
+ items: [],
29
+ currentIndex: 0,
30
+ isComplete: false,
31
+ collectedItems: [],
32
+ };
33
+ }
34
+ /**
35
+ * Handle events and update state
36
+ */
37
+ async handleEvent(event, state, emit) {
38
+ const { inputs, config } = event;
39
+ const resolvedConfig = config;
40
+ // Log what we received
41
+ this.logger.info(`Loop handleEvent called:`, {
42
+ eventType: event.type,
43
+ hasConfig: !!resolvedConfig,
44
+ configItemsLength: resolvedConfig?.items?.length || 0,
45
+ hasInputs: !!inputs,
46
+ inputKeys: inputs ? Object.keys(inputs) : [],
47
+ stateItemsLength: state.items.length,
48
+ currentIndex: state.currentIndex,
49
+ });
50
+ // Handle different input signals independently
51
+ // 1. Check if this is a "next" signal to advance iteration
52
+ if (inputs?.next !== undefined) {
53
+ this.logger.info(`Loop: Received 'next' signal`);
54
+ // We need items in state to iterate
55
+ if (!state.items || state.items.length === 0) {
56
+ this.logger.warn(`Loop: Received 'next' but no items in state`);
57
+ return state;
58
+ }
59
+ // Check if we've exhausted all items
60
+ if (state.currentIndex >= state.items.length) {
61
+ this.logger.info(`Loop: No more items to process, emitting finished signal`);
62
+ // Build finished object with collected items if any
63
+ const finishedOutput = { finished: true };
64
+ if (state.collectedItems.length > 0) {
65
+ finishedOutput.collected = state.collectedItems;
66
+ this.logger.info(`Loop: Emitting ${state.collectedItems.length} collected items`);
67
+ }
68
+ emit({
69
+ __outputs: {
70
+ finished: finishedOutput,
71
+ },
72
+ });
73
+ return {
74
+ ...state,
75
+ isComplete: true,
76
+ };
77
+ }
78
+ // Process next item if available
79
+ if (state.currentIndex < state.items.length) {
80
+ const currentItem = state.items[state.currentIndex];
81
+ const isLastItem = state.currentIndex === state.items.length - 1;
82
+ this.logger.info(`Loop: Outputting item ${state.currentIndex}/${state.items.length - 1}`);
83
+ // Check if we should collect items from this iteration
84
+ let newCollectedItems = state.collectedItems;
85
+ if (resolvedConfig?.collectItems && inputs?.next) {
86
+ // The collectItems template should already be resolved to an object by the workflow engine
87
+ const collectedItem = resolvedConfig.collectItems;
88
+ if (collectedItem && typeof collectedItem === "object") {
89
+ newCollectedItems = [...state.collectedItems, collectedItem];
90
+ this.logger.info(`Loop: Collected item ${newCollectedItems.length}`);
91
+ }
92
+ }
93
+ // Emit the item without finished signal
94
+ emit({
95
+ __outputs: {
96
+ item: currentItem,
97
+ index: state.currentIndex,
98
+ },
99
+ });
100
+ return {
101
+ ...state,
102
+ currentIndex: state.currentIndex + 1,
103
+ collectedItems: newCollectedItems,
104
+ // Never mark complete here - only when next signal finds no more items
105
+ };
106
+ }
107
+ }
108
+ // 2. Check if we have items in state already (from previous SPAWN)
109
+ if (state.items.length > 0) {
110
+ this.logger.info(`Loop: Using ${state.items.length} items from state`);
111
+ }
112
+ // 3. Check if we got new items from config (resolved from SPAWN input)
113
+ else if (resolvedConfig?.items !== undefined && Array.isArray(resolvedConfig.items)) {
114
+ // New items arrived via config (resolved from SPAWN input), save to state
115
+ this.logger.info(`Loop: Initialized with ${resolvedConfig.items.length} items from config`);
116
+ // Save items to state for future events
117
+ state = {
118
+ ...state,
119
+ items: resolvedConfig.items,
120
+ };
121
+ // Check if we have an empty array - immediately signal completion
122
+ if (resolvedConfig.items.length === 0) {
123
+ this.logger.info(`Loop: Received empty array, emitting finished signal`);
124
+ emit({
125
+ __outputs: {
126
+ finished: {
127
+ finished: true,
128
+ collected: [], // Empty array if no items to process
129
+ },
130
+ },
131
+ });
132
+ return {
133
+ items: resolvedConfig.items,
134
+ currentIndex: 0,
135
+ isComplete: true,
136
+ collectedItems: [],
137
+ };
138
+ }
139
+ // If we have items, emit the first one immediately
140
+ if (resolvedConfig.items.length > 0) {
141
+ const firstItem = resolvedConfig.items[0];
142
+ const isLastItem = resolvedConfig.items.length === 1;
143
+ this.logger.info(`Loop: Outputting first item (0/${resolvedConfig.items.length - 1})`);
144
+ // Only emit the item, never finished with items
145
+ emit({
146
+ __outputs: {
147
+ item: firstItem,
148
+ index: 0,
149
+ },
150
+ });
151
+ return {
152
+ items: resolvedConfig.items,
153
+ currentIndex: 1, // Start at 1 since we already emitted the first
154
+ isComplete: false, // Never complete until we receive next with no more items
155
+ collectedItems: [], // Start with empty collection
156
+ };
157
+ }
158
+ }
159
+ // If we don't have items yet, wait
160
+ if (!state.items || state.items.length === 0) {
161
+ this.logger.info("Loop: No items yet, waiting...");
162
+ return state;
163
+ }
164
+ // If we've already processed all items, we're done
165
+ if (state.currentIndex >= state.items.length) {
166
+ this.logger.info(`Loop: Already completed`);
167
+ return state;
168
+ }
169
+ // Default case: no specific signal received, just return current state
170
+ this.logger.info(`Loop: No action taken, current index: ${state.currentIndex}/${state.items.length}`);
171
+ return state;
172
+ }
173
+ /**
174
+ * Cleanup any resources when the node is stopped
175
+ */
176
+ async cleanup(state) {
177
+ this.logger.info(`Loop: Cleaning up, processed ${state.currentIndex} of ${state.items.length} items`);
178
+ }
179
+ }
180
+ exports.LoopNode = LoopNode;
181
+ exports.default = LoopNode;
182
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/Loop/executor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,iDAAkD;AAqBlD,MAAa,QAAS,SAAQ,uBAAmC;IAC/D;QACE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,cAAc,CAAC,MAAkB;QAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAW;QACzB,oFAAoF;QACpF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACjD,OAAO;YACL,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,CAAC;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E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yCAAyC,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACtG,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,KAAgB;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,KAAK,CAAC,YAAY,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC;IACxG,CAAC;CACF;AAtMD,4BAsMC;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Loop Node Definition
3
+ * Iterates over an array of items for downstream processing
4
+ */
5
+ import { type EnhancedNodeDefinition } from "@gravity-platform/plugin-base";
6
+ import LoopExecutor from "./executor";
7
+ export declare const NODE_TYPE = "Loop";
8
+ export declare function createNodeDefinition(): EnhancedNodeDefinition;
9
+ export declare const LoopNode: {
10
+ definition: any;
11
+ executor: typeof LoopExecutor;
12
+ };
13
+ export declare const definition: any;
14
+ export default LoopExecutor;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Loop/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,YAAY,MAAM,YAAY,CAAC;AAGtC,eAAO,MAAM,SAAS,SAAS,CAAC;AAGhC,wBAAgB,oBAAoB,IAAI,sBAAsB,CAuE7D;AAGD,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAGF,eAAO,MAAM,UAAU,KAAyB,CAAC;AACjD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ /**
3
+ * Loop Node Definition
4
+ * Iterates over an array of items for downstream processing
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.definition = exports.LoopNode = exports.NODE_TYPE = void 0;
11
+ exports.createNodeDefinition = createNodeDefinition;
12
+ const plugin_base_1 = require("@gravity-platform/plugin-base");
13
+ const executor_1 = __importDefault(require("./executor"));
14
+ // Export node type constant
15
+ exports.NODE_TYPE = "Loop";
16
+ // Export a function that creates the definition after platform deps are set
17
+ function createNodeDefinition() {
18
+ const { NodeInputType } = (0, plugin_base_1.getPlatformDependencies)();
19
+ return {
20
+ packageVersion: "1.1.1",
21
+ type: exports.NODE_TYPE,
22
+ name: "Loop",
23
+ description: "Iterate through array items one by one",
24
+ category: "Flow",
25
+ color: "#4A90E2",
26
+ logoUrl: "https://res.cloudinary.com/sonik/image/upload/v1749961542/gravity/icons/loop.png",
27
+ inputs: [
28
+ {
29
+ name: "items",
30
+ type: NodeInputType.SPAWN,
31
+ description: "Loop me",
32
+ },
33
+ {
34
+ name: "next",
35
+ type: NodeInputType.OBJECT, // Any input here triggers next iteration
36
+ description: "Signal to advance to next iteration",
37
+ },
38
+ ],
39
+ outputs: [
40
+ {
41
+ name: "item",
42
+ type: NodeInputType.OBJECT,
43
+ description: "Current item",
44
+ },
45
+ {
46
+ name: "index",
47
+ type: NodeInputType.NUMBER,
48
+ description: "Current index",
49
+ },
50
+ {
51
+ name: "finished",
52
+ type: NodeInputType.OBJECT,
53
+ description: "Signal sent when loop completes. Contains {finished: true, collected?: [...]} if collectItems is configured",
54
+ },
55
+ ],
56
+ configSchema: {
57
+ type: "object",
58
+ properties: {
59
+ items: {
60
+ type: "array",
61
+ title: "Items",
62
+ description: "Array of items to loop through",
63
+ default: [],
64
+ "ui:field": "template",
65
+ items: {
66
+ type: "object",
67
+ },
68
+ },
69
+ collectItems: {
70
+ type: "object",
71
+ title: "Collect Items (Optional)",
72
+ description: "Template to collect objects from each iteration to collect outputs from downstream node",
73
+ default: "",
74
+ "ui:field": "template",
75
+ },
76
+ },
77
+ required: [],
78
+ },
79
+ capabilities: {
80
+ isTrigger: false,
81
+ },
82
+ };
83
+ }
84
+ // Export as enhanced node
85
+ exports.LoopNode = {
86
+ definition: createNodeDefinition(),
87
+ executor: executor_1.default,
88
+ };
89
+ // Export for node registry
90
+ exports.definition = createNodeDefinition();
91
+ exports.default = executor_1.default;
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Loop/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AASH,oDAuEC;AA9ED,+DAAqG;AACrG,0DAAsC;AAEtC,4BAA4B;AACf,QAAA,SAAS,GAAG,MAAM,CAAC;AAEhC,4EAA4E;AAC5E,SAAgB,oBAAoB;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,qCAAuB,GAAE,CAAC;IAEpD,OAAO;QACL,cAAc,EAAE,OAAO;QACvB,IAAI,EAAE,iBAAS;QACf,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,wCAAwC;QACrD,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,kFAAkF;QAE3F,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,aAAa,CAAC,KAAK;gBACzB,WAAW,EAAE,SAAS;aACvB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,yCAAyC;gBACrE,WAAW,EAAE,qCAAqC;aACnD;SACF;QAED,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,aAAa,CAAC,MAAM;gBAC1B,WAAW,EAAE,cAAc;aAC5B;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,aAAa,CAAC,MAAM;gBAC1B,WAAW,EAAE,eAAe;aAC7B;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,aAAa,CAAC,MAAM;gBAC1B,WAAW,EAAE,6GAA6G;aAC3H;SACF;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,OAAO;oBACd,WAAW,EAAE,gCAAgC;oBAC7C,OAAO,EAAE,EAAE;oBACX,UAAU,EAAE,UAAU;oBACtB,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;qBACf;iBACF;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,0BAA0B;oBACjC,WAAW,EAAE,yFAAyF;oBACtG,OAAO,EAAE,EAAE;oBACX,UAAU,EAAE,UAAU;iBACvB;aACF;YACD,QAAQ,EAAE,EAAE;SACb;QAED,YAAY,EAAE;YACZ,SAAS,EAAE,KAAK;SACjB;KACF,CAAC;AACJ,CAAC;AAED,0BAA0B;AACb,QAAA,QAAQ,GAAG;IACtB,UAAU,EAAE,oBAAoB,EAAE;IAClC,QAAQ,EAAE,kBAAY;CACvB,CAAC;AAEF,2BAA2B;AACd,QAAA,UAAU,GAAG,oBAAoB,EAAE,CAAC;AACjD,kBAAe,kBAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Loop node utils exports
3
+ */
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Loop/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Loop node utils exports
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Loop/utils/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0CAAwB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Type definitions for Loop node
3
+ */
4
+ export interface LoopInput {
5
+ items?: any[];
6
+ continue?: boolean;
7
+ }
8
+ export interface LoopOutput {
9
+ item: any;
10
+ }
11
+ export interface LoopMetadata {
12
+ index: number;
13
+ total: number;
14
+ hasMore: boolean;
15
+ complete: boolean;
16
+ }
17
+ export interface LoopState {
18
+ }
19
+ export interface LoopConfig {
20
+ items?: any[];
21
+ continue?: any;
22
+ collectItems?: string;
23
+ }
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Loop/utils/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,GAAG,CAAC;CACX;AAGD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAGD,MAAM,WAAW,SAAS;CAEzB;AAGD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for Loop node
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/Loop/utils/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,14 @@
1
+ import { type NodeExecutionContext } from "@gravity-platform/plugin-base";
2
+ import { MCPServiceSchema } from "../util/types";
3
+ declare const PromiseNode: any;
4
+ interface MCPConfig {
5
+ serviceSchema: MCPServiceSchema;
6
+ debugMode?: boolean;
7
+ }
8
+ export default class MCPExecutor extends PromiseNode<MCPConfig> {
9
+ constructor();
10
+ protected executeNode(inputs: Record<string, any>, config: MCPConfig, context: NodeExecutionContext): Promise<any>;
11
+ handleServiceCall(method: string, params: any, config: any, context: NodeExecutionContext): Promise<any>;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/MCP/node/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,QAAA,MAAQ,WAAW,KAA8B,CAAC;AAIlD,UAAU,SAAS;IACjB,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW,CAAC,SAAS,CAAC;;cAK7C,WAAW,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,GAAG,CAAC;IAMT,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,GAAG,CAAC;CA4FhB"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const plugin_base_1 = require("@gravity-platform/plugin-base");
4
+ // Get platform dependencies
5
+ const { PromiseNode } = (0, plugin_base_1.getPlatformDependencies)();
6
+ const NODE_TYPE = "MCP";
7
+ class MCPExecutor extends PromiseNode {
8
+ constructor() {
9
+ super(NODE_TYPE);
10
+ }
11
+ async executeNode(inputs, config, context) {
12
+ // This is a service node - it should not be executed in normal workflow
13
+ throw new Error("MCP is a service node - it responds to SERVICE_CALL signals only");
14
+ }
15
+ // This method is called when the service receives a SERVICE_CALL signal
16
+ async handleServiceCall(method, params, config, context) {
17
+ this.logger.info(`Handling SERVICE_CALL: ${method}`, {
18
+ method,
19
+ nodeId: context.nodeId,
20
+ params
21
+ });
22
+ // Check if config is nested or direct
23
+ const actualConfig = config?.config ? config.config : config;
24
+ const serviceSchema = actualConfig?.serviceSchema;
25
+ if (!serviceSchema) {
26
+ throw new Error("Service schema not configured");
27
+ }
28
+ try {
29
+ switch (method) {
30
+ case 'getSchema': {
31
+ // Simply return the configured schema
32
+ this.logger.info("Returning service schema", {
33
+ schemaName: serviceSchema.name
34
+ });
35
+ return serviceSchema;
36
+ }
37
+ case 'callMethod': {
38
+ // Extract the method name and parameters from the call
39
+ const { methodName, methodParams } = params;
40
+ if (!methodName) {
41
+ throw new Error("methodName is required in params");
42
+ }
43
+ // Validate the method exists in the schema
44
+ if (!serviceSchema.methods || !serviceSchema.methods[methodName]) {
45
+ throw new Error(`Method '${methodName}' not found in service schema`);
46
+ }
47
+ // Create a unique request ID
48
+ const requestId = `${context.executionId}-${Date.now()}`;
49
+ // Emit the request through the output
50
+ // In a state machine, this will trigger the connected node
51
+ const request = {
52
+ method: methodName,
53
+ params: methodParams,
54
+ requestId,
55
+ schema: serviceSchema.methods[methodName]
56
+ };
57
+ this.logger.info(`Forwarding service request`, {
58
+ method: methodName,
59
+ requestId
60
+ });
61
+ // In a reactive state machine, we emit and wait for the response
62
+ // The state machine will handle the flow
63
+ return new Promise((resolve, reject) => {
64
+ // Emit the request
65
+ this.emit({ request });
66
+ // Set up a listener for the response
67
+ // This is handled by the state machine when input arrives
68
+ const responseHandler = (response) => {
69
+ if (response.requestId === requestId) {
70
+ if (response.error) {
71
+ reject(new Error(response.error));
72
+ }
73
+ else {
74
+ resolve(response.result);
75
+ }
76
+ }
77
+ };
78
+ // In practice, the state machine handles this flow
79
+ // This is a simplified version for illustration
80
+ setTimeout(() => {
81
+ reject(new Error(`Timeout waiting for response to ${methodName}`));
82
+ }, 30000);
83
+ });
84
+ }
85
+ default:
86
+ throw new Error(`Unknown service method: ${method}. Available methods: getSchema, callMethod`);
87
+ }
88
+ }
89
+ catch (error) {
90
+ this.logger.error(`SERVICE_CALL failed: ${method}`, {
91
+ method,
92
+ error: error.message
93
+ });
94
+ throw error;
95
+ }
96
+ }
97
+ }
98
+ exports.default = MCPExecutor;
99
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/MCP/node/executor.ts"],"names":[],"mappings":";;AAAA,+DAAmG;AAGnG,4BAA4B;AAC5B,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,qCAAuB,GAAE,CAAC;AAElD,MAAM,SAAS,GAAG,KAAK,CAAC;AAOxB,MAAqB,WAAY,SAAQ,WAAsB;IAC7D;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAES,KAAK,CAAC,WAAW,CAC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BACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,4CAA4C,CAAC,CAAC;YACnG,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,MAAM,EAAE,EAAE;gBAClD,MAAM;gBACN,KAAK,EAAG,KAAe,CAAC,OAAO;aAChC,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAhHD,8BAgHC"}
@@ -0,0 +1,10 @@
1
+ import { type EnhancedNodeDefinition } from "@gravity-platform/plugin-base";
2
+ import MCPExecutor from "./executor";
3
+ export declare const NODE_TYPE = "MCP";
4
+ declare function createNodeDefinition(): EnhancedNodeDefinition;
5
+ export declare const MCPNode: {
6
+ definition: any;
7
+ executor: typeof MCPExecutor;
8
+ };
9
+ export { createNodeDefinition };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MCP/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,WAAW,MAAM,YAAY,CAAC;AAErC,eAAO,MAAM,SAAS,QAAQ,CAAC;AAE/B,iBAAS,oBAAoB,IAAI,sBAAsB,CA8DtD;AAID,eAAO,MAAM,OAAO;;;CAGnB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MCPNode = exports.NODE_TYPE = void 0;
7
+ exports.createNodeDefinition = createNodeDefinition;
8
+ const plugin_base_1 = require("@gravity-platform/plugin-base");
9
+ const executor_1 = __importDefault(require("./executor"));
10
+ exports.NODE_TYPE = "MCP";
11
+ function createNodeDefinition() {
12
+ const { NodeInputType } = (0, plugin_base_1.getPlatformDependencies)();
13
+ return {
14
+ packageVersion: "1.1.1",
15
+ type: exports.NODE_TYPE,
16
+ name: "MCP Service",
17
+ description: "Model Context Protocol service node that handles schema-based service requests",
18
+ category: "Flow",
19
+ color: "#8B5CF6", // Purple color for service nodes
20
+ // Node template for styling
21
+ template: "service", // Options: "standard", "service", "mini"
22
+ // This service node ALSO has workflow connections
23
+ inputs: [
24
+ {
25
+ name: "response",
26
+ type: NodeInputType.OBJECT,
27
+ description: "Response from the connected node handling the service request",
28
+ required: false
29
+ }
30
+ ],
31
+ outputs: [
32
+ {
33
+ name: "request",
34
+ type: NodeInputType.OBJECT,
35
+ description: "Service request forwarded to connected node"
36
+ }
37
+ ],
38
+ // SERVICE CONNECTORS - defines what services this node provides
39
+ serviceConnectors: [
40
+ {
41
+ name: "mcpService",
42
+ description: "Provides Model Context Protocol services",
43
+ serviceType: "mcp",
44
+ methods: ["getSchema", "getChunksByQuery"],
45
+ isService: true, // This node PROVIDES MCP services to others
46
+ },
47
+ ],
48
+ // Configuration schema - holds the service schema
49
+ configSchema: {
50
+ type: "object",
51
+ properties: {
52
+ serviceSchema: {
53
+ type: "object",
54
+ title: "Service Schema",
55
+ description: "JSON schema defining the service methods and their input/output formats",
56
+ default: {},
57
+ "ui:field": "JSON",
58
+ },
59
+ },
60
+ required: ["serviceSchema"],
61
+ },
62
+ // Node capabilities
63
+ capabilities: {
64
+ isTrigger: false,
65
+ },
66
+ };
67
+ }
68
+ const definition = createNodeDefinition();
69
+ exports.MCPNode = {
70
+ definition,
71
+ executor: executor_1.default,
72
+ };
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MCP/node/index.ts"],"names":[],"mappings":";;;;;;AA4ES,oDAAoB;AA5E7B,+DAAqG;AACrG,0DAAqC;AAExB,QAAA,SAAS,GAAG,KAAK,CAAC;AAE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