@mastra/cloudflare-d1 0.13.8 → 0.13.9

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @mastra/cloudflare-d1
2
2
 
3
+ ## 0.13.9
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: ensure score responses match saved payloads for Mastra Stores. ([#10570](https://github.com/mastra-ai/mastra/pull/10570))
8
+
9
+ - Fix message sorting in getMessagesPaginated when using semantic recall (include parameter). Messages are now always sorted by createdAt after combining paginated and included messages, ensuring correct chronological ordering of conversation history. All stores now consistently use MessageList for deduplication followed by explicit sorting. ([#10573](https://github.com/mastra-ai/mastra/pull/10573))
10
+
11
+ - Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
12
+ - @mastra/core@0.24.6
13
+
14
+ ## 0.13.9-alpha.0
15
+
16
+ ### Patch Changes
17
+
18
+ - fix: ensure score responses match saved payloads for Mastra Stores. ([#10570](https://github.com/mastra-ai/mastra/pull/10570))
19
+
20
+ - Fix message sorting in getMessagesPaginated when using semantic recall (include parameter). Messages are now always sorted by createdAt after combining paginated and included messages, ensuring correct chronological ordering of conversation history. All stores now consistently use MessageList for deduplication followed by explicit sorting. ([#10573](https://github.com/mastra-ai/mastra/pull/10573))
21
+
22
+ - Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
23
+ - @mastra/core@0.24.6-alpha.0
24
+
3
25
  ## 0.13.8
4
26
 
5
27
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1052,17 +1052,16 @@ var MemoryStorageD1 = class extends storage.MemoryStorage {
1052
1052
  }
1053
1053
  return processedMsg;
1054
1054
  });
1055
- if (selectBy?.last) {
1056
- processedMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
1057
- }
1058
- const list = new agent.MessageList().add(processedMessages, "memory");
1059
- messages.push(...format === `v2` ? list.get.all.v2() : list.get.all.v1());
1055
+ const allMessages = [...messages, ...processedMessages];
1056
+ const list = new agent.MessageList().add(allMessages, "memory");
1057
+ let finalMessages = format === `v2` ? list.get.all.v2() : list.get.all.v1();
1058
+ finalMessages = finalMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
1060
1059
  return {
1061
- messages,
1060
+ messages: finalMessages,
1062
1061
  total,
1063
1062
  page,
1064
1063
  perPage,
1065
- hasMore: selectBy?.last ? false : page * perPage + messages.length < total
1064
+ hasMore: selectBy?.last ? false : page * perPage + processedMessages.length < total
1066
1065
  };
1067
1066
  } catch (error$1) {
1068
1067
  const mastraError = new error.MastraError(
@@ -1575,15 +1574,15 @@ var StoreOperationsD1 = class extends storage.StoreOperations {
1575
1574
  };
1576
1575
  function transformScoreRow(row) {
1577
1576
  const deserialized = { ...row };
1578
- deserialized.input = storage.safelyParseJSON(row.input);
1579
- deserialized.output = storage.safelyParseJSON(row.output);
1580
- deserialized.scorer = storage.safelyParseJSON(row.scorer);
1581
- deserialized.preprocessStepResult = storage.safelyParseJSON(row.preprocessStepResult);
1582
- deserialized.analyzeStepResult = storage.safelyParseJSON(row.analyzeStepResult);
1583
- deserialized.metadata = storage.safelyParseJSON(row.metadata);
1584
- deserialized.additionalContext = storage.safelyParseJSON(row.additionalContext);
1585
- deserialized.runtimeContext = storage.safelyParseJSON(row.runtimeContext);
1586
- deserialized.entity = storage.safelyParseJSON(row.entity);
1577
+ deserialized.input = row.input ? storage.safelyParseJSON(row.input) : void 0;
1578
+ deserialized.output = row.output ? storage.safelyParseJSON(row.output) : void 0;
1579
+ deserialized.scorer = row.scorer ? storage.safelyParseJSON(row.scorer) : void 0;
1580
+ deserialized.preprocessStepResult = row.preprocessStepResult ? storage.safelyParseJSON(row.preprocessStepResult) : void 0;
1581
+ deserialized.analyzeStepResult = row.analyzeStepResult ? storage.safelyParseJSON(row.analyzeStepResult) : void 0;
1582
+ deserialized.metadata = row.metadata ? storage.safelyParseJSON(row.metadata) : void 0;
1583
+ deserialized.additionalContext = row.additionalContext ? storage.safelyParseJSON(row.additionalContext) : void 0;
1584
+ deserialized.runtimeContext = row.runtimeContext ? storage.safelyParseJSON(row.runtimeContext) : void 0;
1585
+ deserialized.entity = row.entity ? storage.safelyParseJSON(row.entity) : void 0;
1587
1586
  deserialized.createdAt = row.createdAtZ || row.createdAt;
1588
1587
  deserialized.updatedAt = row.updatedAtZ || row.updatedAt;
1589
1588
  return deserialized;