@motiadev/core 0.5.12-beta.121 → 0.6.0-beta.122

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.
@@ -19,6 +19,20 @@ class RpcStateManager:
19
19
  return {'data': result}
20
20
 
21
21
  return result
22
+
23
+ async def get_group(self, group_id: str) -> asyncio.Future[Any]:
24
+ result = await self.rpc.send('state.getGroup', {'groupId': group_id})
25
+
26
+ if result is None:
27
+ return {'data': None}
28
+ elif isinstance(result, dict):
29
+ if 'data' not in result:
30
+ return {'data': result}
31
+
32
+ return result
33
+
34
+ async def getGroup(self, trace_id: str, key: str) -> asyncio.Future[Any]:
35
+ return await self.get_group(trace_id, key)
22
36
 
23
37
  async def set(self, trace_id: str, key: str, value: Any) -> asyncio.Future[None]:
24
38
  future = await self.rpc.send('state.set', {'traceId': trace_id, 'key': key, 'value': value})
@@ -23,6 +23,9 @@ class RpcStreamManager:
23
23
 
24
24
  async def getGroup(self, group_id: str) -> asyncio.Future[None]:
25
25
  return await self.rpc.send(f'streams.{self.stream_name}.getGroup', {'groupId': group_id})
26
+
27
+ async def get_group(self, group_id: str) -> asyncio.Future[None]:
28
+ return await self.getGroup(group_id)
26
29
 
27
30
  async def send(self, channel: Dict, event: Dict) -> asyncio.Future[None]:
28
31
  return await self.rpc.send(f'streams.{self.stream_name}.send', {'channel': channel, 'event': event})
@@ -6,23 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.stepEndpoint = void 0;
7
7
  const promises_1 = __importDefault(require("fs/promises"));
8
8
  const flows_helper_1 = require("./helper/flows-helper");
9
+ const getFeatures = async (filePath) => {
10
+ const stat = await promises_1.default.stat(filePath + '-features.json').catch(() => null);
11
+ if (!stat || stat.isDirectory()) {
12
+ return [];
13
+ }
14
+ try {
15
+ const content = await promises_1.default.readFile(filePath + '-features.json', 'utf8');
16
+ return JSON.parse(content);
17
+ }
18
+ catch (error) {
19
+ return [];
20
+ }
21
+ };
9
22
  const stepEndpoint = (app, lockedData) => {
10
23
  app.get('/step/:stepId', async (req, res) => {
11
- const stepId = req.params.stepId;
24
+ const id = req.params.stepId;
12
25
  const allSteps = [...lockedData.activeSteps, ...lockedData.devSteps];
13
- const step = allSteps.find((step) => (0, flows_helper_1.generateStepId)(step.filePath) === stepId);
26
+ const step = allSteps.find((step) => (0, flows_helper_1.generateStepId)(step.filePath) === id);
14
27
  if (!step) {
15
- res.status(404).send({
16
- error: 'Step not found',
17
- });
28
+ res.status(404).send({ error: 'Step not found' });
18
29
  return;
19
30
  }
20
31
  try {
21
32
  const content = await promises_1.default.readFile(step.filePath, 'utf8');
22
- res.status(200).send({
23
- id: stepId,
24
- content,
25
- });
33
+ const features = await getFeatures(step.filePath);
34
+ res.status(200).send({ id, content, features });
26
35
  }
27
36
  catch (error) {
28
37
  console.error('Error reading step file:', error);
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.12-beta.121",
5
+ "version": "0.6.0-beta.122",
6
6
  "dependencies": {
7
7
  "@amplitude/analytics-node": "^1.3.8",
8
8
  "body-parser": "^1.20.3",