@motiadev/core 0.8.2-beta.140-111855 → 0.8.2-beta.140-559269
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/motia.d.ts +1 -0
- package/dist/src/motia.d.ts.map +1 -1
- package/dist/src/observability/tracer.js +1 -1
- package/dist/src/printer.d.ts +6 -0
- package/dist/src/printer.d.ts.map +1 -1
- package/dist/src/printer.js +19 -2
- package/dist/src/queue-manager.d.ts +0 -1
- package/dist/src/queue-manager.d.ts.map +1 -1
- package/dist/src/queue-manager.js +3 -17
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +3 -4
- package/package.json +1 -1
package/dist/src/motia.d.ts
CHANGED
package/dist/src/motia.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motia.d.ts","sourceRoot":"","sources":["../../src/motia.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,MAAM,MAAM,KAAK,GAAG;IAClB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UA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apter_1 = require("./trace-stream-adapter");
|
|
8
8
|
const MAX_TRACE_GROUPS = process.env.MOTIA_MAX_TRACE_GROUPS //
|
|
9
|
-
? parseInt(process.env.MOTIA_MAX_TRACE_GROUPS)
|
|
9
|
+
? Number.parseInt(process.env.MOTIA_MAX_TRACE_GROUPS, 10)
|
|
10
10
|
: 50;
|
|
11
11
|
class BaseTracerFactory {
|
|
12
12
|
constructor(traceStream, traceGroupStream) {
|
package/dist/src/printer.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ export declare class Printer {
|
|
|
35
35
|
getStepType(step: Step): string;
|
|
36
36
|
getStepPath(step: Step): string;
|
|
37
37
|
getStreamPath(stream: Stream): string;
|
|
38
|
+
printPluginLog(message: string): void;
|
|
39
|
+
printPluginWarn(message: string): void;
|
|
40
|
+
printPluginError(message: string, ...args: unknown[]): void;
|
|
38
41
|
}
|
|
39
42
|
export declare class NoPrinter extends Printer {
|
|
40
43
|
constructor();
|
|
@@ -51,5 +54,8 @@ export declare class NoPrinter extends Printer {
|
|
|
51
54
|
printStreamCreated(): void;
|
|
52
55
|
printStreamUpdated(): void;
|
|
53
56
|
printStreamRemoved(): void;
|
|
57
|
+
printPluginLog(): void;
|
|
58
|
+
printPluginWarn(): void;
|
|
59
|
+
printPluginError(): void;
|
|
54
60
|
}
|
|
55
61
|
//# sourceMappingURL=printer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../../src/printer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../../src/printer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,MA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AAM;IAK5B,cAAc,CAAC,OAAO,EAAE,MAAM;IAK9B,eAAe,CAAC,OAAO,EAAE,MAAM;IAK/B,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;CAIrD;AAED,qBAAa,SAAU,SAAQ,OAAO;;IAKpC,8BAA8B;IAE9B,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,aAAa;IAEb,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAElB,cAAc;IACd,eAAe;IACf,gBAAgB;CACjB"}
|
package/dist/src/printer.js
CHANGED
|
@@ -18,6 +18,9 @@ const removed = colors_1.default.red('➜ [REMOVED]');
|
|
|
18
18
|
const invalidEmit = colors_1.default.red('➜ [INVALID EMIT]');
|
|
19
19
|
const error = colors_1.default.red('[ERROR]');
|
|
20
20
|
const warning = colors_1.default.yellow('[WARNING]');
|
|
21
|
+
const warnIcon = colors_1.default.yellow('⚠');
|
|
22
|
+
const infoIcon = colors_1.default.blue('ℹ');
|
|
23
|
+
const errorIcon = colors_1.default.red('✖');
|
|
21
24
|
class Printer {
|
|
22
25
|
constructor(baseDir) {
|
|
23
26
|
this.baseDir = baseDir;
|
|
@@ -30,7 +33,6 @@ class Printer {
|
|
|
30
33
|
this.removed = removed;
|
|
31
34
|
}
|
|
32
35
|
printEventInputValidationError(emit, details) {
|
|
33
|
-
const warnIcon = colors_1.default.yellow('⚠');
|
|
34
36
|
const emitPath = colors_1.default.bold(colors_1.default.cyan(`Emit ${emit.topic}`));
|
|
35
37
|
console.log(`${warnIcon} ${warning} ${emitPath} validation issues:`);
|
|
36
38
|
const hasAny = details.missingFields?.length || details.extraFields?.length || details.typeMismatches?.length;
|
|
@@ -81,7 +83,7 @@ class Printer {
|
|
|
81
83
|
console.log(`${removed} ${streamTag} ${this.getStreamPath(stream)} removed`);
|
|
82
84
|
}
|
|
83
85
|
printInvalidEmitConfiguration(step, emit) {
|
|
84
|
-
console.log(`${warning} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} emits to ${colors_1.default.yellow(emit)}, but there is no subscriber defined`);
|
|
86
|
+
console.log(`${warnIcon} ${warning} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} emits to ${colors_1.default.yellow(emit)}, but there is no subscriber defined`);
|
|
85
87
|
}
|
|
86
88
|
printInvalidSchema(topic, step) {
|
|
87
89
|
console.log(`${error} Topic ${colors_1.default.bold(colors_1.default.blue(topic))} has incompatible schemas in the following steps:`);
|
|
@@ -124,6 +126,18 @@ class Printer {
|
|
|
124
126
|
const streamPath = this.getRelativePath(stream.filePath);
|
|
125
127
|
return colors_1.default.bold(colors_1.default.magenta(streamPath));
|
|
126
128
|
}
|
|
129
|
+
printPluginLog(message) {
|
|
130
|
+
const pluginTag = colors_1.default.bold(colors_1.default.cyan('[motia-plugins]'));
|
|
131
|
+
console.log(`${infoIcon} ${pluginTag} ${message}`);
|
|
132
|
+
}
|
|
133
|
+
printPluginWarn(message) {
|
|
134
|
+
const pluginTag = colors_1.default.bold(colors_1.default.cyan('[motia-plugins]'));
|
|
135
|
+
console.warn(`${warnIcon} ${pluginTag} ${colors_1.default.yellow(message)}`);
|
|
136
|
+
}
|
|
137
|
+
printPluginError(message, ...args) {
|
|
138
|
+
const pluginTag = colors_1.default.bold(colors_1.default.cyan('[motia-plugins]'));
|
|
139
|
+
console.error(`${errorIcon} ${pluginTag} ${colors_1.default.red(message)}`, ...args);
|
|
140
|
+
}
|
|
127
141
|
}
|
|
128
142
|
exports.Printer = Printer;
|
|
129
143
|
class NoPrinter extends Printer {
|
|
@@ -143,5 +157,8 @@ class NoPrinter extends Printer {
|
|
|
143
157
|
printStreamCreated() { }
|
|
144
158
|
printStreamUpdated() { }
|
|
145
159
|
printStreamRemoved() { }
|
|
160
|
+
printPluginLog() { }
|
|
161
|
+
printPluginWarn() { }
|
|
162
|
+
printPluginError() { }
|
|
146
163
|
}
|
|
147
164
|
exports.NoPrinter = NoPrinter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-manager.d.ts","sourceRoot":"","sources":["../../src/queue-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1D,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,eAAgB,SAAQ,UAAU;aAG3B,QAAQ,EAAE,MAAM;gBADhC,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM;CAKnC;AAoBD,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"queue-manager.d.ts","sourceRoot":"","sources":["../../src/queue-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1D,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,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AAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAQ7C,KAAK,IAAI,IAAI;CAUd"}
|
|
@@ -34,9 +34,11 @@ class QueueManager {
|
|
|
34
34
|
this.queueEmitter = new events_1.EventEmitter();
|
|
35
35
|
this.scheduledTimeouts = new Map();
|
|
36
36
|
this.metrics = new Map();
|
|
37
|
-
this.topicListeners = new Map();
|
|
38
37
|
this.processingMessages = new Set();
|
|
39
38
|
this.logger = logger || logger_1.globalLogger;
|
|
39
|
+
this.queueEmitter.on('process', (topic) => {
|
|
40
|
+
this.processQueue(topic);
|
|
41
|
+
});
|
|
40
42
|
}
|
|
41
43
|
initMetrics(topic) {
|
|
42
44
|
if (!this.metrics.has(topic)) {
|
|
@@ -96,7 +98,6 @@ class QueueManager {
|
|
|
96
98
|
message.subscriptionId = handler.subscriptionId;
|
|
97
99
|
message.visibleAt = Date.now();
|
|
98
100
|
}
|
|
99
|
-
const visibilityTimeoutMs = handler.queueConfig.visibilityTimeout * 1000;
|
|
100
101
|
this.updateMetric(topic, 'processingCount', 1);
|
|
101
102
|
try {
|
|
102
103
|
await handler.handler(message.event);
|
|
@@ -194,15 +195,6 @@ class QueueManager {
|
|
|
194
195
|
if (!this.subscriptions[topic]) {
|
|
195
196
|
this.subscriptions[topic] = [];
|
|
196
197
|
}
|
|
197
|
-
if (!this.topicListeners.has(topic)) {
|
|
198
|
-
const listener = (t) => {
|
|
199
|
-
if (t === topic) {
|
|
200
|
-
this.processQueue(topic);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
this.topicListeners.set(topic, listener);
|
|
204
|
-
this.queueEmitter.on('process', listener);
|
|
205
|
-
}
|
|
206
198
|
const internalSubscriptionId = (0, crypto_1.randomUUID)();
|
|
207
199
|
this.subscriptions[topic].push({ handler, queueConfig, subscriptionId, internalSubscriptionId });
|
|
208
200
|
if (this.queues[topic] && this.queues[topic].length > 0) {
|
|
@@ -228,11 +220,6 @@ class QueueManager {
|
|
|
228
220
|
delete this.subscriptions[topic];
|
|
229
221
|
const hasQueuedMessages = this.queues[topic] && this.queues[topic].length > 0;
|
|
230
222
|
if (!hasQueuedMessages) {
|
|
231
|
-
const listener = this.topicListeners.get(topic);
|
|
232
|
-
if (listener) {
|
|
233
|
-
this.queueEmitter.off('process', listener);
|
|
234
|
-
this.topicListeners.delete(topic);
|
|
235
|
-
}
|
|
236
223
|
const timeout = this.scheduledTimeouts.get(topic);
|
|
237
224
|
if (timeout) {
|
|
238
225
|
clearTimeout(timeout);
|
|
@@ -260,7 +247,6 @@ class QueueManager {
|
|
|
260
247
|
this.lockedGroups = new Set();
|
|
261
248
|
this.processingMessages = new Set();
|
|
262
249
|
this.metrics.clear();
|
|
263
|
-
this.topicListeners.clear();
|
|
264
250
|
}
|
|
265
251
|
}
|
|
266
252
|
exports.QueueManager = QueueManager;
|
package/dist/src/server.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { StateAdapter } from './state/state-adapter';
|
|
|
10
10
|
import { type MotiaEventManager } from './step-handlers';
|
|
11
11
|
import type { ApiRouteConfig, EventManager, Step } from './types';
|
|
12
12
|
export type MotiaServer = {
|
|
13
|
+
printer: Printer;
|
|
13
14
|
app: Express;
|
|
14
15
|
server: http.Server;
|
|
15
16
|
socketServer: WsServer;
|
package/dist/src/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,KAAK,OAAO,EAA+B,MAAM,SAAS,CAAA;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAA;AAG5C,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,gBAAgB,CAAA;AAOpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,C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AAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,YAAY,UAAU,EACtB,cAAc,YAAY,EAC1B,OAAO,YAAY,EACnB,QAAQ,iBAAiB,EACzB,eAAe,YAAY,KAC1B,WAmRF,CAAA"}
|
package/dist/src/server.js
CHANGED
|
@@ -127,7 +127,6 @@ const createServer = (lockedData, eventManager, state, config, queueManager) =>
|
|
|
127
127
|
const traceId = (0, generate_trace_id_1.generateTraceId)();
|
|
128
128
|
const { name: stepName, flows } = step.config;
|
|
129
129
|
const logger = loggerFactory.create({ traceId, flows, stepName });
|
|
130
|
-
const tracer = await motia.tracerFactory.createTracer(traceId, step, logger);
|
|
131
130
|
logger.debug('[API] Received request, processing step', { path: req.path });
|
|
132
131
|
const data = {
|
|
133
132
|
body: req.body,
|
|
@@ -148,7 +147,7 @@ const createServer = (lockedData, eventManager, state, config, queueManager) =>
|
|
|
148
147
|
traceId,
|
|
149
148
|
flows,
|
|
150
149
|
logger,
|
|
151
|
-
tracer,
|
|
150
|
+
tracer: null,
|
|
152
151
|
};
|
|
153
152
|
await eventManager.emit(eventObj);
|
|
154
153
|
},
|
|
@@ -156,9 +155,9 @@ const createServer = (lockedData, eventManager, state, config, queueManager) =>
|
|
|
156
155
|
streams: lockedData.getStreams(),
|
|
157
156
|
};
|
|
158
157
|
result = await step.handler(data, context);
|
|
159
|
-
tracer.end();
|
|
160
158
|
}
|
|
161
159
|
else {
|
|
160
|
+
const tracer = await motia.tracerFactory.createTracer(traceId, step, logger);
|
|
162
161
|
result = await (0, call_step_file_1.callStepFile)({ data, step, logger, tracer, traceId }, motia);
|
|
163
162
|
}
|
|
164
163
|
(0, utils_1.trackEvent)('api_call_success', { stepName });
|
|
@@ -256,6 +255,6 @@ const createServer = (lockedData, eventManager, state, config, queueManager) =>
|
|
|
256
255
|
cronManager.close();
|
|
257
256
|
socketServer.close();
|
|
258
257
|
};
|
|
259
|
-
return { app, server, socketServer, close, removeRoute, addRoute, cronManager, motiaEventManager, motia };
|
|
258
|
+
return { app, server, socketServer, close, removeRoute, addRoute, cronManager, motiaEventManager, motia, printer };
|
|
260
259
|
};
|
|
261
260
|
exports.createServer = createServer;
|
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.140-
|
|
5
|
+
"version": "0.8.2-beta.140-559269",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@amplitude/analytics-node": "^1.3.8",
|
|
8
8
|
"ajv": "^8.17.1",
|