@mastra/mssql 0.2.1-alpha.0 → 0.2.1
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +54 -0
- package/dist/_tsup-dts-rollup.d.cts +37 -0
- package/dist/_tsup-dts-rollup.d.ts +37 -0
- package/dist/index.cjs +69 -1
- package/dist/index.js +69 -1
- package/package.json +4 -4
- package/src/storage/index.test.ts +2211 -2222
- package/src/storage/index.ts +90 -0
package/src/storage/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type MastraMessageV2WithTypedContent = Omit<MastraMessageV2, 'content'> &
|
|
|
4
4
|
import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
|
|
5
5
|
import type { MetricResult } from '@mastra/core/eval';
|
|
6
6
|
import type { MastraMessageV1, StorageThreadType } from '@mastra/core/memory';
|
|
7
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
7
8
|
import {
|
|
8
9
|
MastraStorage,
|
|
9
10
|
TABLE_MESSAGES,
|
|
@@ -23,6 +24,7 @@ import type {
|
|
|
23
24
|
WorkflowRun,
|
|
24
25
|
WorkflowRuns,
|
|
25
26
|
PaginationArgs,
|
|
27
|
+
StoragePagination,
|
|
26
28
|
} from '@mastra/core/storage';
|
|
27
29
|
import { parseSqlIdentifier, parseFieldKey } from '@mastra/core/utils';
|
|
28
30
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
@@ -129,10 +131,14 @@ export class MSSQLStore extends MastraStorage {
|
|
|
129
131
|
public get supports(): {
|
|
130
132
|
selectByIncludeResourceScope: boolean;
|
|
131
133
|
resourceWorkingMemory: boolean;
|
|
134
|
+
hasColumn: boolean;
|
|
135
|
+
createTable: boolean;
|
|
132
136
|
} {
|
|
133
137
|
return {
|
|
134
138
|
selectByIncludeResourceScope: true,
|
|
135
139
|
resourceWorkingMemory: true,
|
|
140
|
+
hasColumn: true,
|
|
141
|
+
createTable: true,
|
|
136
142
|
};
|
|
137
143
|
}
|
|
138
144
|
|
|
@@ -2041,4 +2047,88 @@ export class MSSQLStore extends MastraStorage {
|
|
|
2041
2047
|
throw mastraError;
|
|
2042
2048
|
}
|
|
2043
2049
|
}
|
|
2050
|
+
|
|
2051
|
+
async getScoreById({ id }: { id: string }): Promise<ScoreRowData | null> {
|
|
2052
|
+
throw new MastraError({
|
|
2053
|
+
id: 'STORAGE_MONGODB_STORE_GET_SCORE_BY_ID_FAILED',
|
|
2054
|
+
domain: ErrorDomain.STORAGE,
|
|
2055
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2056
|
+
details: { id },
|
|
2057
|
+
text: 'getScoreById is not implemented yet in MongoDBStore',
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
async saveScore(_score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{ score: ScoreRowData }> {
|
|
2062
|
+
throw new MastraError({
|
|
2063
|
+
id: 'STORAGE_MONGODB_STORE_SAVE_SCORE_FAILED',
|
|
2064
|
+
domain: ErrorDomain.STORAGE,
|
|
2065
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2066
|
+
details: {},
|
|
2067
|
+
text: 'saveScore is not implemented yet in MongoDBStore',
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
async getScoresByScorerId({
|
|
2072
|
+
scorerId,
|
|
2073
|
+
pagination: _pagination,
|
|
2074
|
+
entityId,
|
|
2075
|
+
entityType,
|
|
2076
|
+
}: {
|
|
2077
|
+
scorerId: string;
|
|
2078
|
+
pagination: StoragePagination;
|
|
2079
|
+
entityId?: string;
|
|
2080
|
+
entityType?: string;
|
|
2081
|
+
}): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
|
|
2082
|
+
throw new MastraError({
|
|
2083
|
+
id: 'STORAGE_MONGODB_STORE_GET_SCORES_BY_SCORER_ID_FAILED',
|
|
2084
|
+
domain: ErrorDomain.STORAGE,
|
|
2085
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2086
|
+
details: { scorerId, entityId: entityId || '', entityType: entityType || '' },
|
|
2087
|
+
text: 'getScoresByScorerId is not implemented yet in MongoDBStore',
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
async getScoresByRunId({
|
|
2092
|
+
runId,
|
|
2093
|
+
pagination: _pagination,
|
|
2094
|
+
}: {
|
|
2095
|
+
runId: string;
|
|
2096
|
+
pagination: StoragePagination;
|
|
2097
|
+
}): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
|
|
2098
|
+
throw new MastraError({
|
|
2099
|
+
id: 'STORAGE_MONGODB_STORE_GET_SCORES_BY_RUN_ID_FAILED',
|
|
2100
|
+
domain: ErrorDomain.STORAGE,
|
|
2101
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2102
|
+
details: { runId },
|
|
2103
|
+
text: 'getScoresByRunId is not implemented yet in MongoDBStore',
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
async getScoresByEntityId({
|
|
2108
|
+
entityId,
|
|
2109
|
+
entityType,
|
|
2110
|
+
pagination: _pagination,
|
|
2111
|
+
}: {
|
|
2112
|
+
pagination: StoragePagination;
|
|
2113
|
+
entityId: string;
|
|
2114
|
+
entityType: string;
|
|
2115
|
+
}): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
|
|
2116
|
+
throw new MastraError({
|
|
2117
|
+
id: 'STORAGE_MONGODB_STORE_GET_SCORES_BY_ENTITY_ID_FAILED',
|
|
2118
|
+
domain: ErrorDomain.STORAGE,
|
|
2119
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2120
|
+
details: { entityId, entityType },
|
|
2121
|
+
text: 'getScoresByEntityId is not implemented yet in MongoDBStore',
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
async dropTable({ tableName }: { tableName: TABLE_NAMES }): Promise<void> {
|
|
2126
|
+
throw new MastraError({
|
|
2127
|
+
id: 'STORAGE_MONGODB_STORE_DROP_TABLE_FAILED',
|
|
2128
|
+
domain: ErrorDomain.STORAGE,
|
|
2129
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2130
|
+
details: { tableName },
|
|
2131
|
+
text: 'dropTable is not implemented yet in MongoDBStore',
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2044
2134
|
}
|