Skip to content

Commit 3e3759d

Browse files
authored
chore(force-release): release the version 7
2 parents 4b616f4 + 2626315 commit 3e3759d

24 files changed

+714
-167
lines changed

CHANGELOG.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# [7.0.0-beta.12](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.11...v7.0.0-beta.12) (2021-02-22)
2+
3+
4+
### Bug Fixes
5+
6+
* fix error when no foreign key is found but foreign and primary key is detected ([#632](https://github.com/ForestAdmin/forest-express-sequelize/issues/632)) ([6f06512](https://github.com/ForestAdmin/forest-express-sequelize/commit/6f0651264e28cb8259589f04f4c0a3eabcb59bb6))
7+
8+
# [7.0.0-beta.11](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.10...v7.0.0-beta.11) (2021-02-22)
9+
10+
11+
### Bug Fixes
12+
13+
* fix record creation with unconventional pk field acting as a fk ([#598](https://github.com/ForestAdmin/forest-express-sequelize/issues/598)) ([d3779b7](https://github.com/ForestAdmin/forest-express-sequelize/commit/d3779b75f553830574c51850dfdec5c6ab3eabc6))
14+
* support foreign and primary key column ([#630](https://github.com/ForestAdmin/forest-express-sequelize/issues/630)) ([2a289b8](https://github.com/ForestAdmin/forest-express-sequelize/commit/2a289b805727d51d112719ee29af28b7745bff73))
15+
* **search:** don't convert float values to bigint ([75c1517](https://github.com/ForestAdmin/forest-express-sequelize/commit/75c151720bb9c260272325f1f2c088b0c9050ac7))
16+
* **search:** handle large numbers in search queries ([c0c1c70](https://github.com/ForestAdmin/forest-express-sequelize/commit/c0c1c70686ecdaab9c9e6bbf432f44a414cf8c2e))
17+
* **search:** handle large numbers in search queries ([#621](https://github.com/ForestAdmin/forest-express-sequelize/issues/621)) ([ec6ab89](https://github.com/ForestAdmin/forest-express-sequelize/commit/ec6ab8989cde26af379f814fa7ee4bd28a1cddd6))
18+
* **search:** handle tables that contain floats and bigints ([7ac2fe1](https://github.com/ForestAdmin/forest-express-sequelize/commit/7ac2fe152ae01af98484d88e8c98c612bcb50573))
19+
* **search:** revert changes when numbers are below MAX_SAFE_INTEGER ([1d95021](https://github.com/ForestAdmin/forest-express-sequelize/commit/1d95021f55a64a519d71c301ceb810196abfdd34))
20+
121
## [6.7.11](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.7.10...v6.7.11) (2021-02-22)
222

323

@@ -30,12 +50,44 @@
3050
* **search:** handle tables that contain floats and bigints ([7ac2fe1](https://github.com/ForestAdmin/forest-express-sequelize/commit/7ac2fe152ae01af98484d88e8c98c612bcb50573))
3151
* **search:** revert changes when numbers are below MAX_SAFE_INTEGER ([1d95021](https://github.com/ForestAdmin/forest-express-sequelize/commit/1d95021f55a64a519d71c301ceb810196abfdd34))
3252

53+
# [7.0.0-beta.10](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.9...v7.0.0-beta.10) (2021-02-09)
54+
55+
### Bug Fixes
56+
57+
* array display with smart field ([#575](https://github.com/ForestAdmin/forest-express-sequelize/issues/575)) ([e0698d3](https://github.com/ForestAdmin/forest-express-sequelize/commit/e0698d30f9ae1a792a51b61bb74a8a29753d1317))
58+
* correctly set fields holding belongsTo relationships to null when updated with a null value ([#607](https://github.com/ForestAdmin/forest-express-sequelize/issues/607)) ([374151f](https://github.com/ForestAdmin/forest-express-sequelize/commit/374151fcfa7d3e70ce5817039749656250131e2f))
59+
* display correct reference field when it is a smartfield ([#584](https://github.com/ForestAdmin/forest-express-sequelize/issues/584)) ([50aef31](https://github.com/ForestAdmin/forest-express-sequelize/commit/50aef319977555c31f853d4436fcfa6694f85b26))
60+
* fix belongsTo relationships creation when creating a record ([#602](https://github.com/ForestAdmin/forest-express-sequelize/issues/602)) ([e06dbc8](https://github.com/ForestAdmin/forest-express-sequelize/commit/e06dbc831dddeffed8d13a8a942b3998ef2982bf))
61+
* fix related data list display ([#578](https://github.com/ForestAdmin/forest-express-sequelize/issues/578)) ([370dba7](https://github.com/ForestAdmin/forest-express-sequelize/commit/370dba7c0c60a64dad6688a54e62cc508e44b9b5))
62+
* fix unconventional pk when referenced as null on creation ([#608](https://github.com/ForestAdmin/forest-express-sequelize/issues/608)) ([af70d62](https://github.com/ForestAdmin/forest-express-sequelize/commit/af70d62d36052ab0b77295a581d82ae69068ccda))
63+
* handle foreign key toward non primary key ([#585](https://github.com/ForestAdmin/forest-express-sequelize/issues/585)) ([64c78c7](https://github.com/ForestAdmin/forest-express-sequelize/commit/64c78c7545bc03fa03984572b39cf6977e927f17))
64+
* secure sql queries generated by leaderboard stats ([#611](https://github.com/ForestAdmin/forest-express-sequelize/issues/611)) ([f41d79c](https://github.com/ForestAdmin/forest-express-sequelize/commit/f41d79c979b01a9d15e8354df94918e27faf9187))
65+
* **forestadmin-schema:** regenerate forestadmin schema only when files are valid ([#597](https://github.com/ForestAdmin/forest-express-sequelize/issues/597)) ([a24abbd](https://github.com/ForestAdmin/forest-express-sequelize/commit/a24abbdfd91c24aff87fc649e9889e5d88cef61d))
66+
* **leaderboard:** fix an error when use "user" table ([#565](https://github.com/ForestAdmin/forest-express-sequelize/issues/565)) ([0cbbc32](https://github.com/ForestAdmin/forest-express-sequelize/commit/0cbbc326b0f8ff686ed1e6b37dc719005e06866a))
67+
* **smart-action-hook:** value injected to an enum field of type is now correctly handled ([#600](https://github.com/ForestAdmin/forest-express-sequelize/issues/600)) ([c0a3b58](https://github.com/ForestAdmin/forest-express-sequelize/commit/c0a3b58dc272f91d1802fa00dca3b3c79ca56e01))
68+
69+
70+
### Features
71+
72+
* **filter:** add possibility to filter on smart field ([eaead56](https://github.com/ForestAdmin/forest-express-sequelize/commit/eaead56004a67edd4d266dc1583c43146ca393c3))
73+
* **filter:** add possibility to filter on smart field ([#583](https://github.com/ForestAdmin/forest-express-sequelize/issues/583)) ([dbf136a](https://github.com/ForestAdmin/forest-express-sequelize/commit/dbf136a2f8b1fd7b3694769792e9e15b4a93a6e4))
74+
* **smart actions:** introduce smart action forms hooks ([#569](https://github.com/ForestAdmin/forest-express-sequelize/issues/569)) ([cd13029](https://github.com/ForestAdmin/forest-express-sequelize/commit/cd13029551e6b6cbee0ecaed4c51d0bf44794e0a))
75+
3376
## [6.7.7](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.7.6...v6.7.7) (2021-02-05)
3477

3578

3679
### Bug Fixes
3780

38-
* secure sql queries generated by leaderboard stats ([#611](https://github.com/ForestAdmin/forest-express-sequelize/issues/611)) ([f41d79c](https://github.com/ForestAdmin/forest-express-sequelize/commit/f41d79c979b01a9d15e8354df94918e27faf9187))
81+
* secure sql queries generated by leaderboard stats ([#611](https://github.com/ForestAdmin/forest-express-sequelize/issues/611)) ([f41d79c](https://github.com/ForestAdmin/forest-express-sequelize/commit/f41d79c979b01a9d15e8354df94918e27faf9187
82+
))
83+
84+
# [7.0.0-beta.9](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.8...v7.0.0-beta.9) (2021-02-02)
85+
86+
87+
### Features
88+
89+
* return correct errors when the user needs to configure the 2FA ([#609](https://github.com/ForestAdmin/forest-express-sequelize/issues/609)) ([08b64a0](https://github.com/ForestAdmin/forest-express-sequelize/commit/08b64a038f2d9aef206710234d16d6e877274967))
90+
3991

4092
## [6.7.6](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.7.5...v6.7.6) (2021-02-02)
4193

@@ -87,6 +139,31 @@
87139
* **filter:** add possibility to filter on smart field ([eaead56](https://github.com/ForestAdmin/forest-express-sequelize/commit/eaead56004a67edd4d266dc1583c43146ca393c3))
88140
* **filter:** add possibility to filter on smart field ([#583](https://github.com/ForestAdmin/forest-express-sequelize/issues/583)) ([dbf136a](https://github.com/ForestAdmin/forest-express-sequelize/commit/dbf136a2f8b1fd7b3694769792e9e15b4a93a6e4))
89141

142+
# [7.0.0-beta.8](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.7...v7.0.0-beta.8) (2021-01-08)
143+
144+
145+
### Bug Fixes
146+
147+
* **authentication:** error when authenticating with an invalid token in cookies ([#593](https://github.com/ForestAdmin/forest-express-sequelize/issues/593)) ([405feb4](https://github.com/ForestAdmin/forest-express-sequelize/commit/405feb439e34746b385203eb995aec92e955eeab))
148+
149+
# [7.0.0-beta.7](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.6...v7.0.0-beta.7) (2021-01-06)
150+
151+
152+
### Bug Fixes
153+
154+
* user being disconnected after 33min instead of 14 days ([#591](https://github.com/ForestAdmin/forest-express-sequelize/issues/591)) ([2e2dc81](https://github.com/ForestAdmin/forest-express-sequelize/commit/2e2dc811f497acb0d771497c55b75349480e46a5))
155+
156+
# [7.0.0-beta.6](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.5...v7.0.0-beta.6) (2021-01-06)
157+
158+
159+
### Bug Fixes
160+
161+
* connect to liana through safari ([#590](https://github.com/ForestAdmin/forest-express-sequelize/issues/590)) ([6a0fcb3](https://github.com/ForestAdmin/forest-express-sequelize/commit/6a0fcb346c71f561e80b7d691f38774eaa8c24b9))
162+
163+
# [7.0.0-beta.5](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.4...v7.0.0-beta.5) (2020-12-30)
164+
165+
# [7.0.0-beta.4](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.3...v7.0.0-beta.4) (2020-12-23)
166+
90167
## [6.6.3](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.6.2...v6.6.3) (2020-12-21)
91168

92169

@@ -113,6 +190,7 @@
113190

114191
### Features
115192

193+
* **smart actions:** endpoint that handle forms' load hooks ([0902ef4](https://github.com/ForestAdmin/forest-express-sequelize/commit/0902ef458abf41efb25f0dc024549702a50645fe))
116194
* **smart actions:** introduce smart action forms hooks ([#569](https://github.com/ForestAdmin/forest-express-sequelize/issues/569)) ([cd13029](https://github.com/ForestAdmin/forest-express-sequelize/commit/cd13029551e6b6cbee0ecaed4c51d0bf44794e0a))
117195

118196
## [6.5.1](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.5.0...v6.5.1) (2020-12-09)
@@ -122,6 +200,21 @@
122200

123201
* **leaderboard:** fix an error when use "user" table ([#565](https://github.com/ForestAdmin/forest-express-sequelize/issues/565)) ([0cbbc32](https://github.com/ForestAdmin/forest-express-sequelize/commit/0cbbc326b0f8ff686ed1e6b37dc719005e06866a))
124202

203+
# [7.0.0-beta.3](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.2...v7.0.0-beta.3) (2020-12-02)
204+
205+
206+
### Bug Fixes
207+
208+
* always return primary keys of associated records ([#550](https://github.com/ForestAdmin/forest-express-sequelize/issues/550)) ([57bd84b](https://github.com/ForestAdmin/forest-express-sequelize/commit/57bd84bc992bbe5fd703b2e36c02bb431885535d))
209+
* export error handler middleware ([#552](https://github.com/ForestAdmin/forest-express-sequelize/issues/552)) ([a87591b](https://github.com/ForestAdmin/forest-express-sequelize/commit/a87591b8d5cffc5041fedcb654be2fadfb6dd78f))
210+
211+
# [7.0.0-beta.2](https://github.com/ForestAdmin/forest-express-sequelize/compare/v7.0.0-beta.1...v7.0.0-beta.2) (2020-11-30)
212+
213+
214+
### Bug Fixes
215+
216+
* fix incorrect usage of the new connections parameter ([#557](https://github.com/ForestAdmin/forest-express-sequelize/issues/557)) ([2840e41](https://github.com/ForestAdmin/forest-express-sequelize/commit/2840e418bb782a83b861dda217d45b3d70175253))
217+
125218
# [6.5.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.4.2...v6.5.0) (2020-11-27)
126219

127220

@@ -143,6 +236,20 @@
143236

144237
* always return primary keys of associated records ([#550](https://github.com/ForestAdmin/forest-express-sequelize/issues/550)) ([57bd84b](https://github.com/ForestAdmin/forest-express-sequelize/commit/57bd84bc992bbe5fd703b2e36c02bb431885535d))
145238

239+
# [7.0.0-beta.1](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.4.0...v7.0.0-beta.1) (2020-11-24)
240+
241+
242+
### Features
243+
244+
* init function now uses connections & objectMapping instead of sequelize as parameter ([#539](https://github.com/ForestAdmin/forest-express-sequelize/issues/539)) ([74262ac](https://github.com/ForestAdmin/forest-express-sequelize/commit/74262acfc7d77ce1e0aa1b2f44d3e69b7fce470a))
245+
246+
247+
### BREAKING CHANGES
248+
249+
* sequelize options is not supported anymore by Liana.init()
250+
connections and objectMapping is now required on Liana.init().
251+
Update forest-express dependency to 8.0.0-beta.1 (See https://github.com/ForestAdmin/forest-express/tree/v8.0.0-beta.1)
252+
146253
# [6.4.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v6.3.15...v6.4.0) (2020-11-17)
147254

148255

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "forest-express-sequelize",
33
"description": "Official Express/Sequelize Liana for Forest",
4-
"version": "6.7.11",
4+
"version": "7.0.0-beta.12",
55
"author": "Sandro Munda <[email protected]>",
66
"contributors": [
77
"Arnaud Besnier <[email protected]>",
@@ -27,7 +27,7 @@
2727
"@babel/runtime": "7.10.1",
2828
"bluebird": "2.9.25",
2929
"core-js": "3.6.5",
30-
"forest-express": "7.10.1",
30+
"forest-express": "8.0.0",
3131
"http-errors": "1.6.1",
3232
"lodash": "4.17.19",
3333
"moment": "2.19.4",

src/index.js

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const _ = require('lodash');
21
const P = require('bluebird');
32
const Interface = require('forest-express');
43
const orm = require('./utils/orm');
@@ -54,12 +53,18 @@ exports.PUBLIC_ROUTES = Interface.PUBLIC_ROUTES;
5453
exports.init = function init(opts) {
5554
exports.opts = opts;
5655

57-
// NOTICE: Ensure compatibility with the old middleware configuration.
58-
if (opts.sequelize && !('connections' in opts)) {
59-
opts.connections = [opts.sequelize];
60-
opts.sequelize = opts.sequelize.Sequelize;
56+
if (!opts.objectMapping) {
57+
Interface.logger.error('The objectMapping option appears to be missing. Please make sure it is set correctly.');
58+
return Promise.resolve(() => {});
6159
}
6260

61+
if (opts.sequelize) {
62+
Interface.logger.warn('The sequelize option is not supported anymore. Please remove this option.');
63+
}
64+
65+
opts.Sequelize = opts.objectMapping;
66+
opts.useMultipleDatabases = Object.keys(opts.connections).length > 1;
67+
6368
exports.getLianaName = function getLianaName() {
6469
return 'forest-express-sequelize';
6570
};
@@ -73,41 +78,17 @@ exports.init = function init(opts) {
7378
};
7479

7580
exports.getOrmVersion = function getOrmVersion() {
76-
if (!opts.sequelize) { return null; }
77-
78-
return orm.getVersion(opts.sequelize);
81+
return orm.getVersion(opts.Sequelize);
7982
};
8083

8184
exports.getDatabaseType = function getDatabaseType() {
82-
if (!opts.connections) { return null; }
85+
if (opts.useMultipleDatabases) return 'multiple';
8386

84-
return opts.connections[0].options.dialect;
87+
return Object.values(opts.connections)[0].options.dialect;
8588
};
8689

8790
exports.SchemaAdapter = SchemaAdapter;
8891

89-
exports.getModels = function getModels() {
90-
// NOTICE: The default Forest configuration detects all models.
91-
const detectAllModels = _.isEmpty(opts.includedModels) && _.isEmpty(opts.excludedModels);
92-
const models = {};
93-
94-
_.each(opts.connections, (connection) => {
95-
_.each(connection.models, (model) => {
96-
if (detectAllModels) {
97-
models[model.name] = model;
98-
} else if (!_.isEmpty(opts.includedModels)
99-
&& _.includes(opts.includedModels, model.name)) {
100-
models[model.name] = model;
101-
} else if (!_.isEmpty(opts.excludedModels)
102-
&& !_.includes(opts.excludedModels, model.name)) {
103-
models[model.name] = model;
104-
}
105-
});
106-
});
107-
108-
return models;
109-
};
110-
11192
exports.getModelName = function getModelName(model) {
11293
return model.name;
11394
};

src/services/apimap-field-builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const _ = require('lodash');
22
const ApimapFieldTypeDetector = require('./apimap-field-type-detector');
33

44
function ApimapFieldBuilder(model, column, options) {
5-
const DataTypes = options.sequelize;
5+
const DataTypes = options.Sequelize;
66

77
function isRequired() {
88
// eslint-disable-next-line

src/services/apimap-field-type-detector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function ApimapFieldTypeDetector(column, options) {
2-
const DataTypes = options.sequelize;
2+
const DataTypes = options.Sequelize;
33

44
this.perform = () => {
55
if (column.type instanceof DataTypes.STRING

src/services/filters-parser.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ function FiltersParser(modelSchema, timezone, options) {
1111
this.perform = async (filtersString) =>
1212
BaseFiltersParser.perform(filtersString, this.formatAggregation, this.formatCondition);
1313

14-
this.formatAggregation = async (aggregator, formatedConditions) => {
14+
this.formatAggregation = async (aggregator, formattedConditions) => {
1515
const aggregatorOperator = this.formatAggregatorOperator(aggregator);
16-
return { [aggregatorOperator]: formatedConditions };
16+
return { [aggregatorOperator]: formattedConditions };
1717
};
1818

1919
this.formatCondition = async (condition) => {
@@ -32,16 +32,19 @@ function FiltersParser(modelSchema, timezone, options) {
3232
return formattedCondition;
3333
}
3434

35-
const formatedField = this.formatField(condition.field);
35+
const formattedField = this.formatField(condition.field);
3636

3737
if (this.operatorDateParser.isDateOperator(condition.operator)) {
3838
return {
39-
[formatedField]: this.operatorDateParser.getDateFilter(condition.operator, condition.value),
39+
[formattedField]: this.operatorDateParser.getDateFilter(
40+
condition.operator,
41+
condition.value,
42+
),
4043
};
4144
}
4245

4346
return {
44-
[formatedField]: this.formatOperatorValue(condition.operator, condition.value, isTextField),
47+
[formattedField]: this.formatOperatorValue(condition.operator, condition.value, isTextField),
4548
};
4649
};
4750

src/services/leaderboard-stat-getter.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ function getAggregateField({
2121
* aggregate: string;
2222
* aggregate_field: string;
2323
* }} params
24-
* @param {*} options
2524
*/
26-
function LeaderboardStatGetter(model, modelRelationship, params, options) {
25+
function LeaderboardStatGetter(model, modelRelationship, params) {
2726
const labelField = params.label_field;
2827
const aggregate = params.aggregate.toUpperCase();
2928
const { limit } = params;
@@ -57,8 +56,8 @@ function LeaderboardStatGetter(model, modelRelationship, params, options) {
5756
.unscoped()
5857
.findAll({
5958
attributes: [
60-
[options.sequelize.col(groupBy), 'key'],
61-
[options.sequelize.fn(aggregate, options.sequelize.col(aggregateField)), 'value'],
59+
[model.sequelize.col(groupBy), 'key'],
60+
[model.sequelize.fn(aggregate, model.sequelize.col(aggregateField)), 'value'],
6261
],
6362
includeIgnoreAttributes: false,
6463
include: [{
@@ -69,7 +68,7 @@ function LeaderboardStatGetter(model, modelRelationship, params, options) {
6968
}],
7069
subQuery: false,
7170
group: groupBy,
72-
order: [[options.sequelize.literal('value'), 'DESC']],
71+
order: [[model.sequelize.literal('value'), 'DESC']],
7372
limit,
7473
raw: true,
7574
});

0 commit comments

Comments
 (0)