motia 0.5.11-beta.120-598191 → 0.5.11-beta.120-662415

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 (41) hide show
  1. package/dist/cjs/create/index.js +0 -8
  2. package/dist/cjs/create/interactive.js +1 -1
  3. package/dist/cjs/create/templates/generate.js +11 -2
  4. package/dist/cjs/create/templates/generate.ts +11 -2
  5. package/dist/cjs/create/templates/index.js +1 -1
  6. package/dist/cjs/create/templates/index.ts +1 -1
  7. package/dist/cjs/create/templates/python/motia-workbench.json +13 -12
  8. package/dist/cjs/create/templates/python/requirements.txt +2 -1
  9. package/dist/cjs/create/templates/python/tutorial.tsx.txt +11 -9
  10. package/dist/cjs/create/templates/{default → typescript}/tutorial.tsx.txt +11 -9
  11. package/dist/esm/create/index.js +0 -8
  12. package/dist/esm/create/interactive.js +1 -1
  13. package/dist/esm/create/templates/generate.js +11 -2
  14. package/dist/esm/create/templates/generate.ts +11 -2
  15. package/dist/esm/create/templates/index.js +1 -1
  16. package/dist/esm/create/templates/index.ts +1 -1
  17. package/dist/esm/create/templates/python/motia-workbench.json +13 -12
  18. package/dist/esm/create/templates/python/requirements.txt +2 -1
  19. package/dist/esm/create/templates/python/tutorial.tsx.txt +11 -9
  20. package/dist/esm/create/templates/{default → typescript}/tutorial.tsx.txt +11 -9
  21. package/package.json +4 -4
  22. /package/dist/cjs/create/templates/{default → typescript}/motia-workbench.json +0 -0
  23. /package/dist/cjs/create/templates/{default → typescript}/services/pet-store.ts.txt +0 -0
  24. /package/dist/cjs/create/templates/{default → typescript}/services/types.ts.txt +0 -0
  25. /package/dist/cjs/create/templates/{default → typescript}/steps/01-api.step.ts-features.json.txt +0 -0
  26. /package/dist/cjs/create/templates/{default → typescript}/steps/01-api.step.ts.txt +0 -0
  27. /package/dist/cjs/create/templates/{default → typescript}/steps/02-process-food-order.step.ts-features.json.txt +0 -0
  28. /package/dist/cjs/create/templates/{default → typescript}/steps/02-process-food-order.step.ts.txt +0 -0
  29. /package/dist/cjs/create/templates/{default → typescript}/steps/03-state-audit-cron.step.ts-features.json.txt +0 -0
  30. /package/dist/cjs/create/templates/{default → typescript}/steps/03-state-audit-cron.step.ts.txt +0 -0
  31. /package/dist/cjs/create/templates/{default → typescript}/steps/04-notification.step.ts.txt +0 -0
  32. /package/dist/esm/create/templates/{default → typescript}/motia-workbench.json +0 -0
  33. /package/dist/esm/create/templates/{default → typescript}/services/pet-store.ts.txt +0 -0
  34. /package/dist/esm/create/templates/{default → typescript}/services/types.ts.txt +0 -0
  35. /package/dist/esm/create/templates/{default → typescript}/steps/01-api.step.ts-features.json.txt +0 -0
  36. /package/dist/esm/create/templates/{default → typescript}/steps/01-api.step.ts.txt +0 -0
  37. /package/dist/esm/create/templates/{default → typescript}/steps/02-process-food-order.step.ts-features.json.txt +0 -0
  38. /package/dist/esm/create/templates/{default → typescript}/steps/02-process-food-order.step.ts.txt +0 -0
  39. /package/dist/esm/create/templates/{default → typescript}/steps/03-state-audit-cron.step.ts-features.json.txt +0 -0
  40. /package/dist/esm/create/templates/{default → typescript}/steps/03-state-audit-cron.step.ts.txt +0 -0
  41. /package/dist/esm/create/templates/{default → typescript}/steps/04-notification.step.ts.txt +0 -0
@@ -182,14 +182,6 @@ const create = async ({ projectName, template, cursorEnabled, context }) => {
182
182
  }
183
183
  const packageManager = await installNodeDependencies(rootDir, context);
184
184
  if (template === 'python') {
185
- if (!(0, utils_1.checkIfFileExists)(rootDir, 'requirements.txt')) {
186
- const requirementsContent = [
187
- // TODO: motia PyPi package
188
- // Add other Python dependencies as needed
189
- ].join('\n');
190
- fs_1.default.writeFileSync(path_1.default.join(rootDir, 'requirements.txt'), requirementsContent);
191
- context.log('requirements-txt-created', (message) => message.tag('success').append('File').append('requirements.txt', 'gray').append('has been created.'));
192
- }
193
185
  await (0, install_1.pythonInstall)({ baseDir: rootDir });
194
186
  }
195
187
  await (0, generate_types_1.generateTypes)(rootDir);
@@ -8,7 +8,7 @@ const inquirer_1 = __importDefault(require("inquirer"));
8
8
  const colors_1 = __importDefault(require("colors"));
9
9
  const index_1 = require("./index");
10
10
  const choices = {
11
- default: 'Base (TypeScript)',
11
+ typescript: 'Base (TypeScript)',
12
12
  python: 'Base (Python)',
13
13
  };
14
14
  const createInteractive = async (_args, context) => {
@@ -44,12 +44,21 @@ const generateTemplateSteps = (templateFolder) => {
44
44
  try {
45
45
  for (const fileName of files) {
46
46
  const filePath = path.join(templatePath, fileName);
47
+ const targetFilePath = path.join(rootDir, fileName);
48
+ const targetDir = path.dirname(targetFilePath);
49
+ try {
50
+ // Check if it's a directory in the template
51
+ (0, fs_1.statSync)(targetDir);
52
+ }
53
+ catch {
54
+ (0, fs_1.mkdirSync)(targetDir, { recursive: true });
55
+ }
47
56
  if ((0, fs_1.statSync)(filePath).isDirectory()) {
48
57
  const folderPath = path.basename(filePath);
49
- (0, fs_1.mkdirSync)(path.join(rootDir, folderPath));
58
+ (0, fs_1.mkdirSync)(path.join(rootDir, folderPath), { recursive: true });
50
59
  continue;
51
60
  }
52
- const sanitizedFileName = fileName.replace('.txt', '');
61
+ const sanitizedFileName = fileName === 'requirements.txt' ? fileName : fileName.replace('.txt', '');
53
62
  const isWorkbenchConfig = fileName.match('motia-workbench.json');
54
63
  const generateFilePath = path.join(rootDir, sanitizedFileName);
55
64
  let content = await fs_1.promises.readFile(filePath, 'utf8');
@@ -13,14 +13,23 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
13
13
  try {
14
14
  for (const fileName of files) {
15
15
  const filePath = path.join(templatePath, fileName)
16
+ const targetFilePath = path.join(rootDir, fileName)
17
+ const targetDir = path.dirname(targetFilePath)
18
+
19
+ try {
20
+ // Check if it's a directory in the template
21
+ statSync(targetDir)
22
+ } catch {
23
+ mkdirSync(targetDir, { recursive: true })
24
+ }
16
25
 
17
26
  if (statSync(filePath).isDirectory()) {
18
27
  const folderPath = path.basename(filePath)
19
- mkdirSync(path.join(rootDir, folderPath))
28
+ mkdirSync(path.join(rootDir, folderPath), { recursive: true })
20
29
  continue
21
30
  }
22
31
 
23
- const sanitizedFileName = fileName.replace('.txt', '')
32
+ const sanitizedFileName = fileName === 'requirements.txt' ? fileName : fileName.replace('.txt', '')
24
33
  const isWorkbenchConfig = fileName.match('motia-workbench.json')
25
34
  const generateFilePath = path.join(rootDir, sanitizedFileName)
26
35
  let content = await fs.readFile(filePath, 'utf8')
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.templates = void 0;
4
4
  const generate_1 = require("./generate");
5
5
  exports.templates = {
6
- default: (0, generate_1.generateTemplateSteps)('default'),
6
+ typescript: (0, generate_1.generateTemplateSteps)('typescript'),
7
7
  python: (0, generate_1.generateTemplateSteps)('python'),
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import { generateTemplateSteps, Generator } from './generate'
2
2
 
3
3
  export const templates: Record<string, Generator> = {
4
- default: generateTemplateSteps('default'),
4
+ typescript: generateTemplateSteps('typescript'),
5
5
  python: generateTemplateSteps('python'),
6
6
  }
@@ -2,23 +2,24 @@
2
2
  {
3
3
  "id": "python-tutorial",
4
4
  "config": {
5
- "steps/default_python/state_audit_cron_step.py": {
6
- "x": -332,
7
- "y": 149,
5
+ "steps/state_audit_cron_step.py": {
6
+ "x": -38,
7
+ "y": 683,
8
8
  "sourceHandlePosition": "right"
9
9
  },
10
- "steps/default_python/process_food_order_step.py": {
11
- "x": 81,
12
- "y": -52,
10
+ "steps/process_food_order_step.py": {
11
+ "x": 384,
12
+ "y": 476,
13
13
  "targetHandlePosition": "left"
14
14
  },
15
- "steps/default_python/notification_step.py": {
16
- "x": 142,
17
- "y": 175
15
+ "steps/notification_step.py": {
16
+ "x": 601,
17
+ "y": 724,
18
+ "targetHandlePosition": "left"
18
19
  },
19
- "steps/default_python/api_step.py": {
20
- "x": -302,
21
- "y": -66,
20
+ "steps/api_step.py": {
21
+ "x": 15,
22
+ "y": 461,
22
23
  "sourceHandlePosition": "right"
23
24
  }
24
25
  }
@@ -1 +1,2 @@
1
- pydantic>=2.6.1
1
+ pydantic>=2.6.1
2
+ httpx>=0.28.1
@@ -54,14 +54,16 @@ export const steps: TutorialStep[] = [
54
54
  elementXpath: workbenchXPath.sidebarContainer,
55
55
  title: 'Step Config',
56
56
  description: () => (
57
- <p>
58
- All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
59
- the programming language).
60
- <br />
61
- <br />
62
- Let's start with the configuration, the common config attributes are
63
- <i>type, name, description, and flows</i>.<br />
64
- <br />
57
+ <div>
58
+ <p>
59
+ All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
60
+ the programming language).
61
+ <br />
62
+ <br />
63
+ Let's start with the configuration, the common config attributes are
64
+ <i>type, name, description, and flows</i>.<br />
65
+ <br />
66
+ </p>
65
67
  <ul>
66
68
  <li>
67
69
  The <b>type</b> attribute is important since it declares the type of Step primitive
@@ -74,7 +76,7 @@ export const steps: TutorialStep[] = [
74
76
  observability tools.
75
77
  </li>
76
78
  </ul>
77
- </p>
79
+ </div>
78
80
  ),
79
81
  before: [
80
82
  { type: 'click', selector: workbenchXPath.flows.previewButton('pythonapitrigger') },
@@ -54,14 +54,16 @@ export const steps: TutorialStep[] = [
54
54
  elementXpath: workbenchXPath.sidebarContainer,
55
55
  title: 'Step Config',
56
56
  description: () => (
57
- <p>
58
- All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
59
- the programming language).
60
- <br />
61
- <br />
62
- Let's start with the configuration, the common config attributes are
63
- <i>type, name, description, and flows</i>.<br />
64
- <br />
57
+ <div>
58
+ <p>
59
+ All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
60
+ the programming language).
61
+ <br />
62
+ <br />
63
+ Let's start with the configuration, the common config attributes are
64
+ <i>type, name, description, and flows</i>.<br />
65
+ <br />
66
+ </p>
65
67
  <ul>
66
68
  <li>
67
69
  The <b>type</b> attribute is important since it declares the type of Step primitive
@@ -74,7 +76,7 @@ export const steps: TutorialStep[] = [
74
76
  observability tools.
75
77
  </li>
76
78
  </ul>
77
- </p>
79
+ </div>
78
80
  ),
79
81
  before: [
80
82
  { type: 'click', selector: workbenchXPath.flows.previewButton('apitrigger') },
@@ -176,14 +176,6 @@ export const create = async ({ projectName, template, cursorEnabled, context })
176
176
  }
177
177
  const packageManager = await installNodeDependencies(rootDir, context);
178
178
  if (template === 'python') {
179
- if (!checkIfFileExists(rootDir, 'requirements.txt')) {
180
- const requirementsContent = [
181
- // TODO: motia PyPi package
182
- // Add other Python dependencies as needed
183
- ].join('\n');
184
- fs.writeFileSync(path.join(rootDir, 'requirements.txt'), requirementsContent);
185
- context.log('requirements-txt-created', (message) => message.tag('success').append('File').append('requirements.txt', 'gray').append('has been created.'));
186
- }
187
179
  await pythonInstall({ baseDir: rootDir });
188
180
  }
189
181
  await generateTypes(rootDir);
@@ -2,7 +2,7 @@ import inquirer from 'inquirer';
2
2
  import colors from 'colors';
3
3
  import { create } from './index';
4
4
  const choices = {
5
- default: 'Base (TypeScript)',
5
+ typescript: 'Base (TypeScript)',
6
6
  python: 'Base (Python)',
7
7
  };
8
8
  export const createInteractive = async (_args, context) => {
@@ -8,12 +8,21 @@ export const generateTemplateSteps = (templateFolder) => {
8
8
  try {
9
9
  for (const fileName of files) {
10
10
  const filePath = path.join(templatePath, fileName);
11
+ const targetFilePath = path.join(rootDir, fileName);
12
+ const targetDir = path.dirname(targetFilePath);
13
+ try {
14
+ // Check if it's a directory in the template
15
+ statSync(targetDir);
16
+ }
17
+ catch {
18
+ mkdirSync(targetDir, { recursive: true });
19
+ }
11
20
  if (statSync(filePath).isDirectory()) {
12
21
  const folderPath = path.basename(filePath);
13
- mkdirSync(path.join(rootDir, folderPath));
22
+ mkdirSync(path.join(rootDir, folderPath), { recursive: true });
14
23
  continue;
15
24
  }
16
- const sanitizedFileName = fileName.replace('.txt', '');
25
+ const sanitizedFileName = fileName === 'requirements.txt' ? fileName : fileName.replace('.txt', '');
17
26
  const isWorkbenchConfig = fileName.match('motia-workbench.json');
18
27
  const generateFilePath = path.join(rootDir, sanitizedFileName);
19
28
  let content = await fs.readFile(filePath, 'utf8');
@@ -13,14 +13,23 @@ export const generateTemplateSteps = (templateFolder: string): Generator => {
13
13
  try {
14
14
  for (const fileName of files) {
15
15
  const filePath = path.join(templatePath, fileName)
16
+ const targetFilePath = path.join(rootDir, fileName)
17
+ const targetDir = path.dirname(targetFilePath)
18
+
19
+ try {
20
+ // Check if it's a directory in the template
21
+ statSync(targetDir)
22
+ } catch {
23
+ mkdirSync(targetDir, { recursive: true })
24
+ }
16
25
 
17
26
  if (statSync(filePath).isDirectory()) {
18
27
  const folderPath = path.basename(filePath)
19
- mkdirSync(path.join(rootDir, folderPath))
28
+ mkdirSync(path.join(rootDir, folderPath), { recursive: true })
20
29
  continue
21
30
  }
22
31
 
23
- const sanitizedFileName = fileName.replace('.txt', '')
32
+ const sanitizedFileName = fileName === 'requirements.txt' ? fileName : fileName.replace('.txt', '')
24
33
  const isWorkbenchConfig = fileName.match('motia-workbench.json')
25
34
  const generateFilePath = path.join(rootDir, sanitizedFileName)
26
35
  let content = await fs.readFile(filePath, 'utf8')
@@ -1,5 +1,5 @@
1
1
  import { generateTemplateSteps } from './generate';
2
2
  export const templates = {
3
- default: generateTemplateSteps('default'),
3
+ typescript: generateTemplateSteps('typescript'),
4
4
  python: generateTemplateSteps('python'),
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { generateTemplateSteps, Generator } from './generate'
2
2
 
3
3
  export const templates: Record<string, Generator> = {
4
- default: generateTemplateSteps('default'),
4
+ typescript: generateTemplateSteps('typescript'),
5
5
  python: generateTemplateSteps('python'),
6
6
  }
@@ -2,23 +2,24 @@
2
2
  {
3
3
  "id": "python-tutorial",
4
4
  "config": {
5
- "steps/default_python/state_audit_cron_step.py": {
6
- "x": -332,
7
- "y": 149,
5
+ "steps/state_audit_cron_step.py": {
6
+ "x": -38,
7
+ "y": 683,
8
8
  "sourceHandlePosition": "right"
9
9
  },
10
- "steps/default_python/process_food_order_step.py": {
11
- "x": 81,
12
- "y": -52,
10
+ "steps/process_food_order_step.py": {
11
+ "x": 384,
12
+ "y": 476,
13
13
  "targetHandlePosition": "left"
14
14
  },
15
- "steps/default_python/notification_step.py": {
16
- "x": 142,
17
- "y": 175
15
+ "steps/notification_step.py": {
16
+ "x": 601,
17
+ "y": 724,
18
+ "targetHandlePosition": "left"
18
19
  },
19
- "steps/default_python/api_step.py": {
20
- "x": -302,
21
- "y": -66,
20
+ "steps/api_step.py": {
21
+ "x": 15,
22
+ "y": 461,
22
23
  "sourceHandlePosition": "right"
23
24
  }
24
25
  }
@@ -1 +1,2 @@
1
- pydantic>=2.6.1
1
+ pydantic>=2.6.1
2
+ httpx>=0.28.1
@@ -54,14 +54,16 @@ export const steps: TutorialStep[] = [
54
54
  elementXpath: workbenchXPath.sidebarContainer,
55
55
  title: 'Step Config',
56
56
  description: () => (
57
- <p>
58
- All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
59
- the programming language).
60
- <br />
61
- <br />
62
- Let's start with the configuration, the common config attributes are
63
- <i>type, name, description, and flows</i>.<br />
64
- <br />
57
+ <div>
58
+ <p>
59
+ All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
60
+ the programming language).
61
+ <br />
62
+ <br />
63
+ Let's start with the configuration, the common config attributes are
64
+ <i>type, name, description, and flows</i>.<br />
65
+ <br />
66
+ </p>
65
67
  <ul>
66
68
  <li>
67
69
  The <b>type</b> attribute is important since it declares the type of Step primitive
@@ -74,7 +76,7 @@ export const steps: TutorialStep[] = [
74
76
  observability tools.
75
77
  </li>
76
78
  </ul>
77
- </p>
79
+ </div>
78
80
  ),
79
81
  before: [
80
82
  { type: 'click', selector: workbenchXPath.flows.previewButton('pythonapitrigger') },
@@ -54,14 +54,16 @@ export const steps: TutorialStep[] = [
54
54
  elementXpath: workbenchXPath.sidebarContainer,
55
55
  title: 'Step Config',
56
56
  description: () => (
57
- <p>
58
- All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
59
- the programming language).
60
- <br />
61
- <br />
62
- Let's start with the configuration, the common config attributes are
63
- <i>type, name, description, and flows</i>.<br />
64
- <br />
57
+ <div>
58
+ <p>
59
+ All Steps are defined by two main components, the <b>configuration</b> and the <b>handler</b> (disregarding of
60
+ the programming language).
61
+ <br />
62
+ <br />
63
+ Let's start with the configuration, the common config attributes are
64
+ <i>type, name, description, and flows</i>.<br />
65
+ <br />
66
+ </p>
65
67
  <ul>
66
68
  <li>
67
69
  The <b>type</b> attribute is important since it declares the type of Step primitive
@@ -74,7 +76,7 @@ export const steps: TutorialStep[] = [
74
76
  observability tools.
75
77
  </li>
76
78
  </ul>
77
- </p>
79
+ </div>
78
80
  ),
79
81
  before: [
80
82
  { type: 'click', selector: workbenchXPath.flows.previewButton('apitrigger') },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motia",
3
3
  "description": "A Modern Unified Backend Framework for APIs, Events and Agents",
4
- "version": "0.5.11-beta.120-598191",
4
+ "version": "0.5.11-beta.120-662415",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -43,9 +43,9 @@
43
43
  "inquirer": "^8.2.5",
44
44
  "table": "^6.9.0",
45
45
  "ts-node": "^10.9.2",
46
- "@motiadev/core": "0.5.11-beta.120-598191",
47
- "@motiadev/stream-client-node": "0.5.11-beta.120-598191",
48
- "@motiadev/workbench": "0.5.11-beta.120-598191"
46
+ "@motiadev/core": "0.5.11-beta.120-662415",
47
+ "@motiadev/stream-client-node": "0.5.11-beta.120-662415",
48
+ "@motiadev/workbench": "0.5.11-beta.120-662415"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@amplitude/analytics-types": "^2.9.2",