@motiadev/core 0.11.1-beta.155 → 0.11.1-beta.156-879726
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/locked-data.d.ts +3 -1
- package/dist/src/locked-data.d.ts.map +1 -1
- package/dist/src/locked-data.js +2 -1
- package/dist/src/logger-factory.d.ts +1 -1
- package/dist/src/logger-factory.d.ts.map +1 -1
- package/dist/src/observability/redis-trace-stream-adapter.d.ts +17 -0
- package/dist/src/observability/redis-trace-stream-adapter.d.ts.map +1 -0
- package/dist/src/observability/redis-trace-stream-adapter.js +65 -0
- package/dist/src/observability/tracer.d.ts.map +1 -1
- package/dist/src/observability/tracer.js +3 -5
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +7 -2
- package/dist/src/streams/redis-logs-stream.d.ts +31 -0
- package/dist/src/streams/redis-logs-stream.d.ts.map +1 -0
- package/dist/src/streams/redis-logs-stream.js +84 -0
- package/package.json +4 -1
- package/dist/src/observability/trace-stream-adapter.d.ts +0 -12
- package/dist/src/observability/trace-stream-adapter.d.ts.map +0 -1
- package/dist/src/observability/trace-stream-adapter.js +0 -54
- package/dist/src/streams/logs-stream.d.ts +0 -18
- package/dist/src/streams/logs-stream.d.ts.map +0 -1
- package/dist/src/streams/logs-stream.js +0 -22
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RedisClientType } from 'redis';
|
|
1
2
|
import type { StreamAdapterManager } from './adapters/interfaces/stream-adapter-manager.interface';
|
|
2
3
|
import type { Printer } from './printer';
|
|
3
4
|
import type { StreamFactory } from './streams/stream-factory';
|
|
@@ -11,6 +12,7 @@ export declare class LockedData {
|
|
|
11
12
|
readonly baseDir: string;
|
|
12
13
|
readonly streamAdapter: StreamAdapterManager;
|
|
13
14
|
private readonly printer;
|
|
15
|
+
readonly redisClient: RedisClientType;
|
|
14
16
|
flows: Record<string, Flow>;
|
|
15
17
|
activeSteps: Step[];
|
|
16
18
|
devSteps: Step[];
|
|
@@ -20,7 +22,7 @@ export declare class LockedData {
|
|
|
20
22
|
private streamHandlers;
|
|
21
23
|
private streams;
|
|
22
24
|
private streamWrapper?;
|
|
23
|
-
constructor(baseDir: string, streamAdapter: StreamAdapterManager, printer: Printer);
|
|
25
|
+
constructor(baseDir: string, streamAdapter: StreamAdapterManager, printer: Printer, redisClient: RedisClientType);
|
|
24
26
|
applyStreamWrapper<TData>(streamWrapper: StreamWrapper<TData>): void;
|
|
25
27
|
saveTypes(): void;
|
|
26
28
|
on(event: FlowEvent, handler: (flowName: string) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locked-data.d.ts","sourceRoot":"","sources":["../../src/locked-data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"locked-data.d.ts","sourceRoot":"","sources":["../../src/locked-data.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAA;AAGlG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,KAAK,SAAS,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAA;AACjE,KAAK,SAAS,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAA;AACjE,KAAK,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAA;AAEzE,KAAK,aAAa,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,aAAa,CAAC,KAAK,CAAC,CAAA;AAEvG,qBAAa,UAAU;aAcH,OAAO,EAAE,MAAM;aACf,aAAa,EAAE,oBAAoB;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,WAAW,EAAE,eAAe;IAhBvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC3B,WAAW,EAAE,IAAI,EAAE,CAAA;IACnB,QAAQ,EAAE,IAAI,EAAE,CAAA;IAEvB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAAmD;IACnE,OAAO,CAAC,YAAY,CAA6C;IACjE,OAAO,CAAC,cAAc,CAAmD;IACzE,OAAO,CAAC,OAAO,CAAwB;IAEvC,OAAO,CAAC,aAAa,CAAC,CAAoB;gBAGxB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,oBAAoB,EAClC,OAAO,EAAE,OAAO,EACjB,WAAW,EAAE,eAAe;IA4B9C,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;IAIpE,SAAS;IAOT,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;IAIxD,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;IAItD,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI;IAI9D,cAAc;IAId,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE;IAIjC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE;IAIlC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;IAI/B,WAAW,IAAI,IAAI,EAAE;IAIrB,OAAO,IAAI,IAAI,EAAE;IAIjB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAUhD,WAAW,IAAI,MAAM,EAAE;IAIvB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI5C,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO;IAyDlG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO;IAiChF,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IA6B7E,OAAO,CAAC,oBAAoB;IAS5B,YAAY,CAAC,KAAK,EAChB,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EACnC,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAC9C,aAAa,CAAC,KAAK,CAAC;IAuBvB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAkBnF,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAuBtG,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;CAG5B"}
|
package/dist/src/locked-data.js
CHANGED
|
@@ -11,10 +11,11 @@ const motia_1 = require("./motia");
|
|
|
11
11
|
const step_validator_1 = require("./step-validator");
|
|
12
12
|
const generate_types_1 = require("./types/generate-types");
|
|
13
13
|
class LockedData {
|
|
14
|
-
constructor(baseDir, streamAdapter, printer) {
|
|
14
|
+
constructor(baseDir, streamAdapter, printer, redisClient) {
|
|
15
15
|
this.baseDir = baseDir;
|
|
16
16
|
this.streamAdapter = streamAdapter;
|
|
17
17
|
this.printer = printer;
|
|
18
|
+
this.redisClient = redisClient;
|
|
18
19
|
this.flows = {};
|
|
19
20
|
this.activeSteps = [];
|
|
20
21
|
this.devSteps = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-factory.d.ts","sourceRoot":"","sources":["../../src/logger-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"logger-factory.d.ts","sourceRoot":"","sources":["../../src/logger-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,CAAA;CACvC;AAED,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC;IAG9C,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,YAAY,GAAG,MAAM;CAiB3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RedisClientType } from 'redis';
|
|
2
|
+
import { StreamAdapter } from '../adapters/interfaces/stream-adapter.interface';
|
|
3
|
+
import type { BaseStreamItem, StateStreamEvent, StateStreamEventChannel } from '../types-stream';
|
|
4
|
+
export declare class RedisTraceStreamAdapter<TData> extends StreamAdapter<TData> {
|
|
5
|
+
private client;
|
|
6
|
+
private readonly keyPrefix;
|
|
7
|
+
private ttl;
|
|
8
|
+
constructor(streamName: string, client: RedisClientType, ttl?: number);
|
|
9
|
+
private makeGroupKey;
|
|
10
|
+
get(groupId: string, id: string): Promise<BaseStreamItem<TData> | null>;
|
|
11
|
+
set(groupId: string, id: string, data: TData): Promise<BaseStreamItem<TData>>;
|
|
12
|
+
delete(groupId: string, id: string): Promise<BaseStreamItem<TData> | null>;
|
|
13
|
+
getGroup(groupId: string): Promise<BaseStreamItem<TData>[]>;
|
|
14
|
+
send<T>(channel: StateStreamEventChannel, event: StateStreamEvent<T>): Promise<void>;
|
|
15
|
+
clear(groupId: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=redis-trace-stream-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-trace-stream-adapter.d.ts","sourceRoot":"","sources":["../../../src/observability/redis-trace-stream-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAIhG,qBAAa,uBAAuB,CAAC,KAAK,CAAE,SAAQ,aAAa,CAAC,KAAK,CAAC;IACtE,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,OAAO,CAAC,GAAG,CAAQ;gBAEP,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,GAAE,MAA0B;IAMxF,OAAO,CAAC,YAAY;IAId,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAMvE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAiB7E,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAa1E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IAc3D,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpF,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisTraceStreamAdapter = void 0;
|
|
4
|
+
const stream_adapter_interface_1 = require("../adapters/interfaces/stream-adapter.interface");
|
|
5
|
+
const TRACE_TTL_SECONDS = 3 * 24 * 60 * 60;
|
|
6
|
+
class RedisTraceStreamAdapter extends stream_adapter_interface_1.StreamAdapter {
|
|
7
|
+
constructor(streamName, client, ttl = TRACE_TTL_SECONDS) {
|
|
8
|
+
super(streamName);
|
|
9
|
+
this.keyPrefix = 'motia:trace:';
|
|
10
|
+
this.client = client;
|
|
11
|
+
this.ttl = ttl;
|
|
12
|
+
}
|
|
13
|
+
makeGroupKey(groupId) {
|
|
14
|
+
return `${this.keyPrefix}${groupId}`;
|
|
15
|
+
}
|
|
16
|
+
async get(groupId, id) {
|
|
17
|
+
const hashKey = this.makeGroupKey(groupId);
|
|
18
|
+
const value = await this.client.hGet(hashKey, id);
|
|
19
|
+
return value ? JSON.parse(value) : null;
|
|
20
|
+
}
|
|
21
|
+
async set(groupId, id, data) {
|
|
22
|
+
const hashKey = this.makeGroupKey(groupId);
|
|
23
|
+
const item = { ...data, id };
|
|
24
|
+
const itemJson = JSON.stringify(item);
|
|
25
|
+
const existed = await this.client.hExists(hashKey, id);
|
|
26
|
+
const eventType = existed ? 'update' : 'create';
|
|
27
|
+
await Promise.all([
|
|
28
|
+
this.client.hSet(hashKey, id, itemJson),
|
|
29
|
+
this.send({ groupId, id }, { type: eventType, data: item }),
|
|
30
|
+
this.client.expire(hashKey, this.ttl),
|
|
31
|
+
]);
|
|
32
|
+
return item;
|
|
33
|
+
}
|
|
34
|
+
async delete(groupId, id) {
|
|
35
|
+
const hashKey = this.makeGroupKey(groupId);
|
|
36
|
+
const value = await this.client.hGet(hashKey, id);
|
|
37
|
+
if (!value)
|
|
38
|
+
return null;
|
|
39
|
+
const item = JSON.parse(value);
|
|
40
|
+
await Promise.all([this.client.hDel(hashKey, id), this.send({ groupId, id }, { type: 'delete', data: item })]);
|
|
41
|
+
return item;
|
|
42
|
+
}
|
|
43
|
+
async getGroup(groupId) {
|
|
44
|
+
const hashKey = this.makeGroupKey(groupId);
|
|
45
|
+
const values = await this.client.hGetAll(hashKey);
|
|
46
|
+
const items = Object.values(values).map((v) => JSON.parse(v));
|
|
47
|
+
const sortDesc = (a, b) => {
|
|
48
|
+
const aTime = a.startTime || 0;
|
|
49
|
+
const bTime = b.startTime || 0;
|
|
50
|
+
return aTime - bTime;
|
|
51
|
+
};
|
|
52
|
+
return items.sort(sortDesc);
|
|
53
|
+
}
|
|
54
|
+
async send(channel, event) {
|
|
55
|
+
const channelKey = channel.id
|
|
56
|
+
? `${this.keyPrefix}events:${this.streamName}:${channel.groupId}:${channel.id}`
|
|
57
|
+
: `${this.keyPrefix}events:${this.streamName}:${channel.groupId}`;
|
|
58
|
+
await this.client.publish(channelKey, JSON.stringify(event));
|
|
59
|
+
}
|
|
60
|
+
async clear(groupId) {
|
|
61
|
+
const hashKey = this.makeGroupKey(groupId);
|
|
62
|
+
await this.client.del(hashKey);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.RedisTraceStreamAdapter = RedisTraceStreamAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../../src/observability/tracer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../../src/observability/tracer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,CAAA;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMhD,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,EAC/B,gBAAgB,EAAE,WAAW,CAAC,UAAU,CAAC;YAG9C,YAAY;YAIZ,WAAW;IASnB,KAAK;IAQL,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;IAiCxD,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;CAYhE;AAED,eAAO,MAAM,mBAAmB,GAAI,YAAY,UAAU,KAAG,aA+B5D,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTracerFactory = exports.BaseTracerFactory = void 0;
|
|
4
|
-
const file_stream_adapter_manager_1 = require("../adapters/defaults/stream/file-stream-adapter-manager");
|
|
5
4
|
const create_trace_1 = require("./create-trace");
|
|
5
|
+
const redis_trace_stream_adapter_1 = require("./redis-trace-stream-adapter");
|
|
6
6
|
const stream_tracer_1 = require("./stream-tracer");
|
|
7
7
|
const trace_manager_1 = require("./trace-manager");
|
|
8
|
-
const trace_stream_adapter_1 = require("./trace-stream-adapter");
|
|
9
8
|
const MAX_TRACE_GROUPS = process.env.MOTIA_MAX_TRACE_GROUPS //
|
|
10
9
|
? Number.parseInt(process.env.MOTIA_MAX_TRACE_GROUPS, 10)
|
|
11
10
|
: 50;
|
|
@@ -69,9 +68,8 @@ class BaseTracerFactory {
|
|
|
69
68
|
}
|
|
70
69
|
exports.BaseTracerFactory = BaseTracerFactory;
|
|
71
70
|
const createTracerFactory = (lockedData) => {
|
|
72
|
-
const streamAdapter = lockedData.streamAdapter instanceof file_stream_adapter_manager_1.FileStreamAdapterManager ? 'file' : 'memory';
|
|
73
71
|
const traceStreamName = 'motia-trace';
|
|
74
|
-
const traceStreamAdapter = new
|
|
72
|
+
const traceStreamAdapter = new redis_trace_stream_adapter_1.RedisTraceStreamAdapter(traceStreamName, lockedData.redisClient);
|
|
75
73
|
const traceStream = lockedData.createStream({
|
|
76
74
|
filePath: traceStreamName,
|
|
77
75
|
hidden: true,
|
|
@@ -82,7 +80,7 @@ const createTracerFactory = (lockedData) => {
|
|
|
82
80
|
},
|
|
83
81
|
})();
|
|
84
82
|
const traceGroupName = 'motia-trace-group';
|
|
85
|
-
const traceGroupStreamAdapter = new
|
|
83
|
+
const traceGroupStreamAdapter = new redis_trace_stream_adapter_1.RedisTraceStreamAdapter(traceGroupName, lockedData.redisClient);
|
|
86
84
|
const traceGroupStream = lockedData.createStream({
|
|
87
85
|
filePath: traceGroupName,
|
|
88
86
|
hidden: true,
|
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;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;
|
|
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;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAA;AAGlG,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,CAAA;AAGpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAG5E,OAAO,KAAK,EAA2B,cAAc,EAA4B,IAAI,EAAE,MAAM,SAAS,CAAA;AAGtG,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;IACnB,YAAY,EAAE,QAAQ,CAAA;IACtB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IACjD,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IAC9C,WAAW,EAAE,WAAW,CAAA;IACxB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,YAAY,UAAU,EACtB,OAAO,YAAY,EACnB,QAAQ,iBAAiB,EACzB,UAAU,cAAc,EACxB,eAAe,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,KACpC,WA4RF,CAAA"}
|
package/dist/src/server.js
CHANGED
|
@@ -23,7 +23,7 @@ const printer_1 = require("./printer");
|
|
|
23
23
|
const socket_server_1 = require("./socket-server");
|
|
24
24
|
const step_handlers_1 = require("./step-handlers");
|
|
25
25
|
const steps_1 = require("./steps");
|
|
26
|
-
const
|
|
26
|
+
const redis_logs_stream_1 = require("./streams/redis-logs-stream");
|
|
27
27
|
const createServer = (lockedData, state, config, adapters, configureApp) => {
|
|
28
28
|
const printer = config.printer ?? new printer_1.Printer(process.cwd());
|
|
29
29
|
const app = (0, express_1.default)();
|
|
@@ -103,7 +103,12 @@ const createServer = (lockedData, state, config, adapters, configureApp) => {
|
|
|
103
103
|
hidden: true,
|
|
104
104
|
config: {
|
|
105
105
|
name: '__motia.logs',
|
|
106
|
-
baseConfig: {
|
|
106
|
+
baseConfig: {
|
|
107
|
+
storageType: 'custom',
|
|
108
|
+
factory: () => {
|
|
109
|
+
return new redis_logs_stream_1.RedisLogsStream(lockedData.redisClient);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
107
112
|
schema: null,
|
|
108
113
|
},
|
|
109
114
|
})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RedisClientType } from 'redis';
|
|
2
|
+
import { StreamAdapter } from '../adapters/interfaces/stream-adapter.interface';
|
|
3
|
+
import type { BaseStreamItem, StateStreamEvent } from '../types-stream';
|
|
4
|
+
export type Log = {
|
|
5
|
+
id: string;
|
|
6
|
+
level: string;
|
|
7
|
+
time: number;
|
|
8
|
+
msg: string;
|
|
9
|
+
traceId: string;
|
|
10
|
+
flows: string[];
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
export declare class RedisLogsStream extends StreamAdapter<Log> {
|
|
14
|
+
private client;
|
|
15
|
+
readonly keyPrefix = "motia:logs:";
|
|
16
|
+
constructor(client: RedisClientType);
|
|
17
|
+
private makeLogKey;
|
|
18
|
+
private makeChannelKey;
|
|
19
|
+
private makeLogId;
|
|
20
|
+
private scanKeys;
|
|
21
|
+
get(groupId: string, id: string): Promise<BaseStreamItem<Log> | null>;
|
|
22
|
+
set(groupId: string, id: string, data: Log): Promise<BaseStreamItem<Log>>;
|
|
23
|
+
delete(groupId: string, id: string): Promise<BaseStreamItem<Log> | null>;
|
|
24
|
+
getGroup(groupId: string): Promise<BaseStreamItem<Log>[]>;
|
|
25
|
+
send<T>(channel: {
|
|
26
|
+
groupId: string;
|
|
27
|
+
id: string;
|
|
28
|
+
}, event: StateStreamEvent<T>): Promise<void>;
|
|
29
|
+
clear(groupId: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=redis-logs-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-logs-stream.d.ts","sourceRoot":"","sources":["../../../src/streams/redis-logs-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvE,MAAM,MAAM,GAAG,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAID,qBAAa,eAAgB,SAAQ,aAAa,CAAC,GAAG,CAAC;IACrD,OAAO,CAAC,MAAM,CAAiB;IAC/B,QAAQ,CAAC,SAAS,iBAAgB;gBAEtB,MAAM,EAAE,eAAe;IAKnC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;YAIH,QAAQ;IAgBhB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAMrE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAgBzE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAaxE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;IAazD,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5F,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ5C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedisLogsStream = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const stream_adapter_interface_1 = require("../adapters/interfaces/stream-adapter.interface");
|
|
6
|
+
const LOG_TTL_SECONDS = 3 * 24 * 60 * 60;
|
|
7
|
+
class RedisLogsStream extends stream_adapter_interface_1.StreamAdapter {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
super('__motia.logs');
|
|
10
|
+
this.keyPrefix = 'motia:logs:';
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
makeLogKey(groupId, id) {
|
|
14
|
+
return `${this.keyPrefix}${groupId}:${id}`;
|
|
15
|
+
}
|
|
16
|
+
makeChannelKey(channel) {
|
|
17
|
+
return `${this.keyPrefix}events:${channel.groupId}:${channel.id}`;
|
|
18
|
+
}
|
|
19
|
+
makeLogId() {
|
|
20
|
+
return `${Date.now()}-${(0, uuid_1.v4)()}`;
|
|
21
|
+
}
|
|
22
|
+
async scanKeys(pattern) {
|
|
23
|
+
const keys = [];
|
|
24
|
+
let cursor = '0';
|
|
25
|
+
do {
|
|
26
|
+
const result = await this.client.scan(cursor.toString(), {
|
|
27
|
+
MATCH: pattern,
|
|
28
|
+
COUNT: 100,
|
|
29
|
+
});
|
|
30
|
+
cursor = result.cursor;
|
|
31
|
+
keys.push(...result.keys);
|
|
32
|
+
} while (String(cursor) !== '0');
|
|
33
|
+
return keys;
|
|
34
|
+
}
|
|
35
|
+
async get(groupId, id) {
|
|
36
|
+
const key = this.makeLogKey(groupId, id);
|
|
37
|
+
const value = await this.client.get(key);
|
|
38
|
+
return value ? JSON.parse(value) : null;
|
|
39
|
+
}
|
|
40
|
+
async set(groupId, id, data) {
|
|
41
|
+
const logId = id || this.makeLogId();
|
|
42
|
+
const key = this.makeLogKey(groupId, logId);
|
|
43
|
+
const logData = { ...data, id: logId };
|
|
44
|
+
const item = { ...logData, id: logId };
|
|
45
|
+
const itemJson = JSON.stringify(item);
|
|
46
|
+
await Promise.all([
|
|
47
|
+
this.client.set(key, itemJson),
|
|
48
|
+
this.client.expire(key, LOG_TTL_SECONDS),
|
|
49
|
+
this.send({ groupId, id: logId }, { type: 'log', data: item }),
|
|
50
|
+
]);
|
|
51
|
+
return item;
|
|
52
|
+
}
|
|
53
|
+
async delete(groupId, id) {
|
|
54
|
+
const key = this.makeLogKey(groupId, id);
|
|
55
|
+
const value = await this.client.get(key);
|
|
56
|
+
if (!value)
|
|
57
|
+
return null;
|
|
58
|
+
const item = JSON.parse(value);
|
|
59
|
+
await Promise.all([this.client.del(key), this.send({ groupId, id }, { type: 'delete', data: item })]);
|
|
60
|
+
return item;
|
|
61
|
+
}
|
|
62
|
+
async getGroup(groupId) {
|
|
63
|
+
const pattern = `${this.keyPrefix}${groupId}:*`;
|
|
64
|
+
const keys = await this.scanKeys(pattern);
|
|
65
|
+
if (keys.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
const values = await this.client.mGet(keys);
|
|
68
|
+
const logs = values.filter((v) => v !== null).map((v) => JSON.parse(v));
|
|
69
|
+
const sortDesc = (a, b) => a.time - b.time;
|
|
70
|
+
return logs.sort(sortDesc);
|
|
71
|
+
}
|
|
72
|
+
async send(channel, event) {
|
|
73
|
+
const channelKey = this.makeChannelKey(channel);
|
|
74
|
+
await this.client.publish(channelKey, JSON.stringify(event));
|
|
75
|
+
}
|
|
76
|
+
async clear(groupId) {
|
|
77
|
+
const pattern = `${this.keyPrefix}${groupId}:*`;
|
|
78
|
+
const keys = await this.scanKeys(pattern);
|
|
79
|
+
if (keys.length === 0)
|
|
80
|
+
return;
|
|
81
|
+
await this.client.del(keys);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.RedisLogsStream = RedisLogsStream;
|
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.11.1-beta.
|
|
5
|
+
"version": "0.11.1-beta.156-879726",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@amplitude/analytics-node": "^1.3.8",
|
|
8
8
|
"ajv": "^8.17.1",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"ts-jest": "^29.2.5",
|
|
30
30
|
"typescript": "^5.7.2"
|
|
31
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"redis": "^5.0.0"
|
|
34
|
+
},
|
|
32
35
|
"scripts": {
|
|
33
36
|
"python-setup": "python3 -m venv python_modules && python_modules/bin/pip install -r requirements.txt",
|
|
34
37
|
"move:python": "mkdir -p dist/src/python && cp src/python/*.py dist/src/python",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FileStreamAdapter } from '../adapters/defaults/stream/file-stream-adapter';
|
|
2
|
-
import type { BaseStreamItem } from '../types-stream';
|
|
3
|
-
export declare class TraceStreamAdapter<TData> extends FileStreamAdapter<TData> {
|
|
4
|
-
private state;
|
|
5
|
-
private isDirty;
|
|
6
|
-
constructor(filePath: string, streamName: string, streamAdapter: 'file' | 'memory');
|
|
7
|
-
get(groupId: string, id: string): Promise<BaseStreamItem<TData> | null>;
|
|
8
|
-
set(groupId: string, id: string, data: TData): Promise<BaseStreamItem<TData>>;
|
|
9
|
-
delete(groupId: string, id: string): Promise<BaseStreamItem<TData> | null>;
|
|
10
|
-
getGroup(groupId: string): Promise<BaseStreamItem<TData>[]>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=trace-stream-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace-stream-adapter.d.ts","sourceRoot":"","sources":["../../../src/observability/trace-stream-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAA;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,qBAAa,kBAAkB,CAAC,KAAK,CAAE,SAAQ,iBAAiB,CAAC,KAAK,CAAC;IACrE,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,OAAO,CAAiB;gBAEpB,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,QAAQ;IAuB5E,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAMvE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAS7E,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAY1E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;CAMlE"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TraceStreamAdapter = void 0;
|
|
4
|
-
const file_stream_adapter_1 = require("../adapters/defaults/stream/file-stream-adapter");
|
|
5
|
-
class TraceStreamAdapter extends file_stream_adapter_1.FileStreamAdapter {
|
|
6
|
-
constructor(filePath, streamName, streamAdapter) {
|
|
7
|
-
super(filePath ?? '', streamName);
|
|
8
|
-
this.state = {};
|
|
9
|
-
this.isDirty = false;
|
|
10
|
-
if (streamAdapter === 'file') {
|
|
11
|
-
const state = this._readFile();
|
|
12
|
-
Object.entries(state).forEach(([key, value]) => {
|
|
13
|
-
if (typeof value === 'string') {
|
|
14
|
-
this.state[key] = JSON.parse(value);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
this.state[key] = value;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
setInterval(() => {
|
|
21
|
-
if (this.isDirty) {
|
|
22
|
-
this._writeFile(this.state);
|
|
23
|
-
this.isDirty = false;
|
|
24
|
-
}
|
|
25
|
-
}, 30000);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async get(groupId, id) {
|
|
29
|
-
const key = this._makeKey(groupId, id);
|
|
30
|
-
return this.state[key] ? this.state[key] : null;
|
|
31
|
-
}
|
|
32
|
-
async set(groupId, id, data) {
|
|
33
|
-
const key = this._makeKey(groupId, id);
|
|
34
|
-
this.state[key] = data;
|
|
35
|
-
this.isDirty = true;
|
|
36
|
-
return { ...data, id };
|
|
37
|
-
}
|
|
38
|
-
async delete(groupId, id) {
|
|
39
|
-
const key = this._makeKey(groupId, id);
|
|
40
|
-
const value = await this.get(groupId, id);
|
|
41
|
-
if (value) {
|
|
42
|
-
delete this.state[key];
|
|
43
|
-
this.isDirty = true;
|
|
44
|
-
}
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
async getGroup(groupId) {
|
|
48
|
-
const prefix = this._makeKey(groupId, '');
|
|
49
|
-
return Object.entries(this.state)
|
|
50
|
-
.filter(([key]) => key.startsWith(prefix))
|
|
51
|
-
.map(([, value]) => value);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.TraceStreamAdapter = TraceStreamAdapter;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StreamAdapter } from '../adapters/interfaces/stream-adapter.interface';
|
|
2
|
-
export type Log = {
|
|
3
|
-
id: string;
|
|
4
|
-
level: string;
|
|
5
|
-
time: number;
|
|
6
|
-
msg: string;
|
|
7
|
-
traceId: string;
|
|
8
|
-
flows: string[];
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
export declare class LogsStream extends StreamAdapter<Log> {
|
|
12
|
-
constructor();
|
|
13
|
-
get: () => Promise<null>;
|
|
14
|
-
delete: () => Promise<null>;
|
|
15
|
-
getGroup: () => Promise<never[]>;
|
|
16
|
-
set(_: string, __: string, data: Log): Promise<Log>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=logs-stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logs-stream.d.ts","sourceRoot":"","sources":["../../../src/streams/logs-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAA;AAE/E,MAAM,MAAM,GAAG,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAOD,qBAAa,UAAW,SAAQ,aAAa,CAAC,GAAG,CAAC;;IAKhD,GAAG,sBAAmB;IACtB,MAAM,sBAAmB;IACzB,QAAQ,yBAAiB;IAEnB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAI1D"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogsStream = void 0;
|
|
4
|
-
const stream_adapter_interface_1 = require("../adapters/interfaces/stream-adapter.interface");
|
|
5
|
-
/*
|
|
6
|
-
* We're not storing logs in the state because of size of data
|
|
7
|
-
* if process stays for to long it would consume too much memory
|
|
8
|
-
* in this case, we're just streaming through events.
|
|
9
|
-
*/
|
|
10
|
-
class LogsStream extends stream_adapter_interface_1.StreamAdapter {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('__motia.logs');
|
|
13
|
-
this.get = async () => null;
|
|
14
|
-
this.delete = async () => null;
|
|
15
|
-
this.getGroup = async () => [];
|
|
16
|
-
}
|
|
17
|
-
async set(_, __, data) {
|
|
18
|
-
await this.send({ groupId: 'default' }, { type: 'log', data });
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.LogsStream = LogsStream;
|