Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 90f802f

Browse files
author
Nir Hadassi
authored
fix: trim sequelize operation name (#47)
1 parent 2cb558e commit 90f802f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/plugin-sequelize/src/sequelize.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ class SequelizePlugin extends BasePlugin<typeof sequelize> {
2929
return original.apply(this, arguments);
3030
}
3131

32-
const statement = sql?.query ? sql.query : sql;
33-
const operation = option.type ?? (typeof statement === 'string' ? statement.split(' ')[0] : undefined);
32+
let statement = sql?.query ? sql.query : sql;
33+
let operation = option.type;
34+
35+
if (typeof statement === 'string') {
36+
statement = statement.trim();
37+
if (!operation) operation = statement.split(' ')[0];
38+
}
39+
3440
const sequelizeInstance: sequelize.Sequelize = this;
3541
const config = sequelizeInstance?.config;
3642

0 commit comments

Comments
 (0)