@mastra/libsql 0.14.0 → 0.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 0.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix AI Trace bug for libsql ([#7695](https://github.com/mastra-ai/mastra/pull/7695))
8
+
9
+ - Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
10
+ - @mastra/core@0.16.3
11
+
12
+ ## 0.14.1-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Fix AI Trace bug for libsql ([#7695](https://github.com/mastra-ai/mastra/pull/7695))
17
+
18
+ - Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
19
+ - @mastra/core@0.16.3-alpha.0
20
+
3
21
  ## 0.14.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2029,17 +2029,47 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
2029
2029
  }) {
2030
2030
  const page = pagination?.page ?? 0;
2031
2031
  const perPage = pagination?.perPage ?? 10;
2032
+ const { entityId, entityType, ...actualFilters } = filters || {};
2032
2033
  const filtersWithDateRange = {
2033
- ...filters,
2034
- ...buildDateRangeFilter(pagination?.dateRange, "startedAt")
2034
+ ...actualFilters,
2035
+ ...buildDateRangeFilter(pagination?.dateRange, "startedAt"),
2036
+ parentSpanId: null
2035
2037
  };
2036
2038
  const whereClause = prepareWhereClause(filtersWithDateRange, storage.AI_SPAN_SCHEMA);
2039
+ let actualWhereClause = whereClause.sql || "";
2040
+ if (entityId && entityType) {
2041
+ const statement = `name = ?`;
2042
+ let name = "";
2043
+ if (entityType === "workflow") {
2044
+ name = `workflow run: '${entityId}'`;
2045
+ } else if (entityType === "agent") {
2046
+ name = `agent run: '${entityId}'`;
2047
+ } else {
2048
+ const error$1 = new error.MastraError({
2049
+ id: "LIBSQL_STORE_GET_AI_TRACES_PAGINATED_FAILED",
2050
+ domain: error.ErrorDomain.STORAGE,
2051
+ category: error.ErrorCategory.USER,
2052
+ details: {
2053
+ entityType
2054
+ },
2055
+ text: `Cannot filter by entity type: ${entityType}`
2056
+ });
2057
+ this.logger?.trackException(error$1);
2058
+ throw error$1;
2059
+ }
2060
+ whereClause.args.push(name);
2061
+ if (actualWhereClause) {
2062
+ actualWhereClause += ` AND ${statement}`;
2063
+ } else {
2064
+ actualWhereClause += `WHERE ${statement}`;
2065
+ }
2066
+ }
2037
2067
  const orderBy = "startedAt DESC";
2038
2068
  let count = 0;
2039
2069
  try {
2040
2070
  count = await this.operations.loadTotalCount({
2041
2071
  tableName: storage.TABLE_AI_SPANS,
2042
- whereClause: { sql: whereClause.sql, args: whereClause.args }
2072
+ whereClause: { sql: actualWhereClause, args: whereClause.args }
2043
2073
  });
2044
2074
  } catch (error$1) {
2045
2075
  throw new error.MastraError(
@@ -2065,7 +2095,10 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
2065
2095
  try {
2066
2096
  const spans = await this.operations.loadMany({
2067
2097
  tableName: storage.TABLE_AI_SPANS,
2068
- whereClause,
2098
+ whereClause: {
2099
+ sql: actualWhereClause,
2100
+ args: whereClause.args
2101
+ },
2069
2102
  orderBy,
2070
2103
  offset: page * perPage,
2071
2104
  limit: perPage