@mastra/mongodb 0.14.9 → 0.14.10-alpha.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +199 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +199 -133
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts +5 -0
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/vector/index.d.ts +3 -2
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { saveScorePayloadSchema } from '@mastra/core/scores';
|
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
13
|
var package_default = {
|
|
14
|
-
version: "0.14.
|
|
14
|
+
version: "0.14.10-alpha.0"};
|
|
15
15
|
var MongoDBFilterTranslator = class extends BaseFilterTranslator {
|
|
16
16
|
getSupportedOperators() {
|
|
17
17
|
return {
|
|
@@ -353,12 +353,17 @@ var MongoDBVector = class extends MastraVector {
|
|
|
353
353
|
limit: topK
|
|
354
354
|
};
|
|
355
355
|
if (Object.keys(combinedFilter).length > 0) {
|
|
356
|
-
const
|
|
356
|
+
const filterWithExclusion = {
|
|
357
|
+
$and: [{ _id: { $ne: "__index_metadata__" } }, combinedFilter]
|
|
358
|
+
};
|
|
359
|
+
const candidateIds = await collection.aggregate([{ $match: filterWithExclusion }, { $project: { _id: 1 } }]).map((doc) => doc._id).toArray();
|
|
357
360
|
if (candidateIds.length > 0) {
|
|
358
361
|
vectorSearch.filter = { _id: { $in: candidateIds } };
|
|
359
362
|
} else {
|
|
360
363
|
return [];
|
|
361
364
|
}
|
|
365
|
+
} else {
|
|
366
|
+
vectorSearch.filter = { _id: { $ne: "__index_metadata__" } };
|
|
362
367
|
}
|
|
363
368
|
const pipeline = [
|
|
364
369
|
{
|
|
@@ -479,7 +484,26 @@ var MongoDBVector = class extends MastraVector {
|
|
|
479
484
|
* @returns A promise that resolves when the update is complete.
|
|
480
485
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
481
486
|
*/
|
|
482
|
-
async updateVector(
|
|
487
|
+
async updateVector(params) {
|
|
488
|
+
const { indexName, update } = params;
|
|
489
|
+
if ("id" in params && params.id && "filter" in params && params.filter) {
|
|
490
|
+
throw new MastraError({
|
|
491
|
+
id: "STORAGE_MONGODB_VECTOR_UPDATE_MUTUALLY_EXCLUSIVE_PARAMS",
|
|
492
|
+
domain: ErrorDomain.STORAGE,
|
|
493
|
+
category: ErrorCategory.USER,
|
|
494
|
+
details: { indexName },
|
|
495
|
+
text: "id and filter are mutually exclusive - provide only one"
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
if (!("id" in params || "filter" in params) || !params.id && !params.filter) {
|
|
499
|
+
throw new MastraError({
|
|
500
|
+
id: "STORAGE_MONGODB_VECTOR_UPDATE_MISSING_PARAMS",
|
|
501
|
+
domain: ErrorDomain.STORAGE,
|
|
502
|
+
category: ErrorCategory.USER,
|
|
503
|
+
text: "Either id or filter must be provided",
|
|
504
|
+
details: { indexName }
|
|
505
|
+
});
|
|
506
|
+
}
|
|
483
507
|
try {
|
|
484
508
|
if (!update.vector && !update.metadata) {
|
|
485
509
|
throw new Error("No updates provided");
|
|
@@ -501,17 +525,49 @@ var MongoDBVector = class extends MastraVector {
|
|
|
501
525
|
);
|
|
502
526
|
updateDoc[this.metadataFieldName] = normalizedMeta;
|
|
503
527
|
}
|
|
504
|
-
|
|
528
|
+
if ("id" in params && params.id) {
|
|
529
|
+
await collection.findOneAndUpdate({ _id: params.id }, { $set: updateDoc });
|
|
530
|
+
} else if ("filter" in params && params.filter) {
|
|
531
|
+
const filter = params.filter;
|
|
532
|
+
if (!filter || Object.keys(filter).length === 0) {
|
|
533
|
+
throw new MastraError({
|
|
534
|
+
id: "STORAGE_MONGODB_VECTOR_UPDATE_EMPTY_FILTER",
|
|
535
|
+
domain: ErrorDomain.STORAGE,
|
|
536
|
+
category: ErrorCategory.USER,
|
|
537
|
+
details: { indexName },
|
|
538
|
+
text: "Cannot update with empty filter"
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
const mongoFilter = this.transformFilter(filter);
|
|
542
|
+
const transformedFilter = this.transformMetadataFilter(mongoFilter);
|
|
543
|
+
if (!transformedFilter || Object.keys(transformedFilter).length === 0) {
|
|
544
|
+
throw new MastraError({
|
|
545
|
+
id: "STORAGE_MONGODB_VECTOR_UPDATE_INVALID_FILTER",
|
|
546
|
+
domain: ErrorDomain.STORAGE,
|
|
547
|
+
category: ErrorCategory.USER,
|
|
548
|
+
details: { indexName },
|
|
549
|
+
text: "Filter produced empty query"
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
await collection.updateMany(transformedFilter, { $set: updateDoc });
|
|
553
|
+
}
|
|
505
554
|
} catch (error) {
|
|
555
|
+
if (error instanceof MastraError) {
|
|
556
|
+
throw error;
|
|
557
|
+
}
|
|
558
|
+
const errorDetails = { indexName };
|
|
559
|
+
if ("id" in params && params.id) {
|
|
560
|
+
errorDetails.id = params.id;
|
|
561
|
+
}
|
|
562
|
+
if ("filter" in params && params.filter) {
|
|
563
|
+
errorDetails.filter = JSON.stringify(params.filter);
|
|
564
|
+
}
|
|
506
565
|
throw new MastraError(
|
|
507
566
|
{
|
|
508
567
|
id: "STORAGE_MONGODB_VECTOR_UPDATE_VECTOR_FAILED",
|
|
509
568
|
domain: ErrorDomain.STORAGE,
|
|
510
569
|
category: ErrorCategory.THIRD_PARTY,
|
|
511
|
-
details:
|
|
512
|
-
indexName,
|
|
513
|
-
id
|
|
514
|
-
}
|
|
570
|
+
details: errorDetails
|
|
515
571
|
},
|
|
516
572
|
error
|
|
517
573
|
);
|
|
@@ -543,6 +599,83 @@ var MongoDBVector = class extends MastraVector {
|
|
|
543
599
|
);
|
|
544
600
|
}
|
|
545
601
|
}
|
|
602
|
+
async deleteVectors({ indexName, filter, ids }) {
|
|
603
|
+
if (!filter && !ids) {
|
|
604
|
+
throw new MastraError({
|
|
605
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_MISSING_PARAMS",
|
|
606
|
+
domain: ErrorDomain.STORAGE,
|
|
607
|
+
category: ErrorCategory.USER,
|
|
608
|
+
details: { indexName },
|
|
609
|
+
text: "Either filter or ids must be provided"
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
if (filter && ids) {
|
|
613
|
+
throw new MastraError({
|
|
614
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_CONFLICTING_PARAMS",
|
|
615
|
+
domain: ErrorDomain.STORAGE,
|
|
616
|
+
category: ErrorCategory.USER,
|
|
617
|
+
details: { indexName },
|
|
618
|
+
text: "Cannot provide both filter and ids - they are mutually exclusive"
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
try {
|
|
622
|
+
const collection = await this.getCollection(indexName, true);
|
|
623
|
+
if (ids) {
|
|
624
|
+
if (ids.length === 0) {
|
|
625
|
+
throw new MastraError({
|
|
626
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_EMPTY_IDS",
|
|
627
|
+
domain: ErrorDomain.STORAGE,
|
|
628
|
+
category: ErrorCategory.USER,
|
|
629
|
+
details: { indexName },
|
|
630
|
+
text: "Cannot delete with empty ids array"
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
await collection.deleteMany({ _id: { $in: ids } });
|
|
634
|
+
} else {
|
|
635
|
+
if (!filter || Object.keys(filter).length === 0) {
|
|
636
|
+
throw new MastraError({
|
|
637
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_EMPTY_FILTER",
|
|
638
|
+
domain: ErrorDomain.STORAGE,
|
|
639
|
+
category: ErrorCategory.USER,
|
|
640
|
+
details: { indexName },
|
|
641
|
+
text: "Cannot delete with empty filter"
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
const mongoFilter = this.transformFilter(filter);
|
|
645
|
+
const transformedFilter = this.transformMetadataFilter(mongoFilter);
|
|
646
|
+
if (!transformedFilter || Object.keys(transformedFilter).length === 0) {
|
|
647
|
+
throw new MastraError({
|
|
648
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_INVALID_FILTER",
|
|
649
|
+
domain: ErrorDomain.STORAGE,
|
|
650
|
+
category: ErrorCategory.USER,
|
|
651
|
+
details: { indexName },
|
|
652
|
+
text: "Filter produced empty query"
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
const finalFilter = {
|
|
656
|
+
$and: [{ _id: { $ne: "__index_metadata__" } }, transformedFilter]
|
|
657
|
+
};
|
|
658
|
+
await collection.deleteMany(finalFilter);
|
|
659
|
+
}
|
|
660
|
+
} catch (error) {
|
|
661
|
+
if (error instanceof MastraError) {
|
|
662
|
+
throw error;
|
|
663
|
+
}
|
|
664
|
+
throw new MastraError(
|
|
665
|
+
{
|
|
666
|
+
id: "STORAGE_MONGODB_VECTOR_DELETE_VECTORS_FAILED",
|
|
667
|
+
domain: ErrorDomain.STORAGE,
|
|
668
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
669
|
+
details: {
|
|
670
|
+
indexName,
|
|
671
|
+
...filter && { filter: JSON.stringify(filter) },
|
|
672
|
+
...ids && { idsCount: ids.length }
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
error
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
546
679
|
// Private methods
|
|
547
680
|
async getCollection(indexName, throwIfNotExists = true) {
|
|
548
681
|
if (this.collections.has(indexName)) {
|
|
@@ -590,16 +723,26 @@ var MongoDBVector = class extends MastraVector {
|
|
|
590
723
|
*/
|
|
591
724
|
transformMetadataFilter(filter) {
|
|
592
725
|
if (!filter || typeof filter !== "object") return filter;
|
|
726
|
+
if (Array.isArray(filter)) {
|
|
727
|
+
return filter.map((item) => this.transformMetadataFilter(item));
|
|
728
|
+
}
|
|
593
729
|
const transformed = {};
|
|
594
730
|
for (const [key, value] of Object.entries(filter)) {
|
|
595
731
|
if (key.startsWith("$")) {
|
|
596
732
|
if (Array.isArray(value)) {
|
|
597
733
|
transformed[key] = value.map((item) => this.transformMetadataFilter(item));
|
|
598
|
-
} else {
|
|
734
|
+
} else if (typeof value === "object" && value !== null) {
|
|
599
735
|
transformed[key] = this.transformMetadataFilter(value);
|
|
736
|
+
} else {
|
|
737
|
+
transformed[key] = value;
|
|
600
738
|
}
|
|
601
739
|
} else if (key.startsWith("metadata.")) {
|
|
602
|
-
|
|
740
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
741
|
+
const hasOperator = Object.keys(value).some((k) => k.startsWith("$"));
|
|
742
|
+
transformed[key] = hasOperator ? value : value;
|
|
743
|
+
} else {
|
|
744
|
+
transformed[key] = value;
|
|
745
|
+
}
|
|
603
746
|
} else if (this.isMetadataField(key)) {
|
|
604
747
|
transformed[`metadata.${key}`] = value;
|
|
605
748
|
} else {
|
|
@@ -842,11 +985,27 @@ var LegacyEvalsMongoDB = class extends LegacyEvalsStorage {
|
|
|
842
985
|
}
|
|
843
986
|
}
|
|
844
987
|
};
|
|
845
|
-
|
|
846
|
-
// src/storage/domains/utils.ts
|
|
847
988
|
function formatDateForMongoDB(date) {
|
|
848
989
|
return typeof date === "string" ? new Date(date) : date;
|
|
849
990
|
}
|
|
991
|
+
var transformRow = ({ row, tableName }) => {
|
|
992
|
+
const tableSchema = TABLE_SCHEMAS[tableName];
|
|
993
|
+
const result = {};
|
|
994
|
+
Object.entries(tableSchema).forEach(([key, columnSchema]) => {
|
|
995
|
+
const value = row[key];
|
|
996
|
+
if (value === void 0 || value === null) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
if (columnSchema.type === "jsonb" && typeof value === "string") {
|
|
1000
|
+
result[key] = safelyParseJSON(value);
|
|
1001
|
+
} else if (columnSchema.type === "timestamp" && typeof value === "string") {
|
|
1002
|
+
result[key] = new Date(value);
|
|
1003
|
+
} else {
|
|
1004
|
+
result[key] = value;
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
return result;
|
|
1008
|
+
};
|
|
850
1009
|
|
|
851
1010
|
// src/storage/domains/memory/index.ts
|
|
852
1011
|
var MemoryStorageMongoDB = class extends MemoryStorage {
|
|
@@ -1020,7 +1179,11 @@ var MemoryStorageMongoDB = class extends MemoryStorage {
|
|
|
1020
1179
|
}
|
|
1021
1180
|
const dataResult = await collection.find(query).sort({ createdAt: -1 }).skip(currentOffset).limit(perPage).toArray();
|
|
1022
1181
|
messages.push(...dataResult.map((row) => this.parseRow(row)));
|
|
1023
|
-
const
|
|
1182
|
+
const list = new MessageList().add(messages, "memory");
|
|
1183
|
+
let messagesToReturn = format === "v1" ? list.get.all.v1() : list.get.all.v2();
|
|
1184
|
+
messagesToReturn = messagesToReturn.sort(
|
|
1185
|
+
(a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
|
|
1186
|
+
);
|
|
1024
1187
|
return {
|
|
1025
1188
|
messages: messagesToReturn,
|
|
1026
1189
|
total,
|
|
@@ -1905,98 +2068,8 @@ var StoreOperationsMongoDB = class extends StoreOperations {
|
|
|
1905
2068
|
}
|
|
1906
2069
|
};
|
|
1907
2070
|
function transformScoreRow(row) {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
try {
|
|
1911
|
-
scorerValue = typeof row.scorer === "string" ? safelyParseJSON(row.scorer) : row.scorer;
|
|
1912
|
-
} catch (e) {
|
|
1913
|
-
console.warn("Failed to parse scorer:", e);
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
let preprocessStepResultValue = null;
|
|
1917
|
-
if (row.preprocessStepResult) {
|
|
1918
|
-
try {
|
|
1919
|
-
preprocessStepResultValue = typeof row.preprocessStepResult === "string" ? safelyParseJSON(row.preprocessStepResult) : row.preprocessStepResult;
|
|
1920
|
-
} catch (e) {
|
|
1921
|
-
console.warn("Failed to parse preprocessStepResult:", e);
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
let analyzeStepResultValue = null;
|
|
1925
|
-
if (row.analyzeStepResult) {
|
|
1926
|
-
try {
|
|
1927
|
-
analyzeStepResultValue = typeof row.analyzeStepResult === "string" ? safelyParseJSON(row.analyzeStepResult) : row.analyzeStepResult;
|
|
1928
|
-
} catch (e) {
|
|
1929
|
-
console.warn("Failed to parse analyzeStepResult:", e);
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
let inputValue = null;
|
|
1933
|
-
if (row.input) {
|
|
1934
|
-
try {
|
|
1935
|
-
inputValue = typeof row.input === "string" ? safelyParseJSON(row.input) : row.input;
|
|
1936
|
-
} catch (e) {
|
|
1937
|
-
console.warn("Failed to parse input:", e);
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
let outputValue = null;
|
|
1941
|
-
if (row.output) {
|
|
1942
|
-
try {
|
|
1943
|
-
outputValue = typeof row.output === "string" ? safelyParseJSON(row.output) : row.output;
|
|
1944
|
-
} catch (e) {
|
|
1945
|
-
console.warn("Failed to parse output:", e);
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
let entityValue = null;
|
|
1949
|
-
if (row.entity) {
|
|
1950
|
-
try {
|
|
1951
|
-
entityValue = typeof row.entity === "string" ? safelyParseJSON(row.entity) : row.entity;
|
|
1952
|
-
} catch (e) {
|
|
1953
|
-
console.warn("Failed to parse entity:", e);
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
let runtimeContextValue = null;
|
|
1957
|
-
if (row.runtimeContext) {
|
|
1958
|
-
try {
|
|
1959
|
-
runtimeContextValue = typeof row.runtimeContext === "string" ? safelyParseJSON(row.runtimeContext) : row.runtimeContext;
|
|
1960
|
-
} catch (e) {
|
|
1961
|
-
console.warn("Failed to parse runtimeContext:", e);
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
let metadataValue = null;
|
|
1965
|
-
if (row.metadata) {
|
|
1966
|
-
try {
|
|
1967
|
-
metadataValue = typeof row.metadata === "string" ? safelyParseJSON(row.metadata) : row.metadata;
|
|
1968
|
-
} catch (e) {
|
|
1969
|
-
console.warn("Failed to parse metadata:", e);
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
return {
|
|
1973
|
-
id: row.id,
|
|
1974
|
-
entityId: row.entityId,
|
|
1975
|
-
entityType: row.entityType,
|
|
1976
|
-
scorerId: row.scorerId,
|
|
1977
|
-
traceId: row.traceId,
|
|
1978
|
-
spanId: row.spanId,
|
|
1979
|
-
runId: row.runId,
|
|
1980
|
-
scorer: scorerValue,
|
|
1981
|
-
preprocessStepResult: preprocessStepResultValue,
|
|
1982
|
-
preprocessPrompt: row.preprocessPrompt,
|
|
1983
|
-
analyzeStepResult: analyzeStepResultValue,
|
|
1984
|
-
generateScorePrompt: row.generateScorePrompt,
|
|
1985
|
-
score: row.score,
|
|
1986
|
-
analyzePrompt: row.analyzePrompt,
|
|
1987
|
-
reasonPrompt: row.reasonPrompt,
|
|
1988
|
-
metadata: metadataValue,
|
|
1989
|
-
input: inputValue,
|
|
1990
|
-
output: outputValue,
|
|
1991
|
-
additionalContext: row.additionalContext,
|
|
1992
|
-
runtimeContext: runtimeContextValue,
|
|
1993
|
-
entity: entityValue,
|
|
1994
|
-
source: row.source,
|
|
1995
|
-
resourceId: row.resourceId,
|
|
1996
|
-
threadId: row.threadId,
|
|
1997
|
-
createdAt: new Date(row.createdAt),
|
|
1998
|
-
updatedAt: new Date(row.updatedAt)
|
|
1999
|
-
};
|
|
2071
|
+
const transformedRow = transformRow({ row, tableName: TABLE_SCORERS });
|
|
2072
|
+
return transformedRow;
|
|
2000
2073
|
}
|
|
2001
2074
|
var ScoresStorageMongoDB = class extends ScoresStorage {
|
|
2002
2075
|
operations;
|
|
@@ -2041,36 +2114,29 @@ var ScoresStorageMongoDB = class extends ScoresStorage {
|
|
|
2041
2114
|
try {
|
|
2042
2115
|
const now = /* @__PURE__ */ new Date();
|
|
2043
2116
|
const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
runtimeContext: typeof validatedScore.runtimeContext === "string" ? safelyParseJSON(validatedScore.runtimeContext) : validatedScore.runtimeContext,
|
|
2065
|
-
entity: typeof validatedScore.entity === "string" ? safelyParseJSON(validatedScore.entity) : validatedScore.entity,
|
|
2066
|
-
source: validatedScore.source,
|
|
2067
|
-
resourceId: validatedScore.resourceId || "",
|
|
2068
|
-
threadId: validatedScore.threadId || "",
|
|
2069
|
-
createdAt: now,
|
|
2070
|
-
updatedAt: now
|
|
2117
|
+
const scorer = typeof validatedScore.scorer === "string" ? safelyParseJSON(validatedScore.scorer) : validatedScore.scorer;
|
|
2118
|
+
const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? safelyParseJSON(validatedScore.preprocessStepResult) : validatedScore.preprocessStepResult;
|
|
2119
|
+
const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? safelyParseJSON(validatedScore.analyzeStepResult) : validatedScore.analyzeStepResult;
|
|
2120
|
+
const input = typeof validatedScore.input === "string" ? safelyParseJSON(validatedScore.input) : validatedScore.input;
|
|
2121
|
+
const output = typeof validatedScore.output === "string" ? safelyParseJSON(validatedScore.output) : validatedScore.output;
|
|
2122
|
+
const runtimeContext = typeof validatedScore.runtimeContext === "string" ? safelyParseJSON(validatedScore.runtimeContext) : validatedScore.runtimeContext;
|
|
2123
|
+
const entity = typeof validatedScore.entity === "string" ? safelyParseJSON(validatedScore.entity) : validatedScore.entity;
|
|
2124
|
+
const createdAt = now;
|
|
2125
|
+
const updatedAt = now;
|
|
2126
|
+
const dataToSave = {
|
|
2127
|
+
...validatedScore,
|
|
2128
|
+
scorer,
|
|
2129
|
+
preprocessStepResult,
|
|
2130
|
+
analyzeStepResult,
|
|
2131
|
+
input,
|
|
2132
|
+
output,
|
|
2133
|
+
runtimeContext,
|
|
2134
|
+
entity,
|
|
2135
|
+
createdAt,
|
|
2136
|
+
updatedAt
|
|
2071
2137
|
};
|
|
2072
2138
|
const collection = await this.operations.getCollection(TABLE_SCORERS);
|
|
2073
|
-
await collection.insertOne(
|
|
2139
|
+
await collection.insertOne(dataToSave);
|
|
2074
2140
|
const savedScore = {
|
|
2075
2141
|
...score,
|
|
2076
2142
|
id: scoreId,
|