@motiadev/core 0.5.11-beta.119 → 0.5.11-beta.120-433270

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
1
  import { StepConfig } from './types';
2
2
  import { StreamConfig } from './types-stream';
3
- export declare const getStepConfig: (file: string) => Promise<StepConfig | null>;
4
- export declare const getStreamConfig: (file: string) => Promise<StreamConfig | null>;
3
+ export declare const getStepConfig: (baseDir: string, file: string) => Promise<StepConfig | null>;
4
+ export declare const getStreamConfig: (baseDir: string, file: string) => Promise<StreamConfig | null>;
@@ -7,13 +7,13 @@ exports.getStreamConfig = exports.getStepConfig = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const logger_1 = require("./logger");
9
9
  const process_manager_1 = require("./process-communication/process-manager");
10
- const getLanguageBasedRunner = (stepFilePath = '') => {
10
+ const getLanguageBasedRunner = (baseDir, stepFilePath) => {
11
11
  const isPython = stepFilePath.endsWith('.py');
12
12
  const isRuby = stepFilePath.endsWith('.rb');
13
13
  const isNode = stepFilePath.endsWith('.js') || stepFilePath.endsWith('.ts');
14
14
  if (isPython) {
15
15
  const pythonRunner = path_1.default.join(__dirname, 'python', 'get-config.py');
16
- return { runner: pythonRunner, command: 'python', args: [] };
16
+ return { runner: pythonRunner, command: 'python', args: [baseDir] };
17
17
  }
18
18
  else if (isRuby) {
19
19
  const rubyRunner = path_1.default.join(__dirname, 'ruby', 'get-config.rb');
@@ -29,13 +29,13 @@ const getLanguageBasedRunner = (stepFilePath = '') => {
29
29
  }
30
30
  throw Error(`Unsupported file extension ${stepFilePath}`);
31
31
  };
32
- const getConfig = (file) => {
33
- const { runner, command, args } = getLanguageBasedRunner(file);
32
+ const getConfig = (baseDir, file) => {
33
+ const { runner, command, args } = getLanguageBasedRunner(baseDir, file);
34
34
  return new Promise((resolve, reject) => {
35
35
  let config = null;
36
36
  const processManager = new process_manager_1.ProcessManager({
37
37
  command,
38
- args: [...args, runner, file],
38
+ args: [runner, ...args, file],
39
39
  logger: logger_1.globalLogger,
40
40
  context: 'Config',
41
41
  });
@@ -78,11 +78,11 @@ const getConfig = (file) => {
78
78
  });
79
79
  });
80
80
  };
81
- const getStepConfig = (file) => {
82
- return getConfig(file);
81
+ const getStepConfig = (baseDir, file) => {
82
+ return getConfig(baseDir, file);
83
83
  };
84
84
  exports.getStepConfig = getStepConfig;
85
- const getStreamConfig = (file) => {
86
- return getConfig(file);
85
+ const getStreamConfig = (baseDir, file) => {
86
+ return getConfig(baseDir, file);
87
87
  };
88
88
  exports.getStreamConfig = getStreamConfig;
@@ -19,13 +19,13 @@ def sendMessage(text):
19
19
  NODEIPCFD = int(os.environ["NODE_CHANNEL_FD"])
20
20
  os.write(NODEIPCFD, bytesMessage)
21
21
 
22
- async def run_python_module(file_path: str) -> None:
22
+ async def run_python_module(project_path: str, file_path: str) -> None:
23
23
  try:
24
- module_dir = os.path.dirname(os.path.abspath(file_path))
24
+ module_dir = os.path.dirname(file_path)
25
25
 
26
- if module_dir not in sys.path:
27
- sys.path.insert(0, module_dir)
28
-
26
+ if project_path not in sys.path:
27
+ sys.path.insert(0, project_path)
28
+
29
29
  flows_dir = os.path.dirname(module_dir)
30
30
  if flows_dir not in sys.path:
31
31
  sys.path.insert(0, flows_dir)
@@ -51,10 +51,11 @@ async def run_python_module(file_path: str) -> None:
51
51
  sys.exit(1)
52
52
 
53
53
  if __name__ == "__main__":
54
- if len(sys.argv) < 2:
54
+ if len(sys.argv) < 3:
55
55
  sys.exit(1)
56
56
 
57
- file_path = sys.argv[1]
57
+ project_path = sys.argv[1]
58
+ file_path = sys.argv[2]
58
59
 
59
60
  import asyncio
60
- asyncio.run(run_python_module(file_path))
61
+ asyncio.run(run_python_module(project_path, file_path))
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@motiadev/core",
3
3
  "description": "Core functionality for the Motia framework, providing the foundation for building event-driven workflows.",
4
4
  "main": "dist/index.js",
5
- "version": "0.5.11-beta.119",
5
+ "version": "0.5.11-beta.120-433270",
6
6
  "dependencies": {
7
7
  "@amplitude/analytics-node": "^1.3.8",
8
8
  "body-parser": "^1.20.3",