forest-express-sequelize 8.2.9 → 8.3.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,10 @@
1
+ # [8.3.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.2.9...v8.3.0) (2021-09-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * **filter:** handle correctly uuid field type ([#835](https://github.com/ForestAdmin/forest-express-sequelize/issues/835)) ([92463c0](https://github.com/ForestAdmin/forest-express-sequelize/commit/92463c0adabfb1ca86eabeb18b14930995953caf))
7
+
1
8
  ## [8.2.9](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.2.8...v8.2.9) (2021-09-29)
2
9
 
3
10
 
@@ -4,7 +4,7 @@ function ApimapFieldTypeDetector(column, options) {
4
4
  const DataTypes = options.Sequelize;
5
5
 
6
6
  this.perform = function () {
7
- if (column.type instanceof DataTypes.STRING || column.type instanceof DataTypes.TEXT || column.type instanceof DataTypes.UUID || column.type instanceof DataTypes.UUIDV1 || column.type instanceof DataTypes.UUIDV4 || DataTypes.CITEXT && column.type instanceof DataTypes.CITEXT || column.type === 'citext') {
7
+ if (column.type instanceof DataTypes.STRING || column.type instanceof DataTypes.TEXT || DataTypes.CITEXT && column.type instanceof DataTypes.CITEXT || column.type === 'citext') {
8
8
  // TODO: Remove 'citext' once Sequelize 4 has been deprecated.
9
9
  return 'String';
10
10
  }
@@ -39,6 +39,10 @@ function ApimapFieldTypeDetector(column, options) {
39
39
 
40
40
  if (column.type instanceof DataTypes.GEOMETRY && column.type.type === 'POINT') {
41
41
  return 'Point';
42
+ }
43
+
44
+ if (column.type instanceof DataTypes.UUID || column.type instanceof DataTypes.UUIDV1 || column.type instanceof DataTypes.UUIDV4) {
45
+ return 'Uuid';
42
46
  } // NOTICE: Detect Array types (Array(String), Array(Integer), ...)
43
47
 
44
48
 
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": "8.2.9",
4
+ "version": "8.3.0",
5
5
  "author": "Sandro Munda <sandro@munda.me>",
6
6
  "contributors": [
7
7
  "Arnaud Besnier <arnaudibesnier@gmail.com>",
@@ -483,7 +483,7 @@ const user = { renderingId: 1 };
483
483
  expect(schema.fields[7].type).toStrictEqual('Date');
484
484
  expect(schema.fields[8].type).toStrictEqual('Date');
485
485
  expect(schema.fields[9].type).toStrictEqual('String');
486
- expect(schema.fields[10].type).toStrictEqual('String');
486
+ expect(schema.fields[10].type).toStrictEqual('Uuid');
487
487
  expect(schema.fields[11].type).toStrictEqual('Number');
488
488
  expect(schema.fields[12].type[0]).toStrictEqual('Number');
489
489
  expect(schema.fields[13].type[0]).toStrictEqual('Number');
@@ -38,10 +38,10 @@ describe('services > apimap-field-builder', () => {
38
38
  expect(uuid.field).toStrictEqual('uuid');
39
39
  });
40
40
 
41
- it('should have a String type', () => {
41
+ it('should have a Uuid type', () => {
42
42
  expect.assertions(1);
43
43
  const { uuid } = initializeField(fieldDefinitions);
44
- expect(uuid.type).toStrictEqual('String');
44
+ expect(uuid.type).toStrictEqual('Uuid');
45
45
  });
46
46
 
47
47
  it('should not be set as required', () => {