@motiadev/core 0.5.2-beta.102-571342 → 0.5.2-beta.102-976525

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,5 +1,3 @@
1
1
  import { Step } from 'src/types';
2
2
  import { FlowResponse } from '../types/flows-types';
3
- export declare const STEP_NAMESPACE = "7f1c3ff2-9b00-4d0a-bdd7-efb8bca49d4f";
4
- export declare const generateStepId: (filePath: string) => string;
5
3
  export declare const generateFlow: (flowId: string, flowSteps: Step[]) => FlowResponse;
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateFlow = exports.generateStepId = exports.STEP_NAMESPACE = void 0;
6
+ exports.generateFlow = void 0;
7
7
  const guards_1 = require("../guards");
8
+ const crypto_1 = require("crypto");
8
9
  const get_step_language_1 = require("../get-step-language");
9
10
  const path_1 = __importDefault(require("path"));
10
11
  const fs_1 = __importDefault(require("fs"));
11
- const uuid_1 = require("uuid");
12
12
  const getNodeComponentPath = (filePath) => {
13
13
  const filePathWithoutExtension = filePath.replace(/\.[^/.]+$/, '');
14
14
  const tsxPath = filePathWithoutExtension + '.tsx';
@@ -107,13 +107,8 @@ const createCronStepResponse = (step, id) => {
107
107
  cronExpression: step.config.cron,
108
108
  };
109
109
  };
110
- exports.STEP_NAMESPACE = '7f1c3ff2-9b00-4d0a-bdd7-efb8bca49d4f';
111
- const generateStepId = (filePath) => {
112
- return (0, uuid_1.v5)(filePath, exports.STEP_NAMESPACE);
113
- };
114
- exports.generateStepId = generateStepId;
115
110
  const createStepResponse = (step) => {
116
- const id = (0, exports.generateStepId)(step.filePath);
111
+ const id = (0, crypto_1.randomUUID)();
117
112
  if ((0, guards_1.isApiStep)(step))
118
113
  return createApiStepResponse(step, id);
119
114
  if ((0, guards_1.isEventStep)(step))
@@ -25,7 +25,6 @@ const api_endpoints_1 = require("./streams/api-endpoints");
25
25
  const logs_stream_1 = require("./streams/logs-stream");
26
26
  const logger_1 = require("./logger");
27
27
  const printer_1 = require("./printer");
28
- const step_endpoint_1 = require("./step-endpoint");
29
28
  const createServer = (lockedData, eventManager, state, config) => {
30
29
  const printer = config.printer ?? new printer_1.Printer(process.cwd());
31
30
  const app = (0, express_1.default)();
@@ -194,7 +193,6 @@ const createServer = (lockedData, eventManager, state, config) => {
194
193
  (0, flows_endpoint_1.flowsEndpoint)(lockedData);
195
194
  (0, flows_config_endpoint_1.flowsConfigEndpoint)(app, process.cwd(), lockedData);
196
195
  (0, analytics_endpoint_1.analyticsEndpoint)(app, process.cwd());
197
- (0, step_endpoint_1.stepEndpoint)(app, lockedData);
198
196
  server.on('error', (error) => {
199
197
  console.error('Server error:', error);
200
198
  });
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.2-beta.102-571342",
5
+ "version": "0.5.2-beta.102-976525",
6
6
  "dependencies": {
7
7
  "@amplitude/analytics-node": "^1.3.8",
8
8
  "body-parser": "^1.20.3",
@@ -14,7 +14,6 @@
14
14
  "node-cron": "^3.0.3",
15
15
  "ts-node": "^10.9.2",
16
16
  "tsconfig-paths": "^4.2.0",
17
- "uuid": "^11.1.0",
18
17
  "ws": "^8.18.2",
19
18
  "zod": "^3.24.1",
20
19
  "zod-to-json-schema": "^3.24.1"
@@ -1,3 +0,0 @@
1
- import { LockedData } from './locked-data';
2
- import { Express } from 'express';
3
- export declare const stepEndpoint: (app: Express, lockedData: LockedData) => void;
@@ -1,35 +0,0 @@
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.stepEndpoint = void 0;
7
- const promises_1 = __importDefault(require("fs/promises"));
8
- const flows_helper_1 = require("./helper/flows-helper");
9
- const stepEndpoint = (app, lockedData) => {
10
- app.get('/step/:stepId', async (req, res) => {
11
- const stepId = req.params.stepId;
12
- const allSteps = [...lockedData.activeSteps, ...lockedData.devSteps];
13
- const step = allSteps.find((step) => (0, flows_helper_1.generateStepId)(step.filePath) === stepId);
14
- if (!step) {
15
- res.status(404).send({
16
- error: 'Step not found',
17
- });
18
- return;
19
- }
20
- try {
21
- const content = await promises_1.default.readFile(step.filePath, 'utf8');
22
- res.status(200).send({
23
- id: stepId,
24
- content,
25
- });
26
- }
27
- catch (error) {
28
- console.error('Error reading step file:', error);
29
- res.status(500).send({
30
- error: 'Failed to read step file',
31
- });
32
- }
33
- });
34
- };
35
- exports.stepEndpoint = stepEndpoint;