forest-express-sequelize 9.0.0-beta.4 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [9.0.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.5.14...v9.0.0) (2022-11-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **chart:** improve security on chart and rename charts' properties ([#1027](https://github.com/ForestAdmin/forest-express-sequelize/issues/1027)) ([2e4c54e](https://github.com/ForestAdmin/forest-express-sequelize/commit/2e4c54e4b66295451e97c873b3cfa3043e1864e3))
7
+ * **security:** validate that smart action approvals are launched with the same parameters than the initial trigger ([#1026](https://github.com/ForestAdmin/forest-express-sequelize/issues/1026)) ([928865e](https://github.com/ForestAdmin/forest-express-sequelize/commit/928865e9299d1ef9680e9b33ce33ecd8f4c9d077))
8
+
9
+
10
+ ### Features
11
+
12
+ * **chart:** add support for context variables inside SQL query ([#1028](https://github.com/ForestAdmin/forest-express-sequelize/issues/1028)) ([6bf678e](https://github.com/ForestAdmin/forest-express-sequelize/commit/6bf678ead766a202908c0bf8f5376e9c45d9ef6f))
13
+ * **chart:** add support for context variables used by Workspaces ([#1029](https://github.com/ForestAdmin/forest-express-sequelize/issues/1029)) ([dc3009a](https://github.com/ForestAdmin/forest-express-sequelize/commit/dc3009acf395292cf28a8d7b481d36f78bb9d829))
14
+
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * **security:** drop support of projects that are not using roles
19
+
20
+ Co-authored-by: Guillaume Gautreau <guillaumeg@forestadmin.com>, Morgan Perre <morganperre@gmail.com>
21
+
1
22
  # [9.0.0-beta.4](https://github.com/ForestAdmin/forest-express-sequelize/compare/v9.0.0-beta.3...v9.0.0-beta.4) (2022-11-09)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forest-express-sequelize",
3
3
  "description": "Official Express/Sequelize Liana for Forest",
4
- "version": "9.0.0-beta.4",
4
+ "version": "9.0.0",
5
5
  "author": "Sandro Munda <sandro@munda.me>",
6
6
  "contributors": [
7
7
  "Arnaud Besnier <arnaudibesnier@gmail.com>",
@@ -17,6 +17,7 @@ const BelongsToUpdater = require('../src/services/belongs-to-updater');
17
17
  const ResourceRemover = require('../src/services/resource-remover');
18
18
  const HasManyGetter = require('../src/services/has-many-getter');
19
19
  const HasManyDissociator = require('../src/services/has-many-dissociator');
20
+ const QueryStatGetter = require('../src/services/query-stat-getter');
20
21
 
21
22
  const baseParams = { timezone: 'Europe/Paris' };
22
23
  const user = { renderingId: 1 };
@@ -798,6 +799,28 @@ const user = { renderingId: 1 };
798
799
  });
799
800
  });
800
801
 
802
+ describe('stats > query stat getter', () => {
803
+ it('should give correct answer with recordId filtering', async () => {
804
+ expect.assertions(2);
805
+ const { options } = initializeSequelize();
806
+
807
+ try {
808
+ const contextVariables = { recordId: 102 };
809
+ // eslint-disable-next-line jest/no-if
810
+ const escapeQuote = connectionManager === sequelizePostgres ? '"' : '`';
811
+ const stat = await new QueryStatGetter({
812
+ contextVariables,
813
+ query: `SELECT count(*) as value FROM ${escapeQuote}users${escapeQuote} WHERE ${escapeQuote}primaryId${escapeQuote} != ?`,
814
+ }, options).perform();
815
+
816
+ expect(stat).toHaveLength(1);
817
+ expect(`${stat[0].value}`).toStrictEqual('2');
818
+ } finally {
819
+ connectionManager.closeConnection();
820
+ }
821
+ });
822
+ });
823
+
801
824
  describe('resources > resources creator', () => {
802
825
  describe('create a record on a simple collection', () => {
803
826
  it('should create a record', async () => {