@mastra/mssql 0.3.0-alpha.0 → 0.3.0

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,7 +3,7 @@ import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastr
3
3
  import { MemoryStorage } from '@mastra/core/storage';
4
4
  import type { StorageGetMessagesArg, PaginationInfo, PaginationArgs, StorageResourceType, ThreadSortOptions } from '@mastra/core/storage';
5
5
  import sql from 'mssql';
6
- import type { StoreOperationsMSSQL } from '../operations';
6
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
7
7
  export declare class MemoryMSSQL extends MemoryStorage {
8
8
  private pool;
9
9
  private schema;
@@ -2,7 +2,7 @@ import type { PaginationInfo, StoragePagination } from '@mastra/core';
2
2
  import type { ScoreRowData } from '@mastra/core/scores';
3
3
  import { ScoresStorage } from '@mastra/core/storage';
4
4
  import type { ConnectionPool } from 'mssql';
5
- import type { StoreOperationsMSSQL } from '../operations';
5
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
6
6
  export declare class ScoresMSSQL extends ScoresStorage {
7
7
  pool: ConnectionPool;
8
8
  private operations;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA4C1D,qBAAa,WAAY,SAAQ,aAAa;IACrC,IAAI,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,MAAM,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IAsD7D,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAsD7D,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAuDpE"}
@@ -1,7 +1,7 @@
1
1
  import type { PaginationInfo, PaginationArgs } from '@mastra/core/storage';
2
2
  import { TracesStorage } from '@mastra/core/storage';
3
3
  import sql from 'mssql';
4
- import type { StoreOperationsMSSQL } from '../operations';
4
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
5
5
  export declare class TracesMSSQL extends TracesStorage {
6
6
  pool: sql.ConnectionPool;
7
7
  private operations;
@@ -1,7 +1,7 @@
1
1
  import type { WorkflowRun, WorkflowRuns, WorkflowRunState } from '@mastra/core';
2
2
  import { WorkflowsStorage } from '@mastra/core/storage';
3
3
  import sql from 'mssql';
4
- import type { StoreOperationsMSSQL } from '../operations';
4
+ import type { StoreOperationsMSSQL } from '../operations/index.js';
5
5
  export declare class WorkflowsMSSQL extends WorkflowsStorage {
6
6
  pool: sql.ConnectionPool;
7
7
  private operations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mssql",
3
- "version": "0.3.0-alpha.0",
3
+ "version": "0.3.0",
4
4
  "description": "MSSQL provider for Mastra - db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,7 +12,7 @@
12
12
  "default": "./dist/index.js"
13
13
  },
14
14
  "require": {
15
- "types": "./dist/index.d.cts",
15
+ "types": "./dist/index.d.ts",
16
16
  "default": "./dist/index.cjs"
17
17
  }
18
18
  },
@@ -30,12 +30,13 @@
30
30
  "tsup": "^8.5.0",
31
31
  "typescript": "^5.8.3",
32
32
  "vitest": "^3.2.4",
33
- "@internal/lint": "0.0.26",
34
- "@internal/storage-test-utils": "0.0.22",
35
- "@mastra/core": "0.13.0-alpha.1"
33
+ "@internal/storage-test-utils": "0.0.23",
34
+ "@internal/lint": "0.0.27",
35
+ "@mastra/core": "0.13.0",
36
+ "@internal/types-builder": "0.0.2"
36
37
  },
37
38
  "peerDependencies": {
38
- "@mastra/core": ">=0.10.7-0 <0.13.0-0"
39
+ "@mastra/core": ">=0.13.0-0 <0.14.0-0"
39
40
  },
40
41
  "scripts": {
41
42
  "build": "tsup --silent --config tsup.config.ts",
@@ -15,33 +15,17 @@ function parseJSON(jsonString: string): any {
15
15
  }
16
16
 
17
17
  function transformScoreRow(row: Record<string, any>): ScoreRowData {
18
- let input = undefined;
19
- let output = undefined;
20
- let preprocessStepResult = undefined;
21
- let analyzeStepResult = undefined;
22
-
23
- if (row.input) {
24
- input = parseJSON(row.input);
25
- }
26
-
27
- if (row.output) {
28
- output = parseJSON(row.output);
29
- }
30
-
31
- if (row.preprocessStepResult) {
32
- preprocessStepResult = parseJSON(row.preprocessStepResult);
33
- }
34
-
35
- if (row.analyzeStepResult) {
36
- analyzeStepResult = parseJSON(row.analyzeStepResult);
37
- }
38
-
39
18
  return {
40
19
  ...row,
41
- input,
42
- output,
43
- preprocessStepResult,
44
- analyzeStepResult,
20
+ input: parseJSON(row.input),
21
+ scorer: parseJSON(row.scorer),
22
+ preprocessStepResult: parseJSON(row.preprocessStepResult),
23
+ analyzeStepResult: parseJSON(row.analyzeStepResult),
24
+ metadata: parseJSON(row.metadata),
25
+ output: parseJSON(row.output),
26
+ additionalContext: parseJSON(row.additionalContext),
27
+ runtimeContext: parseJSON(row.runtimeContext),
28
+ entity: parseJSON(row.entity),
45
29
  createdAt: row.createdAt,
46
30
  updatedAt: row.updatedAt,
47
31
  } as ScoreRowData;
@@ -98,16 +82,33 @@ export class ScoresMSSQL extends ScoresStorage {
98
82
  // Generate ID like other storage implementations
99
83
  const scoreId = crypto.randomUUID();
100
84
 
101
- const { input, output, preprocessStepResult, analyzeStepResult, ...rest } = score;
85
+ const {
86
+ scorer,
87
+ preprocessStepResult,
88
+ analyzeStepResult,
89
+ metadata,
90
+ input,
91
+ output,
92
+ additionalContext,
93
+ runtimeContext,
94
+ entity,
95
+ ...rest
96
+ } = score;
97
+
102
98
  await this.operations.insert({
103
99
  tableName: TABLE_SCORERS,
104
100
  record: {
105
101
  id: scoreId,
106
102
  ...rest,
107
- input: JSON.stringify(input),
108
- output: JSON.stringify(output),
103
+ input: JSON.stringify(input) || '',
104
+ output: JSON.stringify(output) || '',
109
105
  preprocessStepResult: preprocessStepResult ? JSON.stringify(preprocessStepResult) : null,
110
106
  analyzeStepResult: analyzeStepResult ? JSON.stringify(analyzeStepResult) : null,
107
+ metadata: metadata ? JSON.stringify(metadata) : null,
108
+ additionalContext: additionalContext ? JSON.stringify(additionalContext) : null,
109
+ runtimeContext: runtimeContext ? JSON.stringify(runtimeContext) : null,
110
+ entity: entity ? JSON.stringify(entity) : null,
111
+ scorer: scorer ? JSON.stringify(scorer) : null,
111
112
  createdAt: new Date().toISOString(),
112
113
  updatedAt: new Date().toISOString(),
113
114
  },
package/tsup.config.ts CHANGED
@@ -1,9 +1,6 @@
1
- import { spawn } from 'child_process';
2
- import { promisify } from 'util';
1
+ import { generateTypes } from '@internal/types-builder';
3
2
  import { defineConfig } from 'tsup';
4
3
 
5
- const exec = promisify(spawn);
6
-
7
4
  export default defineConfig({
8
5
  entry: ['src/index.ts'],
9
6
  format: ['esm', 'cjs'],
@@ -15,8 +12,6 @@ export default defineConfig({
15
12
  },
16
13
  sourcemap: true,
17
14
  onSuccess: async () => {
18
- await exec('pnpm', ['tsc', '-p', 'tsconfig.build.json'], {
19
- stdio: 'inherit',
20
- });
15
+ await generateTypes(process.cwd());
21
16
  },
22
17
  });