@mastra/lance 0.0.0-mssql-store-20250804200341 → 0.0.0-netlify-no-bundle-20251127120354

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +857 -2
  2. package/README.md +64 -7
  3. package/dist/index.cjs +635 -651
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +636 -652
  7. package/dist/index.js.map +1 -1
  8. package/dist/storage/domains/memory/index.d.ts +18 -33
  9. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  10. package/dist/storage/domains/operations/index.d.ts.map +1 -1
  11. package/dist/storage/domains/scores/index.d.ts +16 -4
  12. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  13. package/dist/storage/domains/utils.d.ts.map +1 -1
  14. package/dist/storage/domains/workflows/index.d.ts +23 -11
  15. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  16. package/dist/storage/index.d.ts +57 -79
  17. package/dist/storage/index.d.ts.map +1 -1
  18. package/dist/vector/filter.d.ts +5 -5
  19. package/dist/vector/index.d.ts +8 -5
  20. package/dist/vector/index.d.ts.map +1 -1
  21. package/package.json +29 -10
  22. package/dist/storage/domains/legacy-evals/index.d.ts +0 -25
  23. package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
  24. package/dist/storage/domains/traces/index.d.ts +0 -34
  25. package/dist/storage/domains/traces/index.d.ts.map +0 -1
  26. package/eslint.config.js +0 -6
  27. package/src/index.ts +0 -2
  28. package/src/storage/domains/legacy-evals/index.ts +0 -156
  29. package/src/storage/domains/memory/index.ts +0 -947
  30. package/src/storage/domains/operations/index.ts +0 -489
  31. package/src/storage/domains/scores/index.ts +0 -221
  32. package/src/storage/domains/traces/index.ts +0 -212
  33. package/src/storage/domains/utils.ts +0 -158
  34. package/src/storage/domains/workflows/index.ts +0 -207
  35. package/src/storage/index.test.ts +0 -10
  36. package/src/storage/index.ts +0 -442
  37. package/src/vector/filter.test.ts +0 -295
  38. package/src/vector/filter.ts +0 -443
  39. package/src/vector/index.test.ts +0 -1493
  40. package/src/vector/index.ts +0 -941
  41. package/src/vector/types.ts +0 -16
  42. package/tsconfig.build.json +0 -9
  43. package/tsconfig.json +0 -5
  44. package/tsup.config.ts +0 -22
  45. package/vitest.config.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/lance",
3
- "version": "0.0.0-mssql-store-20250804200341",
3
+ "version": "0.0.0-netlify-no-bundle-20251127120354",
4
4
  "description": "Lance provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,29 +12,48 @@
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
  },
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "@lancedb/lancedb": "^0.18.2",
22
+ "@lancedb/lancedb": "^0.22.3",
23
23
  "apache-arrow": "^18.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@microsoft/api-extractor": "^7.52.8",
27
- "@types/node": "^20.19.0",
28
- "eslint": "^9.30.1",
27
+ "@types/node": "22.13.17",
28
+ "@vitest/coverage-v8": "4.0.12",
29
+ "@vitest/ui": "4.0.12",
30
+ "eslint": "^9.37.0",
29
31
  "tsup": "^8.5.0",
30
32
  "typescript": "^5.8.3",
31
- "vitest": "^3.2.4",
32
- "@internal/lint": "0.0.0-mssql-store-20250804200341",
33
- "@mastra/core": "0.0.0-mssql-store-20250804200341",
34
- "@internal/storage-test-utils": "0.0.22"
33
+ "vitest": "4.0.12",
34
+ "@internal/lint": "0.0.0-netlify-no-bundle-20251127120354",
35
+ "@internal/storage-test-utils": "0.0.49",
36
+ "@internal/types-builder": "0.0.0-netlify-no-bundle-20251127120354",
37
+ "@mastra/core": "0.0.0-netlify-no-bundle-20251127120354"
35
38
  },
36
39
  "peerDependencies": {
37
- "@mastra/core": "0.0.0-mssql-store-20250804200341"
40
+ "@mastra/core": "0.0.0-netlify-no-bundle-20251127120354"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "CHANGELOG.md"
45
+ ],
46
+ "homepage": "https://mastra.ai",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/mastra-ai/mastra.git",
50
+ "directory": "stores/lance"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/mastra-ai/mastra/issues"
54
+ },
55
+ "engines": {
56
+ "node": ">=22.13.0"
38
57
  },
39
58
  "scripts": {
40
59
  "build": "tsup --silent --config tsup.config.ts",
@@ -1,25 +0,0 @@
1
- import type { Connection } from '@lancedb/lancedb';
2
- import { LegacyEvalsStorage } from '@mastra/core/storage';
3
- import type { EvalRow, PaginationInfo } from '@mastra/core/storage';
4
- export declare class StoreLegacyEvalsLance extends LegacyEvalsStorage {
5
- private client;
6
- constructor({ client }: {
7
- client: Connection;
8
- });
9
- getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
10
- getEvals(options: {
11
- agentName?: string;
12
- type?: 'test' | 'live';
13
- page?: number;
14
- perPage?: number;
15
- fromDate?: Date;
16
- toDate?: Date;
17
- dateRange?: {
18
- start?: Date;
19
- end?: Date;
20
- };
21
- }): Promise<PaginationInfo & {
22
- evals: EvalRow[];
23
- }>;
24
- }
25
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/legacy-evals/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEpE,qBAAa,qBAAsB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,MAAM,CAAa;gBACf,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAKxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA4ClF,QAAQ,CAAC,OAAO,EAAE;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,SAAS,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,IAAI,CAAC;YAAC,GAAG,CAAC,EAAE,IAAI,CAAA;SAAE,CAAC;KAC1C,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CA2FnD"}
@@ -1,34 +0,0 @@
1
- import type { Connection } from '@lancedb/lancedb';
2
- import type { TraceType } from '@mastra/core/memory';
3
- import { TracesStorage } from '@mastra/core/storage';
4
- import type { PaginationInfo, StorageGetTracesPaginatedArg } from '@mastra/core/storage';
5
- import type { Trace } from '@mastra/core/telemetry';
6
- import type { StoreOperationsLance } from '../operations';
7
- export declare class StoreTracesLance extends TracesStorage {
8
- private client;
9
- private operations;
10
- constructor({ client, operations }: {
11
- client: Connection;
12
- operations: StoreOperationsLance;
13
- });
14
- saveTrace({ trace }: {
15
- trace: TraceType;
16
- }): Promise<TraceType>;
17
- getTraceById({ traceId }: {
18
- traceId: string;
19
- }): Promise<TraceType>;
20
- getTraces({ name, scope, page, perPage, attributes, }: {
21
- name?: string;
22
- scope?: string;
23
- page: number;
24
- perPage: number;
25
- attributes?: Record<string, string>;
26
- }): Promise<Trace[]>;
27
- getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
28
- traces: Trace[];
29
- }>;
30
- batchTraceInsert({ records }: {
31
- records: Record<string, any>[];
32
- }): Promise<void>;
33
- }
34
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAuB;gBAC7B,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,UAAU,EAAE,oBAAoB,CAAA;KAAE;IAMtF,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAyB9D,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAkBlE,SAAS,CAAC,EACd,IAAI,EACJ,KAAK,EACL,IAAQ,EACR,OAAY,EACZ,UAAU,GACX,EAAE;QACD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAoDd,kBAAkB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;IAgFrG,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvF"}
package/eslint.config.js DELETED
@@ -1,6 +0,0 @@
1
- import { createConfig } from '@internal/lint/eslint';
2
-
3
- const config = await createConfig();
4
-
5
- /** @type {import("eslint").Linter.Config[]} */
6
- export default [...config];
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './storage';
2
- export * from './vector';
@@ -1,156 +0,0 @@
1
- import type { Connection } from '@lancedb/lancedb';
2
- import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
3
- import { LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
4
- import type { EvalRow, PaginationInfo } from '@mastra/core/storage';
5
-
6
- export class StoreLegacyEvalsLance extends LegacyEvalsStorage {
7
- private client: Connection;
8
- constructor({ client }: { client: Connection }) {
9
- super();
10
- this.client = client;
11
- }
12
-
13
- async getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
14
- try {
15
- const table = await this.client.openTable(TABLE_EVALS);
16
- const query = table.query().where(`agent_name = '${agentName}'`);
17
- const records = await query.toArray();
18
-
19
- // Filter by type if specified
20
- let filteredRecords = records;
21
- if (type === 'live') {
22
- // Live evals have test_info as null
23
- filteredRecords = records.filter(record => record.test_info === null);
24
- } else if (type === 'test') {
25
- // Test evals have test_info as a JSON string
26
- filteredRecords = records.filter(record => record.test_info !== null);
27
- }
28
-
29
- return filteredRecords.map(record => {
30
- return {
31
- id: record.id,
32
- input: record.input,
33
- output: record.output,
34
- agentName: record.agent_name,
35
- metricName: record.metric_name,
36
- result: JSON.parse(record.result),
37
- instructions: record.instructions,
38
- testInfo: record.test_info ? JSON.parse(record.test_info) : null,
39
- globalRunId: record.global_run_id,
40
- runId: record.run_id,
41
- createdAt: new Date(record.created_at).toString(),
42
- };
43
- }) as EvalRow[];
44
- } catch (error: any) {
45
- throw new MastraError(
46
- {
47
- id: 'LANCE_STORE_GET_EVALS_BY_AGENT_NAME_FAILED',
48
- domain: ErrorDomain.STORAGE,
49
- category: ErrorCategory.THIRD_PARTY,
50
- details: { agentName },
51
- },
52
- error,
53
- );
54
- }
55
- }
56
-
57
- async getEvals(options: {
58
- agentName?: string;
59
- type?: 'test' | 'live';
60
- page?: number;
61
- perPage?: number;
62
- fromDate?: Date;
63
- toDate?: Date;
64
- dateRange?: { start?: Date; end?: Date };
65
- }): Promise<PaginationInfo & { evals: EvalRow[] }> {
66
- try {
67
- const table = await this.client.openTable(TABLE_EVALS);
68
-
69
- // Build combined where clause
70
- const conditions: string[] = [];
71
-
72
- if (options.agentName) {
73
- conditions.push(`agent_name = '${options.agentName}'`);
74
- }
75
-
76
- // Apply type filtering
77
- if (options.type === 'live') {
78
- conditions.push('length(test_info) = 0');
79
- } else if (options.type === 'test') {
80
- conditions.push('length(test_info) > 0');
81
- }
82
-
83
- // Apply date filtering
84
- const startDate = options.dateRange?.start || options.fromDate;
85
- const endDate = options.dateRange?.end || options.toDate;
86
-
87
- if (startDate) {
88
- conditions.push(`\`created_at\` >= ${startDate.getTime()}`);
89
- }
90
-
91
- if (endDate) {
92
- conditions.push(`\`created_at\` <= ${endDate.getTime()}`);
93
- }
94
-
95
- // Get total count with the same conditions
96
- let total = 0;
97
- if (conditions.length > 0) {
98
- total = await table.countRows(conditions.join(' AND '));
99
- } else {
100
- total = await table.countRows();
101
- }
102
-
103
- // Build query for fetching records
104
- const query = table.query();
105
-
106
- // Apply combined where clause if we have conditions
107
- if (conditions.length > 0) {
108
- const whereClause = conditions.join(' AND ');
109
- query.where(whereClause);
110
- }
111
-
112
- const records = await query.toArray();
113
-
114
- const evals = records
115
- .sort((a, b) => b.created_at - a.created_at)
116
- .map(record => {
117
- return {
118
- id: record.id,
119
- input: record.input,
120
- output: record.output,
121
- agentName: record.agent_name,
122
- metricName: record.metric_name,
123
- result: JSON.parse(record.result),
124
- instructions: record.instructions,
125
- testInfo: record.test_info ? JSON.parse(record.test_info) : null,
126
- globalRunId: record.global_run_id,
127
- runId: record.run_id,
128
- createdAt: new Date(record.created_at).toISOString(),
129
- };
130
- }) as EvalRow[];
131
-
132
- // Apply pagination after filtering
133
- const page = options.page || 0;
134
- const perPage = options.perPage || 10;
135
- const pagedEvals = evals.slice(page * perPage, (page + 1) * perPage);
136
-
137
- return {
138
- evals: pagedEvals,
139
- total: total,
140
- page,
141
- perPage,
142
- hasMore: total > (page + 1) * perPage,
143
- };
144
- } catch (error: any) {
145
- throw new MastraError(
146
- {
147
- id: 'LANCE_STORE_GET_EVALS_FAILED',
148
- domain: ErrorDomain.STORAGE,
149
- category: ErrorCategory.THIRD_PARTY,
150
- details: { agentName: options.agentName ?? '' },
151
- },
152
- error,
153
- );
154
- }
155
- }
156
- }