create-mastra 0.0.0-commonjs-20250227130920 → 0.0.0-commonjs-20250414101718

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.
@@ -3,14 +3,9 @@
3
3
  import { evaluate } from '@mastra/core/eval';
4
4
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
5
5
  import { TABLE_EVALS } from '@mastra/core/storage';
6
+ import { checkEvalStorageFields } from '@mastra/core/utils';
6
7
  import { mastra } from '#mastra';
7
8
  import { createNodeServer } from '#server';
8
-
9
- // init storage
10
- if (mastra.storage) {
11
- await mastra.storage.init();
12
- }
13
-
14
9
  // @ts-ignore
15
10
  await createNodeServer(mastra, { playground: true, swaggerUI: true });
16
11
 
@@ -26,14 +21,23 @@ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agen
26
21
  });
27
22
  });
28
23
 
24
+ if (mastra.storage) {
25
+ await mastra.storage.init();
26
+ }
27
+
29
28
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
30
29
  if (mastra.storage) {
30
+ // Check for required fields
31
+ const logger = mastra?.getLogger();
32
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
33
+ if (!areFieldsValid) return;
34
+
31
35
  await mastra.storage.insert({
32
36
  tableName: TABLE_EVALS,
33
37
  record: {
34
38
  input: traceObject.input,
35
39
  output: traceObject.output,
36
- result: JSON.stringify(traceObject.result),
40
+ result: JSON.stringify(traceObject.result || {}),
37
41
  agent_name: traceObject.agentName,
38
42
  metric_name: traceObject.metricName,
39
43
  instructions: traceObject.instructions,
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "create-mastra",
3
- "version": "0.0.0-commonjs-20250227130920",
3
+ "version": "0.0.0-commonjs-20250414101718",
4
4
  "description": "Create Mastra apps with one command",
5
+ "license": "Elastic-2.0",
5
6
  "type": "module",
6
7
  "main": "dist/index.js",
7
8
  "bin": {
@@ -30,29 +31,29 @@
30
31
  "project"
31
32
  ],
32
33
  "dependencies": {
33
- "commander": "^12.0.0",
34
- "execa": "^9.3.1",
35
- "fs-extra": "^11.2.0",
34
+ "commander": "^12.1.0",
35
+ "execa": "^9.5.2",
36
+ "fs-extra": "^11.3.0",
36
37
  "pino": "^9.6.0",
37
38
  "pino-pretty": "^13.0.0",
38
- "posthog-node": "^4.3.1",
39
- "prettier": "^3.3.3"
39
+ "posthog-node": "^4.10.1",
40
+ "prettier": "^3.5.3"
40
41
  },
41
42
  "devDependencies": {
42
- "@microsoft/api-extractor": "^7.49.2",
43
- "@rollup/plugin-commonjs": "^28.0.2",
43
+ "@microsoft/api-extractor": "^7.52.1",
44
+ "@rollup/plugin-commonjs": "^28.0.3",
44
45
  "@rollup/plugin-json": "^6.1.0",
45
46
  "@rollup/plugin-node-resolve": "^16.0.0",
46
47
  "@types/fs-extra": "^11.0.4",
47
- "@types/node": "^22.13.1",
48
- "esbuild": "^0.24.2",
49
- "eslint": "^9.20.1",
50
- "rollup": "^4.30.1",
51
- "rollup-plugin-esbuild": "^6.1.1",
48
+ "@types/node": "^20.17.27",
49
+ "esbuild": "^0.25.0",
50
+ "eslint": "^9.23.0",
51
+ "rollup": "^4.35.0",
52
+ "rollup-plugin-esbuild": "^6.2.1",
52
53
  "rollup-plugin-node-externals": "^8.0.0",
53
- "typescript": "^5.7.3",
54
- "@internal/lint": "0.0.0",
55
- "mastra": "^0.0.0-commonjs-20250227130920"
54
+ "typescript": "^5.8.2",
55
+ "@internal/lint": "0.0.0-commonjs-20250414101718",
56
+ "mastra": "0.0.0-commonjs-20250414101718"
56
57
  },
57
58
  "engines": {
58
59
  "node": ">=20"