@mastra/dsql 1.1.0 → 1.1.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 +18 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2116,13 +2116,13 @@ var MemoryDSQL = class _MemoryDSQL extends MemoryStorage {
|
|
|
2116
2116
|
const queryParams = [];
|
|
2117
2117
|
let paramIndex = 1;
|
|
2118
2118
|
if (filter?.resourceId) {
|
|
2119
|
-
whereClauses.push(`"resourceId" =
|
|
2119
|
+
whereClauses.push(`"resourceId" = $${paramIndex}`);
|
|
2120
2120
|
queryParams.push(filter.resourceId);
|
|
2121
2121
|
paramIndex++;
|
|
2122
2122
|
}
|
|
2123
2123
|
if (filter?.metadata && Object.keys(filter.metadata).length > 0) {
|
|
2124
2124
|
for (const [key, value] of Object.entries(filter.metadata)) {
|
|
2125
|
-
whereClauses.push(`metadata::jsonb @>
|
|
2125
|
+
whereClauses.push(`metadata::jsonb @> $${paramIndex}::jsonb`);
|
|
2126
2126
|
queryParams.push(JSON.stringify({ [key]: value }));
|
|
2127
2127
|
paramIndex++;
|
|
2128
2128
|
}
|
|
@@ -2142,7 +2142,7 @@ var MemoryDSQL = class _MemoryDSQL extends MemoryStorage {
|
|
|
2142
2142
|
};
|
|
2143
2143
|
}
|
|
2144
2144
|
const limitValue = perPageInput === false ? total : perPage;
|
|
2145
|
-
const dataQuery = `SELECT id, "resourceId", title, metadata, "createdAt", "createdAtZ", "updatedAt", "updatedAtZ" ${baseQuery} ORDER BY "${field}" ${direction} LIMIT
|
|
2145
|
+
const dataQuery = `SELECT id, "resourceId", title, metadata, "createdAt", "createdAtZ", "updatedAt", "updatedAtZ" ${baseQuery} ORDER BY "${field}" ${direction} LIMIT $${paramIndex} OFFSET $${paramIndex + 1}`;
|
|
2146
2146
|
const rows = await this.#db.client.manyOrNone(
|
|
2147
2147
|
dataQuery,
|
|
2148
2148
|
[...queryParams, limitValue, offset]
|