cozy-client 58.0.1 → 58.2.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 +17 -7
- package/dist/CozyClient.spec.js +1 -1
- package/dist/ObservableQuery.spec.js +1 -1
- package/dist/__tests__/utils.js +1 -1
- package/dist/associations/HasManyTriggers.spec.js +1 -1
- package/dist/associations.spec.js +1 -1
- package/dist/hooks/useQuery.spec.jsx +1 -1
- package/dist/index.js +12 -3
- package/dist/index.node.js +2 -2
- package/dist/links/DataProxyLink.js +152 -0
- package/dist/{StackLink.js → links/StackLink.js} +12 -12
- package/dist/{StackLink.spec.js → links/StackLink.spec.js} +3 -3
- package/dist/withMutation.spec.jsx +1 -1
- package/package.json +2 -2
- package/types/__tests__/utils.d.ts +1 -1
- package/types/index.d.ts +4 -3
- package/types/index.node.d.ts +2 -2
- package/types/links/DataProxyLink.d.ts +20 -0
- package/types/{StackLink.d.ts → links/StackLink.d.ts} +9 -9
- /package/dist/{CozyLink.js → links/CozyLink.js} +0 -0
- /package/dist/{CozyLink.spec.js → links/CozyLink.spec.js} +0 -0
- /package/dist/{WebFlagshipLink.js → links/WebFlagshipLink.js} +0 -0
- /package/dist/{__snapshots__ → links/__snapshots__}/CozyLink.spec.js.snap +0 -0
- /package/types/{CozyLink.d.ts → links/CozyLink.d.ts} +0 -0
- /package/types/{WebFlagshipLink.d.ts → links/WebFlagshipLink.d.ts} +0 -0
package/dist/CozyClient.js
CHANGED
|
@@ -47,7 +47,7 @@ var _cozyStackClient = _interopRequireWildcard(require("cozy-stack-client"));
|
|
|
47
47
|
|
|
48
48
|
var _const = require("./const");
|
|
49
49
|
|
|
50
|
-
var _StackLink = _interopRequireDefault(require("./StackLink"));
|
|
50
|
+
var _StackLink = _interopRequireDefault(require("./links/StackLink"));
|
|
51
51
|
|
|
52
52
|
var _associations = require("./associations");
|
|
53
53
|
|
|
@@ -67,7 +67,7 @@ var _policies = _interopRequireDefault(require("./policies"));
|
|
|
67
67
|
|
|
68
68
|
var _Schema = _interopRequireDefault(require("./Schema"));
|
|
69
69
|
|
|
70
|
-
var _CozyLink = require("./CozyLink");
|
|
70
|
+
var _CozyLink = require("./links/CozyLink");
|
|
71
71
|
|
|
72
72
|
var _ObservableQuery = _interopRequireDefault(require("./ObservableQuery"));
|
|
73
73
|
|
|
@@ -1630,7 +1630,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1630
1630
|
key: "requestQuery",
|
|
1631
1631
|
value: function () {
|
|
1632
1632
|
var _requestQuery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(definition, options) {
|
|
1633
|
-
var mainResponse, withIncluded;
|
|
1633
|
+
var mainResponse, schema, withIncluded;
|
|
1634
1634
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1635
1635
|
while (1) {
|
|
1636
1636
|
switch (_context11.prev = _context11.next) {
|
|
@@ -1652,14 +1652,24 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1652
1652
|
return _context11.abrupt("return", mainResponse);
|
|
1653
1653
|
|
|
1654
1654
|
case 7:
|
|
1655
|
-
|
|
1655
|
+
schema = this.schema.getDoctypeSchema(definition.doctype);
|
|
1656
|
+
|
|
1657
|
+
if (!schema.relationships) {
|
|
1658
|
+
_context11.next = 13;
|
|
1659
|
+
break;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
_context11.next = 11;
|
|
1656
1663
|
return this.fetchRelationships(mainResponse, this.getIncludesRelationships(definition));
|
|
1657
1664
|
|
|
1658
|
-
case
|
|
1665
|
+
case 11:
|
|
1659
1666
|
withIncluded = _context11.sent;
|
|
1660
1667
|
return _context11.abrupt("return", withIncluded);
|
|
1661
1668
|
|
|
1662
|
-
case
|
|
1669
|
+
case 13:
|
|
1670
|
+
return _context11.abrupt("return", mainResponse);
|
|
1671
|
+
|
|
1672
|
+
case 14:
|
|
1663
1673
|
case "end":
|
|
1664
1674
|
return _context11.stop();
|
|
1665
1675
|
}
|
|
@@ -3133,7 +3143,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
3133
3143
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
3134
3144
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
3135
3145
|
|
|
3136
|
-
CozyClient.version = "58.0
|
|
3146
|
+
CozyClient.version = "58.2.0";
|
|
3137
3147
|
|
|
3138
3148
|
_microee.default.mixin(CozyClient);
|
|
3139
3149
|
|
package/dist/CozyClient.spec.js
CHANGED
|
@@ -18,7 +18,7 @@ import { withIgnoreConsoleWarn } from './__tests__/console'
|
|
|
18
18
|
import CozyClient from './CozyClient'
|
|
19
19
|
import { Q } from './queries/dsl'
|
|
20
20
|
import CozyStackClient, { OAuthClient } from 'cozy-stack-client'
|
|
21
|
-
import CozyLink from './CozyLink'
|
|
21
|
+
import CozyLink from './links/CozyLink'
|
|
22
22
|
import { Mutations, QueryDefinition } from './queries/dsl'
|
|
23
23
|
import {
|
|
24
24
|
initQuery,
|
|
@@ -3,7 +3,7 @@ import omit from 'lodash/omit'
|
|
|
3
3
|
import { Q } from 'cozy-client'
|
|
4
4
|
|
|
5
5
|
import CozyClient from './CozyClient'
|
|
6
|
-
import CozyLink from './CozyLink'
|
|
6
|
+
import CozyLink from './links/CozyLink'
|
|
7
7
|
import ObservableQuery from './ObservableQuery'
|
|
8
8
|
import { initQuery, receiveQueryResult } from './store'
|
|
9
9
|
import { queryResultFromData } from './__tests__/utils'
|
package/dist/__tests__/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _redux = require("redux");
|
|
13
13
|
|
|
14
|
-
var _CozyLink = _interopRequireDefault(require("../CozyLink"));
|
|
14
|
+
var _CozyLink = _interopRequireDefault(require("../links/CozyLink"));
|
|
15
15
|
|
|
16
16
|
var _CozyClient = _interopRequireDefault(require("../CozyClient"));
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CozyClient from './CozyClient'
|
|
2
|
-
import CozyLink from './CozyLink'
|
|
2
|
+
import CozyLink from './links/CozyLink'
|
|
3
3
|
import { defaultPerformanceApi } from './performances/defaultPerformanceApi'
|
|
4
4
|
import { createStore, getQueryFromStore } from './store'
|
|
5
5
|
import { receiveQueryResult, initQuery } from './store/queries'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderHook } from '@testing-library/react-hooks'
|
|
2
2
|
|
|
3
3
|
import CozyClient from '../CozyClient'
|
|
4
|
-
import CozyLink from '../CozyLink'
|
|
4
|
+
import CozyLink from '../links/CozyLink'
|
|
5
5
|
import useQuery, { useQueries } from './useQuery'
|
|
6
6
|
import { Q } from '../queries/dsl'
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var _exportNames = {
|
|
|
11
11
|
CozyLink: true,
|
|
12
12
|
StackLink: true,
|
|
13
13
|
WebFlagshipLink: true,
|
|
14
|
+
DataProxyLink: true,
|
|
14
15
|
compose: true,
|
|
15
16
|
QueryDefinition: true,
|
|
16
17
|
Q: true,
|
|
@@ -86,6 +87,12 @@ Object.defineProperty(exports, "WebFlagshipLink", {
|
|
|
86
87
|
return _WebFlagshipLink.default;
|
|
87
88
|
}
|
|
88
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "DataProxyLink", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _DataProxyLink.default;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
89
96
|
Object.defineProperty(exports, "compose", {
|
|
90
97
|
enumerable: true,
|
|
91
98
|
get: function get() {
|
|
@@ -378,11 +385,13 @@ exports.models = exports.manifest = void 0;
|
|
|
378
385
|
|
|
379
386
|
var _CozyClient = _interopRequireDefault(require("./CozyClient"));
|
|
380
387
|
|
|
381
|
-
var _CozyLink = _interopRequireDefault(require("./CozyLink"));
|
|
388
|
+
var _CozyLink = _interopRequireDefault(require("./links/CozyLink"));
|
|
389
|
+
|
|
390
|
+
var _StackLink = _interopRequireDefault(require("./links/StackLink"));
|
|
382
391
|
|
|
383
|
-
var
|
|
392
|
+
var _WebFlagshipLink = _interopRequireDefault(require("./links/WebFlagshipLink"));
|
|
384
393
|
|
|
385
|
-
var
|
|
394
|
+
var _DataProxyLink = _interopRequireDefault(require("./links/DataProxyLink"));
|
|
386
395
|
|
|
387
396
|
var _flow = _interopRequireDefault(require("lodash/flow"));
|
|
388
397
|
|
package/dist/index.node.js
CHANGED
|
@@ -238,9 +238,9 @@ exports.models = exports.manifest = void 0;
|
|
|
238
238
|
|
|
239
239
|
var _CozyClient = _interopRequireDefault(require("./CozyClient"));
|
|
240
240
|
|
|
241
|
-
var _CozyLink = _interopRequireDefault(require("./CozyLink"));
|
|
241
|
+
var _CozyLink = _interopRequireDefault(require("./links/CozyLink"));
|
|
242
242
|
|
|
243
|
-
var _StackLink = _interopRequireDefault(require("./StackLink"));
|
|
243
|
+
var _StackLink = _interopRequireDefault(require("./links/StackLink"));
|
|
244
244
|
|
|
245
245
|
var _flow = _interopRequireDefault(require("lodash/flow"));
|
|
246
246
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _CozyLink2 = _interopRequireDefault(require("./CozyLink"));
|
|
25
|
+
|
|
26
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
27
|
+
|
|
28
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
+
|
|
30
|
+
var DataProxyLink = /*#__PURE__*/function (_CozyLink) {
|
|
31
|
+
(0, _inherits2.default)(DataProxyLink, _CozyLink);
|
|
32
|
+
|
|
33
|
+
var _super = _createSuper(DataProxyLink);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {object} [options] - Options
|
|
37
|
+
* @param {object} [options.dataproxy] - The dataproxy reference
|
|
38
|
+
*/
|
|
39
|
+
function DataProxyLink() {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
43
|
+
dataproxy = _ref.dataproxy;
|
|
44
|
+
|
|
45
|
+
(0, _classCallCheck2.default)(this, DataProxyLink);
|
|
46
|
+
_this = _super.call(this);
|
|
47
|
+
_this.dataproxy = dataproxy || null;
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
(0, _createClass2.default)(DataProxyLink, [{
|
|
52
|
+
key: "registerClient",
|
|
53
|
+
value: function registerClient(client) {// does nothing, we don't need any client for this kind of link
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* When the link is given to a cozy-client instance, the dataproxy might not be ready yet.
|
|
57
|
+
* Thus, this method will be typically called afterwards by the DataProxyProvider once
|
|
58
|
+
* the dataproxy is ready and set
|
|
59
|
+
*
|
|
60
|
+
* @param {object} dataproxy - The dataproxy instance
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
}, {
|
|
64
|
+
key: "registerDataProxy",
|
|
65
|
+
value: function registerDataProxy(dataproxy) {
|
|
66
|
+
this.dataproxy = dataproxy;
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "reset",
|
|
70
|
+
value: function () {
|
|
71
|
+
var _reset = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
72
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
73
|
+
while (1) {
|
|
74
|
+
switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
function reset() {
|
|
84
|
+
return _reset.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return reset;
|
|
88
|
+
}()
|
|
89
|
+
}, {
|
|
90
|
+
key: "request",
|
|
91
|
+
value: function () {
|
|
92
|
+
var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(operation, options, result, forward) {
|
|
93
|
+
var opts;
|
|
94
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
95
|
+
while (1) {
|
|
96
|
+
switch (_context2.prev = _context2.next) {
|
|
97
|
+
case 0:
|
|
98
|
+
if (!this.dataproxy) {
|
|
99
|
+
_context2.next = 5;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Send the request to the DataProxy, that will handle both web and mobile environments
|
|
104
|
+
opts = options || {};
|
|
105
|
+
return _context2.abrupt("return", this.dataproxy.requestLink(operation, opts));
|
|
106
|
+
|
|
107
|
+
case 5:
|
|
108
|
+
return _context2.abrupt("return", forward(operation, options));
|
|
109
|
+
|
|
110
|
+
case 6:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context2.stop();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, _callee2, this);
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
function request(_x, _x2, _x3, _x4) {
|
|
119
|
+
return _request.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return request;
|
|
123
|
+
}()
|
|
124
|
+
}, {
|
|
125
|
+
key: "persistCozyData",
|
|
126
|
+
value: function () {
|
|
127
|
+
var _persistCozyData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(data, forward) {
|
|
128
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
129
|
+
while (1) {
|
|
130
|
+
switch (_context3.prev = _context3.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
return _context3.abrupt("return");
|
|
133
|
+
|
|
134
|
+
case 1:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context3.stop();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, _callee3);
|
|
140
|
+
}));
|
|
141
|
+
|
|
142
|
+
function persistCozyData(_x5, _x6) {
|
|
143
|
+
return _persistCozyData.apply(this, arguments);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return persistCozyData;
|
|
147
|
+
}()
|
|
148
|
+
}]);
|
|
149
|
+
return DataProxyLink;
|
|
150
|
+
}(_CozyLink2.default);
|
|
151
|
+
|
|
152
|
+
exports.default = DataProxyLink;
|
|
@@ -27,19 +27,19 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
27
27
|
|
|
28
28
|
var _zipWith = _interopRequireDefault(require("lodash/zipWith"));
|
|
29
29
|
|
|
30
|
-
var _dsl = require("
|
|
30
|
+
var _dsl = require("../queries/dsl");
|
|
31
31
|
|
|
32
32
|
var _CozyLink2 = _interopRequireDefault(require("./CozyLink"));
|
|
33
33
|
|
|
34
|
-
var _const = require("
|
|
34
|
+
var _const = require("../const");
|
|
35
35
|
|
|
36
|
-
var _errors = require("
|
|
36
|
+
var _errors = require("../errors");
|
|
37
37
|
|
|
38
|
-
var _logger = _interopRequireDefault(require("
|
|
38
|
+
var _logger = _interopRequireDefault(require("../logger"));
|
|
39
39
|
|
|
40
|
-
var _utils = require("
|
|
40
|
+
var _utils = require("../utils");
|
|
41
41
|
|
|
42
|
-
var _defaultPerformanceApi = require("
|
|
42
|
+
var _defaultPerformanceApi = require("../performances/defaultPerformanceApi");
|
|
43
43
|
|
|
44
44
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
45
45
|
|
|
@@ -72,9 +72,9 @@ var hasFindOptions = function hasFindOptions(queryDefinition) {
|
|
|
72
72
|
*
|
|
73
73
|
* @private
|
|
74
74
|
*
|
|
75
|
-
* @param {import("
|
|
76
|
-
* @param {import("
|
|
77
|
-
* @returns {{ data: import("
|
|
75
|
+
* @param {import("../types").CouchDBBulkResult[]} bulkResponse - Response from bulk docs
|
|
76
|
+
* @param {import("../types").CozyClientDocument[]} originalDocuments - Documents that were updated
|
|
77
|
+
* @returns {{ data: import("../types").CozyClientDocument[] }} - Full documents with updated _id and _rev
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
80
|
|
|
@@ -101,7 +101,7 @@ var transformBulkDocsResponse = function transformBulkDocsResponse(bulkResponse,
|
|
|
101
101
|
* @property {object} [stackClient] - A StackClient
|
|
102
102
|
* @property {object} [client] - A StackClient (deprecated)
|
|
103
103
|
* @property {import('cozy-pouch-link/dist/types').LinkPlatform} [platform] - Platform specific adapters and methods
|
|
104
|
-
* @property {import('
|
|
104
|
+
* @property {import('../performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
|
|
105
105
|
*/
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -137,7 +137,7 @@ var StackLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
137
137
|
|
|
138
138
|
_this.stackClient = stackClient || client;
|
|
139
139
|
_this.isOnline = platform === null || platform === void 0 ? void 0 : platform.isOnline;
|
|
140
|
-
/** @type {import('
|
|
140
|
+
/** @type {import('../performances/types').PerformanceAPI} */
|
|
141
141
|
|
|
142
142
|
_this.performanceApi = performanceApi || _defaultPerformanceApi.defaultPerformanceApi;
|
|
143
143
|
return _this;
|
|
@@ -277,7 +277,7 @@ var StackLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
277
277
|
/**
|
|
278
278
|
*
|
|
279
279
|
* @param {QueryDefinition} query - Query to execute
|
|
280
|
-
* @returns {Promise<import("
|
|
280
|
+
* @returns {Promise<import("../types").ClientResponse>}
|
|
281
281
|
*/
|
|
282
282
|
|
|
283
283
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q } from '
|
|
2
|
-
import CozyClient from '
|
|
1
|
+
import { Q } from '../queries/dsl'
|
|
2
|
+
import CozyClient from '../CozyClient'
|
|
3
3
|
import StackLink, { transformBulkDocsResponse } from './StackLink'
|
|
4
|
-
import { SCHEMA } from '
|
|
4
|
+
import { SCHEMA } from '../__tests__/fixtures'
|
|
5
5
|
|
|
6
6
|
describe('StackLink', () => {
|
|
7
7
|
let stackClient, link, client
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { fireEvent, render } from '@testing-library/react'
|
|
3
3
|
|
|
4
4
|
import CozyClient from './CozyClient'
|
|
5
|
-
import CozyLink from './CozyLink'
|
|
5
|
+
import CozyLink from './links/CozyLink'
|
|
6
6
|
import withMutation from './withMutation'
|
|
7
7
|
import Provider from './Provider'
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "58.0
|
|
3
|
+
"version": "58.2.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": "3a6e5104325605d3d9c74ae5a1738e16289b659d"
|
|
78
78
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { default } from "./CozyClient";
|
|
2
|
-
export { default as CozyLink } from "./CozyLink";
|
|
3
|
-
export { default as StackLink } from "./StackLink";
|
|
4
|
-
export { default as WebFlagshipLink } from "./WebFlagshipLink";
|
|
2
|
+
export { default as CozyLink } from "./links/CozyLink";
|
|
3
|
+
export { default as StackLink } from "./links/StackLink";
|
|
4
|
+
export { default as WebFlagshipLink } from "./links/WebFlagshipLink";
|
|
5
|
+
export { default as DataProxyLink } from "./links/DataProxyLink";
|
|
5
6
|
export { default as compose } from "lodash/flow";
|
|
6
7
|
export { default as Registry } from "./registry";
|
|
7
8
|
export { default as RealTimeQueries } from "./RealTimeQueries";
|
package/types/index.node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default } from "./CozyClient";
|
|
2
|
-
export { default as CozyLink } from "./CozyLink";
|
|
3
|
-
export { default as StackLink } from "./StackLink";
|
|
2
|
+
export { default as CozyLink } from "./links/CozyLink";
|
|
3
|
+
export { default as StackLink } from "./links/StackLink";
|
|
4
4
|
export { default as compose } from "lodash/flow";
|
|
5
5
|
export { getReferencedBy } from "./associations/helpers";
|
|
6
6
|
export { cancelable } from "./utils";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default class DataProxyLink extends CozyLink {
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} [options] - Options
|
|
4
|
+
* @param {object} [options.dataproxy] - The dataproxy reference
|
|
5
|
+
*/
|
|
6
|
+
constructor({ dataproxy }?: {
|
|
7
|
+
dataproxy: object;
|
|
8
|
+
});
|
|
9
|
+
dataproxy: any;
|
|
10
|
+
registerClient(client: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* When the link is given to a cozy-client instance, the dataproxy might not be ready yet.
|
|
13
|
+
* Thus, this method will be typically called afterwards by the DataProxyProvider once
|
|
14
|
+
* the dataproxy is ready and set
|
|
15
|
+
*
|
|
16
|
+
* @param {object} dataproxy - The dataproxy instance
|
|
17
|
+
*/
|
|
18
|
+
registerDataProxy(dataproxy: object): void;
|
|
19
|
+
}
|
|
20
|
+
import CozyLink from "./CozyLink";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export function transformBulkDocsResponse(bulkResponse: import("
|
|
2
|
-
data: import("
|
|
1
|
+
export function transformBulkDocsResponse(bulkResponse: import("../types").CouchDBBulkResult[], originalDocuments: import("../types").CozyClientDocument[]): {
|
|
2
|
+
data: import("../types").CozyClientDocument[];
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {object} StackLinkOptions
|
|
6
6
|
* @property {object} [stackClient] - A StackClient
|
|
7
7
|
* @property {object} [client] - A StackClient (deprecated)
|
|
8
8
|
* @property {import('cozy-pouch-link/dist/types').LinkPlatform} [platform] - Platform specific adapters and methods
|
|
9
|
-
* @property {import('
|
|
9
|
+
* @property {import('../performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* Transfers queries and mutations to a remote stack
|
|
@@ -18,15 +18,15 @@ export default class StackLink extends CozyLink {
|
|
|
18
18
|
constructor({ client, stackClient, platform, performanceApi }?: StackLinkOptions);
|
|
19
19
|
stackClient: any;
|
|
20
20
|
isOnline: any;
|
|
21
|
-
/** @type {import('
|
|
22
|
-
performanceApi: import('
|
|
21
|
+
/** @type {import('../performances/types').PerformanceAPI} */
|
|
22
|
+
performanceApi: import('../performances/types').PerformanceAPI;
|
|
23
23
|
registerClient(client: any): void;
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* @param {QueryDefinition} query - Query to execute
|
|
27
|
-
* @returns {Promise<import("
|
|
27
|
+
* @returns {Promise<import("../types").ClientResponse>}
|
|
28
28
|
*/
|
|
29
|
-
executeQuery(query: QueryDefinition): Promise<import("
|
|
29
|
+
executeQuery(query: QueryDefinition): Promise<import("../types").ClientResponse>;
|
|
30
30
|
executeMutation(mutation: any, options: any, result: any, forward: any): Promise<any>;
|
|
31
31
|
}
|
|
32
32
|
export type StackLinkOptions = {
|
|
@@ -45,7 +45,7 @@ export type StackLinkOptions = {
|
|
|
45
45
|
/**
|
|
46
46
|
* - The performance API that can be used to measure performances
|
|
47
47
|
*/
|
|
48
|
-
performanceApi?: import('
|
|
48
|
+
performanceApi?: import('../performances/types').PerformanceAPI;
|
|
49
49
|
};
|
|
50
50
|
import CozyLink from "./CozyLink";
|
|
51
|
-
import { QueryDefinition } from "
|
|
51
|
+
import { QueryDefinition } from "../queries/dsl";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|