cozy-client 53.1.0 → 53.1.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/dist/CozyClient.js +116 -67
- package/package.json +2 -2
- package/types/CozyClient.d.ts +1 -1
package/dist/CozyClient.js
CHANGED
|
@@ -2728,35 +2728,84 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2728
2728
|
|
|
2729
2729
|
}, {
|
|
2730
2730
|
key: "setLinks",
|
|
2731
|
-
value: function
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2731
|
+
value: function () {
|
|
2732
|
+
var _setLinks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(links) {
|
|
2733
|
+
var _iterator7, _step7, link;
|
|
2734
|
+
|
|
2735
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
2736
|
+
while (1) {
|
|
2737
|
+
switch (_context21.prev = _context21.next) {
|
|
2738
|
+
case 0:
|
|
2739
|
+
this.links = links ? links : [new _StackLink.default({
|
|
2740
|
+
performanceApi: this.performanceApi
|
|
2741
|
+
})];
|
|
2742
|
+
this.registerClientOnLinks();
|
|
2743
|
+
this.chain = (0, _CozyLink.chain)(this.links);
|
|
2744
|
+
|
|
2745
|
+
if (!this.isLogged) {
|
|
2746
|
+
_context21.next = 22;
|
|
2747
|
+
break;
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
// If the client is already logged, it means this method is called manually, after
|
|
2751
|
+
// a client instanciation.
|
|
2752
|
+
// Thus, we call the link's onLogin methods
|
|
2753
|
+
_iterator7 = _createForOfIteratorHelper(this.links);
|
|
2754
|
+
_context21.prev = 5;
|
|
2755
|
+
|
|
2756
|
+
_iterator7.s();
|
|
2757
|
+
|
|
2758
|
+
case 7:
|
|
2759
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
2760
|
+
_context21.next = 14;
|
|
2761
|
+
break;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
link = _step7.value;
|
|
2765
|
+
|
|
2766
|
+
if (!link.onLogin) {
|
|
2767
|
+
_context21.next = 12;
|
|
2768
|
+
break;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
_context21.next = 12;
|
|
2772
|
+
return link.onLogin();
|
|
2773
|
+
|
|
2774
|
+
case 12:
|
|
2775
|
+
_context21.next = 7;
|
|
2776
|
+
break;
|
|
2777
|
+
|
|
2778
|
+
case 14:
|
|
2779
|
+
_context21.next = 19;
|
|
2780
|
+
break;
|
|
2781
|
+
|
|
2782
|
+
case 16:
|
|
2783
|
+
_context21.prev = 16;
|
|
2784
|
+
_context21.t0 = _context21["catch"](5);
|
|
2785
|
+
|
|
2786
|
+
_iterator7.e(_context21.t0);
|
|
2787
|
+
|
|
2788
|
+
case 19:
|
|
2789
|
+
_context21.prev = 19;
|
|
2790
|
+
|
|
2791
|
+
_iterator7.f();
|
|
2792
|
+
|
|
2793
|
+
return _context21.finish(19);
|
|
2794
|
+
|
|
2795
|
+
case 22:
|
|
2796
|
+
case "end":
|
|
2797
|
+
return _context21.stop();
|
|
2751
2798
|
}
|
|
2752
2799
|
}
|
|
2753
|
-
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2800
|
+
}, _callee21, this, [[5, 16, 19, 22]]);
|
|
2801
|
+
}));
|
|
2802
|
+
|
|
2803
|
+
function setLinks(_x23) {
|
|
2804
|
+
return _setLinks.apply(this, arguments);
|
|
2758
2805
|
}
|
|
2759
|
-
|
|
2806
|
+
|
|
2807
|
+
return setLinks;
|
|
2808
|
+
}()
|
|
2760
2809
|
/**
|
|
2761
2810
|
* Query the cozy-app settings corresponding to the given slug and
|
|
2762
2811
|
* extract the value corresponding to the given `key`
|
|
@@ -2771,22 +2820,22 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2771
2820
|
}, {
|
|
2772
2821
|
key: "getSettings",
|
|
2773
2822
|
value: function () {
|
|
2774
|
-
var _getSettings2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2775
|
-
return _regenerator.default.wrap(function
|
|
2823
|
+
var _getSettings2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(slug, keys) {
|
|
2824
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
2776
2825
|
while (1) {
|
|
2777
|
-
switch (
|
|
2826
|
+
switch (_context22.prev = _context22.next) {
|
|
2778
2827
|
case 0:
|
|
2779
|
-
return
|
|
2828
|
+
return _context22.abrupt("return", (0, _helpers2.getSettings)(this, slug, keys));
|
|
2780
2829
|
|
|
2781
2830
|
case 1:
|
|
2782
2831
|
case "end":
|
|
2783
|
-
return
|
|
2832
|
+
return _context22.stop();
|
|
2784
2833
|
}
|
|
2785
2834
|
}
|
|
2786
|
-
},
|
|
2835
|
+
}, _callee22, this);
|
|
2787
2836
|
}));
|
|
2788
2837
|
|
|
2789
|
-
function getSettings(
|
|
2838
|
+
function getSettings(_x24, _x25) {
|
|
2790
2839
|
return _getSettings2.apply(this, arguments);
|
|
2791
2840
|
}
|
|
2792
2841
|
|
|
@@ -2809,22 +2858,22 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2809
2858
|
}, {
|
|
2810
2859
|
key: "saveAfterFetchSettings",
|
|
2811
2860
|
value: function () {
|
|
2812
|
-
var _saveAfterFetchSettings2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2813
|
-
return _regenerator.default.wrap(function
|
|
2861
|
+
var _saveAfterFetchSettings2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(slug, itemsOrSetter, setterKeys) {
|
|
2862
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
2814
2863
|
while (1) {
|
|
2815
|
-
switch (
|
|
2864
|
+
switch (_context23.prev = _context23.next) {
|
|
2816
2865
|
case 0:
|
|
2817
|
-
return
|
|
2866
|
+
return _context23.abrupt("return", (0, _helpers2.saveAfterFetchSettings)(this, slug, itemsOrSetter, setterKeys));
|
|
2818
2867
|
|
|
2819
2868
|
case 1:
|
|
2820
2869
|
case "end":
|
|
2821
|
-
return
|
|
2870
|
+
return _context23.stop();
|
|
2822
2871
|
}
|
|
2823
2872
|
}
|
|
2824
|
-
},
|
|
2873
|
+
}, _callee23, this);
|
|
2825
2874
|
}));
|
|
2826
2875
|
|
|
2827
|
-
function saveAfterFetchSettings(
|
|
2876
|
+
function saveAfterFetchSettings(_x26, _x27, _x28) {
|
|
2828
2877
|
return _saveAfterFetchSettings2.apply(this, arguments);
|
|
2829
2878
|
}
|
|
2830
2879
|
|
|
@@ -2842,46 +2891,46 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2842
2891
|
}, {
|
|
2843
2892
|
key: "resetQuery",
|
|
2844
2893
|
value: function () {
|
|
2845
|
-
var _resetQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2894
|
+
var _resetQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(queryId) {
|
|
2846
2895
|
var query;
|
|
2847
|
-
return _regenerator.default.wrap(function
|
|
2896
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
2848
2897
|
while (1) {
|
|
2849
|
-
switch (
|
|
2898
|
+
switch (_context24.prev = _context24.next) {
|
|
2850
2899
|
case 0:
|
|
2851
|
-
|
|
2900
|
+
_context24.prev = 0;
|
|
2852
2901
|
|
|
2853
2902
|
if ((0, _store.isQueryExisting)(this.store.getState(), queryId)) {
|
|
2854
|
-
|
|
2903
|
+
_context24.next = 3;
|
|
2855
2904
|
break;
|
|
2856
2905
|
}
|
|
2857
2906
|
|
|
2858
|
-
return
|
|
2907
|
+
return _context24.abrupt("return", Promise.resolve(null));
|
|
2859
2908
|
|
|
2860
2909
|
case 3:
|
|
2861
2910
|
this.dispatch((0, _store.resetQuery)(queryId));
|
|
2862
2911
|
query = this.getQueryFromState(queryId);
|
|
2863
|
-
|
|
2912
|
+
_context24.next = 7;
|
|
2864
2913
|
return this.query(query.definition, {
|
|
2865
2914
|
as: queryId
|
|
2866
2915
|
});
|
|
2867
2916
|
|
|
2868
2917
|
case 7:
|
|
2869
|
-
return
|
|
2918
|
+
return _context24.abrupt("return", _context24.sent);
|
|
2870
2919
|
|
|
2871
2920
|
case 10:
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
throw
|
|
2921
|
+
_context24.prev = 10;
|
|
2922
|
+
_context24.t0 = _context24["catch"](0);
|
|
2923
|
+
throw _context24.t0;
|
|
2875
2924
|
|
|
2876
2925
|
case 13:
|
|
2877
2926
|
case "end":
|
|
2878
|
-
return
|
|
2927
|
+
return _context24.stop();
|
|
2879
2928
|
}
|
|
2880
2929
|
}
|
|
2881
|
-
},
|
|
2930
|
+
}, _callee24, this, [[0, 10]]);
|
|
2882
2931
|
}));
|
|
2883
2932
|
|
|
2884
|
-
function resetQuery(
|
|
2933
|
+
function resetQuery(_x29) {
|
|
2885
2934
|
return _resetQuery2.apply(this, arguments);
|
|
2886
2935
|
}
|
|
2887
2936
|
|
|
@@ -2909,22 +2958,22 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2909
2958
|
}, {
|
|
2910
2959
|
key: "fromOldOAuthClient",
|
|
2911
2960
|
value: function () {
|
|
2912
|
-
var _fromOldOAuthClient = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2961
|
+
var _fromOldOAuthClient = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(oldClient, options) {
|
|
2913
2962
|
var credentials, oauthOptions, client;
|
|
2914
|
-
return _regenerator.default.wrap(function
|
|
2963
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
2915
2964
|
while (1) {
|
|
2916
|
-
switch (
|
|
2965
|
+
switch (_context25.prev = _context25.next) {
|
|
2917
2966
|
case 0:
|
|
2918
2967
|
if (!oldClient._oauth) {
|
|
2919
|
-
|
|
2968
|
+
_context25.next = 12;
|
|
2920
2969
|
break;
|
|
2921
2970
|
}
|
|
2922
2971
|
|
|
2923
|
-
|
|
2972
|
+
_context25.next = 3;
|
|
2924
2973
|
return oldClient.authorize();
|
|
2925
2974
|
|
|
2926
2975
|
case 3:
|
|
2927
|
-
credentials =
|
|
2976
|
+
credentials = _context25.sent;
|
|
2928
2977
|
oauthOptions = {
|
|
2929
2978
|
oauth: credentials.client,
|
|
2930
2979
|
token: credentials.token,
|
|
@@ -2935,28 +2984,28 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2935
2984
|
}, oauthOptions), options));
|
|
2936
2985
|
|
|
2937
2986
|
if (!client.loginPromise) {
|
|
2938
|
-
|
|
2987
|
+
_context25.next = 9;
|
|
2939
2988
|
break;
|
|
2940
2989
|
}
|
|
2941
2990
|
|
|
2942
|
-
|
|
2991
|
+
_context25.next = 9;
|
|
2943
2992
|
return client.loginPromise;
|
|
2944
2993
|
|
|
2945
2994
|
case 9:
|
|
2946
|
-
return
|
|
2995
|
+
return _context25.abrupt("return", client);
|
|
2947
2996
|
|
|
2948
2997
|
case 12:
|
|
2949
2998
|
throw new Error('Cannot instantiate a new client: old client is not an OAuth client. CozyClient.fromOldClient might be more suitable.');
|
|
2950
2999
|
|
|
2951
3000
|
case 13:
|
|
2952
3001
|
case "end":
|
|
2953
|
-
return
|
|
3002
|
+
return _context25.stop();
|
|
2954
3003
|
}
|
|
2955
3004
|
}
|
|
2956
|
-
},
|
|
3005
|
+
}, _callee25);
|
|
2957
3006
|
}));
|
|
2958
3007
|
|
|
2959
|
-
function fromOldOAuthClient(
|
|
3008
|
+
function fromOldOAuthClient(_x30, _x31) {
|
|
2960
3009
|
return _fromOldOAuthClient.apply(this, arguments);
|
|
2961
3010
|
}
|
|
2962
3011
|
|
|
@@ -3049,7 +3098,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
3049
3098
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
3050
3099
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
3051
3100
|
|
|
3052
|
-
CozyClient.version = "53.1.
|
|
3101
|
+
CozyClient.version = "53.1.1";
|
|
3053
3102
|
|
|
3054
3103
|
_microee.default.mixin(CozyClient);
|
|
3055
3104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "53.1.
|
|
3
|
+
"version": "53.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
|
|
73
73
|
},
|
|
74
74
|
"sideEffects": false,
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "e74421c0e8a11c5d728a670a1f65b129a0e669d9"
|
|
76
76
|
}
|
package/types/CozyClient.d.ts
CHANGED