motia 0.5.11-beta.120-214453 → 0.5.11-beta.120-559255

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 (27) hide show
  1. package/dist/cjs/create/templates/python/steps/services/pet_store.py.txt +5 -5
  2. package/dist/cjs/create/templates/python/steps/state_audit_cron_step.py.txt +2 -2
  3. package/dist/cjs/create/templates/python/tutorial.tsx.txt +4 -1
  4. package/dist/cjs/create/templates/typescript/motia-workbench.json +4 -4
  5. package/dist/cjs/create/templates/typescript/services/pet-store.ts.txt +5 -5
  6. package/dist/cjs/create/templates/typescript/steps/{01-api.step.ts.txt → api.step.ts.txt} +1 -1
  7. package/dist/{esm/create/templates/typescript/steps/04-notification.step.ts.txt → cjs/create/templates/typescript/steps/notification.step.ts.txt} +2 -2
  8. package/dist/cjs/create/templates/typescript/tutorial.tsx.txt +4 -1
  9. package/dist/esm/create/templates/python/steps/services/pet_store.py.txt +5 -5
  10. package/dist/esm/create/templates/python/steps/state_audit_cron_step.py.txt +2 -2
  11. package/dist/esm/create/templates/python/tutorial.tsx.txt +4 -1
  12. package/dist/esm/create/templates/typescript/motia-workbench.json +4 -4
  13. package/dist/esm/create/templates/typescript/services/pet-store.ts.txt +5 -5
  14. package/dist/esm/create/templates/typescript/steps/{01-api.step.ts.txt → api.step.ts.txt} +1 -1
  15. package/dist/{cjs/create/templates/typescript/steps/04-notification.step.ts.txt → esm/create/templates/typescript/steps/notification.step.ts.txt} +2 -2
  16. package/dist/esm/create/templates/typescript/tutorial.tsx.txt +4 -1
  17. package/package.json +4 -4
  18. /package/dist/cjs/create/templates/typescript/steps/{01-api.step.ts-features.json.txt → api.step.ts-features.json.txt} +0 -0
  19. /package/dist/cjs/create/templates/typescript/steps/{02-process-food-order.step.ts-features.json.txt → process-food-order.step.ts-features.json.txt} +0 -0
  20. /package/dist/cjs/create/templates/typescript/steps/{02-process-food-order.step.ts.txt → process-food-order.step.ts.txt} +0 -0
  21. /package/dist/cjs/create/templates/typescript/steps/{03-state-audit-cron.step.ts-features.json.txt → state-audit-cron.step.ts-features.json.txt} +0 -0
  22. /package/dist/cjs/create/templates/typescript/steps/{03-state-audit-cron.step.ts.txt → state-audit-cron.step.ts.txt} +0 -0
  23. /package/dist/esm/create/templates/typescript/steps/{01-api.step.ts-features.json.txt → api.step.ts-features.json.txt} +0 -0
  24. /package/dist/esm/create/templates/typescript/steps/{02-process-food-order.step.ts-features.json.txt → process-food-order.step.ts-features.json.txt} +0 -0
  25. /package/dist/esm/create/templates/typescript/steps/{02-process-food-order.step.ts.txt → process-food-order.step.ts.txt} +0 -0
  26. /package/dist/esm/create/templates/typescript/steps/{03-state-audit-cron.step.ts-features.json.txt → state-audit-cron.step.ts-features.json.txt} +0 -0
  27. /package/dist/esm/create/templates/typescript/steps/{03-state-audit-cron.step.ts.txt → state-audit-cron.step.ts.txt} +0 -0
@@ -5,8 +5,8 @@ from .types import Order, Pet
5
5
  class PetStoreService:
6
6
  async def create_pet(self, pet: Dict[str, Any]) -> Pet:
7
7
  pet_data = {
8
- "name": pet["name"],
9
- "photoUrls": [pet["photo_url"]],
8
+ "name": pet.get("name", ""),
9
+ "photoUrls": [pet.get("photo_url", "")],
10
10
  "status": "available"
11
11
  }
12
12
 
@@ -21,10 +21,10 @@ class PetStoreService:
21
21
  async def create_order(self, order: Dict[str, Any]) -> Order:
22
22
  async with httpx.AsyncClient() as client:
23
23
  order_data = {
24
- "quantity": order.get("quantity"),
24
+ "quantity": order.get("quantity", 1),
25
25
  "petId": 1,
26
- "shipDate": order.get("ship_date"),
27
- "status": order.get("status"),
26
+ "shipDate": order.get("ship_date", "2025-08-22T22:07:04.730Z"),
27
+ "status": order.get("status", "placed"),
28
28
  }
29
29
 
30
30
  response = await client.post(
@@ -1,4 +1,4 @@
1
- from datetime import datetime
1
+ from datetime import datetime, timezone
2
2
 
3
3
  config = {
4
4
  "type": "cron",
@@ -14,7 +14,7 @@ async def handler(context):
14
14
 
15
15
  for item in state_value:
16
16
  # check if current date is after item.ship_date
17
- current_date = datetime.now()
17
+ current_date = datetime.now(timezone.utc)
18
18
  ship_date = datetime.fromisoformat(item.get("shipDate", "").replace('Z', '+00:00'))
19
19
 
20
20
  if not item.get("complete", False) and current_date > ship_date:
@@ -36,7 +36,10 @@ export const steps: TutorialStep[] = [
36
36
  you to expose an HTTP endpoint for external traffic.
37
37
  </p>
38
38
  ),
39
- before: [{ type: 'click', selector: workbenchXPath.links.flows }],
39
+ before: [
40
+ { type: 'click', selector: workbenchXPath.links.flows },
41
+ { type: 'click', selector: workbenchXPath.flows.dropdownFlow('python-tutorial') },
42
+ ],
40
43
  },
41
44
  {
42
45
  elementXpath: workbenchXPath.flows.previewButton('pythonapitrigger'),
@@ -2,24 +2,24 @@
2
2
  {
3
3
  "id": "basic-tutorial",
4
4
  "config": {
5
- "steps/03-state-audit-cron.step.ts": {
5
+ "steps/state-audit-cron.step.ts": {
6
6
  "x": -165,
7
7
  "y": 217,
8
8
  "sourceHandlePosition": "right"
9
9
  },
10
- "steps/02-process-food-order.step.ts": {
10
+ "steps/process-food-order.step.ts": {
11
11
  "x": 211,
12
12
  "y": 17,
13
13
  "sourceHandlePosition": "bottom",
14
14
  "targetHandlePosition": "left"
15
15
  },
16
- "steps/01-api.step.ts": {
16
+ "steps/api.step.ts": {
17
17
  "x": -100,
18
18
  "y": 3,
19
19
  "sourceHandlePosition": "right",
20
20
  "targetHandlePosition": "left"
21
21
  },
22
- "steps/04-notification.step.ts": {
22
+ "steps/notification.step.ts": {
23
23
  "x": 300,
24
24
  "y": 264
25
25
  }
@@ -5,8 +5,8 @@ export const petStoreService = {
5
5
  const response = await fetch('https://petstore.swagger.io/v2/pet', {
6
6
  method: 'POST',
7
7
  body: JSON.stringify({
8
- name: pet.name,
9
- photoUrls: [pet.photoUrl],
8
+ name: pet?.name ?? '',
9
+ photoUrls: [pet?.photoUrl ?? ''],
10
10
  status: 'available',
11
11
  }),
12
12
  headers: { 'Content-Type': 'application/json' },
@@ -17,10 +17,10 @@ export const petStoreService = {
17
17
  const response = await fetch('https://petstore.swagger.io/v2/store/order', {
18
18
  method: 'POST',
19
19
  body: JSON.stringify({
20
- quantity: order.quantity,
20
+ quantity: order?.quantity ?? 1,
21
21
  petId: 1,
22
- shipDate: order.shipDate,
23
- status: order.status,
22
+ shipDate: order?.shipDate ?? new Date().toISOString(),
23
+ status: order?.status ?? 'placed',
24
24
  }),
25
25
  headers: { 'Content-Type': 'application/json' },
26
26
  })
@@ -29,7 +29,7 @@ export const config: ApiRouteConfig = {
29
29
  emits: ['process-food-order'],
30
30
  }
31
31
 
32
- export const handler: Handlers['ApiTrigger'] = async (req, { logger, emit, traceId }) => {
32
+ export const handler: Handlers['ApiTrigger'] = async (req, { logger, emit }) => {
33
33
  logger.info('Step 01 – Processing API Step', { body: req.body })
34
34
 
35
35
  const { pet, foodOrder } = req.body
@@ -4,7 +4,7 @@ import { z } from 'zod'
4
4
  export const config: EventConfig = {
5
5
  type: 'event',
6
6
  name: 'Notification',
7
- description: 'Checks a state change',
7
+ description: 'Sends notifications to users',
8
8
  flows: ['basic-tutorial'],
9
9
  subscribes: ['notification'],
10
10
  emits: [],
@@ -15,7 +15,7 @@ export const config: EventConfig = {
15
15
  }),
16
16
  }
17
17
 
18
- export const handler: Handlers['Notification'] = async (input, { traceId, logger, state }) => {
18
+ export const handler: Handlers['Notification'] = async (input, { traceId, logger }) => {
19
19
  const { email, ...data } = input
20
20
  const redactedEmail = email.replace(/(?<=.{2}).(?=.*@)/g, '*')
21
21
 
@@ -36,7 +36,10 @@ export const steps: TutorialStep[] = [
36
36
  you to expose an HTTP endpoint for external traffic.
37
37
  </p>
38
38
  ),
39
- before: [{ type: 'click', selector: workbenchXPath.links.flows }],
39
+ before: [
40
+ { type: 'click', selector: workbenchXPath.links.flows },
41
+ { type: 'click', selector: workbenchXPath.flows.dropdownFlow('basic-tutorial') },
42
+ ],
40
43
  },
41
44
  {
42
45
  elementXpath: workbenchXPath.flows.previewButton('apitrigger'),
@@ -5,8 +5,8 @@ from .types import Order, Pet
5
5
  class PetStoreService:
6
6
  async def create_pet(self, pet: Dict[str, Any]) -> Pet:
7
7
  pet_data = {
8
- "name": pet["name"],
9
- "photoUrls": [pet["photo_url"]],
8
+ "name": pet.get("name", ""),
9
+ "photoUrls": [pet.get("photo_url", "")],
10
10
  "status": "available"
11
11
  }
12
12
 
@@ -21,10 +21,10 @@ class PetStoreService:
21
21
  async def create_order(self, order: Dict[str, Any]) -> Order:
22
22
  async with httpx.AsyncClient() as client:
23
23
  order_data = {
24
- "quantity": order.get("quantity"),
24
+ "quantity": order.get("quantity", 1),
25
25
  "petId": 1,
26
- "shipDate": order.get("ship_date"),
27
- "status": order.get("status"),
26
+ "shipDate": order.get("ship_date", "2025-08-22T22:07:04.730Z"),
27
+ "status": order.get("status", "placed"),
28
28
  }
29
29
 
30
30
  response = await client.post(
@@ -1,4 +1,4 @@
1
- from datetime import datetime
1
+ from datetime import datetime, timezone
2
2
 
3
3
  config = {
4
4
  "type": "cron",
@@ -14,7 +14,7 @@ async def handler(context):
14
14
 
15
15
  for item in state_value:
16
16
  # check if current date is after item.ship_date
17
- current_date = datetime.now()
17
+ current_date = datetime.now(timezone.utc)
18
18
  ship_date = datetime.fromisoformat(item.get("shipDate", "").replace('Z', '+00:00'))
19
19
 
20
20
  if not item.get("complete", False) and current_date > ship_date:
@@ -36,7 +36,10 @@ export const steps: TutorialStep[] = [
36
36
  you to expose an HTTP endpoint for external traffic.
37
37
  </p>
38
38
  ),
39
- before: [{ type: 'click', selector: workbenchXPath.links.flows }],
39
+ before: [
40
+ { type: 'click', selector: workbenchXPath.links.flows },
41
+ { type: 'click', selector: workbenchXPath.flows.dropdownFlow('python-tutorial') },
42
+ ],
40
43
  },
41
44
  {
42
45
  elementXpath: workbenchXPath.flows.previewButton('pythonapitrigger'),
@@ -2,24 +2,24 @@
2
2
  {
3
3
  "id": "basic-tutorial",
4
4
  "config": {
5
- "steps/03-state-audit-cron.step.ts": {
5
+ "steps/state-audit-cron.step.ts": {
6
6
  "x": -165,
7
7
  "y": 217,
8
8
  "sourceHandlePosition": "right"
9
9
  },
10
- "steps/02-process-food-order.step.ts": {
10
+ "steps/process-food-order.step.ts": {
11
11
  "x": 211,
12
12
  "y": 17,
13
13
  "sourceHandlePosition": "bottom",
14
14
  "targetHandlePosition": "left"
15
15
  },
16
- "steps/01-api.step.ts": {
16
+ "steps/api.step.ts": {
17
17
  "x": -100,
18
18
  "y": 3,
19
19
  "sourceHandlePosition": "right",
20
20
  "targetHandlePosition": "left"
21
21
  },
22
- "steps/04-notification.step.ts": {
22
+ "steps/notification.step.ts": {
23
23
  "x": 300,
24
24
  "y": 264
25
25
  }
@@ -5,8 +5,8 @@ export const petStoreService = {
5
5
  const response = await fetch('https://petstore.swagger.io/v2/pet', {
6
6
  method: 'POST',
7
7
  body: JSON.stringify({
8
- name: pet.name,
9
- photoUrls: [pet.photoUrl],
8
+ name: pet?.name ?? '',
9
+ photoUrls: [pet?.photoUrl ?? ''],
10
10
  status: 'available',
11
11
  }),
12
12
  headers: { 'Content-Type': 'application/json' },
@@ -17,10 +17,10 @@ export const petStoreService = {
17
17
  const response = await fetch('https://petstore.swagger.io/v2/store/order', {
18
18
  method: 'POST',
19
19
  body: JSON.stringify({
20
- quantity: order.quantity,
20
+ quantity: order?.quantity ?? 1,
21
21
  petId: 1,
22
- shipDate: order.shipDate,
23
- status: order.status,
22
+ shipDate: order?.shipDate ?? new Date().toISOString(),
23
+ status: order?.status ?? 'placed',
24
24
  }),
25
25
  headers: { 'Content-Type': 'application/json' },
26
26
  })
@@ -29,7 +29,7 @@ export const config: ApiRouteConfig = {
29
29
  emits: ['process-food-order'],
30
30
  }
31
31
 
32
- export const handler: Handlers['ApiTrigger'] = async (req, { logger, emit, traceId }) => {
32
+ export const handler: Handlers['ApiTrigger'] = async (req, { logger, emit }) => {
33
33
  logger.info('Step 01 – Processing API Step', { body: req.body })
34
34
 
35
35
  const { pet, foodOrder } = req.body
@@ -4,7 +4,7 @@ import { z } from 'zod'
4
4
  export const config: EventConfig = {
5
5
  type: 'event',
6
6
  name: 'Notification',
7
- description: 'Checks a state change',
7
+ description: 'Sends notifications to users',
8
8
  flows: ['basic-tutorial'],
9
9
  subscribes: ['notification'],
10
10
  emits: [],
@@ -15,7 +15,7 @@ export const config: EventConfig = {
15
15
  }),
16
16
  }
17
17
 
18
- export const handler: Handlers['Notification'] = async (input, { traceId, logger, state }) => {
18
+ export const handler: Handlers['Notification'] = async (input, { traceId, logger }) => {
19
19
  const { email, ...data } = input
20
20
  const redactedEmail = email.replace(/(?<=.{2}).(?=.*@)/g, '*')
21
21
 
@@ -36,7 +36,10 @@ export const steps: TutorialStep[] = [
36
36
  you to expose an HTTP endpoint for external traffic.
37
37
  </p>
38
38
  ),
39
- before: [{ type: 'click', selector: workbenchXPath.links.flows }],
39
+ before: [
40
+ { type: 'click', selector: workbenchXPath.links.flows },
41
+ { type: 'click', selector: workbenchXPath.flows.dropdownFlow('basic-tutorial') },
42
+ ],
40
43
  },
41
44
  {
42
45
  elementXpath: 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-214453",
4
+ "version": "0.5.11-beta.120-559255",
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-214453",
47
- "@motiadev/workbench": "0.5.11-beta.120-214453",
48
- "@motiadev/stream-client-node": "0.5.11-beta.120-214453"
46
+ "@motiadev/core": "0.5.11-beta.120-559255",
47
+ "@motiadev/stream-client-node": "0.5.11-beta.120-559255",
48
+ "@motiadev/workbench": "0.5.11-beta.120-559255"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@amplitude/analytics-types": "^2.9.2",