cozy-client 60.12.2 → 60.13.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/dist/CozyClient.js
CHANGED
|
@@ -3126,7 +3126,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
3126
3126
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
3127
3127
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
3128
3128
|
|
|
3129
|
-
CozyClient.version = "60.
|
|
3129
|
+
CozyClient.version = "60.13.0";
|
|
3130
3130
|
|
|
3131
3131
|
_microee.default.mixin(CozyClient);
|
|
3132
3132
|
|
package/dist/store/documents.js
CHANGED
|
@@ -31,7 +31,20 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
31
31
|
|
|
32
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// By default, deepmerge concatenate array values.
|
|
35
|
+
// We do not want concatenation and we do not know how to do partial updates
|
|
36
|
+
// so we decide to keep the array of the new data.
|
|
37
|
+
// In deepmerge semantics, source object is applied on target object
|
|
38
|
+
var replaceByClonedSource = function replaceByClonedSource(options) {
|
|
39
|
+
var clone = options.clone;
|
|
40
|
+
return function (target, source) {
|
|
41
|
+
return clone(source);
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var deepmergeFn = (0, _deepmerge.default)({
|
|
46
|
+
mergeArray: replaceByClonedSource
|
|
47
|
+
});
|
|
35
48
|
|
|
36
49
|
var storeDocument = function storeDocument(state, document) {
|
|
37
50
|
var type = document._type;
|
|
@@ -112,6 +112,78 @@ describe('extractAndMerge', () => {
|
|
|
112
112
|
expect(returnedDatas).toEqual(manuallyMergedData)
|
|
113
113
|
})
|
|
114
114
|
|
|
115
|
+
it('should select new value from data', () => {
|
|
116
|
+
const returnedDatas = extractAndMergeDocument(
|
|
117
|
+
// data
|
|
118
|
+
[
|
|
119
|
+
{
|
|
120
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
121
|
+
_type: 'io.cozy.files',
|
|
122
|
+
blibli: 'new value'
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
// updatedStateWithIncluded
|
|
126
|
+
{
|
|
127
|
+
'io.cozy.files': {
|
|
128
|
+
b6ff135b34e041ffb2d4a4865f3e235f: {
|
|
129
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
130
|
+
_type: 'io.cozy.files',
|
|
131
|
+
blibli: 'old value'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
const manuallyMergedData = {
|
|
138
|
+
'io.cozy.files': {
|
|
139
|
+
b6ff135b34e041ffb2d4a4865f3e235f: {
|
|
140
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
141
|
+
_type: 'io.cozy.files',
|
|
142
|
+
blibli: 'new value'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
expect(returnedDatas).toEqual(manuallyMergedData)
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('should not concatenate arrays', () => {
|
|
150
|
+
const returnedDatas = extractAndMergeDocument(
|
|
151
|
+
// data
|
|
152
|
+
[
|
|
153
|
+
{
|
|
154
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
155
|
+
_type: 'io.cozy.files',
|
|
156
|
+
blibli: 'a new field',
|
|
157
|
+
tags: ['b']
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
// updatedStateWithIncluded
|
|
161
|
+
{
|
|
162
|
+
'io.cozy.files': {
|
|
163
|
+
b6ff135b34e041ffb2d4a4865f3e235f: {
|
|
164
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
165
|
+
_type: 'io.cozy.files',
|
|
166
|
+
blublu: 'another new field',
|
|
167
|
+
tags: ['a']
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const manuallyMergedData = {
|
|
174
|
+
'io.cozy.files': {
|
|
175
|
+
b6ff135b34e041ffb2d4a4865f3e235f: {
|
|
176
|
+
_id: 'b6ff135b34e041ffb2d4a4865f3e235f',
|
|
177
|
+
_type: 'io.cozy.files',
|
|
178
|
+
blibli: 'a new field',
|
|
179
|
+
blublu: 'another new field',
|
|
180
|
+
tags: ['b']
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
expect(returnedDatas).toEqual(manuallyMergedData)
|
|
185
|
+
})
|
|
186
|
+
|
|
115
187
|
it(
|
|
116
188
|
'should assign a new object for doctype of document to update' +
|
|
117
189
|
'in order to allow selector to recompute their data when documents are updated',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "60.
|
|
3
|
+
"version": "60.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"react-native-ios11-devicecheck": "^0.0.3"
|
|
75
75
|
},
|
|
76
76
|
"sideEffects": false,
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "4f2002995a7e321591cbf56b4d4235cd062457ce"
|
|
78
78
|
}
|