cozy-client 48.15.0 → 48.17.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.
@@ -2844,7 +2844,7 @@ var CozyClient = /*#__PURE__*/function () {
2844
2844
  CozyClient.hooks = CozyClient.hooks || {};
2845
2845
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2846
2846
 
2847
- CozyClient.version = "48.15.0";
2847
+ CozyClient.version = "48.17.0";
2848
2848
 
2849
2849
  _microee.default.mixin(CozyClient);
2850
2850
 
@@ -386,8 +386,10 @@ var executeQueryFromState = function executeQueryFromState(state, queryDefinitio
386
386
  };
387
387
  }
388
388
 
389
+ var sorter = makeSorterFromDefinition(queryDefinition);
390
+ var sortedDocuments = sorter(res);
389
391
  return {
390
- data: res
392
+ data: sortedDocuments
391
393
  };
392
394
  };
393
395
  /**
@@ -798,4 +798,26 @@ describe('execute query from state', () => {
798
798
  )
799
799
  expect(res2.data).toEqual(null)
800
800
  })
801
+
802
+ it('should get all the docs from state for the doctype and sort result', () => {
803
+ const query1 = {
804
+ doctype: 'io.cozy.files',
805
+ sort: [{ created_at: 'asc' }]
806
+ }
807
+
808
+ const res1 = executeQueryFromState(state, query1)
809
+ expect(res1.data[0]._id).toEqual('123')
810
+ expect(res1.data[1]._id).toEqual('456')
811
+ expect(res1.data[2]._id).toEqual('789')
812
+
813
+ const query2 = {
814
+ doctype: 'io.cozy.files',
815
+ sort: [{ created_at: 'desc' }]
816
+ }
817
+
818
+ const res2 = executeQueryFromState(state, query2)
819
+ expect(res2.data[0]._id).toEqual('789')
820
+ expect(res2.data[1]._id).toEqual('456')
821
+ expect(res2.data[2]._id).toEqual('123')
822
+ })
801
823
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "48.15.0",
3
+ "version": "48.17.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "@types/jest": "^26.0.20",
19
19
  "@types/lodash": "^4.14.170",
20
20
  "btoa": "^1.2.1",
21
- "cozy-stack-client": "^48.14.0",
21
+ "cozy-stack-client": "^48.16.0",
22
22
  "date-fns": "2.29.3",
23
23
  "json-stable-stringify": "^1.0.1",
24
24
  "lodash": "^4.17.13",
@@ -75,5 +75,5 @@
75
75
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
76
76
  },
77
77
  "sideEffects": false,
78
- "gitHead": "6e00bf0329e8a8cf406d718782e184885a016b35"
78
+ "gitHead": "7d67e27a397344b6e0293008b472ee3ae8a611fa"
79
79
  }