@motiadev/core 0.8.2-beta.139 → 0.8.2-beta.140-246724
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.
|
@@ -97,7 +97,12 @@ const callStepFile = (options, motia) => {
|
|
|
97
97
|
return motia.state.getGroup(input.groupId);
|
|
98
98
|
});
|
|
99
99
|
processManager.handler('result', async (input) => {
|
|
100
|
-
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
const anyInput = { ...input };
|
|
102
|
+
if (anyInput.body && anyInput.body.type === 'Buffer') {
|
|
103
|
+
anyInput.body = Buffer.from(anyInput.body.data);
|
|
104
|
+
}
|
|
105
|
+
result = anyInput;
|
|
101
106
|
});
|
|
102
107
|
processManager.handler('emit', async (input) => {
|
|
103
108
|
const flows = step.config.flows;
|
|
@@ -20,8 +20,8 @@ class ApiEndpointsStream extends stream_adapter_1.StreamAdapter {
|
|
|
20
20
|
super();
|
|
21
21
|
this.lockedData = lockedData;
|
|
22
22
|
}
|
|
23
|
-
async get(id) {
|
|
24
|
-
const endpoint = this.lockedData.apiSteps().find((step) => step.
|
|
23
|
+
async get(_groupId, id) {
|
|
24
|
+
const endpoint = this.lockedData.apiSteps().find((step) => step.filePath === id);
|
|
25
25
|
return endpoint ? mapEndpoint(endpoint) : null;
|
|
26
26
|
}
|
|
27
27
|
async delete(id) {
|
package/dist/src/printer.d.ts
CHANGED
package/dist/src/printer.js
CHANGED
|
@@ -10,7 +10,7 @@ const guards_1 = require("./guards");
|
|
|
10
10
|
const stepTag = colors_1.default.bold(colors_1.default.magenta('Step'));
|
|
11
11
|
const flowTag = colors_1.default.bold(colors_1.default.blue('Flow'));
|
|
12
12
|
const streamTag = colors_1.default.bold(colors_1.default.green('Stream'));
|
|
13
|
-
const
|
|
13
|
+
const registered = colors_1.default.green('➜ [REGISTERED]');
|
|
14
14
|
const building = colors_1.default.yellow('⚡ [BUILDING]');
|
|
15
15
|
const built = colors_1.default.green('✓ [BUILT]');
|
|
16
16
|
const updated = colors_1.default.yellow('➜ [UPDATED]');
|
|
@@ -23,7 +23,7 @@ class Printer {
|
|
|
23
23
|
this.baseDir = baseDir;
|
|
24
24
|
this.stepTag = stepTag;
|
|
25
25
|
this.flowTag = flowTag;
|
|
26
|
-
this.
|
|
26
|
+
this.registered = registered;
|
|
27
27
|
this.building = building;
|
|
28
28
|
this.built = built;
|
|
29
29
|
this.updated = updated;
|
|
@@ -33,7 +33,7 @@ class Printer {
|
|
|
33
33
|
console.log(`${invalidEmit} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} tried to emit an event not defined in the step config: ${colors_1.default.yellow(emit)}`);
|
|
34
34
|
}
|
|
35
35
|
printStepCreated(step) {
|
|
36
|
-
console.log(`${
|
|
36
|
+
console.log(`${registered} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} registered`);
|
|
37
37
|
}
|
|
38
38
|
printStepUpdated(step) {
|
|
39
39
|
console.log(`${updated} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} updated`);
|
|
@@ -42,7 +42,7 @@ class Printer {
|
|
|
42
42
|
console.log(`${removed} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} removed`);
|
|
43
43
|
}
|
|
44
44
|
printFlowCreated(flowName) {
|
|
45
|
-
console.log(`${
|
|
45
|
+
console.log(`${registered} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} registered`);
|
|
46
46
|
}
|
|
47
47
|
printFlowUpdated(flowName) {
|
|
48
48
|
console.log(`${updated} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} updated`);
|
|
@@ -51,7 +51,7 @@ class Printer {
|
|
|
51
51
|
console.log(`${removed} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} removed`);
|
|
52
52
|
}
|
|
53
53
|
printStreamCreated(stream) {
|
|
54
|
-
console.log(`${
|
|
54
|
+
console.log(`${registered} ${streamTag} ${this.getStreamPath(stream)} registered`);
|
|
55
55
|
}
|
|
56
56
|
printStreamUpdated(stream) {
|
|
57
57
|
console.log(`${updated} ${streamTag} ${this.getStreamPath(stream)} updated`);
|
package/dist/src/server.js
CHANGED
|
@@ -140,7 +140,13 @@ const createServer = (lockedData, eventManager, state, config) => {
|
|
|
140
140
|
Object.entries(result.headers).forEach(([key, value]) => res.setHeader(key, value));
|
|
141
141
|
}
|
|
142
142
|
res.status(result.status);
|
|
143
|
-
|
|
143
|
+
// Handle different body types
|
|
144
|
+
if (Buffer.isBuffer(result.body) || typeof result.body === 'string') {
|
|
145
|
+
res.send(result.body);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
res.json(result.body);
|
|
149
|
+
}
|
|
144
150
|
}
|
|
145
151
|
catch (error) {
|
|
146
152
|
(0, utils_1.trackEvent)('api_call_error', {
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z, ZodArray, ZodObject } from 'zod';
|
|
1
|
+
import { z, ZodAny, ZodArray, ZodObject } from 'zod';
|
|
2
2
|
import { Logger } from './logger';
|
|
3
3
|
import { Tracer } from './observability';
|
|
4
4
|
export type ZodInput = ZodObject<any> | ZodArray<any>;
|
|
@@ -71,7 +71,7 @@ export interface ApiRouteConfig {
|
|
|
71
71
|
flows?: string[];
|
|
72
72
|
middleware?: ApiMiddleware<any, any, any>[];
|
|
73
73
|
bodySchema?: ZodInput;
|
|
74
|
-
responseSchema?: Record<number, ZodInput>;
|
|
74
|
+
responseSchema?: Record<number, ZodInput | ZodAny>;
|
|
75
75
|
queryParams?: QueryParam[];
|
|
76
76
|
/**
|
|
77
77
|
* Files to include in the step bundle.
|
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.8.2-beta.
|
|
5
|
+
"version": "0.8.2-beta.140-246724",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@amplitude/analytics-node": "^1.3.8",
|
|
8
8
|
"body-parser": "^1.20.3",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/body-parser": "^1.19.5",
|
|
22
|
-
"@types/cors": "^2.8.17",
|
|
23
22
|
"@types/express": "^5.0.1",
|
|
24
23
|
"@types/jest": "^29.5.14",
|
|
25
24
|
"@types/node-cron": "^3.0.11",
|