cozy-client 24.9.0 → 24.10.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 +38 -0
- package/dist/CozyClient.js +12 -8
- package/dist/CozyClient.spec.js +15 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [24.10.1](https://github.com/cozy/cozy-client/compare/v24.10.0...v24.10.1) (2021-10-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cozy-client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [24.10.0](https://github.com/cozy/cozy-client/compare/v24.9.2...v24.10.0) (2021-10-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package cozy-client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [24.9.2](https://github.com/cozy/cozy-client/compare/v24.9.1...v24.9.2) (2021-10-01)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* Save also normalize _type like create ([cdbbd9f](https://github.com/cozy/cozy-client/commit/cdbbd9fd4ead453f67462992c5e8cfff4794165e))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [24.9.1](https://github.com/cozy/cozy-client/compare/v24.9.0...v24.9.1) (2021-09-23)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* Revert open upgrade ([6c945a5](https://github.com/cozy/cozy-client/commit/6c945a5ef8c286f546f4343df075cc73e6d3416c))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
6
44
|
# [24.9.0](https://github.com/cozy/cozy-client/compare/v24.8.1...v24.9.0) (2021-09-22)
|
|
7
45
|
|
|
8
46
|
|
package/dist/CozyClient.js
CHANGED
|
@@ -790,6 +790,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
790
790
|
value: function () {
|
|
791
791
|
var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(doc) {
|
|
792
792
|
var mutationOptions,
|
|
793
|
+
normalizedDoc,
|
|
793
794
|
ret,
|
|
794
795
|
_args5 = arguments;
|
|
795
796
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
@@ -797,23 +798,26 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
797
798
|
switch (_context5.prev = _context5.next) {
|
|
798
799
|
case 0:
|
|
799
800
|
mutationOptions = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
800
|
-
|
|
801
|
-
|
|
801
|
+
normalizedDoc = _objectSpread({
|
|
802
|
+
_type: doc.type
|
|
803
|
+
}, doc);
|
|
804
|
+
_context5.next = 4;
|
|
805
|
+
return this.schema.validate(normalizedDoc);
|
|
802
806
|
|
|
803
|
-
case
|
|
807
|
+
case 4:
|
|
804
808
|
ret = _context5.sent;
|
|
805
809
|
|
|
806
810
|
if (!(ret !== true)) {
|
|
807
|
-
_context5.next =
|
|
811
|
+
_context5.next = 7;
|
|
808
812
|
break;
|
|
809
813
|
}
|
|
810
814
|
|
|
811
815
|
throw new Error('Validation failed');
|
|
812
816
|
|
|
813
|
-
case 6:
|
|
814
|
-
return _context5.abrupt("return", this.mutate(this.getDocumentSavePlan(doc), mutationOptions));
|
|
815
|
-
|
|
816
817
|
case 7:
|
|
818
|
+
return _context5.abrupt("return", this.mutate(this.getDocumentSavePlan(normalizedDoc), mutationOptions));
|
|
819
|
+
|
|
820
|
+
case 8:
|
|
817
821
|
case "end":
|
|
818
822
|
return _context5.stop();
|
|
819
823
|
}
|
|
@@ -2386,7 +2390,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2386
2390
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2387
2391
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2388
2392
|
|
|
2389
|
-
CozyClient.version = "24.
|
|
2393
|
+
CozyClient.version = "24.10.1";
|
|
2390
2394
|
|
|
2391
2395
|
_microee.default.mixin(CozyClient);
|
|
2392
2396
|
|
package/dist/CozyClient.spec.js
CHANGED
|
@@ -676,6 +676,21 @@ describe('CozyClient', () => {
|
|
|
676
676
|
})
|
|
677
677
|
|
|
678
678
|
describe('save', () => {
|
|
679
|
+
it('should add the _type if not present', async () => {
|
|
680
|
+
const todo = { type: 'io.cozy.todos', label: 'Buy croissants' }
|
|
681
|
+
client.store.dispatch.mockReset()
|
|
682
|
+
await client.save(todo)
|
|
683
|
+
const dispatchCalls = client.store.dispatch.mock.calls
|
|
684
|
+
expect(dispatchCalls.slice(-2)[0][0]).toMatchObject({
|
|
685
|
+
definition: expect.objectContaining({
|
|
686
|
+
document: expect.objectContaining({
|
|
687
|
+
label: 'Buy croissants',
|
|
688
|
+
_type: 'io.cozy.todos'
|
|
689
|
+
}),
|
|
690
|
+
mutationType: 'CREATE_DOCUMENT'
|
|
691
|
+
})
|
|
692
|
+
})
|
|
693
|
+
})
|
|
679
694
|
it('should mutate the document', async () => {
|
|
680
695
|
client.setData(
|
|
681
696
|
normalizeData({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"cozy-device-helper": "^1.12.0",
|
|
22
22
|
"cozy-flags": "2.7.1",
|
|
23
23
|
"cozy-logger": "^1.6.0",
|
|
24
|
-
"cozy-stack-client": "^24.
|
|
24
|
+
"cozy-stack-client": "^24.10.1",
|
|
25
25
|
"json-stable-stringify": "^1.0.1",
|
|
26
26
|
"lodash": "^4.17.13",
|
|
27
27
|
"microee": "^0.0.6",
|
|
28
28
|
"node-fetch": "^2.6.1",
|
|
29
|
-
"open": "
|
|
29
|
+
"open": "7.4.2",
|
|
30
30
|
"prop-types": "^15.6.2",
|
|
31
31
|
"react-redux": "^7.2.0",
|
|
32
32
|
"redux": "3 || 4",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"react-native-inappbrowser-reborn": "^3.5.1"
|
|
69
69
|
},
|
|
70
70
|
"sideEffects": false,
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "4e753659c09433fe20e0f9d788df6a09ddd66fe7"
|
|
72
72
|
}
|