cozy-client 57.3.0 → 57.5.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 +38 -23
- package/dist/hooks/useQuery.js +1 -0
- package/dist/storage.js +205 -0
- package/dist/storage.spec.js +31 -0
- package/package.json +4 -4
- package/types/models/paper.d.ts +1 -1
- package/types/performances/types.d.ts +1 -1
- package/types/registry.d.ts +1 -1
- package/types/storage.d.ts +48 -0
- package/types/types.d.ts +7 -7
package/dist/CozyClient.js
CHANGED
|
@@ -85,6 +85,8 @@ var _promiseCache = _interopRequireDefault(require("./promise-cache"));
|
|
|
85
85
|
|
|
86
86
|
var _flagshipCertification = require("./flagship-certification/flagship-certification");
|
|
87
87
|
|
|
88
|
+
var _storage = require("./storage");
|
|
89
|
+
|
|
88
90
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
89
91
|
|
|
90
92
|
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; }
|
|
@@ -1618,7 +1620,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1618
1620
|
case 2:
|
|
1619
1621
|
mainResponse = _context11.sent;
|
|
1620
1622
|
_context11.next = 5;
|
|
1621
|
-
return
|
|
1623
|
+
return (0, _storage.persistVirtualDocuments)(this, definition, mainResponse.data);
|
|
1622
1624
|
|
|
1623
1625
|
case 5:
|
|
1624
1626
|
if (definition.includes) {
|
|
@@ -1662,7 +1664,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1662
1664
|
key: "persistVirtualDocuments",
|
|
1663
1665
|
value: function () {
|
|
1664
1666
|
var _persistVirtualDocuments = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(definition, data) {
|
|
1665
|
-
var enforceList, enforce, _iterator5, _step5, _document;
|
|
1667
|
+
var enforceList, enforce, documentsToPersist, _iterator5, _step5, _document;
|
|
1666
1668
|
|
|
1667
1669
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1668
1670
|
while (1) {
|
|
@@ -1697,52 +1699,65 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1697
1699
|
return this.persistVirtualDocument(data, enforce);
|
|
1698
1700
|
|
|
1699
1701
|
case 9:
|
|
1700
|
-
_context12.next =
|
|
1702
|
+
_context12.next = 29;
|
|
1701
1703
|
break;
|
|
1702
1704
|
|
|
1703
1705
|
case 11:
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
+
documentsToPersist = data.filter(function (document) {
|
|
1707
|
+
var _document$meta;
|
|
1708
|
+
|
|
1709
|
+
if (!document || document.cozyLocalOnly) {
|
|
1710
|
+
return false;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
if (!((_document$meta = document.meta) !== null && _document$meta !== void 0 && _document$meta.rev) && !document._rev || enforce) {
|
|
1714
|
+
return true;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
return false;
|
|
1718
|
+
});
|
|
1719
|
+
_iterator5 = _createForOfIteratorHelper(documentsToPersist);
|
|
1720
|
+
_context12.prev = 13;
|
|
1706
1721
|
|
|
1707
1722
|
_iterator5.s();
|
|
1708
1723
|
|
|
1709
|
-
case
|
|
1724
|
+
case 15:
|
|
1710
1725
|
if ((_step5 = _iterator5.n()).done) {
|
|
1711
|
-
_context12.next =
|
|
1726
|
+
_context12.next = 21;
|
|
1712
1727
|
break;
|
|
1713
1728
|
}
|
|
1714
1729
|
|
|
1715
1730
|
_document = _step5.value;
|
|
1716
|
-
_context12.next =
|
|
1731
|
+
_context12.next = 19;
|
|
1717
1732
|
return this.persistVirtualDocument(_document, enforce);
|
|
1718
1733
|
|
|
1719
|
-
case
|
|
1720
|
-
_context12.next =
|
|
1734
|
+
case 19:
|
|
1735
|
+
_context12.next = 15;
|
|
1721
1736
|
break;
|
|
1722
1737
|
|
|
1723
|
-
case
|
|
1724
|
-
_context12.next =
|
|
1738
|
+
case 21:
|
|
1739
|
+
_context12.next = 26;
|
|
1725
1740
|
break;
|
|
1726
1741
|
|
|
1727
|
-
case
|
|
1728
|
-
_context12.prev =
|
|
1729
|
-
_context12.t0 = _context12["catch"](
|
|
1742
|
+
case 23:
|
|
1743
|
+
_context12.prev = 23;
|
|
1744
|
+
_context12.t0 = _context12["catch"](13);
|
|
1730
1745
|
|
|
1731
1746
|
_iterator5.e(_context12.t0);
|
|
1732
1747
|
|
|
1733
|
-
case
|
|
1734
|
-
_context12.prev =
|
|
1748
|
+
case 26:
|
|
1749
|
+
_context12.prev = 26;
|
|
1735
1750
|
|
|
1736
1751
|
_iterator5.f();
|
|
1737
1752
|
|
|
1738
|
-
return _context12.finish(
|
|
1753
|
+
return _context12.finish(26);
|
|
1739
1754
|
|
|
1740
|
-
case
|
|
1755
|
+
case 29:
|
|
1741
1756
|
case "end":
|
|
1742
1757
|
return _context12.stop();
|
|
1743
1758
|
}
|
|
1744
1759
|
}
|
|
1745
|
-
}, _callee12, this, [[
|
|
1760
|
+
}, _callee12, this, [[13, 23, 26, 29]]);
|
|
1746
1761
|
}));
|
|
1747
1762
|
|
|
1748
1763
|
function persistVirtualDocuments(_x14, _x15) {
|
|
@@ -1764,7 +1779,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1764
1779
|
key: "persistVirtualDocument",
|
|
1765
1780
|
value: function () {
|
|
1766
1781
|
var _persistVirtualDocument = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(document, enforce) {
|
|
1767
|
-
var _document$
|
|
1782
|
+
var _document$meta2;
|
|
1768
1783
|
|
|
1769
1784
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1770
1785
|
while (1) {
|
|
@@ -1778,7 +1793,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1778
1793
|
return _context13.abrupt("return");
|
|
1779
1794
|
|
|
1780
1795
|
case 2:
|
|
1781
|
-
if (!(!((_document$
|
|
1796
|
+
if (!(!((_document$meta2 = document.meta) !== null && _document$meta2 !== void 0 && _document$meta2.rev) && !document._rev || enforce)) {
|
|
1782
1797
|
_context13.next = 5;
|
|
1783
1798
|
break;
|
|
1784
1799
|
}
|
|
@@ -3097,7 +3112,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
3097
3112
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
3098
3113
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
3099
3114
|
|
|
3100
|
-
CozyClient.version = "57.
|
|
3115
|
+
CozyClient.version = "57.5.0";
|
|
3101
3116
|
|
|
3102
3117
|
_microee.default.mixin(CozyClient);
|
|
3103
3118
|
|
package/dist/hooks/useQuery.js
CHANGED
|
@@ -29,6 +29,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
+
// @ts-ignore We use our own store in with Redux
|
|
32
33
|
var useSelector = (0, _reactRedux.createSelectorHook)(_context.clientContext);
|
|
33
34
|
|
|
34
35
|
var resolveToValue = function resolveToValue(fnOrValue) {
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.persistVirtualDocuments = exports.shouldDocumentBePersisted = exports.shouldEnforcePersist = exports.ENFORCE_LIST = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _CozyClient = _interopRequireDefault(require("./CozyClient"));
|
|
15
|
+
|
|
16
|
+
var _dsl = require("./queries/dsl");
|
|
17
|
+
|
|
18
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
|
+
|
|
24
|
+
var ENFORCE_LIST = ['io.cozy.files.shortcuts'];
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {import("./types").CozyClientDocument} CozyClientDocument
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
exports.ENFORCE_LIST = ENFORCE_LIST;
|
|
30
|
+
|
|
31
|
+
var shouldEnforcePersist = function shouldEnforcePersist(definition) {
|
|
32
|
+
return ENFORCE_LIST.includes(definition.doctype);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Whether or not a document should be locally persisted
|
|
36
|
+
*
|
|
37
|
+
* @param {CozyClientDocument} document - The document to evaluate
|
|
38
|
+
* @returns {boolean} whether or not the doc should be persisted
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.shouldEnforcePersist = shouldEnforcePersist;
|
|
43
|
+
|
|
44
|
+
var shouldDocumentBePersisted = function shouldDocumentBePersisted(document) {
|
|
45
|
+
var _document$meta;
|
|
46
|
+
|
|
47
|
+
var shouldEnforce = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
48
|
+
|
|
49
|
+
if (!document || document.cozyLocalOnly) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!((_document$meta = document.meta) !== null && _document$meta !== void 0 && _document$meta.rev) && !document._rev || shouldEnforce) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Save the document or array of documents into the persisted storage (if any)
|
|
61
|
+
*
|
|
62
|
+
* @param {CozyClient} client - Cozy client instance
|
|
63
|
+
* @param {QueryDefinition} definition - The query definition
|
|
64
|
+
* @param {CozyClientDocument | Array<CozyClientDocument>} data - Document or array of documents to be saved
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
exports.shouldDocumentBePersisted = shouldDocumentBePersisted;
|
|
70
|
+
|
|
71
|
+
var persistVirtualDocuments = /*#__PURE__*/function () {
|
|
72
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(client, definition, data) {
|
|
73
|
+
var enforce, documentsToPersist, _iterator, _step, document;
|
|
74
|
+
|
|
75
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
76
|
+
while (1) {
|
|
77
|
+
switch (_context.prev = _context.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
enforce = shouldEnforcePersist(definition);
|
|
80
|
+
|
|
81
|
+
if (!(definition.doctype === 'io.cozy.apps_registry')) {
|
|
82
|
+
_context.next = 5;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_context.next = 4;
|
|
87
|
+
return persistVirtualDocument(client, {
|
|
88
|
+
_type: 'io.cozy.apps_registry',
|
|
89
|
+
_id: definition.id,
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
cozyPouchData: data
|
|
92
|
+
}, enforce);
|
|
93
|
+
|
|
94
|
+
case 4:
|
|
95
|
+
return _context.abrupt("return", _context.sent);
|
|
96
|
+
|
|
97
|
+
case 5:
|
|
98
|
+
if (Array.isArray(data)) {
|
|
99
|
+
_context.next = 10;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
_context.next = 8;
|
|
104
|
+
return persistVirtualDocument(client, data, enforce);
|
|
105
|
+
|
|
106
|
+
case 8:
|
|
107
|
+
_context.next = 28;
|
|
108
|
+
break;
|
|
109
|
+
|
|
110
|
+
case 10:
|
|
111
|
+
documentsToPersist = data.filter(function (document) {
|
|
112
|
+
return shouldDocumentBePersisted(document, enforce);
|
|
113
|
+
});
|
|
114
|
+
_iterator = _createForOfIteratorHelper(documentsToPersist);
|
|
115
|
+
_context.prev = 12;
|
|
116
|
+
|
|
117
|
+
_iterator.s();
|
|
118
|
+
|
|
119
|
+
case 14:
|
|
120
|
+
if ((_step = _iterator.n()).done) {
|
|
121
|
+
_context.next = 20;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
document = _step.value;
|
|
126
|
+
_context.next = 18;
|
|
127
|
+
return persistVirtualDocument(client, document, enforce);
|
|
128
|
+
|
|
129
|
+
case 18:
|
|
130
|
+
_context.next = 14;
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
case 20:
|
|
134
|
+
_context.next = 25;
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
case 22:
|
|
138
|
+
_context.prev = 22;
|
|
139
|
+
_context.t0 = _context["catch"](12);
|
|
140
|
+
|
|
141
|
+
_iterator.e(_context.t0);
|
|
142
|
+
|
|
143
|
+
case 25:
|
|
144
|
+
_context.prev = 25;
|
|
145
|
+
|
|
146
|
+
_iterator.f();
|
|
147
|
+
|
|
148
|
+
return _context.finish(25);
|
|
149
|
+
|
|
150
|
+
case 28:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context.stop();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, _callee, null, [[12, 22, 25, 28]]);
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
return function persistVirtualDocuments(_x, _x2, _x3) {
|
|
159
|
+
return _ref.apply(this, arguments);
|
|
160
|
+
};
|
|
161
|
+
}();
|
|
162
|
+
/**
|
|
163
|
+
* Save the document or array of documents into the persisted storage (if any)
|
|
164
|
+
*
|
|
165
|
+
* This relies on the fact that there are some "virtual" documents returned
|
|
166
|
+
* by the stack, in the sense that they are not CouchDB documents, but rather
|
|
167
|
+
* are computed on the fly by the server.
|
|
168
|
+
* To ensure we can use those documents locally, i.e. without the stack,
|
|
169
|
+
* we allow the possibility to persist them.
|
|
170
|
+
*
|
|
171
|
+
* @param {CozyClient} client - Cozy client instance
|
|
172
|
+
* @param {CozyClientDocument} document - Document to be saved
|
|
173
|
+
* @param {boolean} enforce - When true, save the document no matter its content
|
|
174
|
+
* @returns {Promise<void>}
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
exports.persistVirtualDocuments = persistVirtualDocuments;
|
|
179
|
+
|
|
180
|
+
var persistVirtualDocument = /*#__PURE__*/function () {
|
|
181
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(client, document, enforce) {
|
|
182
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
183
|
+
while (1) {
|
|
184
|
+
switch (_context2.prev = _context2.next) {
|
|
185
|
+
case 0:
|
|
186
|
+
if (!shouldDocumentBePersisted(document, enforce)) {
|
|
187
|
+
_context2.next = 3;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
_context2.next = 3;
|
|
192
|
+
return client.chain.persistCozyData(document);
|
|
193
|
+
|
|
194
|
+
case 3:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context2.stop();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, _callee2);
|
|
200
|
+
}));
|
|
201
|
+
|
|
202
|
+
return function persistVirtualDocument(_x4, _x5, _x6) {
|
|
203
|
+
return _ref2.apply(this, arguments);
|
|
204
|
+
};
|
|
205
|
+
}();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { shouldDocumentBePersisted } from './storage'
|
|
2
|
+
|
|
3
|
+
const BASE_DOC = {
|
|
4
|
+
_id: '123',
|
|
5
|
+
name: 'saymy'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
describe('shouldDocumentBePersisted', () => {
|
|
9
|
+
it('should not persist a doc with cozyLocalOnly flag', () => {
|
|
10
|
+
const doc = { ...BASE_DOC, cozyLocalOnly: true }
|
|
11
|
+
expect(shouldDocumentBePersisted(doc)).toBe(false)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('should not persist a doc with rev', () => {
|
|
15
|
+
const doc1 = { ...BASE_DOC, _rev: '123' }
|
|
16
|
+
expect(shouldDocumentBePersisted(doc1)).toBe(false)
|
|
17
|
+
|
|
18
|
+
const doc2 = { ...BASE_DOC, meta: { rev: '123' } }
|
|
19
|
+
expect(shouldDocumentBePersisted(doc2)).toBe(false)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('should persist if we enforce it', () => {
|
|
23
|
+
const doc = { ...BASE_DOC, _rev: '123' }
|
|
24
|
+
expect(shouldDocumentBePersisted(doc, true)).toBe(true)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('should persist if there is not revision', () => {
|
|
28
|
+
const doc = { ...BASE_DOC }
|
|
29
|
+
expect(shouldDocumentBePersisted(doc)).toBe(true)
|
|
30
|
+
})
|
|
31
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "57.
|
|
3
|
+
"version": "57.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"cozy-logger": ">1.7.0",
|
|
70
70
|
"react": "^16.7.0",
|
|
71
71
|
"react-native": "^0.65.0",
|
|
72
|
-
"react-native-google-play-integrity": "
|
|
72
|
+
"react-native-google-play-integrity": "^1.1.0",
|
|
73
73
|
"react-native-inappbrowser-reborn": "^3.5.1",
|
|
74
|
-
"react-native-ios11-devicecheck": "
|
|
74
|
+
"react-native-ios11-devicecheck": "^0.0.3"
|
|
75
75
|
},
|
|
76
76
|
"sideEffects": false,
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "1244b5d668b419f7c10e7474160211b3ec6bbe41"
|
|
78
78
|
}
|
package/types/models/paper.d.ts
CHANGED
|
@@ -59,4 +59,4 @@ export function makeExpirationDescription(expirationDate: string, { lang }: {
|
|
|
59
59
|
}): string;
|
|
60
60
|
export function isForeignPaper(file: IOCozyFile): boolean;
|
|
61
61
|
export type IOCozyFile = import("../types").CozyClientDocument & import("../types").FileDocument;
|
|
62
|
-
export type MetadataQualificationType = "
|
|
62
|
+
export type MetadataQualificationType = "date" | "contact" | "information" | "other" | "bills";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare var _default: {};
|
|
2
2
|
export default _default;
|
|
3
|
-
export type MeasureColor = "
|
|
3
|
+
export type MeasureColor = "primary" | "primary-light" | "primary-dark" | "secondary" | "secondary-light" | "secondary-dark" | "tertiary" | "tertiary-light" | "tertiary-dark" | "error";
|
|
4
4
|
export type MeasureOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* - Mark name used as the start point for performance measurement
|
package/types/registry.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type RegistryApp = {
|
|
|
7
7
|
installed: boolean;
|
|
8
8
|
type: string;
|
|
9
9
|
};
|
|
10
|
-
export type RegistryAppChannel = "
|
|
10
|
+
export type RegistryAppChannel = "dev" | "beta" | "stable";
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {object} RegistryApp
|
|
13
13
|
* @property {string} slug
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const ENFORCE_LIST: string[];
|
|
2
|
+
export function shouldEnforcePersist(definition: any): boolean;
|
|
3
|
+
export function shouldDocumentBePersisted(document: CozyClientDocument, shouldEnforce?: boolean): boolean;
|
|
4
|
+
export function persistVirtualDocuments(client: CozyClient, definition: QueryDefinition, data: CozyClientDocument | Array<CozyClientDocument>): Promise<void>;
|
|
5
|
+
export type CozyClientDocument = {
|
|
6
|
+
/**
|
|
7
|
+
* - Id of the document
|
|
8
|
+
*/
|
|
9
|
+
_id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* - Id of the document
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* - Type of the document
|
|
16
|
+
*/
|
|
17
|
+
_type?: string;
|
|
18
|
+
/**
|
|
19
|
+
* - Current revision of the document
|
|
20
|
+
*/
|
|
21
|
+
_rev?: string;
|
|
22
|
+
/**
|
|
23
|
+
* - When the document has been deleted
|
|
24
|
+
*/
|
|
25
|
+
_deleted?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* - Relationships of the document
|
|
28
|
+
*/
|
|
29
|
+
relationships?: import("./types").ReferencedByRelationship;
|
|
30
|
+
/**
|
|
31
|
+
* - referenced by of another document
|
|
32
|
+
*/
|
|
33
|
+
referenced_by?: import("./types").Reference[];
|
|
34
|
+
/**
|
|
35
|
+
* - Cozy Metadata
|
|
36
|
+
*/
|
|
37
|
+
cozyMetadata?: import("./types").CozyMetadata;
|
|
38
|
+
/**
|
|
39
|
+
* - Pouch Metadata
|
|
40
|
+
*/
|
|
41
|
+
meta?: import("./types").CozyClientDocumentMeta;
|
|
42
|
+
/**
|
|
43
|
+
* - When true the document should NOT be replicated to the remote database
|
|
44
|
+
*/
|
|
45
|
+
cozyLocalOnly?: boolean;
|
|
46
|
+
};
|
|
47
|
+
import CozyClient from "./CozyClient";
|
|
48
|
+
import { QueryDefinition } from "./queries/dsl";
|
package/types/types.d.ts
CHANGED
|
@@ -479,7 +479,7 @@ export type ManifestFields = {
|
|
|
479
479
|
};
|
|
480
480
|
export type OldCozyClient = any;
|
|
481
481
|
export type NodeEnvironment = any;
|
|
482
|
-
export type QueryFetchStatus = "
|
|
482
|
+
export type QueryFetchStatus = "loading" | "loaded" | "pending" | "failed";
|
|
483
483
|
export type QueriesStateSlice = {
|
|
484
484
|
[x: string]: QueryState;
|
|
485
485
|
};
|
|
@@ -1414,7 +1414,7 @@ export type CouchDBBulkResult = {
|
|
|
1414
1414
|
};
|
|
1415
1415
|
export type ViewKey = string | string[];
|
|
1416
1416
|
export type DocId = string;
|
|
1417
|
-
export type CouchDBViewCursor = [
|
|
1417
|
+
export type CouchDBViewCursor = [ViewKey, string];
|
|
1418
1418
|
export type Theme = {
|
|
1419
1419
|
id: string;
|
|
1420
1420
|
label: string;
|
|
@@ -1423,7 +1423,7 @@ export type Theme = {
|
|
|
1423
1423
|
defaultItems?: Array<string>;
|
|
1424
1424
|
};
|
|
1425
1425
|
export type ThemesList = Theme[];
|
|
1426
|
-
export type ThemesLabels = "
|
|
1426
|
+
export type ThemesLabels = "identity" | "family" | "transport" | "health" | "invoice" | "home" | "work_study" | "finance" | "others";
|
|
1427
1427
|
export type QualificationAttributes = {
|
|
1428
1428
|
label: string;
|
|
1429
1429
|
purpose?: string;
|
|
@@ -1433,7 +1433,7 @@ export type QualificationAttributes = {
|
|
|
1433
1433
|
};
|
|
1434
1434
|
export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "electoral_card" | "citizen_registration_certificate" | "personal_sporting_licence" | "note_identity_document";
|
|
1435
1435
|
export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "single_parent_benefit" | "payment_proof_family_allowance" | "person_insurance" | "note_family_document";
|
|
1436
|
-
export type WorkStudyLabels = "
|
|
1436
|
+
export type WorkStudyLabels = "diploma" | "work_contract" | "pay_sheet" | "employment_center_certificate" | "unemployment_benefit" | "pension" | "gradebook" | "student_card" | "resume" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate" | "school_insurance_certificate" | "expense_claim" | "note_work_document";
|
|
1437
1437
|
export type HealthLabels = "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "note_health_document";
|
|
1438
1438
|
export type HomeLabels = "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "unfit_for_habitation_declaration" | "accommodation_proof" | "real_estate_insurance" | "condition_report" | "note_house_document";
|
|
1439
1439
|
export type TransportLabels = "driver_license" | "transport_card" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "note_transport_document";
|
|
@@ -1441,8 +1441,8 @@ export type FinanceLabels = "pay_sheet" | "single_parent_benefit" | "other_reven
|
|
|
1441
1441
|
export type InvoiceLabels = "health_invoice" | "transport_invoice" | "work_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "energy_contract" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "grocery_invoice" | "other_invoice" | "expense_claim" | "note_invoice";
|
|
1442
1442
|
export type ActivityLabels = "fidelity_card" | "personal_sporting_licence" | "other_activity_document" | "note_activity_document";
|
|
1443
1443
|
export type OthersLabels = "other_administrative_document" | "note_other";
|
|
1444
|
-
export type ItemsLabels = "
|
|
1445
|
-
export type iconPeopleLabels = "
|
|
1444
|
+
export type ItemsLabels = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "fidelity_card" | "single_parent_benefit" | "transport_card" | "electoral_card" | "employment_center_certificate" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "resume" | "motivation_letter" | "other_work_document" | "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "house_sale_agreeement" | "real_estate_tax" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "energy_contract" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "grocery_invoice" | "other_invoice" | "tax_certificate" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "school_attendance_certificate" | "school_insurance_certificate" | "unfit_for_habitation_declaration" | "accommodation_proof" | "citizen_registration_certificate" | "personal_sporting_licence" | "other_activity_document" | "real_estate_insurance" | "person_insurance" | "other_administrative_document" | "expense_claim" | "fine" | "condition_report" | "note_identity_document" | "note_family_document" | "note_work_document" | "note_health_document" | "note_house_document" | "note_transport_document" | "note_activity_document" | "note_finance" | "note_invoice" | "note_other";
|
|
1445
|
+
export type iconPeopleLabels = "national_id_card" | "other_identity_document" | "resume" | "work_disability_recognition";
|
|
1446
1446
|
export type iconWorkLabels = "work_contract" | "employment_center_certificate" | "unemployment_benefit" | "student_card" | "motivation_letter" | "other_work_document" | "school_attendance_certificate" | "school_insurance_certificate";
|
|
1447
1447
|
export type iconJusticeLabels = "fine";
|
|
1448
1448
|
export type iconGlobeLabels = "residence_permit";
|
|
@@ -1472,7 +1472,7 @@ export type iconFitnessLabels = "personal_sporting_licence" | "other_activity_do
|
|
|
1472
1472
|
export type iconHeartLabels = "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "person_insurance";
|
|
1473
1473
|
export type iconExchangeLabels = "bank_statement";
|
|
1474
1474
|
export type iconFileTypeNoteLabels = "note_identity_document" | "note_family_document" | "note_work_document" | "note_health_document" | "note_house_document" | "note_transport_document" | "note_activity_document" | "note_finance" | "note_invoice";
|
|
1475
|
-
export type IconQualificationLabels = "
|
|
1475
|
+
export type IconQualificationLabels = "work" | "car" | "telecom" | "water" | "bank" | "child" | "bank-check" | "benefit" | "bill" | "email" | "euro" | "exchange" | "file-type-note" | "fitness" | "globe" | "gouv" | "heart" | "home" | "image" | "justice" | "laudry" | "lightning" | "people" | "plane" | "remboursement" | "restaurant" | "school" | "shop" | "team" | "telephone";
|
|
1476
1476
|
export type iconLabelPairs = {
|
|
1477
1477
|
icon: IconQualificationLabels;
|
|
1478
1478
|
labels: Array<string>;
|