@motiadev/core 0.0.17 → 0.0.18
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.
- package/dist/src/steps/emit.step.ts +28 -0
- package/package.json +3 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ApiRouteConfig, StepHandler } from '../types'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
export const config: ApiRouteConfig = {
|
|
5
|
+
type: 'api',
|
|
6
|
+
name: 'Event Emitter',
|
|
7
|
+
description: 'System endpoint for emitting events',
|
|
8
|
+
path: '/emit',
|
|
9
|
+
method: 'POST',
|
|
10
|
+
emits: [], // Dynamic emissions
|
|
11
|
+
flows: ['_system'],
|
|
12
|
+
bodySchema: z.object({
|
|
13
|
+
type: z.string(),
|
|
14
|
+
data: z.record(z.unknown()),
|
|
15
|
+
}),
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const handler: StepHandler<typeof config> = async (req, { emit, logger }) => {
|
|
19
|
+
const { type, data } = req.body
|
|
20
|
+
|
|
21
|
+
logger.info('[Event Emitter] Emitting event', { type, data })
|
|
22
|
+
await emit({ type, data })
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
status: 200,
|
|
26
|
+
body: { success: true, emitted: { type, data } },
|
|
27
|
+
}
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motiadev/core",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.18",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"body-parser": "^1.20.3",
|
|
7
7
|
"express": "^4.21.2",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"move:python": "cp src/python/*.py dist/src/python",
|
|
28
28
|
"move:rb": "cp src/ruby/*.rb dist/src/ruby",
|
|
29
|
-
"
|
|
29
|
+
"move:steps": "cp src/steps/*.ts dist/src/steps",
|
|
30
|
+
"build": "rm -rf dist && tsc && npm run move:python && npm run move:rb && npm run move:steps",
|
|
30
31
|
"lint": "eslint --config ../../eslint.config.js",
|
|
31
32
|
"watch": "tsc --watch",
|
|
32
33
|
"test": "jest"
|