@elizaos/plugin-trajectory-logger 2.0.0-alpha.11 → 2.0.0-alpha.12
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/node/index.node.js +61 -1857
- package/dist/node/index.node.js.map +3 -33
- package/package.json +6 -3
package/dist/node/index.node.js
CHANGED
|
@@ -1,1801 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, {
|
|
5
|
-
get: all[name],
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
set: (newValue) => all[name] = () => newValue
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
|
-
|
|
13
|
-
// ../node_modules/drizzle-orm/entity.js
|
|
14
|
-
function is(value, type) {
|
|
15
|
-
if (!value || typeof value !== "object") {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (value instanceof type) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
22
|
-
throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
|
|
23
|
-
}
|
|
24
|
-
let cls = Object.getPrototypeOf(value).constructor;
|
|
25
|
-
if (cls) {
|
|
26
|
-
while (cls) {
|
|
27
|
-
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
cls = Object.getPrototypeOf(cls);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
var entityKind, hasOwnEntityKind;
|
|
36
|
-
var init_entity = __esm(() => {
|
|
37
|
-
entityKind = Symbol.for("drizzle:entityKind");
|
|
38
|
-
hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// ../node_modules/drizzle-orm/column.js
|
|
42
|
-
var Column;
|
|
43
|
-
var init_column = __esm(() => {
|
|
44
|
-
init_entity();
|
|
45
|
-
Column = class Column {
|
|
46
|
-
constructor(table, config) {
|
|
47
|
-
this.table = table;
|
|
48
|
-
this.config = config;
|
|
49
|
-
this.name = config.name;
|
|
50
|
-
this.keyAsName = config.keyAsName;
|
|
51
|
-
this.notNull = config.notNull;
|
|
52
|
-
this.default = config.default;
|
|
53
|
-
this.defaultFn = config.defaultFn;
|
|
54
|
-
this.onUpdateFn = config.onUpdateFn;
|
|
55
|
-
this.hasDefault = config.hasDefault;
|
|
56
|
-
this.primary = config.primaryKey;
|
|
57
|
-
this.isUnique = config.isUnique;
|
|
58
|
-
this.uniqueName = config.uniqueName;
|
|
59
|
-
this.uniqueType = config.uniqueType;
|
|
60
|
-
this.dataType = config.dataType;
|
|
61
|
-
this.columnType = config.columnType;
|
|
62
|
-
this.generated = config.generated;
|
|
63
|
-
this.generatedIdentity = config.generatedIdentity;
|
|
64
|
-
}
|
|
65
|
-
static [entityKind] = "Column";
|
|
66
|
-
name;
|
|
67
|
-
keyAsName;
|
|
68
|
-
primary;
|
|
69
|
-
notNull;
|
|
70
|
-
default;
|
|
71
|
-
defaultFn;
|
|
72
|
-
onUpdateFn;
|
|
73
|
-
hasDefault;
|
|
74
|
-
isUnique;
|
|
75
|
-
uniqueName;
|
|
76
|
-
uniqueType;
|
|
77
|
-
dataType;
|
|
78
|
-
columnType;
|
|
79
|
-
enumValues = undefined;
|
|
80
|
-
generated = undefined;
|
|
81
|
-
generatedIdentity = undefined;
|
|
82
|
-
config;
|
|
83
|
-
mapFromDriverValue(value) {
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
mapToDriverValue(value) {
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
shouldDisableInsert() {
|
|
90
|
-
return this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// ../node_modules/drizzle-orm/column-builder.js
|
|
96
|
-
var ColumnBuilder;
|
|
97
|
-
var init_column_builder = __esm(() => {
|
|
98
|
-
init_entity();
|
|
99
|
-
ColumnBuilder = class ColumnBuilder {
|
|
100
|
-
static [entityKind] = "ColumnBuilder";
|
|
101
|
-
config;
|
|
102
|
-
constructor(name, dataType, columnType) {
|
|
103
|
-
this.config = {
|
|
104
|
-
name,
|
|
105
|
-
keyAsName: name === "",
|
|
106
|
-
notNull: false,
|
|
107
|
-
default: undefined,
|
|
108
|
-
hasDefault: false,
|
|
109
|
-
primaryKey: false,
|
|
110
|
-
isUnique: false,
|
|
111
|
-
uniqueName: undefined,
|
|
112
|
-
uniqueType: undefined,
|
|
113
|
-
dataType,
|
|
114
|
-
columnType,
|
|
115
|
-
generated: undefined
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
$type() {
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
notNull() {
|
|
122
|
-
this.config.notNull = true;
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
default(value) {
|
|
126
|
-
this.config.default = value;
|
|
127
|
-
this.config.hasDefault = true;
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
$defaultFn(fn) {
|
|
131
|
-
this.config.defaultFn = fn;
|
|
132
|
-
this.config.hasDefault = true;
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
$default = this.$defaultFn;
|
|
136
|
-
$onUpdateFn(fn) {
|
|
137
|
-
this.config.onUpdateFn = fn;
|
|
138
|
-
this.config.hasDefault = true;
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
$onUpdate = this.$onUpdateFn;
|
|
142
|
-
primaryKey() {
|
|
143
|
-
this.config.primaryKey = true;
|
|
144
|
-
this.config.notNull = true;
|
|
145
|
-
return this;
|
|
146
|
-
}
|
|
147
|
-
setName(name) {
|
|
148
|
-
if (this.config.name !== "")
|
|
149
|
-
return;
|
|
150
|
-
this.config.name = name;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// ../node_modules/drizzle-orm/table.utils.js
|
|
156
|
-
var TableName;
|
|
157
|
-
var init_table_utils = __esm(() => {
|
|
158
|
-
TableName = Symbol.for("drizzle:Name");
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// ../node_modules/drizzle-orm/tracing-utils.js
|
|
162
|
-
function iife(fn, ...args) {
|
|
163
|
-
return fn(...args);
|
|
164
|
-
}
|
|
165
|
-
var init_tracing_utils = () => {};
|
|
166
|
-
|
|
167
|
-
// ../node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
168
|
-
function uniqueKeyName(table, columns) {
|
|
169
|
-
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
170
|
-
}
|
|
171
|
-
var init_unique_constraint = __esm(() => {
|
|
172
|
-
init_table_utils();
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// ../node_modules/drizzle-orm/pg-core/columns/common.js
|
|
176
|
-
var PgColumn, ExtraConfigColumn;
|
|
177
|
-
var init_common = __esm(() => {
|
|
178
|
-
init_column();
|
|
179
|
-
init_entity();
|
|
180
|
-
init_unique_constraint();
|
|
181
|
-
PgColumn = class PgColumn extends Column {
|
|
182
|
-
constructor(table, config) {
|
|
183
|
-
if (!config.uniqueName) {
|
|
184
|
-
config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
185
|
-
}
|
|
186
|
-
super(table, config);
|
|
187
|
-
this.table = table;
|
|
188
|
-
}
|
|
189
|
-
static [entityKind] = "PgColumn";
|
|
190
|
-
};
|
|
191
|
-
ExtraConfigColumn = class ExtraConfigColumn extends PgColumn {
|
|
192
|
-
static [entityKind] = "ExtraConfigColumn";
|
|
193
|
-
getSQLType() {
|
|
194
|
-
return this.getSQLType();
|
|
195
|
-
}
|
|
196
|
-
indexConfig = {
|
|
197
|
-
order: this.config.order ?? "asc",
|
|
198
|
-
nulls: this.config.nulls ?? "last",
|
|
199
|
-
opClass: this.config.opClass
|
|
200
|
-
};
|
|
201
|
-
defaultConfig = {
|
|
202
|
-
order: "asc",
|
|
203
|
-
nulls: "last",
|
|
204
|
-
opClass: undefined
|
|
205
|
-
};
|
|
206
|
-
asc() {
|
|
207
|
-
this.indexConfig.order = "asc";
|
|
208
|
-
return this;
|
|
209
|
-
}
|
|
210
|
-
desc() {
|
|
211
|
-
this.indexConfig.order = "desc";
|
|
212
|
-
return this;
|
|
213
|
-
}
|
|
214
|
-
nullsFirst() {
|
|
215
|
-
this.indexConfig.nulls = "first";
|
|
216
|
-
return this;
|
|
217
|
-
}
|
|
218
|
-
nullsLast() {
|
|
219
|
-
this.indexConfig.nulls = "last";
|
|
220
|
-
return this;
|
|
221
|
-
}
|
|
222
|
-
op(opClass) {
|
|
223
|
-
this.indexConfig.opClass = opClass;
|
|
224
|
-
return this;
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// ../node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
230
|
-
function isPgEnum(obj) {
|
|
231
|
-
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
232
|
-
}
|
|
233
|
-
var PgEnumObjectColumn, isPgEnumSym, PgEnumColumn;
|
|
234
|
-
var init_enum = __esm(() => {
|
|
235
|
-
init_entity();
|
|
236
|
-
init_common();
|
|
237
|
-
PgEnumObjectColumn = class PgEnumObjectColumn extends PgColumn {
|
|
238
|
-
static [entityKind] = "PgEnumObjectColumn";
|
|
239
|
-
enum;
|
|
240
|
-
enumValues = this.config.enum.enumValues;
|
|
241
|
-
constructor(table, config) {
|
|
242
|
-
super(table, config);
|
|
243
|
-
this.enum = config.enum;
|
|
244
|
-
}
|
|
245
|
-
getSQLType() {
|
|
246
|
-
return this.enum.enumName;
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
250
|
-
PgEnumColumn = class PgEnumColumn extends PgColumn {
|
|
251
|
-
static [entityKind] = "PgEnumColumn";
|
|
252
|
-
enum = this.config.enum;
|
|
253
|
-
enumValues = this.config.enum.enumValues;
|
|
254
|
-
constructor(table, config) {
|
|
255
|
-
super(table, config);
|
|
256
|
-
this.enum = config.enum;
|
|
257
|
-
}
|
|
258
|
-
getSQLType() {
|
|
259
|
-
return this.enum.enumName;
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
// ../node_modules/drizzle-orm/subquery.js
|
|
265
|
-
var Subquery, WithSubquery;
|
|
266
|
-
var init_subquery = __esm(() => {
|
|
267
|
-
init_entity();
|
|
268
|
-
Subquery = class Subquery {
|
|
269
|
-
static [entityKind] = "Subquery";
|
|
270
|
-
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
271
|
-
this._ = {
|
|
272
|
-
brand: "Subquery",
|
|
273
|
-
sql,
|
|
274
|
-
selectedFields: fields,
|
|
275
|
-
alias,
|
|
276
|
-
isWith,
|
|
277
|
-
usedTables
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
WithSubquery = class WithSubquery extends Subquery {
|
|
282
|
-
static [entityKind] = "WithSubquery";
|
|
283
|
-
};
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// ../node_modules/drizzle-orm/version.js
|
|
287
|
-
var version = "0.45.1";
|
|
288
|
-
var init_version = () => {};
|
|
289
|
-
|
|
290
|
-
// ../node_modules/drizzle-orm/tracing.js
|
|
291
|
-
var otel, rawTracer, tracer;
|
|
292
|
-
var init_tracing = __esm(() => {
|
|
293
|
-
init_tracing_utils();
|
|
294
|
-
init_version();
|
|
295
|
-
tracer = {
|
|
296
|
-
startActiveSpan(name, fn) {
|
|
297
|
-
if (!otel) {
|
|
298
|
-
return fn();
|
|
299
|
-
}
|
|
300
|
-
if (!rawTracer) {
|
|
301
|
-
rawTracer = otel.trace.getTracer("drizzle-orm", version);
|
|
302
|
-
}
|
|
303
|
-
return iife((otel2, rawTracer2) => rawTracer2.startActiveSpan(name, (span) => {
|
|
304
|
-
try {
|
|
305
|
-
return fn(span);
|
|
306
|
-
} catch (e) {
|
|
307
|
-
span.setStatus({
|
|
308
|
-
code: otel2.SpanStatusCode.ERROR,
|
|
309
|
-
message: e instanceof Error ? e.message : "Unknown error"
|
|
310
|
-
});
|
|
311
|
-
throw e;
|
|
312
|
-
} finally {
|
|
313
|
-
span.end();
|
|
314
|
-
}
|
|
315
|
-
}), otel, rawTracer);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
// ../node_modules/drizzle-orm/view-common.js
|
|
321
|
-
var ViewBaseConfig;
|
|
322
|
-
var init_view_common = __esm(() => {
|
|
323
|
-
ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
// ../node_modules/drizzle-orm/table.js
|
|
327
|
-
function isTable(table) {
|
|
328
|
-
return typeof table === "object" && table !== null && IsDrizzleTable in table;
|
|
329
|
-
}
|
|
330
|
-
function getTableName(table) {
|
|
331
|
-
return table[TableName];
|
|
332
|
-
}
|
|
333
|
-
function getTableUniqueName(table) {
|
|
334
|
-
return `${table[Schema] ?? "public"}.${table[TableName]}`;
|
|
335
|
-
}
|
|
336
|
-
var Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, Table;
|
|
337
|
-
var init_table = __esm(() => {
|
|
338
|
-
init_entity();
|
|
339
|
-
init_table_utils();
|
|
340
|
-
Schema = Symbol.for("drizzle:Schema");
|
|
341
|
-
Columns = Symbol.for("drizzle:Columns");
|
|
342
|
-
ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
343
|
-
OriginalName = Symbol.for("drizzle:OriginalName");
|
|
344
|
-
BaseName = Symbol.for("drizzle:BaseName");
|
|
345
|
-
IsAlias = Symbol.for("drizzle:IsAlias");
|
|
346
|
-
ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
347
|
-
IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
348
|
-
Table = class Table {
|
|
349
|
-
static [entityKind] = "Table";
|
|
350
|
-
static Symbol = {
|
|
351
|
-
Name: TableName,
|
|
352
|
-
Schema,
|
|
353
|
-
OriginalName,
|
|
354
|
-
Columns,
|
|
355
|
-
ExtraConfigColumns,
|
|
356
|
-
BaseName,
|
|
357
|
-
IsAlias,
|
|
358
|
-
ExtraConfigBuilder
|
|
359
|
-
};
|
|
360
|
-
[TableName];
|
|
361
|
-
[OriginalName];
|
|
362
|
-
[Schema];
|
|
363
|
-
[Columns];
|
|
364
|
-
[ExtraConfigColumns];
|
|
365
|
-
[BaseName];
|
|
366
|
-
[IsAlias] = false;
|
|
367
|
-
[IsDrizzleTable] = true;
|
|
368
|
-
[ExtraConfigBuilder] = undefined;
|
|
369
|
-
constructor(name, schema, baseName) {
|
|
370
|
-
this[TableName] = this[OriginalName] = name;
|
|
371
|
-
this[Schema] = schema;
|
|
372
|
-
this[BaseName] = baseName;
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
// ../node_modules/drizzle-orm/sql/sql.js
|
|
378
|
-
function isSQLWrapper(value) {
|
|
379
|
-
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
380
|
-
}
|
|
381
|
-
function mergeQueries(queries) {
|
|
382
|
-
const result = { sql: "", params: [] };
|
|
383
|
-
for (const query of queries) {
|
|
384
|
-
result.sql += query.sql;
|
|
385
|
-
result.params.push(...query.params);
|
|
386
|
-
if (query.typings?.length) {
|
|
387
|
-
if (!result.typings) {
|
|
388
|
-
result.typings = [];
|
|
389
|
-
}
|
|
390
|
-
result.typings.push(...query.typings);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
|
-
function name(value) {
|
|
396
|
-
return new Name(value);
|
|
397
|
-
}
|
|
398
|
-
function isDriverValueEncoder(value) {
|
|
399
|
-
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
|
|
400
|
-
}
|
|
401
|
-
function param(value, encoder) {
|
|
402
|
-
return new Param(value, encoder);
|
|
403
|
-
}
|
|
404
|
-
function sql(strings, ...params) {
|
|
405
|
-
const queryChunks = [];
|
|
406
|
-
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
|
|
407
|
-
queryChunks.push(new StringChunk(strings[0]));
|
|
408
|
-
}
|
|
409
|
-
for (const [paramIndex, param2] of params.entries()) {
|
|
410
|
-
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
411
|
-
}
|
|
412
|
-
return new SQL(queryChunks);
|
|
413
|
-
}
|
|
414
|
-
function placeholder(name2) {
|
|
415
|
-
return new Placeholder(name2);
|
|
416
|
-
}
|
|
417
|
-
function fillPlaceholders(params, values) {
|
|
418
|
-
return params.map((p) => {
|
|
419
|
-
if (is(p, Placeholder)) {
|
|
420
|
-
if (!(p.name in values)) {
|
|
421
|
-
throw new Error(`No value for placeholder "${p.name}" was provided`);
|
|
422
|
-
}
|
|
423
|
-
return values[p.name];
|
|
424
|
-
}
|
|
425
|
-
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
426
|
-
if (!(p.value.name in values)) {
|
|
427
|
-
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
428
|
-
}
|
|
429
|
-
return p.encoder.mapToDriverValue(values[p.value.name]);
|
|
430
|
-
}
|
|
431
|
-
return p;
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
function isView(view) {
|
|
435
|
-
return typeof view === "object" && view !== null && IsDrizzleView in view;
|
|
436
|
-
}
|
|
437
|
-
function getViewName(view) {
|
|
438
|
-
return view[ViewBaseConfig].name;
|
|
439
|
-
}
|
|
440
|
-
var FakePrimitiveParam, StringChunk, SQL, Name, noopDecoder, noopEncoder, noopMapper, Param, Placeholder, IsDrizzleView, View;
|
|
441
|
-
var init_sql = __esm(() => {
|
|
442
|
-
init_entity();
|
|
443
|
-
init_enum();
|
|
444
|
-
init_subquery();
|
|
445
|
-
init_tracing();
|
|
446
|
-
init_view_common();
|
|
447
|
-
init_column();
|
|
448
|
-
init_table();
|
|
449
|
-
FakePrimitiveParam = class FakePrimitiveParam {
|
|
450
|
-
static [entityKind] = "FakePrimitiveParam";
|
|
451
|
-
};
|
|
452
|
-
StringChunk = class StringChunk {
|
|
453
|
-
static [entityKind] = "StringChunk";
|
|
454
|
-
value;
|
|
455
|
-
constructor(value) {
|
|
456
|
-
this.value = Array.isArray(value) ? value : [value];
|
|
457
|
-
}
|
|
458
|
-
getSQL() {
|
|
459
|
-
return new SQL([this]);
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
SQL = class SQL {
|
|
463
|
-
constructor(queryChunks) {
|
|
464
|
-
this.queryChunks = queryChunks;
|
|
465
|
-
for (const chunk of queryChunks) {
|
|
466
|
-
if (is(chunk, Table)) {
|
|
467
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
468
|
-
this.usedTables.push(schemaName === undefined ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
static [entityKind] = "SQL";
|
|
473
|
-
decoder = noopDecoder;
|
|
474
|
-
shouldInlineParams = false;
|
|
475
|
-
usedTables = [];
|
|
476
|
-
append(query) {
|
|
477
|
-
this.queryChunks.push(...query.queryChunks);
|
|
478
|
-
return this;
|
|
479
|
-
}
|
|
480
|
-
toQuery(config) {
|
|
481
|
-
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
482
|
-
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
483
|
-
span?.setAttributes({
|
|
484
|
-
"drizzle.query.text": query.sql,
|
|
485
|
-
"drizzle.query.params": JSON.stringify(query.params)
|
|
486
|
-
});
|
|
487
|
-
return query;
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
buildQueryFromSourceParams(chunks, _config) {
|
|
491
|
-
const config = Object.assign({}, _config, {
|
|
492
|
-
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
493
|
-
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
494
|
-
});
|
|
495
|
-
const {
|
|
496
|
-
casing,
|
|
497
|
-
escapeName,
|
|
498
|
-
escapeParam,
|
|
499
|
-
prepareTyping,
|
|
500
|
-
inlineParams,
|
|
501
|
-
paramStartIndex
|
|
502
|
-
} = config;
|
|
503
|
-
return mergeQueries(chunks.map((chunk) => {
|
|
504
|
-
if (is(chunk, StringChunk)) {
|
|
505
|
-
return { sql: chunk.value.join(""), params: [] };
|
|
506
|
-
}
|
|
507
|
-
if (is(chunk, Name)) {
|
|
508
|
-
return { sql: escapeName(chunk.value), params: [] };
|
|
509
|
-
}
|
|
510
|
-
if (chunk === undefined) {
|
|
511
|
-
return { sql: "", params: [] };
|
|
512
|
-
}
|
|
513
|
-
if (Array.isArray(chunk)) {
|
|
514
|
-
const result = [new StringChunk("(")];
|
|
515
|
-
for (const [i, p] of chunk.entries()) {
|
|
516
|
-
result.push(p);
|
|
517
|
-
if (i < chunk.length - 1) {
|
|
518
|
-
result.push(new StringChunk(", "));
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
result.push(new StringChunk(")"));
|
|
522
|
-
return this.buildQueryFromSourceParams(result, config);
|
|
523
|
-
}
|
|
524
|
-
if (is(chunk, SQL)) {
|
|
525
|
-
return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
526
|
-
...config,
|
|
527
|
-
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
if (is(chunk, Table)) {
|
|
531
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
532
|
-
const tableName = chunk[Table.Symbol.Name];
|
|
533
|
-
return {
|
|
534
|
-
sql: schemaName === undefined || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
535
|
-
params: []
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
if (is(chunk, Column)) {
|
|
539
|
-
const columnName = casing.getColumnCasing(chunk);
|
|
540
|
-
if (_config.invokeSource === "indexes") {
|
|
541
|
-
return { sql: escapeName(columnName), params: [] };
|
|
542
|
-
}
|
|
543
|
-
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
544
|
-
return {
|
|
545
|
-
sql: chunk.table[IsAlias] || schemaName === undefined ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
|
|
546
|
-
params: []
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
if (is(chunk, View)) {
|
|
550
|
-
const schemaName = chunk[ViewBaseConfig].schema;
|
|
551
|
-
const viewName = chunk[ViewBaseConfig].name;
|
|
552
|
-
return {
|
|
553
|
-
sql: schemaName === undefined || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
554
|
-
params: []
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
if (is(chunk, Param)) {
|
|
558
|
-
if (is(chunk.value, Placeholder)) {
|
|
559
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
560
|
-
}
|
|
561
|
-
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
562
|
-
if (is(mappedValue, SQL)) {
|
|
563
|
-
return this.buildQueryFromSourceParams([mappedValue], config);
|
|
564
|
-
}
|
|
565
|
-
if (inlineParams) {
|
|
566
|
-
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
|
|
567
|
-
}
|
|
568
|
-
let typings = ["none"];
|
|
569
|
-
if (prepareTyping) {
|
|
570
|
-
typings = [prepareTyping(chunk.encoder)];
|
|
571
|
-
}
|
|
572
|
-
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
|
|
573
|
-
}
|
|
574
|
-
if (is(chunk, Placeholder)) {
|
|
575
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
576
|
-
}
|
|
577
|
-
if (is(chunk, SQL.Aliased) && chunk.fieldAlias !== undefined) {
|
|
578
|
-
return { sql: escapeName(chunk.fieldAlias), params: [] };
|
|
579
|
-
}
|
|
580
|
-
if (is(chunk, Subquery)) {
|
|
581
|
-
if (chunk._.isWith) {
|
|
582
|
-
return { sql: escapeName(chunk._.alias), params: [] };
|
|
583
|
-
}
|
|
584
|
-
return this.buildQueryFromSourceParams([
|
|
585
|
-
new StringChunk("("),
|
|
586
|
-
chunk._.sql,
|
|
587
|
-
new StringChunk(") "),
|
|
588
|
-
new Name(chunk._.alias)
|
|
589
|
-
], config);
|
|
590
|
-
}
|
|
591
|
-
if (isPgEnum(chunk)) {
|
|
592
|
-
if (chunk.schema) {
|
|
593
|
-
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
|
|
594
|
-
}
|
|
595
|
-
return { sql: escapeName(chunk.enumName), params: [] };
|
|
596
|
-
}
|
|
597
|
-
if (isSQLWrapper(chunk)) {
|
|
598
|
-
if (chunk.shouldOmitSQLParens?.()) {
|
|
599
|
-
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
600
|
-
}
|
|
601
|
-
return this.buildQueryFromSourceParams([
|
|
602
|
-
new StringChunk("("),
|
|
603
|
-
chunk.getSQL(),
|
|
604
|
-
new StringChunk(")")
|
|
605
|
-
], config);
|
|
606
|
-
}
|
|
607
|
-
if (inlineParams) {
|
|
608
|
-
return { sql: this.mapInlineParam(chunk, config), params: [] };
|
|
609
|
-
}
|
|
610
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
611
|
-
}));
|
|
612
|
-
}
|
|
613
|
-
mapInlineParam(chunk, { escapeString }) {
|
|
614
|
-
if (chunk === null) {
|
|
615
|
-
return "null";
|
|
616
|
-
}
|
|
617
|
-
if (typeof chunk === "number" || typeof chunk === "boolean") {
|
|
618
|
-
return chunk.toString();
|
|
619
|
-
}
|
|
620
|
-
if (typeof chunk === "string") {
|
|
621
|
-
return escapeString(chunk);
|
|
622
|
-
}
|
|
623
|
-
if (typeof chunk === "object") {
|
|
624
|
-
const mappedValueAsString = chunk.toString();
|
|
625
|
-
if (mappedValueAsString === "[object Object]") {
|
|
626
|
-
return escapeString(JSON.stringify(chunk));
|
|
627
|
-
}
|
|
628
|
-
return escapeString(mappedValueAsString);
|
|
629
|
-
}
|
|
630
|
-
throw new Error("Unexpected param value: " + chunk);
|
|
631
|
-
}
|
|
632
|
-
getSQL() {
|
|
633
|
-
return this;
|
|
634
|
-
}
|
|
635
|
-
as(alias) {
|
|
636
|
-
if (alias === undefined) {
|
|
637
|
-
return this;
|
|
638
|
-
}
|
|
639
|
-
return new SQL.Aliased(this, alias);
|
|
640
|
-
}
|
|
641
|
-
mapWith(decoder) {
|
|
642
|
-
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
643
|
-
return this;
|
|
644
|
-
}
|
|
645
|
-
inlineParams() {
|
|
646
|
-
this.shouldInlineParams = true;
|
|
647
|
-
return this;
|
|
648
|
-
}
|
|
649
|
-
if(condition) {
|
|
650
|
-
return condition ? this : undefined;
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
Name = class Name {
|
|
654
|
-
constructor(value) {
|
|
655
|
-
this.value = value;
|
|
656
|
-
}
|
|
657
|
-
static [entityKind] = "Name";
|
|
658
|
-
brand;
|
|
659
|
-
getSQL() {
|
|
660
|
-
return new SQL([this]);
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
noopDecoder = {
|
|
664
|
-
mapFromDriverValue: (value) => value
|
|
665
|
-
};
|
|
666
|
-
noopEncoder = {
|
|
667
|
-
mapToDriverValue: (value) => value
|
|
668
|
-
};
|
|
669
|
-
noopMapper = {
|
|
670
|
-
...noopDecoder,
|
|
671
|
-
...noopEncoder
|
|
672
|
-
};
|
|
673
|
-
Param = class Param {
|
|
674
|
-
constructor(value, encoder = noopEncoder) {
|
|
675
|
-
this.value = value;
|
|
676
|
-
this.encoder = encoder;
|
|
677
|
-
}
|
|
678
|
-
static [entityKind] = "Param";
|
|
679
|
-
brand;
|
|
680
|
-
getSQL() {
|
|
681
|
-
return new SQL([this]);
|
|
682
|
-
}
|
|
683
|
-
};
|
|
684
|
-
((sql2) => {
|
|
685
|
-
function empty() {
|
|
686
|
-
return new SQL([]);
|
|
687
|
-
}
|
|
688
|
-
sql2.empty = empty;
|
|
689
|
-
function fromList(list) {
|
|
690
|
-
return new SQL(list);
|
|
691
|
-
}
|
|
692
|
-
sql2.fromList = fromList;
|
|
693
|
-
function raw(str) {
|
|
694
|
-
return new SQL([new StringChunk(str)]);
|
|
695
|
-
}
|
|
696
|
-
sql2.raw = raw;
|
|
697
|
-
function join(chunks, separator) {
|
|
698
|
-
const result = [];
|
|
699
|
-
for (const [i, chunk] of chunks.entries()) {
|
|
700
|
-
if (i > 0 && separator !== undefined) {
|
|
701
|
-
result.push(separator);
|
|
702
|
-
}
|
|
703
|
-
result.push(chunk);
|
|
704
|
-
}
|
|
705
|
-
return new SQL(result);
|
|
706
|
-
}
|
|
707
|
-
sql2.join = join;
|
|
708
|
-
function identifier(value) {
|
|
709
|
-
return new Name(value);
|
|
710
|
-
}
|
|
711
|
-
sql2.identifier = identifier;
|
|
712
|
-
function placeholder2(name2) {
|
|
713
|
-
return new Placeholder(name2);
|
|
714
|
-
}
|
|
715
|
-
sql2.placeholder = placeholder2;
|
|
716
|
-
function param2(value, encoder) {
|
|
717
|
-
return new Param(value, encoder);
|
|
718
|
-
}
|
|
719
|
-
sql2.param = param2;
|
|
720
|
-
})(sql || (sql = {}));
|
|
721
|
-
((SQL2) => {
|
|
722
|
-
|
|
723
|
-
class Aliased {
|
|
724
|
-
constructor(sql2, fieldAlias) {
|
|
725
|
-
this.sql = sql2;
|
|
726
|
-
this.fieldAlias = fieldAlias;
|
|
727
|
-
}
|
|
728
|
-
static [entityKind] = "SQL.Aliased";
|
|
729
|
-
isSelectionField = false;
|
|
730
|
-
getSQL() {
|
|
731
|
-
return this.sql;
|
|
732
|
-
}
|
|
733
|
-
clone() {
|
|
734
|
-
return new Aliased(this.sql, this.fieldAlias);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
SQL2.Aliased = Aliased;
|
|
738
|
-
})(SQL || (SQL = {}));
|
|
739
|
-
Placeholder = class Placeholder {
|
|
740
|
-
constructor(name2) {
|
|
741
|
-
this.name = name2;
|
|
742
|
-
}
|
|
743
|
-
static [entityKind] = "Placeholder";
|
|
744
|
-
getSQL() {
|
|
745
|
-
return new SQL([this]);
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
749
|
-
View = class View {
|
|
750
|
-
static [entityKind] = "View";
|
|
751
|
-
[ViewBaseConfig];
|
|
752
|
-
[IsDrizzleView] = true;
|
|
753
|
-
constructor({ name: name2, schema, selectedFields, query }) {
|
|
754
|
-
this[ViewBaseConfig] = {
|
|
755
|
-
name: name2,
|
|
756
|
-
originalName: name2,
|
|
757
|
-
schema,
|
|
758
|
-
selectedFields,
|
|
759
|
-
query,
|
|
760
|
-
isExisting: !query,
|
|
761
|
-
isAlias: false
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
getSQL() {
|
|
765
|
-
return new SQL([this]);
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
Column.prototype.getSQL = function() {
|
|
769
|
-
return new SQL([this]);
|
|
770
|
-
};
|
|
771
|
-
Table.prototype.getSQL = function() {
|
|
772
|
-
return new SQL([this]);
|
|
773
|
-
};
|
|
774
|
-
Subquery.prototype.getSQL = function() {
|
|
775
|
-
return new SQL([this]);
|
|
776
|
-
};
|
|
777
|
-
});
|
|
778
|
-
|
|
779
|
-
// ../node_modules/drizzle-orm/alias.js
|
|
780
|
-
function aliasedTable(table, tableAlias) {
|
|
781
|
-
return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
|
|
782
|
-
}
|
|
783
|
-
function aliasedRelation(relation, tableAlias) {
|
|
784
|
-
return new Proxy(relation, new RelationTableAliasProxyHandler(tableAlias));
|
|
785
|
-
}
|
|
786
|
-
function aliasedTableColumn(column, tableAlias) {
|
|
787
|
-
return new Proxy(column, new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false))));
|
|
788
|
-
}
|
|
789
|
-
function mapColumnsInAliasedSQLToAlias(query, alias) {
|
|
790
|
-
return new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
|
|
791
|
-
}
|
|
792
|
-
function mapColumnsInSQLToAlias(query, alias) {
|
|
793
|
-
return sql.join(query.queryChunks.map((c) => {
|
|
794
|
-
if (is(c, Column)) {
|
|
795
|
-
return aliasedTableColumn(c, alias);
|
|
796
|
-
}
|
|
797
|
-
if (is(c, SQL)) {
|
|
798
|
-
return mapColumnsInSQLToAlias(c, alias);
|
|
799
|
-
}
|
|
800
|
-
if (is(c, SQL.Aliased)) {
|
|
801
|
-
return mapColumnsInAliasedSQLToAlias(c, alias);
|
|
802
|
-
}
|
|
803
|
-
return c;
|
|
804
|
-
}));
|
|
805
|
-
}
|
|
806
|
-
var ColumnAliasProxyHandler, TableAliasProxyHandler, RelationTableAliasProxyHandler;
|
|
807
|
-
var init_alias = __esm(() => {
|
|
808
|
-
init_column();
|
|
809
|
-
init_entity();
|
|
810
|
-
init_sql();
|
|
811
|
-
init_table();
|
|
812
|
-
init_view_common();
|
|
813
|
-
ColumnAliasProxyHandler = class ColumnAliasProxyHandler {
|
|
814
|
-
constructor(table) {
|
|
815
|
-
this.table = table;
|
|
816
|
-
}
|
|
817
|
-
static [entityKind] = "ColumnAliasProxyHandler";
|
|
818
|
-
get(columnObj, prop) {
|
|
819
|
-
if (prop === "table") {
|
|
820
|
-
return this.table;
|
|
821
|
-
}
|
|
822
|
-
return columnObj[prop];
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
TableAliasProxyHandler = class TableAliasProxyHandler {
|
|
826
|
-
constructor(alias, replaceOriginalName) {
|
|
827
|
-
this.alias = alias;
|
|
828
|
-
this.replaceOriginalName = replaceOriginalName;
|
|
829
|
-
}
|
|
830
|
-
static [entityKind] = "TableAliasProxyHandler";
|
|
831
|
-
get(target, prop) {
|
|
832
|
-
if (prop === Table.Symbol.IsAlias) {
|
|
833
|
-
return true;
|
|
834
|
-
}
|
|
835
|
-
if (prop === Table.Symbol.Name) {
|
|
836
|
-
return this.alias;
|
|
837
|
-
}
|
|
838
|
-
if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
|
|
839
|
-
return this.alias;
|
|
840
|
-
}
|
|
841
|
-
if (prop === ViewBaseConfig) {
|
|
842
|
-
return {
|
|
843
|
-
...target[ViewBaseConfig],
|
|
844
|
-
name: this.alias,
|
|
845
|
-
isAlias: true
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
if (prop === Table.Symbol.Columns) {
|
|
849
|
-
const columns = target[Table.Symbol.Columns];
|
|
850
|
-
if (!columns) {
|
|
851
|
-
return columns;
|
|
852
|
-
}
|
|
853
|
-
const proxiedColumns = {};
|
|
854
|
-
Object.keys(columns).map((key) => {
|
|
855
|
-
proxiedColumns[key] = new Proxy(columns[key], new ColumnAliasProxyHandler(new Proxy(target, this)));
|
|
856
|
-
});
|
|
857
|
-
return proxiedColumns;
|
|
858
|
-
}
|
|
859
|
-
const value = target[prop];
|
|
860
|
-
if (is(value, Column)) {
|
|
861
|
-
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
|
|
862
|
-
}
|
|
863
|
-
return value;
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
RelationTableAliasProxyHandler = class RelationTableAliasProxyHandler {
|
|
867
|
-
constructor(alias) {
|
|
868
|
-
this.alias = alias;
|
|
869
|
-
}
|
|
870
|
-
static [entityKind] = "RelationTableAliasProxyHandler";
|
|
871
|
-
get(target, prop) {
|
|
872
|
-
if (prop === "sourceTable") {
|
|
873
|
-
return aliasedTable(target.sourceTable, this.alias);
|
|
874
|
-
}
|
|
875
|
-
return target[prop];
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
});
|
|
879
|
-
|
|
880
|
-
// ../node_modules/drizzle-orm/errors.js
|
|
881
|
-
var DrizzleError, DrizzleQueryError, TransactionRollbackError;
|
|
882
|
-
var init_errors = __esm(() => {
|
|
883
|
-
init_entity();
|
|
884
|
-
DrizzleError = class DrizzleError extends Error {
|
|
885
|
-
static [entityKind] = "DrizzleError";
|
|
886
|
-
constructor({ message, cause }) {
|
|
887
|
-
super(message);
|
|
888
|
-
this.name = "DrizzleError";
|
|
889
|
-
this.cause = cause;
|
|
890
|
-
}
|
|
891
|
-
};
|
|
892
|
-
DrizzleQueryError = class DrizzleQueryError extends Error {
|
|
893
|
-
constructor(query, params, cause) {
|
|
894
|
-
super(`Failed query: ${query}
|
|
895
|
-
params: ${params}`);
|
|
896
|
-
this.query = query;
|
|
897
|
-
this.params = params;
|
|
898
|
-
this.cause = cause;
|
|
899
|
-
Error.captureStackTrace(this, DrizzleQueryError);
|
|
900
|
-
if (cause)
|
|
901
|
-
this.cause = cause;
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
TransactionRollbackError = class TransactionRollbackError extends DrizzleError {
|
|
905
|
-
static [entityKind] = "TransactionRollbackError";
|
|
906
|
-
constructor() {
|
|
907
|
-
super({ message: "Rollback" });
|
|
908
|
-
}
|
|
909
|
-
};
|
|
910
|
-
});
|
|
911
|
-
|
|
912
|
-
// ../node_modules/drizzle-orm/logger.js
|
|
913
|
-
var ConsoleLogWriter, DefaultLogger, NoopLogger;
|
|
914
|
-
var init_logger = __esm(() => {
|
|
915
|
-
init_entity();
|
|
916
|
-
ConsoleLogWriter = class ConsoleLogWriter {
|
|
917
|
-
static [entityKind] = "ConsoleLogWriter";
|
|
918
|
-
write(message) {
|
|
919
|
-
console.log(message);
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
DefaultLogger = class DefaultLogger {
|
|
923
|
-
static [entityKind] = "DefaultLogger";
|
|
924
|
-
writer;
|
|
925
|
-
constructor(config) {
|
|
926
|
-
this.writer = config?.writer ?? new ConsoleLogWriter;
|
|
927
|
-
}
|
|
928
|
-
logQuery(query, params) {
|
|
929
|
-
const stringifiedParams = params.map((p) => {
|
|
930
|
-
try {
|
|
931
|
-
return JSON.stringify(p);
|
|
932
|
-
} catch {
|
|
933
|
-
return String(p);
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(", ")}]` : "";
|
|
937
|
-
this.writer.write(`Query: ${query}${paramsStr}`);
|
|
938
|
-
}
|
|
939
|
-
};
|
|
940
|
-
NoopLogger = class NoopLogger {
|
|
941
|
-
static [entityKind] = "NoopLogger";
|
|
942
|
-
logQuery() {}
|
|
943
|
-
};
|
|
944
|
-
});
|
|
945
|
-
|
|
946
|
-
// ../node_modules/drizzle-orm/query-promise.js
|
|
947
|
-
var QueryPromise;
|
|
948
|
-
var init_query_promise = __esm(() => {
|
|
949
|
-
init_entity();
|
|
950
|
-
QueryPromise = class QueryPromise {
|
|
951
|
-
static [entityKind] = "QueryPromise";
|
|
952
|
-
[Symbol.toStringTag] = "QueryPromise";
|
|
953
|
-
catch(onRejected) {
|
|
954
|
-
return this.then(undefined, onRejected);
|
|
955
|
-
}
|
|
956
|
-
finally(onFinally) {
|
|
957
|
-
return this.then((value) => {
|
|
958
|
-
onFinally?.();
|
|
959
|
-
return value;
|
|
960
|
-
}, (reason) => {
|
|
961
|
-
onFinally?.();
|
|
962
|
-
throw reason;
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
then(onFulfilled, onRejected) {
|
|
966
|
-
return this.execute().then(onFulfilled, onRejected);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
// ../node_modules/drizzle-orm/utils.js
|
|
972
|
-
function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
973
|
-
const nullifyMap = {};
|
|
974
|
-
const result = columns.reduce((result2, { path, field }, columnIndex) => {
|
|
975
|
-
let decoder;
|
|
976
|
-
if (is(field, Column)) {
|
|
977
|
-
decoder = field;
|
|
978
|
-
} else if (is(field, SQL)) {
|
|
979
|
-
decoder = field.decoder;
|
|
980
|
-
} else if (is(field, Subquery)) {
|
|
981
|
-
decoder = field._.sql.decoder;
|
|
982
|
-
} else {
|
|
983
|
-
decoder = field.sql.decoder;
|
|
984
|
-
}
|
|
985
|
-
let node = result2;
|
|
986
|
-
for (const [pathChunkIndex, pathChunk] of path.entries()) {
|
|
987
|
-
if (pathChunkIndex < path.length - 1) {
|
|
988
|
-
if (!(pathChunk in node)) {
|
|
989
|
-
node[pathChunk] = {};
|
|
990
|
-
}
|
|
991
|
-
node = node[pathChunk];
|
|
992
|
-
} else {
|
|
993
|
-
const rawValue = row[columnIndex];
|
|
994
|
-
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
|
995
|
-
if (joinsNotNullableMap && is(field, Column) && path.length === 2) {
|
|
996
|
-
const objectName = path[0];
|
|
997
|
-
if (!(objectName in nullifyMap)) {
|
|
998
|
-
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
|
999
|
-
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
|
|
1000
|
-
nullifyMap[objectName] = false;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
return result2;
|
|
1006
|
-
}, {});
|
|
1007
|
-
if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) {
|
|
1008
|
-
for (const [objectName, tableName] of Object.entries(nullifyMap)) {
|
|
1009
|
-
if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) {
|
|
1010
|
-
result[objectName] = null;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
return result;
|
|
1015
|
-
}
|
|
1016
|
-
function orderSelectedFields(fields, pathPrefix) {
|
|
1017
|
-
return Object.entries(fields).reduce((result, [name2, field]) => {
|
|
1018
|
-
if (typeof name2 !== "string") {
|
|
1019
|
-
return result;
|
|
1020
|
-
}
|
|
1021
|
-
const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
|
|
1022
|
-
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
|
|
1023
|
-
result.push({ path: newPath, field });
|
|
1024
|
-
} else if (is(field, Table)) {
|
|
1025
|
-
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
|
1026
|
-
} else {
|
|
1027
|
-
result.push(...orderSelectedFields(field, newPath));
|
|
1028
|
-
}
|
|
1029
|
-
return result;
|
|
1030
|
-
}, []);
|
|
1031
|
-
}
|
|
1032
|
-
function haveSameKeys(left, right) {
|
|
1033
|
-
const leftKeys = Object.keys(left);
|
|
1034
|
-
const rightKeys = Object.keys(right);
|
|
1035
|
-
if (leftKeys.length !== rightKeys.length) {
|
|
1036
|
-
return false;
|
|
1037
|
-
}
|
|
1038
|
-
for (const [index, key] of leftKeys.entries()) {
|
|
1039
|
-
if (key !== rightKeys[index]) {
|
|
1040
|
-
return false;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
return true;
|
|
1044
|
-
}
|
|
1045
|
-
function mapUpdateSet(table, values) {
|
|
1046
|
-
const entries = Object.entries(values).filter(([, value]) => value !== undefined).map(([key, value]) => {
|
|
1047
|
-
if (is(value, SQL) || is(value, Column)) {
|
|
1048
|
-
return [key, value];
|
|
1049
|
-
} else {
|
|
1050
|
-
return [key, new Param(value, table[Table.Symbol.Columns][key])];
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
if (entries.length === 0) {
|
|
1054
|
-
throw new Error("No values to set");
|
|
1055
|
-
}
|
|
1056
|
-
return Object.fromEntries(entries);
|
|
1057
|
-
}
|
|
1058
|
-
function applyMixins(baseClass, extendedClasses) {
|
|
1059
|
-
for (const extendedClass of extendedClasses) {
|
|
1060
|
-
for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
|
1061
|
-
if (name2 === "constructor")
|
|
1062
|
-
continue;
|
|
1063
|
-
Object.defineProperty(baseClass.prototype, name2, Object.getOwnPropertyDescriptor(extendedClass.prototype, name2) || /* @__PURE__ */ Object.create(null));
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
function getTableColumns(table) {
|
|
1068
|
-
return table[Table.Symbol.Columns];
|
|
1069
|
-
}
|
|
1070
|
-
function getViewSelectedFields(view) {
|
|
1071
|
-
return view[ViewBaseConfig].selectedFields;
|
|
1072
|
-
}
|
|
1073
|
-
function getTableLikeName(table) {
|
|
1074
|
-
return is(table, Subquery) ? table._.alias : is(table, View) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : table[Table.Symbol.IsAlias] ? table[Table.Symbol.Name] : table[Table.Symbol.BaseName];
|
|
1075
|
-
}
|
|
1076
|
-
function getColumnNameAndConfig(a, b) {
|
|
1077
|
-
return {
|
|
1078
|
-
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
1079
|
-
config: typeof a === "object" ? a : b
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
function isConfig(data) {
|
|
1083
|
-
if (typeof data !== "object" || data === null)
|
|
1084
|
-
return false;
|
|
1085
|
-
if (data.constructor.name !== "Object")
|
|
1086
|
-
return false;
|
|
1087
|
-
if ("logger" in data) {
|
|
1088
|
-
const type = typeof data["logger"];
|
|
1089
|
-
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
|
|
1090
|
-
return false;
|
|
1091
|
-
return true;
|
|
1092
|
-
}
|
|
1093
|
-
if ("schema" in data) {
|
|
1094
|
-
const type = typeof data["schema"];
|
|
1095
|
-
if (type !== "object" && type !== "undefined")
|
|
1096
|
-
return false;
|
|
1097
|
-
return true;
|
|
1098
|
-
}
|
|
1099
|
-
if ("casing" in data) {
|
|
1100
|
-
const type = typeof data["casing"];
|
|
1101
|
-
if (type !== "string" && type !== "undefined")
|
|
1102
|
-
return false;
|
|
1103
|
-
return true;
|
|
1104
|
-
}
|
|
1105
|
-
if ("mode" in data) {
|
|
1106
|
-
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== undefined)
|
|
1107
|
-
return false;
|
|
1108
|
-
return true;
|
|
1109
|
-
}
|
|
1110
|
-
if ("connection" in data) {
|
|
1111
|
-
const type = typeof data["connection"];
|
|
1112
|
-
if (type !== "string" && type !== "object" && type !== "undefined")
|
|
1113
|
-
return false;
|
|
1114
|
-
return true;
|
|
1115
|
-
}
|
|
1116
|
-
if ("client" in data) {
|
|
1117
|
-
const type = typeof data["client"];
|
|
1118
|
-
if (type !== "object" && type !== "function" && type !== "undefined")
|
|
1119
|
-
return false;
|
|
1120
|
-
return true;
|
|
1121
|
-
}
|
|
1122
|
-
if (Object.keys(data).length === 0)
|
|
1123
|
-
return true;
|
|
1124
|
-
return false;
|
|
1125
|
-
}
|
|
1126
|
-
var textDecoder;
|
|
1127
|
-
var init_utils = __esm(() => {
|
|
1128
|
-
init_column();
|
|
1129
|
-
init_entity();
|
|
1130
|
-
init_sql();
|
|
1131
|
-
init_subquery();
|
|
1132
|
-
init_table();
|
|
1133
|
-
init_view_common();
|
|
1134
|
-
textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
// ../node_modules/drizzle-orm/pg-core/table.js
|
|
1138
|
-
var InlineForeignKeys, EnableRLS, PgTable;
|
|
1139
|
-
var init_table2 = __esm(() => {
|
|
1140
|
-
init_entity();
|
|
1141
|
-
init_table();
|
|
1142
|
-
InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
|
1143
|
-
EnableRLS = Symbol.for("drizzle:EnableRLS");
|
|
1144
|
-
PgTable = class PgTable extends Table {
|
|
1145
|
-
static [entityKind] = "PgTable";
|
|
1146
|
-
static Symbol = Object.assign({}, Table.Symbol, {
|
|
1147
|
-
InlineForeignKeys,
|
|
1148
|
-
EnableRLS
|
|
1149
|
-
});
|
|
1150
|
-
[InlineForeignKeys] = [];
|
|
1151
|
-
[EnableRLS] = false;
|
|
1152
|
-
[Table.Symbol.ExtraConfigBuilder] = undefined;
|
|
1153
|
-
[Table.Symbol.ExtraConfigColumns] = {};
|
|
1154
|
-
};
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
// ../node_modules/drizzle-orm/pg-core/primary-keys.js
|
|
1158
|
-
var PrimaryKeyBuilder, PrimaryKey;
|
|
1159
|
-
var init_primary_keys = __esm(() => {
|
|
1160
|
-
init_entity();
|
|
1161
|
-
init_table2();
|
|
1162
|
-
PrimaryKeyBuilder = class PrimaryKeyBuilder {
|
|
1163
|
-
static [entityKind] = "PgPrimaryKeyBuilder";
|
|
1164
|
-
columns;
|
|
1165
|
-
name;
|
|
1166
|
-
constructor(columns, name2) {
|
|
1167
|
-
this.columns = columns;
|
|
1168
|
-
this.name = name2;
|
|
1169
|
-
}
|
|
1170
|
-
build(table) {
|
|
1171
|
-
return new PrimaryKey(table, this.columns, this.name);
|
|
1172
|
-
}
|
|
1173
|
-
};
|
|
1174
|
-
PrimaryKey = class PrimaryKey {
|
|
1175
|
-
constructor(table, columns, name2) {
|
|
1176
|
-
this.table = table;
|
|
1177
|
-
this.columns = columns;
|
|
1178
|
-
this.name = name2;
|
|
1179
|
-
}
|
|
1180
|
-
static [entityKind] = "PgPrimaryKey";
|
|
1181
|
-
columns;
|
|
1182
|
-
name;
|
|
1183
|
-
getName() {
|
|
1184
|
-
return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1187
|
-
});
|
|
1188
|
-
|
|
1189
|
-
// ../node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
1190
|
-
function bindIfParam(value, column) {
|
|
1191
|
-
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
|
1192
|
-
return new Param(value, column);
|
|
1193
|
-
}
|
|
1194
|
-
return value;
|
|
1195
|
-
}
|
|
1196
|
-
function and(...unfilteredConditions) {
|
|
1197
|
-
const conditions = unfilteredConditions.filter((c) => c !== undefined);
|
|
1198
|
-
if (conditions.length === 0) {
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
if (conditions.length === 1) {
|
|
1202
|
-
return new SQL(conditions);
|
|
1203
|
-
}
|
|
1204
|
-
return new SQL([
|
|
1205
|
-
new StringChunk("("),
|
|
1206
|
-
sql.join(conditions, new StringChunk(" and ")),
|
|
1207
|
-
new StringChunk(")")
|
|
1208
|
-
]);
|
|
1209
|
-
}
|
|
1210
|
-
function or(...unfilteredConditions) {
|
|
1211
|
-
const conditions = unfilteredConditions.filter((c) => c !== undefined);
|
|
1212
|
-
if (conditions.length === 0) {
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
if (conditions.length === 1) {
|
|
1216
|
-
return new SQL(conditions);
|
|
1217
|
-
}
|
|
1218
|
-
return new SQL([
|
|
1219
|
-
new StringChunk("("),
|
|
1220
|
-
sql.join(conditions, new StringChunk(" or ")),
|
|
1221
|
-
new StringChunk(")")
|
|
1222
|
-
]);
|
|
1223
|
-
}
|
|
1224
|
-
function not(condition) {
|
|
1225
|
-
return sql`not ${condition}`;
|
|
1226
|
-
}
|
|
1227
|
-
function inArray(column, values) {
|
|
1228
|
-
if (Array.isArray(values)) {
|
|
1229
|
-
if (values.length === 0) {
|
|
1230
|
-
return sql`false`;
|
|
1231
|
-
}
|
|
1232
|
-
return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;
|
|
1233
|
-
}
|
|
1234
|
-
return sql`${column} in ${bindIfParam(values, column)}`;
|
|
1235
|
-
}
|
|
1236
|
-
function notInArray(column, values) {
|
|
1237
|
-
if (Array.isArray(values)) {
|
|
1238
|
-
if (values.length === 0) {
|
|
1239
|
-
return sql`true`;
|
|
1240
|
-
}
|
|
1241
|
-
return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;
|
|
1242
|
-
}
|
|
1243
|
-
return sql`${column} not in ${bindIfParam(values, column)}`;
|
|
1244
|
-
}
|
|
1245
|
-
function isNull(value) {
|
|
1246
|
-
return sql`${value} is null`;
|
|
1247
|
-
}
|
|
1248
|
-
function isNotNull(value) {
|
|
1249
|
-
return sql`${value} is not null`;
|
|
1250
|
-
}
|
|
1251
|
-
function exists(subquery) {
|
|
1252
|
-
return sql`exists ${subquery}`;
|
|
1253
|
-
}
|
|
1254
|
-
function notExists(subquery) {
|
|
1255
|
-
return sql`not exists ${subquery}`;
|
|
1256
|
-
}
|
|
1257
|
-
function between(column, min, max) {
|
|
1258
|
-
return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
|
|
1259
|
-
}
|
|
1260
|
-
function notBetween(column, min, max) {
|
|
1261
|
-
return sql`${column} not between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
|
|
1262
|
-
}
|
|
1263
|
-
function like(column, value) {
|
|
1264
|
-
return sql`${column} like ${value}`;
|
|
1265
|
-
}
|
|
1266
|
-
function notLike(column, value) {
|
|
1267
|
-
return sql`${column} not like ${value}`;
|
|
1268
|
-
}
|
|
1269
|
-
function ilike(column, value) {
|
|
1270
|
-
return sql`${column} ilike ${value}`;
|
|
1271
|
-
}
|
|
1272
|
-
function notIlike(column, value) {
|
|
1273
|
-
return sql`${column} not ilike ${value}`;
|
|
1274
|
-
}
|
|
1275
|
-
function arrayContains(column, values) {
|
|
1276
|
-
if (Array.isArray(values)) {
|
|
1277
|
-
if (values.length === 0) {
|
|
1278
|
-
throw new Error("arrayContains requires at least one value");
|
|
1279
|
-
}
|
|
1280
|
-
const array = sql`${bindIfParam(values, column)}`;
|
|
1281
|
-
return sql`${column} @> ${array}`;
|
|
1282
|
-
}
|
|
1283
|
-
return sql`${column} @> ${bindIfParam(values, column)}`;
|
|
1284
|
-
}
|
|
1285
|
-
function arrayContained(column, values) {
|
|
1286
|
-
if (Array.isArray(values)) {
|
|
1287
|
-
if (values.length === 0) {
|
|
1288
|
-
throw new Error("arrayContained requires at least one value");
|
|
1289
|
-
}
|
|
1290
|
-
const array = sql`${bindIfParam(values, column)}`;
|
|
1291
|
-
return sql`${column} <@ ${array}`;
|
|
1292
|
-
}
|
|
1293
|
-
return sql`${column} <@ ${bindIfParam(values, column)}`;
|
|
1294
|
-
}
|
|
1295
|
-
function arrayOverlaps(column, values) {
|
|
1296
|
-
if (Array.isArray(values)) {
|
|
1297
|
-
if (values.length === 0) {
|
|
1298
|
-
throw new Error("arrayOverlaps requires at least one value");
|
|
1299
|
-
}
|
|
1300
|
-
const array = sql`${bindIfParam(values, column)}`;
|
|
1301
|
-
return sql`${column} && ${array}`;
|
|
1302
|
-
}
|
|
1303
|
-
return sql`${column} && ${bindIfParam(values, column)}`;
|
|
1304
|
-
}
|
|
1305
|
-
var eq = (left, right) => {
|
|
1306
|
-
return sql`${left} = ${bindIfParam(right, left)}`;
|
|
1307
|
-
}, ne = (left, right) => {
|
|
1308
|
-
return sql`${left} <> ${bindIfParam(right, left)}`;
|
|
1309
|
-
}, gt = (left, right) => {
|
|
1310
|
-
return sql`${left} > ${bindIfParam(right, left)}`;
|
|
1311
|
-
}, gte = (left, right) => {
|
|
1312
|
-
return sql`${left} >= ${bindIfParam(right, left)}`;
|
|
1313
|
-
}, lt = (left, right) => {
|
|
1314
|
-
return sql`${left} < ${bindIfParam(right, left)}`;
|
|
1315
|
-
}, lte = (left, right) => {
|
|
1316
|
-
return sql`${left} <= ${bindIfParam(right, left)}`;
|
|
1317
|
-
};
|
|
1318
|
-
var init_conditions = __esm(() => {
|
|
1319
|
-
init_column();
|
|
1320
|
-
init_entity();
|
|
1321
|
-
init_table();
|
|
1322
|
-
init_sql();
|
|
1323
|
-
});
|
|
1324
|
-
|
|
1325
|
-
// ../node_modules/drizzle-orm/sql/expressions/select.js
|
|
1326
|
-
function asc(column) {
|
|
1327
|
-
return sql`${column} asc`;
|
|
1328
|
-
}
|
|
1329
|
-
function desc(column) {
|
|
1330
|
-
return sql`${column} desc`;
|
|
1331
|
-
}
|
|
1332
|
-
var init_select = __esm(() => {
|
|
1333
|
-
init_sql();
|
|
1334
|
-
});
|
|
1335
|
-
|
|
1336
|
-
// ../node_modules/drizzle-orm/sql/expressions/index.js
|
|
1337
|
-
var init_expressions = __esm(() => {
|
|
1338
|
-
init_conditions();
|
|
1339
|
-
init_select();
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
|
-
// ../node_modules/drizzle-orm/relations.js
|
|
1343
|
-
function getOperators() {
|
|
1344
|
-
return {
|
|
1345
|
-
and,
|
|
1346
|
-
between,
|
|
1347
|
-
eq,
|
|
1348
|
-
exists,
|
|
1349
|
-
gt,
|
|
1350
|
-
gte,
|
|
1351
|
-
ilike,
|
|
1352
|
-
inArray,
|
|
1353
|
-
isNull,
|
|
1354
|
-
isNotNull,
|
|
1355
|
-
like,
|
|
1356
|
-
lt,
|
|
1357
|
-
lte,
|
|
1358
|
-
ne,
|
|
1359
|
-
not,
|
|
1360
|
-
notBetween,
|
|
1361
|
-
notExists,
|
|
1362
|
-
notLike,
|
|
1363
|
-
notIlike,
|
|
1364
|
-
notInArray,
|
|
1365
|
-
or,
|
|
1366
|
-
sql
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
|
-
function getOrderByOperators() {
|
|
1370
|
-
return {
|
|
1371
|
-
sql,
|
|
1372
|
-
asc,
|
|
1373
|
-
desc
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1376
|
-
function extractTablesRelationalConfig(schema, configHelpers) {
|
|
1377
|
-
if (Object.keys(schema).length === 1 && "default" in schema && !is(schema["default"], Table)) {
|
|
1378
|
-
schema = schema["default"];
|
|
1379
|
-
}
|
|
1380
|
-
const tableNamesMap = {};
|
|
1381
|
-
const relationsBuffer = {};
|
|
1382
|
-
const tablesConfig = {};
|
|
1383
|
-
for (const [key, value] of Object.entries(schema)) {
|
|
1384
|
-
if (is(value, Table)) {
|
|
1385
|
-
const dbName = getTableUniqueName(value);
|
|
1386
|
-
const bufferedRelations = relationsBuffer[dbName];
|
|
1387
|
-
tableNamesMap[dbName] = key;
|
|
1388
|
-
tablesConfig[key] = {
|
|
1389
|
-
tsName: key,
|
|
1390
|
-
dbName: value[Table.Symbol.Name],
|
|
1391
|
-
schema: value[Table.Symbol.Schema],
|
|
1392
|
-
columns: value[Table.Symbol.Columns],
|
|
1393
|
-
relations: bufferedRelations?.relations ?? {},
|
|
1394
|
-
primaryKey: bufferedRelations?.primaryKey ?? []
|
|
1395
|
-
};
|
|
1396
|
-
for (const column of Object.values(value[Table.Symbol.Columns])) {
|
|
1397
|
-
if (column.primary) {
|
|
1398
|
-
tablesConfig[key].primaryKey.push(column);
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
|
|
1402
|
-
if (extraConfig) {
|
|
1403
|
-
for (const configEntry of Object.values(extraConfig)) {
|
|
1404
|
-
if (is(configEntry, PrimaryKeyBuilder)) {
|
|
1405
|
-
tablesConfig[key].primaryKey.push(...configEntry.columns);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
} else if (is(value, Relations)) {
|
|
1410
|
-
const dbName = getTableUniqueName(value.table);
|
|
1411
|
-
const tableName = tableNamesMap[dbName];
|
|
1412
|
-
const relations2 = value.config(configHelpers(value.table));
|
|
1413
|
-
let primaryKey;
|
|
1414
|
-
for (const [relationName, relation] of Object.entries(relations2)) {
|
|
1415
|
-
if (tableName) {
|
|
1416
|
-
const tableConfig = tablesConfig[tableName];
|
|
1417
|
-
tableConfig.relations[relationName] = relation;
|
|
1418
|
-
if (primaryKey) {
|
|
1419
|
-
tableConfig.primaryKey.push(...primaryKey);
|
|
1420
|
-
}
|
|
1421
|
-
} else {
|
|
1422
|
-
if (!(dbName in relationsBuffer)) {
|
|
1423
|
-
relationsBuffer[dbName] = {
|
|
1424
|
-
relations: {},
|
|
1425
|
-
primaryKey
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1428
|
-
relationsBuffer[dbName].relations[relationName] = relation;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
return { tables: tablesConfig, tableNamesMap };
|
|
1434
|
-
}
|
|
1435
|
-
function relations(table, relations2) {
|
|
1436
|
-
return new Relations(table, (helpers) => Object.fromEntries(Object.entries(relations2(helpers)).map(([key, value]) => [
|
|
1437
|
-
key,
|
|
1438
|
-
value.withFieldName(key)
|
|
1439
|
-
])));
|
|
1440
|
-
}
|
|
1441
|
-
function createOne(sourceTable) {
|
|
1442
|
-
return function one(table, config) {
|
|
1443
|
-
return new One(sourceTable, table, config, config?.fields.reduce((res, f) => res && f.notNull, true) ?? false);
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
function createMany(sourceTable) {
|
|
1447
|
-
return function many(referencedTable, config) {
|
|
1448
|
-
return new Many(sourceTable, referencedTable, config);
|
|
1449
|
-
};
|
|
1450
|
-
}
|
|
1451
|
-
function normalizeRelation(schema, tableNamesMap, relation) {
|
|
1452
|
-
if (is(relation, One) && relation.config) {
|
|
1453
|
-
return {
|
|
1454
|
-
fields: relation.config.fields,
|
|
1455
|
-
references: relation.config.references
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
|
|
1459
|
-
if (!referencedTableTsName) {
|
|
1460
|
-
throw new Error(`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`);
|
|
1461
|
-
}
|
|
1462
|
-
const referencedTableConfig = schema[referencedTableTsName];
|
|
1463
|
-
if (!referencedTableConfig) {
|
|
1464
|
-
throw new Error(`Table "${referencedTableTsName}" not found in schema`);
|
|
1465
|
-
}
|
|
1466
|
-
const sourceTable = relation.sourceTable;
|
|
1467
|
-
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
|
|
1468
|
-
if (!sourceTableTsName) {
|
|
1469
|
-
throw new Error(`Table "${sourceTable[Table.Symbol.Name]}" not found in schema`);
|
|
1470
|
-
}
|
|
1471
|
-
const reverseRelations = [];
|
|
1472
|
-
for (const referencedTableRelation of Object.values(referencedTableConfig.relations)) {
|
|
1473
|
-
if (relation.relationName && relation !== referencedTableRelation && referencedTableRelation.relationName === relation.relationName || !relation.relationName && referencedTableRelation.referencedTable === relation.sourceTable) {
|
|
1474
|
-
reverseRelations.push(referencedTableRelation);
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
if (reverseRelations.length > 1) {
|
|
1478
|
-
throw relation.relationName ? new Error(`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`) : new Error(`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`);
|
|
1479
|
-
}
|
|
1480
|
-
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
|
|
1481
|
-
return {
|
|
1482
|
-
fields: reverseRelations[0].config.references,
|
|
1483
|
-
references: reverseRelations[0].config.fields
|
|
1484
|
-
};
|
|
1485
|
-
}
|
|
1486
|
-
throw new Error(`There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"`);
|
|
1487
|
-
}
|
|
1488
|
-
function createTableRelationsHelpers(sourceTable) {
|
|
1489
|
-
return {
|
|
1490
|
-
one: createOne(sourceTable),
|
|
1491
|
-
many: createMany(sourceTable)
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelection, mapColumnValue = (value) => value) {
|
|
1495
|
-
const result = {};
|
|
1496
|
-
for (const [
|
|
1497
|
-
selectionItemIndex,
|
|
1498
|
-
selectionItem
|
|
1499
|
-
] of buildQueryResultSelection.entries()) {
|
|
1500
|
-
if (selectionItem.isJson) {
|
|
1501
|
-
const relation = tableConfig.relations[selectionItem.tsKey];
|
|
1502
|
-
const rawSubRows = row[selectionItemIndex];
|
|
1503
|
-
const subRows = typeof rawSubRows === "string" ? JSON.parse(rawSubRows) : rawSubRows;
|
|
1504
|
-
result[selectionItem.tsKey] = is(relation, One) ? subRows && mapRelationalRow(tablesConfig, tablesConfig[selectionItem.relationTableTsKey], subRows, selectionItem.selection, mapColumnValue) : subRows.map((subRow) => mapRelationalRow(tablesConfig, tablesConfig[selectionItem.relationTableTsKey], subRow, selectionItem.selection, mapColumnValue));
|
|
1505
|
-
} else {
|
|
1506
|
-
const value = mapColumnValue(row[selectionItemIndex]);
|
|
1507
|
-
const field = selectionItem.field;
|
|
1508
|
-
let decoder;
|
|
1509
|
-
if (is(field, Column)) {
|
|
1510
|
-
decoder = field;
|
|
1511
|
-
} else if (is(field, SQL)) {
|
|
1512
|
-
decoder = field.decoder;
|
|
1513
|
-
} else {
|
|
1514
|
-
decoder = field.sql.decoder;
|
|
1515
|
-
}
|
|
1516
|
-
result[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
return result;
|
|
1520
|
-
}
|
|
1521
|
-
var Relation, Relations, One, Many;
|
|
1522
|
-
var init_relations = __esm(() => {
|
|
1523
|
-
init_table();
|
|
1524
|
-
init_column();
|
|
1525
|
-
init_entity();
|
|
1526
|
-
init_primary_keys();
|
|
1527
|
-
init_expressions();
|
|
1528
|
-
init_sql();
|
|
1529
|
-
Relation = class Relation {
|
|
1530
|
-
constructor(sourceTable, referencedTable, relationName) {
|
|
1531
|
-
this.sourceTable = sourceTable;
|
|
1532
|
-
this.referencedTable = referencedTable;
|
|
1533
|
-
this.relationName = relationName;
|
|
1534
|
-
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
|
1535
|
-
}
|
|
1536
|
-
static [entityKind] = "Relation";
|
|
1537
|
-
referencedTableName;
|
|
1538
|
-
fieldName;
|
|
1539
|
-
};
|
|
1540
|
-
Relations = class Relations {
|
|
1541
|
-
constructor(table, config) {
|
|
1542
|
-
this.table = table;
|
|
1543
|
-
this.config = config;
|
|
1544
|
-
}
|
|
1545
|
-
static [entityKind] = "Relations";
|
|
1546
|
-
};
|
|
1547
|
-
One = class One extends Relation {
|
|
1548
|
-
constructor(sourceTable, referencedTable, config, isNullable) {
|
|
1549
|
-
super(sourceTable, referencedTable, config?.relationName);
|
|
1550
|
-
this.config = config;
|
|
1551
|
-
this.isNullable = isNullable;
|
|
1552
|
-
}
|
|
1553
|
-
static [entityKind] = "One";
|
|
1554
|
-
withFieldName(fieldName) {
|
|
1555
|
-
const relation = new One(this.sourceTable, this.referencedTable, this.config, this.isNullable);
|
|
1556
|
-
relation.fieldName = fieldName;
|
|
1557
|
-
return relation;
|
|
1558
|
-
}
|
|
1559
|
-
};
|
|
1560
|
-
Many = class Many extends Relation {
|
|
1561
|
-
constructor(sourceTable, referencedTable, config) {
|
|
1562
|
-
super(sourceTable, referencedTable, config?.relationName);
|
|
1563
|
-
this.config = config;
|
|
1564
|
-
}
|
|
1565
|
-
static [entityKind] = "Many";
|
|
1566
|
-
withFieldName(fieldName) {
|
|
1567
|
-
const relation = new Many(this.sourceTable, this.referencedTable, this.config);
|
|
1568
|
-
relation.fieldName = fieldName;
|
|
1569
|
-
return relation;
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
});
|
|
1573
|
-
|
|
1574
|
-
// ../node_modules/drizzle-orm/sql/functions/aggregate.js
|
|
1575
|
-
function count(expression) {
|
|
1576
|
-
return sql`count(${expression || sql.raw("*")})`.mapWith(Number);
|
|
1577
|
-
}
|
|
1578
|
-
function countDistinct(expression) {
|
|
1579
|
-
return sql`count(distinct ${expression})`.mapWith(Number);
|
|
1580
|
-
}
|
|
1581
|
-
function avg(expression) {
|
|
1582
|
-
return sql`avg(${expression})`.mapWith(String);
|
|
1583
|
-
}
|
|
1584
|
-
function avgDistinct(expression) {
|
|
1585
|
-
return sql`avg(distinct ${expression})`.mapWith(String);
|
|
1586
|
-
}
|
|
1587
|
-
function sum(expression) {
|
|
1588
|
-
return sql`sum(${expression})`.mapWith(String);
|
|
1589
|
-
}
|
|
1590
|
-
function sumDistinct(expression) {
|
|
1591
|
-
return sql`sum(distinct ${expression})`.mapWith(String);
|
|
1592
|
-
}
|
|
1593
|
-
function max(expression) {
|
|
1594
|
-
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
|
1595
|
-
}
|
|
1596
|
-
function min(expression) {
|
|
1597
|
-
return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
|
1598
|
-
}
|
|
1599
|
-
var init_aggregate = __esm(() => {
|
|
1600
|
-
init_column();
|
|
1601
|
-
init_entity();
|
|
1602
|
-
init_sql();
|
|
1603
|
-
});
|
|
1604
|
-
|
|
1605
|
-
// ../node_modules/drizzle-orm/sql/functions/vector.js
|
|
1606
|
-
function toSql(value) {
|
|
1607
|
-
return JSON.stringify(value);
|
|
1608
|
-
}
|
|
1609
|
-
function l2Distance(column, value) {
|
|
1610
|
-
if (Array.isArray(value)) {
|
|
1611
|
-
return sql`${column} <-> ${toSql(value)}`;
|
|
1612
|
-
}
|
|
1613
|
-
return sql`${column} <-> ${value}`;
|
|
1614
|
-
}
|
|
1615
|
-
function l1Distance(column, value) {
|
|
1616
|
-
if (Array.isArray(value)) {
|
|
1617
|
-
return sql`${column} <+> ${toSql(value)}`;
|
|
1618
|
-
}
|
|
1619
|
-
return sql`${column} <+> ${value}`;
|
|
1620
|
-
}
|
|
1621
|
-
function innerProduct(column, value) {
|
|
1622
|
-
if (Array.isArray(value)) {
|
|
1623
|
-
return sql`${column} <#> ${toSql(value)}`;
|
|
1624
|
-
}
|
|
1625
|
-
return sql`${column} <#> ${value}`;
|
|
1626
|
-
}
|
|
1627
|
-
function cosineDistance(column, value) {
|
|
1628
|
-
if (Array.isArray(value)) {
|
|
1629
|
-
return sql`${column} <=> ${toSql(value)}`;
|
|
1630
|
-
}
|
|
1631
|
-
return sql`${column} <=> ${value}`;
|
|
1632
|
-
}
|
|
1633
|
-
function hammingDistance(column, value) {
|
|
1634
|
-
if (Array.isArray(value)) {
|
|
1635
|
-
return sql`${column} <~> ${toSql(value)}`;
|
|
1636
|
-
}
|
|
1637
|
-
return sql`${column} <~> ${value}`;
|
|
1638
|
-
}
|
|
1639
|
-
function jaccardDistance(column, value) {
|
|
1640
|
-
if (Array.isArray(value)) {
|
|
1641
|
-
return sql`${column} <%> ${toSql(value)}`;
|
|
1642
|
-
}
|
|
1643
|
-
return sql`${column} <%> ${value}`;
|
|
1644
|
-
}
|
|
1645
|
-
var init_vector = __esm(() => {
|
|
1646
|
-
init_sql();
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
|
-
// ../node_modules/drizzle-orm/sql/functions/index.js
|
|
1650
|
-
var init_functions = __esm(() => {
|
|
1651
|
-
init_aggregate();
|
|
1652
|
-
init_vector();
|
|
1653
|
-
});
|
|
1654
|
-
|
|
1655
|
-
// ../node_modules/drizzle-orm/sql/index.js
|
|
1656
|
-
var init_sql2 = __esm(() => {
|
|
1657
|
-
init_expressions();
|
|
1658
|
-
init_functions();
|
|
1659
|
-
init_sql();
|
|
1660
|
-
});
|
|
1661
|
-
|
|
1662
|
-
// ../node_modules/drizzle-orm/index.js
|
|
1663
|
-
var exports_drizzle_orm = {};
|
|
1664
|
-
__export(exports_drizzle_orm, {
|
|
1665
|
-
textDecoder: () => textDecoder,
|
|
1666
|
-
sumDistinct: () => sumDistinct,
|
|
1667
|
-
sum: () => sum,
|
|
1668
|
-
sql: () => sql,
|
|
1669
|
-
relations: () => relations,
|
|
1670
|
-
placeholder: () => placeholder,
|
|
1671
|
-
param: () => param,
|
|
1672
|
-
orderSelectedFields: () => orderSelectedFields,
|
|
1673
|
-
or: () => or,
|
|
1674
|
-
notLike: () => notLike,
|
|
1675
|
-
notInArray: () => notInArray,
|
|
1676
|
-
notIlike: () => notIlike,
|
|
1677
|
-
notExists: () => notExists,
|
|
1678
|
-
notBetween: () => notBetween,
|
|
1679
|
-
not: () => not,
|
|
1680
|
-
normalizeRelation: () => normalizeRelation,
|
|
1681
|
-
noopMapper: () => noopMapper,
|
|
1682
|
-
noopEncoder: () => noopEncoder,
|
|
1683
|
-
noopDecoder: () => noopDecoder,
|
|
1684
|
-
ne: () => ne,
|
|
1685
|
-
name: () => name,
|
|
1686
|
-
min: () => min,
|
|
1687
|
-
max: () => max,
|
|
1688
|
-
mapUpdateSet: () => mapUpdateSet,
|
|
1689
|
-
mapResultRow: () => mapResultRow,
|
|
1690
|
-
mapRelationalRow: () => mapRelationalRow,
|
|
1691
|
-
mapColumnsInSQLToAlias: () => mapColumnsInSQLToAlias,
|
|
1692
|
-
mapColumnsInAliasedSQLToAlias: () => mapColumnsInAliasedSQLToAlias,
|
|
1693
|
-
lte: () => lte,
|
|
1694
|
-
lt: () => lt,
|
|
1695
|
-
like: () => like,
|
|
1696
|
-
l2Distance: () => l2Distance,
|
|
1697
|
-
l1Distance: () => l1Distance,
|
|
1698
|
-
jaccardDistance: () => jaccardDistance,
|
|
1699
|
-
isView: () => isView,
|
|
1700
|
-
isTable: () => isTable,
|
|
1701
|
-
isSQLWrapper: () => isSQLWrapper,
|
|
1702
|
-
isNull: () => isNull,
|
|
1703
|
-
isNotNull: () => isNotNull,
|
|
1704
|
-
isDriverValueEncoder: () => isDriverValueEncoder,
|
|
1705
|
-
isConfig: () => isConfig,
|
|
1706
|
-
is: () => is,
|
|
1707
|
-
innerProduct: () => innerProduct,
|
|
1708
|
-
inArray: () => inArray,
|
|
1709
|
-
ilike: () => ilike,
|
|
1710
|
-
haveSameKeys: () => haveSameKeys,
|
|
1711
|
-
hasOwnEntityKind: () => hasOwnEntityKind,
|
|
1712
|
-
hammingDistance: () => hammingDistance,
|
|
1713
|
-
gte: () => gte,
|
|
1714
|
-
gt: () => gt,
|
|
1715
|
-
getViewSelectedFields: () => getViewSelectedFields,
|
|
1716
|
-
getViewName: () => getViewName,
|
|
1717
|
-
getTableUniqueName: () => getTableUniqueName,
|
|
1718
|
-
getTableName: () => getTableName,
|
|
1719
|
-
getTableLikeName: () => getTableLikeName,
|
|
1720
|
-
getTableColumns: () => getTableColumns,
|
|
1721
|
-
getOrderByOperators: () => getOrderByOperators,
|
|
1722
|
-
getOperators: () => getOperators,
|
|
1723
|
-
getColumnNameAndConfig: () => getColumnNameAndConfig,
|
|
1724
|
-
fillPlaceholders: () => fillPlaceholders,
|
|
1725
|
-
extractTablesRelationalConfig: () => extractTablesRelationalConfig,
|
|
1726
|
-
exists: () => exists,
|
|
1727
|
-
eq: () => eq,
|
|
1728
|
-
entityKind: () => entityKind,
|
|
1729
|
-
desc: () => desc,
|
|
1730
|
-
createTableRelationsHelpers: () => createTableRelationsHelpers,
|
|
1731
|
-
createOne: () => createOne,
|
|
1732
|
-
createMany: () => createMany,
|
|
1733
|
-
countDistinct: () => countDistinct,
|
|
1734
|
-
count: () => count,
|
|
1735
|
-
cosineDistance: () => cosineDistance,
|
|
1736
|
-
bindIfParam: () => bindIfParam,
|
|
1737
|
-
between: () => between,
|
|
1738
|
-
avgDistinct: () => avgDistinct,
|
|
1739
|
-
avg: () => avg,
|
|
1740
|
-
asc: () => asc,
|
|
1741
|
-
arrayOverlaps: () => arrayOverlaps,
|
|
1742
|
-
arrayContains: () => arrayContains,
|
|
1743
|
-
arrayContained: () => arrayContained,
|
|
1744
|
-
applyMixins: () => applyMixins,
|
|
1745
|
-
and: () => and,
|
|
1746
|
-
aliasedTableColumn: () => aliasedTableColumn,
|
|
1747
|
-
aliasedTable: () => aliasedTable,
|
|
1748
|
-
aliasedRelation: () => aliasedRelation,
|
|
1749
|
-
WithSubquery: () => WithSubquery,
|
|
1750
|
-
ViewBaseConfig: () => ViewBaseConfig,
|
|
1751
|
-
View: () => View,
|
|
1752
|
-
TransactionRollbackError: () => TransactionRollbackError,
|
|
1753
|
-
TableAliasProxyHandler: () => TableAliasProxyHandler,
|
|
1754
|
-
Table: () => Table,
|
|
1755
|
-
Subquery: () => Subquery,
|
|
1756
|
-
StringChunk: () => StringChunk,
|
|
1757
|
-
Schema: () => Schema,
|
|
1758
|
-
SQL: () => SQL,
|
|
1759
|
-
Relations: () => Relations,
|
|
1760
|
-
RelationTableAliasProxyHandler: () => RelationTableAliasProxyHandler,
|
|
1761
|
-
Relation: () => Relation,
|
|
1762
|
-
QueryPromise: () => QueryPromise,
|
|
1763
|
-
Placeholder: () => Placeholder,
|
|
1764
|
-
Param: () => Param,
|
|
1765
|
-
OriginalName: () => OriginalName,
|
|
1766
|
-
One: () => One,
|
|
1767
|
-
NoopLogger: () => NoopLogger,
|
|
1768
|
-
Name: () => Name,
|
|
1769
|
-
Many: () => Many,
|
|
1770
|
-
IsAlias: () => IsAlias,
|
|
1771
|
-
FakePrimitiveParam: () => FakePrimitiveParam,
|
|
1772
|
-
ExtraConfigColumns: () => ExtraConfigColumns,
|
|
1773
|
-
ExtraConfigBuilder: () => ExtraConfigBuilder,
|
|
1774
|
-
DrizzleQueryError: () => DrizzleQueryError,
|
|
1775
|
-
DrizzleError: () => DrizzleError,
|
|
1776
|
-
DefaultLogger: () => DefaultLogger,
|
|
1777
|
-
ConsoleLogWriter: () => ConsoleLogWriter,
|
|
1778
|
-
Columns: () => Columns,
|
|
1779
|
-
ColumnBuilder: () => ColumnBuilder,
|
|
1780
|
-
ColumnAliasProxyHandler: () => ColumnAliasProxyHandler,
|
|
1781
|
-
Column: () => Column,
|
|
1782
|
-
BaseName: () => BaseName
|
|
1783
|
-
});
|
|
1784
|
-
var init_drizzle_orm = __esm(() => {
|
|
1785
|
-
init_alias();
|
|
1786
|
-
init_column_builder();
|
|
1787
|
-
init_column();
|
|
1788
|
-
init_entity();
|
|
1789
|
-
init_errors();
|
|
1790
|
-
init_logger();
|
|
1791
|
-
init_query_promise();
|
|
1792
|
-
init_relations();
|
|
1793
|
-
init_sql2();
|
|
1794
|
-
init_subquery();
|
|
1795
|
-
init_table();
|
|
1796
|
-
init_utils();
|
|
1797
|
-
init_view_common();
|
|
1798
|
-
});
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1799
3
|
|
|
1800
4
|
// index.ts
|
|
1801
5
|
import {
|
|
@@ -1804,7 +8,7 @@ import {
|
|
|
1804
8
|
import crypto from "node:crypto";
|
|
1805
9
|
|
|
1806
10
|
// TrajectoryLoggerService.ts
|
|
1807
|
-
import { logger
|
|
11
|
+
import { logger, Service } from "@elizaos/core";
|
|
1808
12
|
import { v4 as uuidv4 } from "uuid";
|
|
1809
13
|
function asNumber(value) {
|
|
1810
14
|
if (typeof value === "number" && Number.isFinite(value))
|
|
@@ -1881,7 +85,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
1881
85
|
return this.enabled;
|
|
1882
86
|
}
|
|
1883
87
|
async getSqlHelper() {
|
|
1884
|
-
const drizzle = await
|
|
88
|
+
const drizzle = await import("drizzle-orm");
|
|
1885
89
|
return drizzle.sql;
|
|
1886
90
|
}
|
|
1887
91
|
async executeRawSql(sqlText) {
|
|
@@ -1902,13 +106,13 @@ class TrajectoryLoggerService extends Service {
|
|
|
1902
106
|
return;
|
|
1903
107
|
const runtime = this.runtime;
|
|
1904
108
|
if (!runtime?.adapter) {
|
|
1905
|
-
|
|
109
|
+
logger.warn("[trajectory-logger] No runtime adapter available, skipping initialization");
|
|
1906
110
|
return;
|
|
1907
111
|
}
|
|
1908
112
|
await this.ensureTablesExist();
|
|
1909
113
|
await this.backfillTrajectoriesMissingLlmCalls();
|
|
1910
114
|
this.initialized = true;
|
|
1911
|
-
|
|
115
|
+
logger.info("[trajectory-logger] Trajectory logger service initialized");
|
|
1912
116
|
}
|
|
1913
117
|
async getTableColumnNames(tableName) {
|
|
1914
118
|
const names = new Set;
|
|
@@ -1920,9 +124,9 @@ class TrajectoryLoggerService extends Service {
|
|
|
1920
124
|
AND table_schema NOT IN ('pg_catalog', 'information_schema')
|
|
1921
125
|
`);
|
|
1922
126
|
for (const row of result.rows) {
|
|
1923
|
-
const
|
|
1924
|
-
if (
|
|
1925
|
-
names.add(
|
|
127
|
+
const name = asString(pickCell(row, "column_name"));
|
|
128
|
+
if (name)
|
|
129
|
+
names.add(name);
|
|
1926
130
|
}
|
|
1927
131
|
if (names.size > 0)
|
|
1928
132
|
return names;
|
|
@@ -1933,9 +137,9 @@ class TrajectoryLoggerService extends Service {
|
|
|
1933
137
|
try {
|
|
1934
138
|
const pragma = await this.executeRawSql(`PRAGMA table_info(${safeTableName})`);
|
|
1935
139
|
for (const row of pragma.rows) {
|
|
1936
|
-
const
|
|
1937
|
-
if (
|
|
1938
|
-
names.add(
|
|
140
|
+
const name = asString(pickCell(row, "name"));
|
|
141
|
+
if (name)
|
|
142
|
+
names.add(name);
|
|
1939
143
|
}
|
|
1940
144
|
} catch {}
|
|
1941
145
|
return names;
|
|
@@ -1975,7 +179,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
1975
179
|
if (combinedMessage.includes("already exists") || combinedMessage.includes("duplicate column") || combinedMessage.includes("duplicate_column")) {
|
|
1976
180
|
continue;
|
|
1977
181
|
}
|
|
1978
|
-
|
|
182
|
+
logger.warn(`[trajectory-logger] Failed to add trajectories.${columnName} (non-fatal): ${errPlain instanceof Error ? errPlain.message : String(errPlain)}`);
|
|
1979
183
|
}
|
|
1980
184
|
}
|
|
1981
185
|
}
|
|
@@ -2036,7 +240,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2036
240
|
await this.executeRawSql(`CREATE INDEX IF NOT EXISTS idx_trajectories_batch_id ON trajectories(batch_id)`);
|
|
2037
241
|
await this.executeRawSql(`CREATE INDEX IF NOT EXISTS idx_trajectories_is_training ON trajectories(is_training_data)`);
|
|
2038
242
|
} catch (e) {
|
|
2039
|
-
|
|
243
|
+
logger.warn(`[trajectory-logger] Failed to create indexes (non-fatal): ${e instanceof Error ? e.message : String(e)}`);
|
|
2040
244
|
}
|
|
2041
245
|
await this.executeRawSql(`
|
|
2042
246
|
CREATE TABLE IF NOT EXISTS trajectory_step_index (
|
|
@@ -2092,13 +296,13 @@ class TrajectoryLoggerService extends Service {
|
|
|
2092
296
|
});
|
|
2093
297
|
}
|
|
2094
298
|
if (fixed > 0) {
|
|
2095
|
-
|
|
299
|
+
logger.info(`[trajectory-logger] Backfilled ${fixed} completed trajectories with synthetic LLM calls`);
|
|
2096
300
|
}
|
|
2097
301
|
if (rows.rows.length >= maxRows) {
|
|
2098
|
-
|
|
302
|
+
logger.warn(`[trajectory-logger] Backfill hit safety cap (${maxRows}); remaining older trajectories will be fixed lazily when touched`);
|
|
2099
303
|
}
|
|
2100
304
|
} catch (err) {
|
|
2101
|
-
|
|
305
|
+
logger.warn(`[trajectory-logger] Failed to backfill trajectories missing LLM calls (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
|
|
2102
306
|
}
|
|
2103
307
|
}
|
|
2104
308
|
normalizePurpose(value) {
|
|
@@ -2336,7 +540,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2336
540
|
updated_at = ${sqlLiteral(updatedAtIso)}
|
|
2337
541
|
WHERE id = ${sqlLiteral(trajectoryId)}
|
|
2338
542
|
`).catch((legacyErr) => {
|
|
2339
|
-
|
|
543
|
+
logger.warn({ err: legacyErr, trajectoryId }, `[trajectory-logger] Failed to persist trajectory update after compatibility fallback: ${modernErr instanceof Error ? modernErr.message : String(modernErr)}`);
|
|
2340
544
|
throw legacyErr;
|
|
2341
545
|
});
|
|
2342
546
|
}
|
|
@@ -2363,7 +567,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2363
567
|
(async () => {
|
|
2364
568
|
const trajectoryId = await this.resolveTrajectoryId(params.stepId);
|
|
2365
569
|
if (!trajectoryId) {
|
|
2366
|
-
|
|
570
|
+
logger.debug({ stepId: params.stepId }, "[trajectory-logger] No trajectory mapping for LLM call");
|
|
2367
571
|
return;
|
|
2368
572
|
}
|
|
2369
573
|
await this.withTrajectoryWriteLock(trajectoryId, async () => {
|
|
@@ -2392,7 +596,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2392
596
|
await this.persistTrajectory(trajectoryId, trajectory, "active");
|
|
2393
597
|
});
|
|
2394
598
|
})().catch((err) => {
|
|
2395
|
-
|
|
599
|
+
logger.warn({ err, stepId: params.stepId }, "[trajectory-logger] Failed to persist LLM call");
|
|
2396
600
|
});
|
|
2397
601
|
}
|
|
2398
602
|
logLLMCall(stepId, details) {
|
|
@@ -2426,7 +630,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2426
630
|
(async () => {
|
|
2427
631
|
const trajectoryId = await this.resolveTrajectoryId(params.stepId);
|
|
2428
632
|
if (!trajectoryId) {
|
|
2429
|
-
|
|
633
|
+
logger.debug({ stepId: params.stepId }, "[trajectory-logger] No trajectory mapping for provider access");
|
|
2430
634
|
return;
|
|
2431
635
|
}
|
|
2432
636
|
await this.withTrajectoryWriteLock(trajectoryId, async () => {
|
|
@@ -2446,13 +650,13 @@ class TrajectoryLoggerService extends Service {
|
|
|
2446
650
|
await this.persistTrajectory(trajectoryId, trajectory, "active");
|
|
2447
651
|
});
|
|
2448
652
|
})().catch((err) => {
|
|
2449
|
-
|
|
653
|
+
logger.warn({ err, stepId: params.stepId }, "[trajectory-logger] Failed to persist provider access");
|
|
2450
654
|
});
|
|
2451
655
|
}
|
|
2452
656
|
logProviderAccessByTrajectoryId(trajectoryId, access) {
|
|
2453
657
|
const stepId = this.getCurrentStepId(trajectoryId);
|
|
2454
658
|
if (!stepId) {
|
|
2455
|
-
|
|
659
|
+
logger.debug({ trajectoryId }, "[trajectory-logger] No active step for provider access by trajectory");
|
|
2456
660
|
return;
|
|
2457
661
|
}
|
|
2458
662
|
this.logProviderAccess(stepId, access);
|
|
@@ -2539,7 +743,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2539
743
|
`);
|
|
2540
744
|
persistedStart = true;
|
|
2541
745
|
} catch (legacyErr) {
|
|
2542
|
-
|
|
746
|
+
logger.warn({ err: legacyErr, trajectoryId }, "[trajectory-logger] Failed to persist trajectory start");
|
|
2543
747
|
}
|
|
2544
748
|
}
|
|
2545
749
|
if (persistedStart && legacyStepId) {
|
|
@@ -2547,7 +751,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2547
751
|
try {
|
|
2548
752
|
await this.setStepIndex(legacyStepId, trajectoryId, -1, false);
|
|
2549
753
|
} catch (indexErr) {
|
|
2550
|
-
|
|
754
|
+
logger.warn({ err: indexErr, trajectoryId, stepId: legacyStepId }, "[trajectory-logger] Failed to persist step index for trajectory start");
|
|
2551
755
|
}
|
|
2552
756
|
}
|
|
2553
757
|
return trajectoryId;
|
|
@@ -2561,7 +765,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2561
765
|
this.withTrajectoryWriteLock(trajectoryId, async () => {
|
|
2562
766
|
const trajectory = await this.getTrajectoryById(trajectoryId);
|
|
2563
767
|
if (!trajectory) {
|
|
2564
|
-
|
|
768
|
+
logger.warn({ trajectoryId }, "[trajectory-logger] Trajectory not found for startStep");
|
|
2565
769
|
return;
|
|
2566
770
|
}
|
|
2567
771
|
const step = this.createStep(stepId, trajectory.steps.length, envState);
|
|
@@ -2570,7 +774,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2570
774
|
await this.setStepIndex(stepId, trajectoryId, step.stepNumber, true);
|
|
2571
775
|
await this.persistTrajectory(trajectoryId, trajectory, "active");
|
|
2572
776
|
}).catch((err) => {
|
|
2573
|
-
|
|
777
|
+
logger.warn({ err, trajectoryId, stepId }, "[trajectory-logger] Failed to persist startStep");
|
|
2574
778
|
});
|
|
2575
779
|
return stepId;
|
|
2576
780
|
}
|
|
@@ -2610,7 +814,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2610
814
|
this.activeStepIds.delete(trajectoryId);
|
|
2611
815
|
await this.persistTrajectory(trajectoryId, trajectory, "active");
|
|
2612
816
|
}).catch((err) => {
|
|
2613
|
-
|
|
817
|
+
logger.warn({ err, trajectoryId }, "[trajectory-logger] Failed to complete step");
|
|
2614
818
|
});
|
|
2615
819
|
}
|
|
2616
820
|
async endTrajectory(stepIdOrTrajectoryId, status = "completed", finalMetrics) {
|
|
@@ -2618,13 +822,13 @@ class TrajectoryLoggerService extends Service {
|
|
|
2618
822
|
return;
|
|
2619
823
|
const trajectoryId = await this.resolveTrajectoryId(stepIdOrTrajectoryId);
|
|
2620
824
|
if (!trajectoryId) {
|
|
2621
|
-
|
|
825
|
+
logger.debug({ stepIdOrTrajectoryId }, "[trajectory-logger] No trajectory to end");
|
|
2622
826
|
return;
|
|
2623
827
|
}
|
|
2624
828
|
await this.withTrajectoryWriteLock(trajectoryId, async () => {
|
|
2625
829
|
const trajectory = await this.getTrajectoryById(trajectoryId);
|
|
2626
830
|
if (!trajectory) {
|
|
2627
|
-
|
|
831
|
+
logger.debug({ trajectoryId }, "[trajectory-logger] Trajectory not found while ending");
|
|
2628
832
|
return;
|
|
2629
833
|
}
|
|
2630
834
|
const now = Date.now();
|
|
@@ -2837,9 +1041,9 @@ class TrajectoryLoggerService extends Service {
|
|
|
2837
1041
|
if (!runtime?.adapter)
|
|
2838
1042
|
return 0;
|
|
2839
1043
|
const countResult = await this.executeRawSql(`SELECT count(*)::int AS cnt FROM trajectories`);
|
|
2840
|
-
const
|
|
1044
|
+
const count = asNumber(pickCell(countResult.rows[0] ?? {}, "cnt")) ?? 0;
|
|
2841
1045
|
await this.executeRawSql(`DELETE FROM trajectories`);
|
|
2842
|
-
return
|
|
1046
|
+
return count;
|
|
2843
1047
|
}
|
|
2844
1048
|
sanitizeZipFolderName(value) {
|
|
2845
1049
|
const sanitized = value.trim().replace(/[^a-zA-Z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -2988,7 +1192,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
2988
1192
|
t.endTime,
|
|
2989
1193
|
t.durationMs,
|
|
2990
1194
|
t.steps.length,
|
|
2991
|
-
t.steps.reduce((
|
|
1195
|
+
t.steps.reduce((sum, s) => sum + s.llmCalls.length, 0),
|
|
2992
1196
|
t.totalReward,
|
|
2993
1197
|
t.scenarioId ?? ""
|
|
2994
1198
|
].join(","));
|
|
@@ -3058,7 +1262,7 @@ class TrajectoryLoggerService extends Service {
|
|
|
3058
1262
|
}
|
|
3059
1263
|
}
|
|
3060
1264
|
// action-interceptor.ts
|
|
3061
|
-
import { logger as
|
|
1265
|
+
import { logger as logger2 } from "@elizaos/core";
|
|
3062
1266
|
var trajectoryContexts = new WeakMap;
|
|
3063
1267
|
function setTrajectoryContext(runtime, trajectoryId, trajectoryLogger) {
|
|
3064
1268
|
trajectoryContexts.set(runtime, { trajectoryId, logger: trajectoryLogger });
|
|
@@ -3082,7 +1286,7 @@ function wrapActionWithLogging(action, _trajectoryLogger) {
|
|
|
3082
1286
|
const { trajectoryId, logger: loggerService } = context;
|
|
3083
1287
|
const stepId = loggerService.getCurrentStepId(trajectoryId);
|
|
3084
1288
|
if (!stepId) {
|
|
3085
|
-
|
|
1289
|
+
logger2.warn({ action: action.name, trajectoryId }, "No active step for action execution");
|
|
3086
1290
|
const result = await originalHandler(runtime, message, state, options, callback);
|
|
3087
1291
|
return result ?? undefined;
|
|
3088
1292
|
}
|
|
@@ -3102,7 +1306,7 @@ function wrapActionWithLogging(action, _trajectoryLogger) {
|
|
|
3102
1306
|
};
|
|
3103
1307
|
const errorHandler = (err) => {
|
|
3104
1308
|
const error = err instanceof Error ? err.message : typeof err === "string" ? err : err.message || String(err);
|
|
3105
|
-
|
|
1309
|
+
logger2.error({ action: action.name, trajectoryId, error }, "Action execution failed");
|
|
3106
1310
|
const stateSnapshot = state ? JSON.parse(JSON.stringify(state)) : null;
|
|
3107
1311
|
loggerService.completeStep(trajectoryId, stepId, {
|
|
3108
1312
|
actionType: action.name,
|
|
@@ -3145,7 +1349,7 @@ function wrapPluginActions(plugin, trajectoryLogger) {
|
|
|
3145
1349
|
function logLLMCallFromAction(actionContext, trajectoryLogger, trajectoryId) {
|
|
3146
1350
|
const stepId = trajectoryLogger.getCurrentStepId(trajectoryId);
|
|
3147
1351
|
if (!stepId) {
|
|
3148
|
-
|
|
1352
|
+
logger2.warn({ trajectoryId }, "No active step for LLM call from action");
|
|
3149
1353
|
return;
|
|
3150
1354
|
}
|
|
3151
1355
|
trajectoryLogger.logLLMCall(stepId, {
|
|
@@ -3166,7 +1370,7 @@ function logLLMCallFromAction(actionContext, trajectoryLogger, trajectoryId) {
|
|
|
3166
1370
|
function logProviderFromAction(actionContext, trajectoryLogger, trajectoryId) {
|
|
3167
1371
|
const stepId = trajectoryLogger.getCurrentStepId(trajectoryId);
|
|
3168
1372
|
if (!stepId) {
|
|
3169
|
-
|
|
1373
|
+
logger2.warn({ trajectoryId }, "No active step for provider access from action");
|
|
3170
1374
|
return;
|
|
3171
1375
|
}
|
|
3172
1376
|
trajectoryLogger.logProviderAccess(stepId, {
|
|
@@ -3188,7 +1392,7 @@ function wrapProviderWithLogging(provider, _trajectoryLogger) {
|
|
|
3188
1392
|
const { trajectoryId, logger: loggerService } = context;
|
|
3189
1393
|
const stepId = loggerService.getCurrentStepId(trajectoryId);
|
|
3190
1394
|
if (!stepId) {
|
|
3191
|
-
|
|
1395
|
+
logger2.warn({ provider: provider.name, trajectoryId }, "No active step for provider access");
|
|
3192
1396
|
return originalGet?.(runtime, message, state) || { text: "" };
|
|
3193
1397
|
}
|
|
3194
1398
|
const result = await originalGet?.(runtime, message, state) || { text: "" };
|
|
@@ -3390,14 +1594,14 @@ function toARTJSONL(trajectory) {
|
|
|
3390
1594
|
return JSON.stringify(toARTTrajectory(trajectory));
|
|
3391
1595
|
}
|
|
3392
1596
|
function validateARTCompatibility(trajectory) {
|
|
3393
|
-
const
|
|
1597
|
+
const errors = [];
|
|
3394
1598
|
const warnings = [];
|
|
3395
1599
|
if (trajectory.steps.length === 0) {
|
|
3396
|
-
|
|
1600
|
+
errors.push("Trajectory has no steps");
|
|
3397
1601
|
}
|
|
3398
1602
|
for (const [idx, step] of trajectory.steps.entries()) {
|
|
3399
1603
|
if (step.llmCalls.length === 0) {
|
|
3400
|
-
|
|
1604
|
+
errors.push(`Step ${idx} has no LLM calls - can't extract messages`);
|
|
3401
1605
|
}
|
|
3402
1606
|
for (const llmCall of step.llmCalls) {
|
|
3403
1607
|
if (!llmCall.userPrompt || llmCall.userPrompt.length < 10) {
|
|
@@ -3409,15 +1613,15 @@ function validateARTCompatibility(trajectory) {
|
|
|
3409
1613
|
}
|
|
3410
1614
|
}
|
|
3411
1615
|
if (trajectory.totalReward === undefined || Number.isNaN(trajectory.totalReward)) {
|
|
3412
|
-
|
|
1616
|
+
errors.push("Trajectory has no valid reward");
|
|
3413
1617
|
}
|
|
3414
1618
|
const artTraj = toARTTrajectory(trajectory);
|
|
3415
1619
|
if (artTraj.messages.length < 2) {
|
|
3416
1620
|
warnings.push("Trajectory converts to very few messages (< 2)");
|
|
3417
1621
|
}
|
|
3418
1622
|
return {
|
|
3419
|
-
valid:
|
|
3420
|
-
errors
|
|
1623
|
+
valid: errors.length === 0,
|
|
1624
|
+
errors,
|
|
3421
1625
|
warnings
|
|
3422
1626
|
};
|
|
3423
1627
|
}
|
|
@@ -3513,7 +1717,7 @@ async function buildGameStateFromDB(_trajectoryId) {
|
|
|
3513
1717
|
}
|
|
3514
1718
|
async function recomputeTrajectoryRewards(_trajectoryIds) {}
|
|
3515
1719
|
// integration.ts
|
|
3516
|
-
import { logger as
|
|
1720
|
+
import { logger as logger3 } from "@elizaos/core";
|
|
3517
1721
|
async function startAutonomousTick(trajectoryLogger, context) {
|
|
3518
1722
|
const trajectoryId = await trajectoryLogger.startTrajectory(context.agentId, {
|
|
3519
1723
|
scenarioId: context.scenarioId,
|
|
@@ -3529,17 +1733,17 @@ async function startAutonomousTick(trajectoryLogger, context) {
|
|
|
3529
1733
|
openPositions: 0
|
|
3530
1734
|
};
|
|
3531
1735
|
trajectoryLogger.startStep(trajectoryId, envState);
|
|
3532
|
-
|
|
1736
|
+
logger3.info({ trajectoryId, agentId: context.agentId }, "Started autonomous tick trajectory");
|
|
3533
1737
|
return trajectoryId;
|
|
3534
1738
|
}
|
|
3535
1739
|
async function endAutonomousTick(trajectoryLogger, trajectoryId, status = "completed", finalMetrics) {
|
|
3536
1740
|
await trajectoryLogger.endTrajectory(trajectoryId, status, finalMetrics);
|
|
3537
|
-
|
|
1741
|
+
logger3.info({ trajectoryId, status }, "Ended autonomous tick trajectory");
|
|
3538
1742
|
}
|
|
3539
1743
|
async function loggedLLMCall(trajectoryLogger, trajectoryId, options, llmCallFn) {
|
|
3540
1744
|
const stepId = trajectoryLogger.getCurrentStepId(trajectoryId);
|
|
3541
1745
|
if (!stepId) {
|
|
3542
|
-
|
|
1746
|
+
logger3.warn({ trajectoryId }, "No active step for LLM call");
|
|
3543
1747
|
const result2 = await llmCallFn();
|
|
3544
1748
|
return result2.text;
|
|
3545
1749
|
}
|
|
@@ -3644,13 +1848,13 @@ class RewardService {
|
|
|
3644
1848
|
return (score + 1) / 2;
|
|
3645
1849
|
}
|
|
3646
1850
|
normalizeScoresForGroup(scores) {
|
|
3647
|
-
const
|
|
3648
|
-
const
|
|
3649
|
-
const range =
|
|
1851
|
+
const min = Math.min(...scores);
|
|
1852
|
+
const max = Math.max(...scores);
|
|
1853
|
+
const range = max - min;
|
|
3650
1854
|
if (range === 0) {
|
|
3651
1855
|
return scores.map(() => 0.5);
|
|
3652
1856
|
}
|
|
3653
|
-
return scores.map((s) => (s -
|
|
1857
|
+
return scores.map((s) => (s - min) / range);
|
|
3654
1858
|
}
|
|
3655
1859
|
}
|
|
3656
1860
|
function createRewardService(options = {}) {
|
|
@@ -3685,13 +1889,13 @@ var trajectoryLoggerPlugin = {
|
|
|
3685
1889
|
};
|
|
3686
1890
|
}
|
|
3687
1891
|
const meta = message.metadata;
|
|
3688
|
-
const
|
|
3689
|
-
if (!
|
|
1892
|
+
const logger4 = runtime.getService("trajectory_logger");
|
|
1893
|
+
if (!logger4)
|
|
3690
1894
|
return;
|
|
3691
1895
|
let trajectoryStepId = crypto.randomUUID();
|
|
3692
1896
|
meta.trajectoryStepId = trajectoryStepId;
|
|
3693
1897
|
try {
|
|
3694
|
-
const trajectoryId = await
|
|
1898
|
+
const trajectoryId = await logger4.startTrajectory(runtime.agentId, {
|
|
3695
1899
|
source: source ?? meta.source ?? "chat",
|
|
3696
1900
|
metadata: {
|
|
3697
1901
|
roomId: message.roomId,
|
|
@@ -3703,7 +1907,7 @@ var trajectoryLoggerPlugin = {
|
|
|
3703
1907
|
});
|
|
3704
1908
|
const normalizedTrajectoryId = typeof trajectoryId === "string" && trajectoryId.trim().length > 0 ? trajectoryId : null;
|
|
3705
1909
|
if (normalizedTrajectoryId) {
|
|
3706
|
-
const runtimeStepId =
|
|
1910
|
+
const runtimeStepId = logger4.startStep(normalizedTrajectoryId, {
|
|
3707
1911
|
timestamp: Date.now(),
|
|
3708
1912
|
agentBalance: 0,
|
|
3709
1913
|
agentPoints: 0,
|
|
@@ -3741,12 +1945,12 @@ var trajectoryLoggerPlugin = {
|
|
|
3741
1945
|
}
|
|
3742
1946
|
if (!trajectoryStepId)
|
|
3743
1947
|
return;
|
|
3744
|
-
const
|
|
3745
|
-
if (!
|
|
1948
|
+
const logger4 = runtime.getService("trajectory_logger");
|
|
1949
|
+
if (!logger4)
|
|
3746
1950
|
return;
|
|
3747
1951
|
try {
|
|
3748
1952
|
const endTarget = pendingTrajectoryEndTargetByStepId.get(trajectoryStepId) ?? trajectoryStepId;
|
|
3749
|
-
await
|
|
1953
|
+
await logger4.endTrajectory(endTarget, "completed");
|
|
3750
1954
|
} catch (err) {
|
|
3751
1955
|
runtime.logger?.warn({
|
|
3752
1956
|
err,
|
|
@@ -3803,4 +2007,4 @@ export {
|
|
|
3803
2007
|
RewardService
|
|
3804
2008
|
};
|
|
3805
2009
|
|
|
3806
|
-
//# debugId=
|
|
2010
|
+
//# debugId=C01EFBED6D31A62B64756E2164756E21
|