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

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,31 @@
1
+ ## [9.0.1](https://github.com/ForestAdmin/forest-express-sequelize/compare/v9.0.0...v9.0.1) (2022-11-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **types:** remove unused and incorrect exported type related to aggregation ([#1041](https://github.com/ForestAdmin/forest-express-sequelize/issues/1041)) ([9091a67](https://github.com/ForestAdmin/forest-express-sequelize/commit/9091a6714bc0716b21f309059e8e7fccfb9bc987))
7
+
8
+ # [9.0.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.5.14...v9.0.0) (2022-11-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **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))
14
+ * **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))
15
+
16
+
17
+ ### Features
18
+
19
+ * **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))
20
+ * **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))
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * **security:** drop support of projects that are not using roles
26
+
27
+ Co-authored-by: Guillaume Gautreau <guillaumeg@forestadmin.com>, Morgan Perre <morganperre@gmail.com>
28
+
1
29
  # [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
30
 
3
31
 
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.1",
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 () => {
package/types/index.d.ts CHANGED
@@ -213,16 +213,6 @@ export interface Filter {
213
213
  value: string;
214
214
  }
215
215
 
216
- export enum Aggregator {
217
- AND = 'and',
218
- OR = 'or'
219
- }
220
-
221
- export interface AggregatedFilters {
222
- aggregator: Aggregator;
223
- conditions: Filter[];
224
- }
225
-
226
216
  export interface Query {
227
217
  timezone?: string;
228
218
  search?: string;