@sentry/junior-memory 0.131.0 → 0.132.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/db/schema.d.ts +21 -0
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/migrations/0006_friendly_hydra.sql +4 -0
- package/migrations/meta/0006_snapshot.json +386 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +2 -2
- package/src/db/schema.ts +11 -1
- package/src/store.ts +2 -1
package/dist/db/schema.d.ts
CHANGED
|
@@ -121,6 +121,27 @@ export declare const juniorMemoryMemories: import("drizzle-orm/pg-core").PgTable
|
|
|
121
121
|
identity: undefined;
|
|
122
122
|
generated: undefined;
|
|
123
123
|
}, {}, {}>;
|
|
124
|
+
searchVector: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "search_vector";
|
|
126
|
+
tableName: "junior_memory_memories";
|
|
127
|
+
dataType: "custom";
|
|
128
|
+
columnType: "PgCustomColumn";
|
|
129
|
+
data: string;
|
|
130
|
+
driverParam: unknown;
|
|
131
|
+
notNull: false;
|
|
132
|
+
hasDefault: true;
|
|
133
|
+
isPrimaryKey: false;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: undefined;
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: {
|
|
140
|
+
type: "always";
|
|
141
|
+
};
|
|
142
|
+
}, {}, {
|
|
143
|
+
pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
|
|
144
|
+
}>;
|
|
124
145
|
sourcePlatform: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
146
|
name: "source_platform";
|
|
126
147
|
tableName: "junior_memory_memories";
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { sql } from "drizzle-orm";
|
|
|
29
29
|
import {
|
|
30
30
|
bigint,
|
|
31
31
|
check,
|
|
32
|
+
customType,
|
|
32
33
|
index,
|
|
33
34
|
integer,
|
|
34
35
|
pgTable,
|
|
@@ -75,6 +76,11 @@ var memoryRuntimeContextSchema = z.union([
|
|
|
75
76
|
]);
|
|
76
77
|
|
|
77
78
|
// src/db/schema.ts
|
|
79
|
+
var tsvector = customType({
|
|
80
|
+
dataType() {
|
|
81
|
+
return "tsvector";
|
|
82
|
+
}
|
|
83
|
+
});
|
|
78
84
|
var juniorMemoryMemories = pgTable(
|
|
79
85
|
"junior_memory_memories",
|
|
80
86
|
{
|
|
@@ -85,6 +91,9 @@ var juniorMemoryMemories = pgTable(
|
|
|
85
91
|
subjectType: text("subject_type", { enum: MEMORY_SUBJECT_TYPES }).notNull(),
|
|
86
92
|
subjectKey: text("subject_key"),
|
|
87
93
|
content: text("content").notNull(),
|
|
94
|
+
searchVector: tsvector("search_vector").generatedAlwaysAs(
|
|
95
|
+
sql`to_tsvector('english', "content")`
|
|
96
|
+
),
|
|
88
97
|
sourcePlatform: text("source_platform", {
|
|
89
98
|
enum: MEMORY_SOURCE_PLATFORMS
|
|
90
99
|
}).notNull(),
|
|
@@ -105,7 +114,7 @@ var juniorMemoryMemories = pgTable(
|
|
|
105
114
|
index("junior_memory_memories_expiration_idx").on(table.expiresAtMs).where(
|
|
106
115
|
sql`${table.archivedAtMs} IS NULL AND ${table.expiresAtMs} IS NOT NULL`
|
|
107
116
|
),
|
|
108
|
-
index("junior_memory_memories_search_idx").using("gin",
|
|
117
|
+
index("junior_memory_memories_search_idx").using("gin", table.scope, table.scopeKey, table.searchVector).where(
|
|
109
118
|
sql`${table.archivedAtMs} IS NULL AND ${table.supersededAtMs} IS NULL AND ${table.supersededById} IS NULL`
|
|
110
119
|
),
|
|
111
120
|
uniqueIndex("junior_memory_memories_idempotency_idx").on(table.scope, table.scopeKey, table.idempotencyKey).where(
|
|
@@ -388,6 +397,7 @@ var memoryRowSchema = z2.object({
|
|
|
388
397
|
id: z2.string().min(1),
|
|
389
398
|
idempotencyKey: optionalStringSchema,
|
|
390
399
|
observedAtMs: z2.coerce.number(),
|
|
400
|
+
searchVector: z2.string().optional(),
|
|
391
401
|
scope: z2.enum(MEMORY_SCOPES),
|
|
392
402
|
scopeKey: z2.string().min(1),
|
|
393
403
|
sourceKey: z2.string().min(1),
|
|
@@ -893,7 +903,7 @@ async function searchVisibleLexicalMemories(args) {
|
|
|
893
903
|
)
|
|
894
904
|
FROM unnest(tsvector_to_array(${queryVector})) AS query_terms(term)
|
|
895
905
|
)`;
|
|
896
|
-
const textsearch =
|
|
906
|
+
const textsearch = juniorMemoryMemories.searchVector;
|
|
897
907
|
const textRank = sql2`ts_rank_cd(${textsearch}, ${tsquery})`;
|
|
898
908
|
const rows = await args.db.select({
|
|
899
909
|
memory: juniorMemoryMemories,
|