@motiadev/core 0.13.1-beta.163-010752 → 0.13.2-beta.163

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.
@@ -4,26 +4,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.prettyPrint = void 0;
7
- const colors_1 = __importDefault(require("colors"));
8
- const stepTag = (step) => colors_1.default.bold(colors_1.default.cyan(step));
9
- const timestampTag = (timestamp) => colors_1.default.gray(timestamp);
10
- const traceIdTag = (traceId) => colors_1.default.gray(traceId);
7
+ const picocolors_1 = __importDefault(require("picocolors"));
8
+ const stepTag = (step) => picocolors_1.default.bold(picocolors_1.default.cyan(step));
9
+ const timestampTag = (timestamp) => picocolors_1.default.gray(timestamp);
10
+ const traceIdTag = (traceId) => picocolors_1.default.gray(traceId);
11
11
  const levelTags = {
12
- error: colors_1.default.red('[ERROR]'),
13
- info: colors_1.default.blue('[INFO]'),
14
- warn: colors_1.default.yellow('[WARN]'),
15
- debug: colors_1.default.gray('[DEBUG]'),
16
- trace: colors_1.default.gray('[TRACE]'),
12
+ error: picocolors_1.default.red('[ERROR]'),
13
+ info: picocolors_1.default.blue('[INFO]'),
14
+ warn: picocolors_1.default.yellow('[WARN]'),
15
+ debug: picocolors_1.default.gray('[DEBUG]'),
16
+ trace: picocolors_1.default.gray('[TRACE]'),
17
17
  };
18
- const numericTag = (value) => colors_1.default.green(value);
19
- const stringTag = (value) => colors_1.default.cyan(value);
20
- const booleanTag = (value) => colors_1.default.blue(value);
21
- const arrayBrackets = ['[', ']'].map((s) => colors_1.default.gray(s));
22
- const objectBrackets = ['{', '}'].map((s) => colors_1.default.gray(s));
18
+ const numericTag = (value) => picocolors_1.default.green(value);
19
+ const stringTag = (value) => picocolors_1.default.cyan(value);
20
+ const booleanTag = (value) => picocolors_1.default.blue(value);
21
+ const arrayBrackets = ['[', ']'].map((s) => picocolors_1.default.gray(s));
22
+ const objectBrackets = ['{', '}'].map((s) => picocolors_1.default.gray(s));
23
23
  const prettyPrintObject = (obj, depth = 0, parentIsLast = false, prefix = '') => {
24
24
  const tab = prefix + (depth === 0 ? '' : parentIsLast ? '│ ' : '│ ');
25
25
  if (depth > 2) {
26
- return `${tab} └ ${colors_1.default.gray('[...]')}`;
26
+ return `${tab} └ ${picocolors_1.default.gray('[...]')}`;
27
27
  }
28
28
  const entries = Object.entries(obj);
29
29
  return entries
@@ -4,23 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NoPrinter = exports.Printer = void 0;
7
- const colors_1 = __importDefault(require("colors"));
8
7
  const path_1 = __importDefault(require("path"));
8
+ const picocolors_1 = __importDefault(require("picocolors"));
9
9
  const guards_1 = require("./guards");
10
- const stepTag = colors_1.default.bold(colors_1.default.magenta('Step'));
11
- const flowTag = colors_1.default.bold(colors_1.default.blue('Flow'));
12
- const streamTag = colors_1.default.bold(colors_1.default.green('Stream'));
13
- const registered = colors_1.default.green('➜ [REGISTERED]');
14
- const building = colors_1.default.yellow('⚡ [BUILDING]');
15
- const built = colors_1.default.green('✓ [BUILT]');
16
- const updated = colors_1.default.yellow('➜ [UPDATED]');
17
- const removed = colors_1.default.red('➜ [REMOVED]');
18
- const invalidEmit = colors_1.default.red('➜ [INVALID EMIT]');
19
- const error = colors_1.default.red('[ERROR]');
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('✖');
10
+ const stepTag = picocolors_1.default.bold(picocolors_1.default.magenta('Step'));
11
+ const flowTag = picocolors_1.default.bold(picocolors_1.default.blue('Flow'));
12
+ const streamTag = picocolors_1.default.bold(picocolors_1.default.green('Stream'));
13
+ const registered = picocolors_1.default.green('➜ [REGISTERED]');
14
+ const building = picocolors_1.default.yellow('⚡ [BUILDING]');
15
+ const built = picocolors_1.default.green('✓ [BUILT]');
16
+ const updated = picocolors_1.default.yellow('➜ [UPDATED]');
17
+ const removed = picocolors_1.default.red('➜ [REMOVED]');
18
+ const invalidEmit = picocolors_1.default.red('➜ [INVALID EMIT]');
19
+ const error = picocolors_1.default.red('[ERROR]');
20
+ const warning = picocolors_1.default.yellow('[WARNING]');
21
+ const warnIcon = picocolors_1.default.yellow('⚠');
22
+ const infoIcon = picocolors_1.default.blue('ℹ');
23
+ const errorIcon = picocolors_1.default.red('✖');
24
24
  class Printer {
25
25
  constructor(baseDir) {
26
26
  this.baseDir = baseDir;
@@ -33,27 +33,27 @@ class Printer {
33
33
  this.removed = removed;
34
34
  }
35
35
  printEventInputValidationError(emit, details) {
36
- const emitPath = colors_1.default.bold(colors_1.default.cyan(`Emit ${emit.topic}`));
36
+ const emitPath = picocolors_1.default.bold(picocolors_1.default.cyan(`Emit ${emit.topic}`));
37
37
  console.log(`${warnIcon} ${warning} ${emitPath} validation issues:`);
38
38
  const hasAny = details.missingFields?.length || details.extraFields?.length || details.typeMismatches?.length;
39
39
  if (!hasAny) {
40
- console.log(`${colors_1.default.yellow('│')} No issues found.`);
41
- console.log(`${colors_1.default.yellow('└─')} Validation passed.`);
40
+ console.log(`${picocolors_1.default.yellow('│')} No issues found.`);
41
+ console.log(`${picocolors_1.default.yellow('└─')} Validation passed.`);
42
42
  return;
43
43
  }
44
44
  if (details.missingFields?.length) {
45
- console.log(`${colors_1.default.yellow('│')} ${colors_1.default.yellow(`⚠ Missing fields: ${details.missingFields.join(', ')}`)}`);
45
+ console.log(`${picocolors_1.default.yellow('│')} ${picocolors_1.default.yellow(`⚠ Missing fields: ${details.missingFields.join(', ')}`)}`);
46
46
  }
47
47
  if (details.extraFields?.length) {
48
- console.log(`${colors_1.default.yellow('│')} ${colors_1.default.yellow(`⚠ Extra fields: ${details.extraFields.join(', ')}`)}`);
48
+ console.log(`${picocolors_1.default.yellow('│')} ${picocolors_1.default.yellow(`⚠ Extra fields: ${details.extraFields.join(', ')}`)}`);
49
49
  }
50
50
  if (details.typeMismatches?.length) {
51
- console.log(`${colors_1.default.yellow('│')} ${colors_1.default.yellow(`⚠ Type mismatches: ${details.typeMismatches.join(', ')}`)}`);
51
+ console.log(`${picocolors_1.default.yellow('│')} ${picocolors_1.default.yellow(`⚠ Type mismatches: ${details.typeMismatches.join(', ')}`)}`);
52
52
  }
53
- console.log(`${colors_1.default.yellow('└─')} ${colors_1.default.yellow('Payload does not match schema.')}`);
53
+ console.log(`${picocolors_1.default.yellow('└─')} ${picocolors_1.default.yellow('Payload does not match schema.')}`);
54
54
  }
55
55
  printInvalidEmit(step, emit) {
56
- 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)}`);
56
+ console.log(`${invalidEmit} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} tried to emit an event not defined in the step config: ${picocolors_1.default.yellow(emit)}`);
57
57
  }
58
58
  printStepCreated(step) {
59
59
  console.log(`${registered} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} registered`);
@@ -65,13 +65,13 @@ class Printer {
65
65
  console.log(`${removed} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} removed`);
66
66
  }
67
67
  printFlowCreated(flowName) {
68
- console.log(`${registered} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} registered`);
68
+ console.log(`${registered} ${flowTag} ${picocolors_1.default.bold(picocolors_1.default.cyan(flowName))} registered`);
69
69
  }
70
70
  printFlowUpdated(flowName) {
71
- console.log(`${updated} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} updated`);
71
+ console.log(`${updated} ${flowTag} ${picocolors_1.default.bold(picocolors_1.default.cyan(flowName))} updated`);
72
72
  }
73
73
  printFlowRemoved(flowName) {
74
- console.log(`${removed} ${flowTag} ${colors_1.default.bold(colors_1.default.cyan(flowName))} removed`);
74
+ console.log(`${removed} ${flowTag} ${picocolors_1.default.bold(picocolors_1.default.cyan(flowName))} removed`);
75
75
  }
76
76
  printStreamCreated(stream) {
77
77
  console.log(`${registered} ${streamTag} ${this.getStreamPath(stream)} registered`);
@@ -83,60 +83,60 @@ class Printer {
83
83
  console.log(`${removed} ${streamTag} ${this.getStreamPath(stream)} removed`);
84
84
  }
85
85
  printInvalidEmitConfiguration(step, emit) {
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`);
86
+ console.log(`${warnIcon} ${warning} ${stepTag} ${this.getStepType(step)} ${this.getStepPath(step)} emits to ${picocolors_1.default.yellow(emit)}, but there is no subscriber defined`);
87
87
  }
88
88
  printInvalidSchema(topic, step) {
89
- console.log(`${error} Topic ${colors_1.default.bold(colors_1.default.blue(topic))} has incompatible schemas in the following steps:`);
89
+ console.log(`${error} Topic ${picocolors_1.default.bold(picocolors_1.default.blue(topic))} has incompatible schemas in the following steps:`);
90
90
  step.forEach((step) => {
91
- console.log(`${colors_1.default.red(' ✖')} ${this.getStepPath(step)}`);
91
+ console.log(`${picocolors_1.default.red(' ✖')} ${this.getStepPath(step)}`);
92
92
  });
93
93
  }
94
94
  printValidationError(stepPath, validationError) {
95
95
  const relativePath = this.getRelativePath(stepPath);
96
- console.log(`${error} ${colors_1.default.bold(colors_1.default.cyan(relativePath))}`);
96
+ console.log(`${error} ${picocolors_1.default.bold(picocolors_1.default.cyan(relativePath))}`);
97
97
  validationError.errors?.forEach((error) => {
98
98
  if (error.path) {
99
- console.log(`${colors_1.default.red('│')} ${colors_1.default.yellow(`✖ ${error.path}`)}: ${error.message}`);
99
+ console.log(`${picocolors_1.default.red('│')} ${picocolors_1.default.yellow(`✖ ${error.path}`)}: ${error.message}`);
100
100
  }
101
101
  else {
102
- console.log(`${colors_1.default.red('│')} ${colors_1.default.yellow('✖')} ${error.message}`);
102
+ console.log(`${picocolors_1.default.red('│')} ${picocolors_1.default.yellow('✖')} ${error.message}`);
103
103
  }
104
104
  });
105
- console.log(`${colors_1.default.red('└─')} ${colors_1.default.red(validationError.error)} `);
105
+ console.log(`${picocolors_1.default.red('└─')} ${picocolors_1.default.red(validationError.error)} `);
106
106
  }
107
107
  getRelativePath(filePath) {
108
108
  return path_1.default.relative(this.baseDir, filePath);
109
109
  }
110
110
  getStepType(step) {
111
111
  if ((0, guards_1.isApiStep)(step))
112
- return colors_1.default.gray('(API)');
112
+ return picocolors_1.default.gray('(API)');
113
113
  if ((0, guards_1.isEventStep)(step))
114
- return colors_1.default.gray('(Event)');
114
+ return picocolors_1.default.gray('(Event)');
115
115
  if ((0, guards_1.isCronStep)(step))
116
- return colors_1.default.gray('(Cron)');
116
+ return picocolors_1.default.gray('(Cron)');
117
117
  if ((0, guards_1.isNoopStep)(step))
118
- return colors_1.default.gray('(Noop)');
119
- return colors_1.default.gray('(Unknown)');
118
+ return picocolors_1.default.gray('(Noop)');
119
+ return picocolors_1.default.gray('(Unknown)');
120
120
  }
121
121
  getStepPath(step) {
122
122
  const stepPath = this.getRelativePath(step.filePath);
123
- return colors_1.default.bold(colors_1.default.cyan(stepPath));
123
+ return picocolors_1.default.bold(picocolors_1.default.cyan(stepPath));
124
124
  }
125
125
  getStreamPath(stream) {
126
126
  const streamPath = this.getRelativePath(stream.filePath);
127
- return colors_1.default.bold(colors_1.default.magenta(streamPath));
127
+ return picocolors_1.default.bold(picocolors_1.default.magenta(streamPath));
128
128
  }
129
129
  printPluginLog(message) {
130
- const pluginTag = colors_1.default.bold(colors_1.default.cyan('[motia-plugins]'));
130
+ const pluginTag = picocolors_1.default.bold(picocolors_1.default.cyan('[motia-plugins]'));
131
131
  console.log(`${infoIcon} ${pluginTag} ${message}`);
132
132
  }
133
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)}`);
134
+ const pluginTag = picocolors_1.default.bold(picocolors_1.default.cyan('[motia-plugins]'));
135
+ console.warn(`${warnIcon} ${pluginTag} ${picocolors_1.default.yellow(message)}`);
136
136
  }
137
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);
138
+ const pluginTag = picocolors_1.default.bold(picocolors_1.default.cyan('[motia-plugins]'));
139
+ console.error(`${errorIcon} ${pluginTag} ${picocolors_1.default.red(message)}`, ...args);
140
140
  }
141
141
  }
142
142
  exports.Printer = Printer;
package/package.json CHANGED
@@ -2,12 +2,12 @@
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.13.1-beta.163-010752",
5
+ "version": "0.13.2-beta.163",
6
6
  "dependencies": {
7
7
  "@amplitude/analytics-node": "^1.3.8",
8
8
  "ajv": "^8.17.1",
9
9
  "body-parser": "^1.20.3",
10
- "colors": "^1.4.0",
10
+ "picocolors": "^1.1.1",
11
11
  "dotenv": "^16.4.7",
12
12
  "express": "^4.21.2",
13
13
  "node-cron": "^3.0.3",