@nocobase/database
Advanced tools
Comparing version 0.5.0-alpha.20 to 0.5.0-alpha.21
@@ -178,3 +178,2 @@ "use strict"; | ||
const state = this.hookTypes.get(hookType); | ||
console.log('sequelize.addHook', event, hookType); | ||
this.sequelize.addHook(hookType, (...args) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -181,0 +180,0 @@ var _a, _b, _c, _d, _e, _f; |
@@ -35,3 +35,3 @@ import { Model as SequelizeModel, ProjectionAlias, SaveOptions } from 'sequelize'; | ||
get database(): Database; | ||
static withCountAttribute(options?: string | WithCountAttributeOptions): (string | ProjectionAlias); | ||
static withCountAttribute(options?: string | WithCountAttributeOptions): string | ProjectionAlias; | ||
static selectQuery(options?: {}): string; | ||
@@ -38,0 +38,0 @@ static parseApiJson(options: ApiJsonOptions): any; |
@@ -75,19 +75,31 @@ "use strict"; | ||
})); | ||
op.set('$includes', value => ({ | ||
[sequelize_1.Op.iLike]: `%${value}%` | ||
op.set('$includes', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.iLike : sequelize_1.Op.like]: `%${value}%` | ||
})); | ||
op.set('$notIncludes', value => ({ | ||
[sequelize_1.Op.notILike]: `%${value}%` | ||
op.set('$notIncludes', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.notILike : sequelize_1.Op.notLike]: `%${value}%` | ||
})); | ||
op.set('$startsWith', value => ({ | ||
[sequelize_1.Op.iLike]: `${value}%` | ||
op.set('$startsWith', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.iLike : sequelize_1.Op.like]: `${value}%` | ||
})); | ||
op.set('$notStartsWith', value => ({ | ||
[sequelize_1.Op.notILike]: `${value}%` | ||
op.set('$notStartsWith', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.notILike : sequelize_1.Op.notLike]: `${value}%` | ||
})); | ||
op.set('$endsWith', value => ({ | ||
[sequelize_1.Op.iLike]: `%${value}` | ||
op.set('$endsWith', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.iLike : sequelize_1.Op.like]: `%${value}` | ||
})); | ||
op.set('$notEndsWith', value => ({ | ||
[sequelize_1.Op.notILike]: `%${value}` | ||
op.set('$notEndsWith', (value, { | ||
dialect | ||
}) => ({ | ||
[dialect === 'postgres' ? sequelize_1.Op.notILike : sequelize_1.Op.notLike]: `%${value}` | ||
})); | ||
@@ -149,3 +161,2 @@ op.set('$dateOn', value => ({ | ||
const sql = values.map(value => `(${column})::jsonb @> '${JSON.stringify(value)}'`).join(' OR '); | ||
console.log(sql); | ||
return sequelize_1.Sequelize.literal(sql); | ||
@@ -171,3 +182,2 @@ }); | ||
const sql = values.map(value => `(${column})::jsonb @> '${JSON.stringify(value)}'`).join(' OR '); | ||
console.log(sql); | ||
return sequelize_1.Sequelize.literal(`not (${sql})`); | ||
@@ -218,3 +228,2 @@ }); | ||
exports.default = Operator; | ||
; | ||
//# sourceMappingURL=op.js.map |
@@ -17,3 +17,3 @@ import { InitOptions, ModelAttributes, ModelOptions, ModelIndexesOptions, SyncOptions } from 'sequelize'; | ||
} | ||
export interface TabelContext { | ||
export interface TableContext { | ||
database: Database; | ||
@@ -36,3 +36,3 @@ } | ||
get sortable(): boolean; | ||
constructor(options: TableOptions, context: TabelContext); | ||
constructor(options: TableOptions, context: TableContext); | ||
initSortable(): void; | ||
@@ -39,0 +39,0 @@ modelInit(reinitialize?: Reinitialize): void; |
@@ -307,4 +307,14 @@ "use strict"; | ||
for (const key in fields) { | ||
this.addField(fields[key], false); | ||
var _iterator3 = _createForOfIteratorHelper(fields), | ||
_step3; | ||
try { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | ||
const filed = _step3.value; | ||
this.addField(filed, false); | ||
} | ||
} catch (err) { | ||
_iterator3.e(err); | ||
} finally { | ||
_iterator3.f(); | ||
} | ||
@@ -423,14 +433,14 @@ | ||
var _iterator3 = _createForOfIteratorHelper(this.getRelatedTableNames()), | ||
_step3; | ||
var _iterator4 = _createForOfIteratorHelper(this.getRelatedTableNames()), | ||
_step4; | ||
try { | ||
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { | ||
const name = _step3.value; | ||
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { | ||
const name = _step4.value; | ||
tables.push(name); | ||
} | ||
} catch (err) { | ||
_iterator3.e(err); | ||
_iterator4.e(err); | ||
} finally { | ||
_iterator3.f(); | ||
_iterator4.f(); | ||
} | ||
@@ -437,0 +447,0 @@ |
@@ -106,2 +106,3 @@ "use strict"; | ||
database, | ||
dialect: database.sequelize.getDialect(), | ||
fieldPath: name ? `${name}.${prefix}` : prefix | ||
@@ -108,0 +109,0 @@ }); |
{ | ||
"name": "@nocobase/database", | ||
"version": "0.5.0-alpha.20", | ||
"version": "0.5.0-alpha.21", | ||
"description": "", | ||
@@ -13,3 +13,3 @@ "main": "./lib/index.js", | ||
"glob": "^7.1.6", | ||
"sequelize": "^6.3.3" | ||
"sequelize": "6.7.0" | ||
}, | ||
@@ -21,3 +21,3 @@ "repository": { | ||
}, | ||
"gitHead": "d80c875d5e3acacf2f682c954f3b6e63c0386340" | ||
"gitHead": "181872cf075dd9e65f9f2ff0d1ff18c541e0d7cd" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
414461
4014
+ Addedany-promise@1.3.0(transitive)
+ Addedinflection@1.13.1(transitive)
+ Addedretry-as-promised@3.2.0(transitive)
+ Addedsequelize@6.7.0(transitive)
+ Addedsequelize-pool@6.1.0(transitive)
- Removed@types/debug@4.1.12(transitive)
- Removed@types/ms@0.7.34(transitive)
- Removed@types/validator@13.12.2(transitive)
- Removedinflection@1.13.4(transitive)
- Removedpg-connection-string@2.7.0(transitive)
- Removedretry-as-promised@7.0.4(transitive)
- Removedsequelize@6.37.5(transitive)
- Removedsequelize-pool@7.1.0(transitive)
Updatedsequelize@6.7.0