@mastra/pg 1.36.0-alpha.5 → 1.36.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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +17 -17
- package/dist/index.cjs +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/v-next/index.d.ts +1 -1
- package/dist/storage/domains/observability/v-next/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/span-query.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/trace-query.d.ts +1 -1
- package/dist/storage/domains/observability/v-next/trace-query.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.36.0
|
|
2
|
+
"version": "1.36.0",
|
|
3
3
|
"package": "@mastra/pg",
|
|
4
4
|
"exports": {
|
|
5
5
|
"AgentsPG": {
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
"ObservabilityStoragePostgresVNext": {
|
|
71
71
|
"types": "dist/storage/domains/observability/v-next/index.d.ts",
|
|
72
72
|
"implementation": "dist/index.js",
|
|
73
|
-
"line":
|
|
73
|
+
"line": 21993
|
|
74
74
|
},
|
|
75
75
|
"PGVECTOR_PROMPT": {
|
|
76
76
|
"types": "dist/vector/prompt.d.ts",
|
|
77
77
|
"implementation": "dist/index.js",
|
|
78
|
-
"line":
|
|
78
|
+
"line": 28697
|
|
79
79
|
},
|
|
80
80
|
"PgFactoryStorage": {
|
|
81
81
|
"types": "dist/storage/factory-storage.d.ts",
|
|
82
82
|
"implementation": "dist/index.js",
|
|
83
|
-
"line":
|
|
83
|
+
"line": 28177
|
|
84
84
|
},
|
|
85
85
|
"PgVector": {
|
|
86
86
|
"types": "dist/vector/index.d.ts",
|
|
@@ -95,67 +95,67 @@
|
|
|
95
95
|
"PostgresStore": {
|
|
96
96
|
"types": "dist/storage/index.d.ts",
|
|
97
97
|
"implementation": "dist/index.js",
|
|
98
|
-
"line":
|
|
98
|
+
"line": 28397
|
|
99
99
|
},
|
|
100
100
|
"PostgresStoreVNext": {
|
|
101
101
|
"types": "dist/storage/index.d.ts",
|
|
102
102
|
"implementation": "dist/index.js",
|
|
103
|
-
"line":
|
|
103
|
+
"line": 28616
|
|
104
104
|
},
|
|
105
105
|
"PromptBlocksPG": {
|
|
106
106
|
"types": "dist/storage/domains/prompt-blocks/index.d.ts",
|
|
107
107
|
"implementation": "dist/index.js",
|
|
108
|
-
"line":
|
|
108
|
+
"line": 22443
|
|
109
109
|
},
|
|
110
110
|
"SchedulesPG": {
|
|
111
111
|
"types": "dist/storage/domains/schedules/index.d.ts",
|
|
112
112
|
"implementation": "dist/index.js",
|
|
113
|
-
"line":
|
|
113
|
+
"line": 23072
|
|
114
114
|
},
|
|
115
115
|
"ScorerDefinitionsPG": {
|
|
116
116
|
"types": "dist/storage/domains/scorer-definitions/index.d.ts",
|
|
117
117
|
"implementation": "dist/index.js",
|
|
118
|
-
"line":
|
|
118
|
+
"line": 23402
|
|
119
119
|
},
|
|
120
120
|
"ScoresPG": {
|
|
121
121
|
"types": "dist/storage/domains/scores/index.d.ts",
|
|
122
122
|
"implementation": "dist/index.js",
|
|
123
|
-
"line":
|
|
123
|
+
"line": 24025
|
|
124
124
|
},
|
|
125
125
|
"SkillsPG": {
|
|
126
126
|
"types": "dist/storage/domains/skills/index.d.ts",
|
|
127
127
|
"implementation": "dist/index.js",
|
|
128
|
-
"line":
|
|
128
|
+
"line": 24468
|
|
129
129
|
},
|
|
130
130
|
"ThreadStatePG": {
|
|
131
131
|
"types": "dist/storage/domains/thread-state/index.d.ts",
|
|
132
132
|
"implementation": "dist/index.js",
|
|
133
|
-
"line":
|
|
133
|
+
"line": 25159
|
|
134
134
|
},
|
|
135
135
|
"ToolProviderConnectionsPG": {
|
|
136
136
|
"types": "dist/storage/domains/tool-provider-connections/index.d.ts",
|
|
137
137
|
"implementation": "dist/index.js",
|
|
138
|
-
"line":
|
|
138
|
+
"line": 25333
|
|
139
139
|
},
|
|
140
140
|
"WorkflowDefinitionsPG": {
|
|
141
141
|
"types": "dist/storage/domains/workflow-definitions/index.d.ts",
|
|
142
142
|
"implementation": "dist/index.js",
|
|
143
|
-
"line":
|
|
143
|
+
"line": 25597
|
|
144
144
|
},
|
|
145
145
|
"WorkflowsPG": {
|
|
146
146
|
"types": "dist/storage/domains/workflows/index.d.ts",
|
|
147
147
|
"implementation": "dist/index.js",
|
|
148
|
-
"line":
|
|
148
|
+
"line": 25980
|
|
149
149
|
},
|
|
150
150
|
"WorkspacesPG": {
|
|
151
151
|
"types": "dist/storage/domains/workspaces/index.d.ts",
|
|
152
152
|
"implementation": "dist/index.js",
|
|
153
|
-
"line":
|
|
153
|
+
"line": 27266
|
|
154
154
|
},
|
|
155
155
|
"exportSchemas": {
|
|
156
156
|
"types": "dist/storage/index.d.ts",
|
|
157
157
|
"implementation": "dist/index.js",
|
|
158
|
-
"line":
|
|
158
|
+
"line": 28364
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
"modules": {}
|
package/dist/index.cjs
CHANGED
|
@@ -19422,13 +19422,13 @@ const timingFeatures = [
|
|
|
19422
19422
|
* condition for rows level with it. Empty values sort last in both directions, so they are past
|
|
19423
19423
|
* every value and level only with each other.
|
|
19424
19424
|
*/
|
|
19425
|
-
function keysetSortBounds(field, direction, sortValue, values) {
|
|
19425
|
+
function keysetSortBounds(field, direction, sortValue, values, stringSort = false) {
|
|
19426
19426
|
if (sortValue === null) return {
|
|
19427
19427
|
past: [],
|
|
19428
19428
|
level: `${field} IS NULL`
|
|
19429
19429
|
};
|
|
19430
19430
|
values.push(sortValue);
|
|
19431
|
-
const parameter = `$${values.length}::${typeof sortValue === "number" ? "float8" : "timestamptz"}`;
|
|
19431
|
+
const parameter = `$${values.length}::${stringSort ? "text COLLATE \"C\"" : typeof sortValue === "number" ? "float8" : "timestamptz"}`;
|
|
19432
19432
|
return {
|
|
19433
19433
|
past: [`${field} ${direction === "asc" ? ">" : "<"} ${parameter}`, `${field} IS NULL`],
|
|
19434
19434
|
level: `${field} = ${parameter}`
|
|
@@ -20476,10 +20476,14 @@ function selectedKeys(rows, values) {
|
|
|
20476
20476
|
return `"${field}" ${field === "traceId" || field === "spanId" ? "=" : "IS NOT DISTINCT FROM"} $${values.length}::text`;
|
|
20477
20477
|
}).join(" AND ")})`).join(" OR ");
|
|
20478
20478
|
}
|
|
20479
|
+
function sortColumn(plan) {
|
|
20480
|
+
const column = `s."${plan.orderBy.field}"`;
|
|
20481
|
+
return plan.orderBy.field === "model" || plan.orderBy.field === "provider" ? `${column} COLLATE "C"` : column;
|
|
20482
|
+
}
|
|
20479
20483
|
function afterCursor(plan, values) {
|
|
20480
20484
|
if (!plan.cursor) return "TRUE";
|
|
20481
20485
|
const cursor = plan.cursor;
|
|
20482
|
-
const { past: terms, level } = keysetSortBounds(
|
|
20486
|
+
const { past: terms, level } = keysetSortBounds(sortColumn(plan), plan.orderBy.direction, cursor.sortValue, values, plan.orderBy.field === "model" || plan.orderBy.field === "provider");
|
|
20483
20487
|
const equal = [level];
|
|
20484
20488
|
for (const key of identityFields) {
|
|
20485
20489
|
const ref = `s."${key}" COLLATE "C"`;
|
|
@@ -20560,10 +20564,12 @@ function compilePostgresSpanQuery(schema, plan) {
|
|
|
20560
20564
|
"endedAt",
|
|
20561
20565
|
"durationMs",
|
|
20562
20566
|
"status",
|
|
20563
|
-
"version"
|
|
20567
|
+
"version",
|
|
20568
|
+
"model",
|
|
20569
|
+
"provider"
|
|
20564
20570
|
].map((field) => `s."${field}"`).join(", ")}
|
|
20565
20571
|
FROM selected s WHERE ${after}
|
|
20566
|
-
ORDER BY
|
|
20572
|
+
ORDER BY ${sortColumn(plan)} ${plan.orderBy.direction === "asc" ? "ASC" : "DESC"} NULLS LAST, ${identityOrder}
|
|
20567
20573
|
LIMIT $${values.length}`,
|
|
20568
20574
|
values
|
|
20569
20575
|
};
|
|
@@ -20598,6 +20604,7 @@ async function querySpans(client, schema, plan, timeoutMs) {
|
|
|
20598
20604
|
const rows = await tx.any(query.text, query.values);
|
|
20599
20605
|
const selected = rows.map(({ version: _version, startedAt, endedAt, timeToFirstChunkMs, timeToFirstTokenMs, outcome, stopReason, ...row }) => ({
|
|
20600
20606
|
...row,
|
|
20607
|
+
...(plan.orderBy.field === "model" || plan.orderBy.field === "provider") && { cursorSortValue: row[plan.orderBy.field] },
|
|
20601
20608
|
...timeToFirstChunkSupported && { timeToFirstChunkMs },
|
|
20602
20609
|
...timeToFirstTokenSupported && { timeToFirstTokenMs },
|
|
20603
20610
|
...spanQueryOutcomeFieldsSupported && {
|
|
@@ -21993,6 +22000,7 @@ const spanQueryFeatures = typeof _mastra_core_storage.planSpanQuery === "functio
|
|
|
21993
22000
|
"span-query",
|
|
21994
22001
|
"span-query-context-fields",
|
|
21995
22002
|
..._mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("durationMs") ? ["span-query-duration-sort"] : [],
|
|
22003
|
+
..._mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("model") && _mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("provider") ? ["span-query-model-provider-sort"] : [],
|
|
21996
22004
|
..."model" in (_mastra_core_storage.SPAN_QUERY_FIELD_REGISTRY ?? {}) ? ["span-query-model-fields"] : []
|
|
21997
22005
|
] : [];
|
|
21998
22006
|
const spanAggregateFeatures = typeof _mastra_core_storage.planSpanAggregate === "function" ? ["span-aggregate", ..."model" in (_mastra_core_storage.SPAN_AGGREGATE_DIMENSION_REGISTRY ?? {}) ? ["span-aggregate-model-dimensions"] : []] : [];
|