cozy-client 48.25.0 → 49.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 +282 -129
- package/dist/CozyClient.spec.js +116 -1
- package/dist/CozyLink.js +120 -7
- package/dist/StackLink.js +157 -36
- package/dist/WebFlagshipLink.js +128 -0
- package/dist/associations/HasManyFiles.js +1 -1
- package/dist/associations.spec.js +2 -1
- package/dist/hooks/useAppLinkWithStoreFallback.spec.jsx +2 -6
- package/dist/hooks/useCapabilities.js +1 -1
- package/dist/hooks/useCapabilities.spec.jsx +7 -2
- package/dist/hooks/useFetchShortcut.js +3 -3
- package/dist/hooks/useFetchShortcut.spec.jsx +18 -25
- package/dist/index.js +9 -0
- package/dist/models/applications.js +1 -1
- package/dist/models/applications.spec.js +2 -6
- package/dist/models/file.js +104 -2
- package/dist/models/file.spec.js +122 -1
- package/dist/models/instance.js +6 -6
- package/dist/models/instance.spec.js +13 -29
- package/dist/types.js +9 -1
- package/dist/utils.js +17 -2
- package/package.json +5 -5
- package/types/CozyClient.d.ts +61 -0
- package/types/CozyLink.d.ts +24 -2
- package/types/StackLink.d.ts +23 -8
- package/types/WebFlagshipLink.d.ts +12 -0
- package/types/index.d.ts +1 -0
- package/types/models/file.d.ts +6 -0
- package/types/types.d.ts +25 -1
- package/types/utils.d.ts +1 -0
- package/types/devtools/Flags.d.ts +0 -2
- package/types/models/doctypes/index.d.ts +0 -2
- package/types/models/doctypes/locales/index.d.ts +0 -3
- package/types/models/document/emojiCountry.d.ts +0 -1
- package/types/node.d.ts +0 -15
- package/types/queries/referencedBy.d.ts +0 -7
package/dist/models/instance.js
CHANGED
|
@@ -33,26 +33,26 @@ var PREMIUM_QUOTA = 50 * GB;
|
|
|
33
33
|
// If manager URL is present, then the instance is not self-hosted
|
|
34
34
|
|
|
35
35
|
var isSelfHosted = function isSelfHosted(instanceInfo) {
|
|
36
|
-
return (0, _get.default)(instanceInfo, 'context.data.
|
|
36
|
+
return (0, _get.default)(instanceInfo, 'context.data.manager_url') ? false : true;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
exports.isSelfHosted = isSelfHosted;
|
|
40
40
|
|
|
41
41
|
var arePremiumLinksEnabled = function arePremiumLinksEnabled(instanceInfo) {
|
|
42
|
-
return (0, _get.default)(instanceInfo, 'context.data.
|
|
42
|
+
return (0, _get.default)(instanceInfo, 'context.data.enable_premium_links') ? true : false;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
exports.arePremiumLinksEnabled = arePremiumLinksEnabled;
|
|
46
46
|
|
|
47
47
|
var isFreemiumUser = function isFreemiumUser(instanceInfo) {
|
|
48
|
-
var quota = (0, _get.default)(instanceInfo, 'diskUsage.data.
|
|
48
|
+
var quota = (0, _get.default)(instanceInfo, 'diskUsage.data.quota', false);
|
|
49
49
|
return parseInt(quota) <= PREMIUM_QUOTA;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
exports.isFreemiumUser = isFreemiumUser;
|
|
53
53
|
|
|
54
54
|
var getUuid = function getUuid(instanceInfo) {
|
|
55
|
-
return (0, _get.default)(instanceInfo, 'instance.data.
|
|
55
|
+
return (0, _get.default)(instanceInfo, 'instance.data.uuid');
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* Returns whether an instance is concerned by our offers
|
|
@@ -90,7 +90,7 @@ var hasAnOffer = function hasAnOffer(data) {
|
|
|
90
90
|
exports.hasAnOffer = hasAnOffer;
|
|
91
91
|
|
|
92
92
|
var buildPremiumLink = function buildPremiumLink(instanceInfo) {
|
|
93
|
-
var managerUrl = (0, _get.default)(instanceInfo, 'context.data.
|
|
93
|
+
var managerUrl = (0, _get.default)(instanceInfo, 'context.data.manager_url', false);
|
|
94
94
|
var uuid = getUuid(instanceInfo);
|
|
95
95
|
|
|
96
96
|
if (managerUrl && uuid) {
|
|
@@ -129,7 +129,7 @@ var hasPasswordDefinedAttribute = /*#__PURE__*/function () {
|
|
|
129
129
|
|
|
130
130
|
case 3:
|
|
131
131
|
_yield$client$fetchQu = _context.sent;
|
|
132
|
-
password_defined = _yield$client$fetchQu.data.
|
|
132
|
+
password_defined = _yield$client$fetchQu.data.password_defined;
|
|
133
133
|
return _context.abrupt("return", Boolean(password_defined));
|
|
134
134
|
|
|
135
135
|
case 8:
|
|
@@ -3,39 +3,29 @@ import { instance } from './'
|
|
|
3
3
|
const noSelfHostedInstance = {
|
|
4
4
|
context: {
|
|
5
5
|
data: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
enable_premium_links: true
|
|
9
|
-
}
|
|
6
|
+
manager_url: 'https://manager.cozy.cc',
|
|
7
|
+
enable_premium_links: true
|
|
10
8
|
}
|
|
11
9
|
},
|
|
12
10
|
instance: {
|
|
13
11
|
data: {
|
|
14
|
-
|
|
15
|
-
uuid: '1234'
|
|
16
|
-
}
|
|
12
|
+
uuid: '1234'
|
|
17
13
|
}
|
|
18
14
|
},
|
|
19
15
|
diskUsage: {
|
|
20
16
|
data: {
|
|
21
|
-
|
|
22
|
-
quota: '400000000'
|
|
23
|
-
}
|
|
17
|
+
quota: '400000000'
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
const selftHostedInstance = {
|
|
29
23
|
context: {
|
|
30
|
-
data: {
|
|
31
|
-
attributes: {}
|
|
32
|
-
}
|
|
24
|
+
data: {}
|
|
33
25
|
},
|
|
34
26
|
diskUsage: {
|
|
35
27
|
data: {
|
|
36
|
-
|
|
37
|
-
quota: '6000000000000'
|
|
38
|
-
}
|
|
28
|
+
quota: '6000000000000'
|
|
39
29
|
}
|
|
40
30
|
}
|
|
41
31
|
}
|
|
@@ -43,24 +33,18 @@ const selftHostedInstance = {
|
|
|
43
33
|
const hadAnOfferInstance = {
|
|
44
34
|
context: {
|
|
45
35
|
data: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
enable_premium_links: true
|
|
49
|
-
}
|
|
36
|
+
manager_url: 'https://manager.cozy.cc',
|
|
37
|
+
enable_premium_links: true
|
|
50
38
|
}
|
|
51
39
|
},
|
|
52
40
|
instance: {
|
|
53
41
|
data: {
|
|
54
|
-
|
|
55
|
-
uuid: '1234'
|
|
56
|
-
}
|
|
42
|
+
uuid: '1234'
|
|
57
43
|
}
|
|
58
44
|
},
|
|
59
45
|
diskUsage: {
|
|
60
46
|
data: {
|
|
61
|
-
|
|
62
|
-
quota: '60000000000'
|
|
63
|
-
}
|
|
47
|
+
quota: '60000000000'
|
|
64
48
|
}
|
|
65
49
|
}
|
|
66
50
|
}
|
|
@@ -163,17 +147,17 @@ describe('instance', () => {
|
|
|
163
147
|
})
|
|
164
148
|
|
|
165
149
|
it('should return false if attribute password_defined is undefined', async () => {
|
|
166
|
-
const res = await setup({
|
|
150
|
+
const res = await setup({ password_defined: undefined })
|
|
167
151
|
expect(res).toBe(false)
|
|
168
152
|
})
|
|
169
153
|
|
|
170
154
|
it('should return false if attribute password_defined is false', async () => {
|
|
171
|
-
const res = await setup({
|
|
155
|
+
const res = await setup({ password_defined: false })
|
|
172
156
|
expect(res).toBe(false)
|
|
173
157
|
})
|
|
174
158
|
|
|
175
159
|
it('should return true if attribute password_defined is true', async () => {
|
|
176
|
-
const res = await setup({
|
|
160
|
+
const res = await setup({ password_defined: true })
|
|
177
161
|
expect(res).toBe(true)
|
|
178
162
|
})
|
|
179
163
|
})
|
package/dist/types.js
CHANGED
|
@@ -426,6 +426,11 @@ var _dsl = require("./queries/dsl");
|
|
|
426
426
|
* @property {boolean} [favorite] - Whether the document is marked as favorite
|
|
427
427
|
*/
|
|
428
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @typedef {object} CozyClientDocumentMeta - Meta object as specified by JSON-API (https://jsonapi.org/format/#document-meta)
|
|
431
|
+
* @property {string} [rev] - Current revision of the document
|
|
432
|
+
*/
|
|
433
|
+
|
|
429
434
|
/**
|
|
430
435
|
* @typedef {object} CozyClientDocument - A document
|
|
431
436
|
* @property {string} [_id] - Id of the document
|
|
@@ -436,6 +441,8 @@ var _dsl = require("./queries/dsl");
|
|
|
436
441
|
* @property {ReferencedByRelationship} [relationships] - Relationships of the document
|
|
437
442
|
* @property {Reference[]} [referenced_by] - referenced by of another document
|
|
438
443
|
* @property {CozyMetadata} [cozyMetadata] - Cozy Metadata
|
|
444
|
+
* @property {CozyClientDocumentMeta} [meta] - Pouch Metadata
|
|
445
|
+
* @property {boolean} [cozyLocalOnly] - When true the document should NOT be replicated to the remote database
|
|
439
446
|
*/
|
|
440
447
|
|
|
441
448
|
/**
|
|
@@ -451,6 +458,7 @@ var _dsl = require("./queries/dsl");
|
|
|
451
458
|
* @property {object} [content] - The Note's content. See https://prosemirror.net/docs/ref/#model for more informations
|
|
452
459
|
* @property {object} [schema] - the schema used by prosemirror (with notes and marks serialized as arrays to preserve the order).
|
|
453
460
|
* @property {string} [title] - the initial title of the note (that will also be used for the file name)
|
|
461
|
+
* @property {string} [description] - A brief description of the file
|
|
454
462
|
* @property {number} [version] - Number of a note
|
|
455
463
|
* @property {Qualification} [qualification] - Qualification of the file
|
|
456
464
|
* @property {string} [country] - Country of the paper
|
|
@@ -461,7 +469,6 @@ var _dsl = require("./queries/dsl");
|
|
|
461
469
|
* @property {string} [instanceName] - Name of the instance
|
|
462
470
|
* @property {object} [target] - Information of the target of the shortcut
|
|
463
471
|
* @property {string} [target.title] - The title of the application to which the shortcut redirects
|
|
464
|
-
* @property {string} [target.description] - A brief description of the application
|
|
465
472
|
* @property {string} [target.category] - The category of the application
|
|
466
473
|
* @property {object} [externalDataSource] - Additional information to maintain link with external data source
|
|
467
474
|
* @property {string} [externalDataSource.source] - The space to which the application belongs
|
|
@@ -470,6 +477,7 @@ var _dsl = require("./queries/dsl");
|
|
|
470
477
|
/**
|
|
471
478
|
* @typedef {object} FileDocument - An io.cozy.files document
|
|
472
479
|
* @property {string} _id - Id of the file
|
|
480
|
+
* @property {string} _rev - Rev of the file
|
|
473
481
|
* @property {FilesDoctype} _type - Doctype of the file
|
|
474
482
|
* @property {string} dir_id - Id of the parent folder
|
|
475
483
|
* @property {string} [path] - Path of the file
|
package/dist/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.hasQueriesBeenLoaded = exports.isQueriesLoading = exports.hasQueryBeenLoaded = exports.isQueryLoading = exports.cancelable = void 0;
|
|
8
|
+
exports.isReactNativeOfflineError = exports.hasQueriesBeenLoaded = exports.isQueriesLoading = exports.hasQueryBeenLoaded = exports.isQueryLoading = exports.cancelable = void 0;
|
|
9
9
|
|
|
10
10
|
var _logger = _interopRequireDefault(require("./logger"));
|
|
11
11
|
|
|
@@ -89,5 +89,20 @@ var hasQueriesBeenLoaded = function hasQueriesBeenLoaded(queriesResults) {
|
|
|
89
89
|
return hasQueryBeenLoaded(queryResult);
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Check is the error is about ReactNative not having access to internet
|
|
94
|
+
*
|
|
95
|
+
* @param {Error} err - The error to check
|
|
96
|
+
* @returns {boolean} True if the error is a network error, otherwise false
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
exports.hasQueriesBeenLoaded = hasQueriesBeenLoaded;
|
|
101
|
+
|
|
102
|
+
var isReactNativeOfflineError = function isReactNativeOfflineError(err) {
|
|
103
|
+
// This error message is specific to ReactNative
|
|
104
|
+
// Network errors on a browser would produce another error.message
|
|
105
|
+
return err.message === 'Network request failed';
|
|
106
|
+
};
|
|
92
107
|
|
|
93
|
-
exports.
|
|
108
|
+
exports.isReactNativeOfflineError = isReactNativeOfflineError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "49.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@types/jest": "^26.0.20",
|
|
19
19
|
"@types/lodash": "^4.14.170",
|
|
20
20
|
"btoa": "^1.2.1",
|
|
21
|
-
"cozy-stack-client": "^
|
|
21
|
+
"cozy-stack-client": "^49.0.0",
|
|
22
22
|
"date-fns": "2.29.3",
|
|
23
23
|
"json-stable-stringify": "^1.0.1",
|
|
24
24
|
"lodash": "^4.17.13",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"btoa": "1.2.1",
|
|
51
51
|
"cozy-device-helper": "2.7.0",
|
|
52
52
|
"cozy-flags": "2.10.2",
|
|
53
|
-
"cozy-intent": "
|
|
53
|
+
"cozy-intent": "2.23.0",
|
|
54
54
|
"cozy-logger": "1.7.0",
|
|
55
55
|
"cozy-ui": "93.1.1",
|
|
56
56
|
"jsdoc-plugin-intersection": "1.0.4",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"cozy-device-helper": ">=2.1.0",
|
|
67
67
|
"cozy-flags": ">2.8.6",
|
|
68
|
-
"cozy-intent": ">=
|
|
68
|
+
"cozy-intent": ">=2.23.0",
|
|
69
69
|
"cozy-logger": ">1.7.0",
|
|
70
70
|
"cozy-ui": ">=93.1.1",
|
|
71
71
|
"react": "^16.7.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "1743f0008b06d89bacda019231dd2292748c68d5"
|
|
79
79
|
}
|
package/types/CozyClient.d.ts
CHANGED
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
export default CozyClient;
|
|
2
|
+
export type CozyClientDocument = {
|
|
3
|
+
/**
|
|
4
|
+
* - Id of the document
|
|
5
|
+
*/
|
|
6
|
+
_id?: string;
|
|
7
|
+
/**
|
|
8
|
+
* - Id of the document
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* - Type of the document
|
|
13
|
+
*/
|
|
14
|
+
_type?: string;
|
|
15
|
+
/**
|
|
16
|
+
* - Current revision of the document
|
|
17
|
+
*/
|
|
18
|
+
_rev?: string;
|
|
19
|
+
/**
|
|
20
|
+
* - When the document has been deleted
|
|
21
|
+
*/
|
|
22
|
+
_deleted?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* - Relationships of the document
|
|
25
|
+
*/
|
|
26
|
+
relationships?: import("./types").ReferencedByRelationship;
|
|
27
|
+
/**
|
|
28
|
+
* - referenced by of another document
|
|
29
|
+
*/
|
|
30
|
+
referenced_by?: import("./types").Reference[];
|
|
31
|
+
/**
|
|
32
|
+
* - Cozy Metadata
|
|
33
|
+
*/
|
|
34
|
+
cozyMetadata?: import("./types").CozyMetadata;
|
|
35
|
+
/**
|
|
36
|
+
* - Pouch Metadata
|
|
37
|
+
*/
|
|
38
|
+
meta?: import("./types").CozyClientDocumentMeta;
|
|
39
|
+
/**
|
|
40
|
+
* - When true the document should NOT be replicated to the remote database
|
|
41
|
+
*/
|
|
42
|
+
cozyLocalOnly?: boolean;
|
|
43
|
+
};
|
|
2
44
|
export type ClientOptions = {
|
|
3
45
|
client?: object;
|
|
4
46
|
link?: object;
|
|
@@ -36,6 +78,8 @@ export type ClientOptions = {
|
|
|
36
78
|
store?: boolean;
|
|
37
79
|
};
|
|
38
80
|
/**
|
|
81
|
+
* @typedef {import("./types").CozyClientDocument} CozyClientDocument
|
|
82
|
+
*
|
|
39
83
|
* @typedef {object} ClientOptions
|
|
40
84
|
* @property {object} [client]
|
|
41
85
|
* @property {object} [link]
|
|
@@ -458,6 +502,23 @@ declare class CozyClient {
|
|
|
458
502
|
* @returns {Promise<import("./types").ClientResponse>}
|
|
459
503
|
*/
|
|
460
504
|
private requestQuery;
|
|
505
|
+
/**
|
|
506
|
+
* Save the document or array of documents into the persisted storage (if any)
|
|
507
|
+
*
|
|
508
|
+
* @private
|
|
509
|
+
* @param {CozyClientDocument | Array<CozyClientDocument>} data - Document or array of documents to be saved
|
|
510
|
+
* @returns {Promise<void>}
|
|
511
|
+
*/
|
|
512
|
+
private persistVirtualDocuments;
|
|
513
|
+
/**
|
|
514
|
+
* Save the document or array of documents into the persisted storage (if any)
|
|
515
|
+
*
|
|
516
|
+
* @private
|
|
517
|
+
* @param {CozyClientDocument} document - Document to be saved
|
|
518
|
+
* @param {boolean} enforce - When true, save the document even if `meta.rev` or `_rev` exist
|
|
519
|
+
* @returns {Promise<void>}
|
|
520
|
+
*/
|
|
521
|
+
private persistVirtualDocument;
|
|
461
522
|
/**
|
|
462
523
|
* Fetch relationships for a response (can be several docs).
|
|
463
524
|
* Fills the `relationships` attribute of each documents.
|
package/types/CozyLink.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
export default class CozyLink {
|
|
2
|
-
constructor(requestHandler: any);
|
|
3
|
-
|
|
2
|
+
constructor(requestHandler: any, persistHandler: any);
|
|
3
|
+
/**
|
|
4
|
+
* Request the given operation from the link
|
|
5
|
+
*
|
|
6
|
+
* @param {any} operation - The operation to request
|
|
7
|
+
* @param {any} result - The result from the previous request of the chain
|
|
8
|
+
* @param {any} forward - The next request of the chain
|
|
9
|
+
* @returns {Promise<any>}
|
|
10
|
+
*/
|
|
11
|
+
request(operation: any, result: any, forward: any): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Persist the given data into the links storage
|
|
14
|
+
*
|
|
15
|
+
* @param {any} data - The document to persist
|
|
16
|
+
* @param {any} forward - The next persistCozyData of the chain
|
|
17
|
+
* @returns {Promise<any>}
|
|
18
|
+
*/
|
|
19
|
+
persistCozyData(data: any, forward: any): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Reset the link data
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<any>}
|
|
24
|
+
*/
|
|
25
|
+
reset(): Promise<any>;
|
|
4
26
|
}
|
|
5
27
|
export function chain(links: any): any;
|
package/types/StackLink.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
export function transformBulkDocsResponse(bulkResponse: import("./types").CouchDBBulkResult[], originalDocuments: import("./types").CozyClientDocument[]): {
|
|
2
2
|
data: import("./types").CozyClientDocument[];
|
|
3
3
|
};
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} StackLinkOptions
|
|
6
|
+
* @property {object} [stackClient] - A StackClient
|
|
7
|
+
* @property {object} [client] - A StackClient (deprecated)
|
|
8
|
+
* @property {import('cozy-pouch-link/dist/types').LinkPlatform} [platform] - Platform specific adapters and methods
|
|
9
|
+
*/
|
|
4
10
|
/**
|
|
5
11
|
* Transfers queries and mutations to a remote stack
|
|
6
12
|
*/
|
|
7
13
|
export default class StackLink extends CozyLink {
|
|
8
14
|
/**
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {object} [options.stackClient] - A StackClient
|
|
11
|
-
* @param {object} [options.client] - A StackClient (deprecated)
|
|
15
|
+
* @param {StackLinkOptions} [options] - Options
|
|
12
16
|
*/
|
|
13
|
-
constructor({ client, stackClient }?:
|
|
14
|
-
stackClient: object;
|
|
15
|
-
client: object;
|
|
16
|
-
});
|
|
17
|
+
constructor({ client, stackClient, platform }?: StackLinkOptions);
|
|
17
18
|
stackClient: any;
|
|
19
|
+
isOnline: any;
|
|
18
20
|
registerClient(client: any): void;
|
|
19
|
-
reset(): void;
|
|
20
21
|
/**
|
|
21
22
|
*
|
|
22
23
|
* @param {QueryDefinition} query - Query to execute
|
|
@@ -25,5 +26,19 @@ export default class StackLink extends CozyLink {
|
|
|
25
26
|
executeQuery(query: QueryDefinition): Promise<import("./types").ClientResponse>;
|
|
26
27
|
executeMutation(mutation: any, result: any, forward: any): Promise<any>;
|
|
27
28
|
}
|
|
29
|
+
export type StackLinkOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* - A StackClient
|
|
32
|
+
*/
|
|
33
|
+
stackClient?: object;
|
|
34
|
+
/**
|
|
35
|
+
* - A StackClient (deprecated)
|
|
36
|
+
*/
|
|
37
|
+
client?: object;
|
|
38
|
+
/**
|
|
39
|
+
* - Platform specific adapters and methods
|
|
40
|
+
*/
|
|
41
|
+
platform?: any;
|
|
42
|
+
};
|
|
28
43
|
import CozyLink from "./CozyLink";
|
|
29
44
|
import { QueryDefinition } from "./queries/dsl";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default class WebFlagshipLink extends CozyLink {
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} [options] - Options
|
|
4
|
+
* @param {import('cozy-intent').WebviewService} [options.webviewIntent] - The webview's intent reference
|
|
5
|
+
*/
|
|
6
|
+
constructor({ webviewIntent }?: {
|
|
7
|
+
webviewIntent: import('cozy-intent').WebviewService;
|
|
8
|
+
});
|
|
9
|
+
webviewIntent: import("cozy-intent").WebviewService;
|
|
10
|
+
registerClient(client: any): void;
|
|
11
|
+
}
|
|
12
|
+
import CozyLink from "./CozyLink";
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default } from "./CozyClient";
|
|
2
2
|
export { default as CozyLink } from "./CozyLink";
|
|
3
3
|
export { default as StackLink } from "./StackLink";
|
|
4
|
+
export { default as WebFlagshipLink } from "./WebFlagshipLink";
|
|
4
5
|
export { default as compose } from "lodash/flow";
|
|
5
6
|
export { default as Registry } from "./registry";
|
|
6
7
|
export { default as RealTimeQueries } from "./RealTimeQueries";
|
package/types/models/file.d.ts
CHANGED
|
@@ -68,6 +68,12 @@ export function hasCertifications(file: import("../types").IOCozyFile): boolean;
|
|
|
68
68
|
export function isFromKonnector(file: import("../types").IOCozyFile): boolean;
|
|
69
69
|
export function fetchBlobFileById(client: CozyClient, fileId: string): Promise<Blob>;
|
|
70
70
|
export function copy(client: object, file: object, destination: object): Promise<any>;
|
|
71
|
+
export function downloadFile({ client, file, url, webviewIntent }: {
|
|
72
|
+
client: CozyClient;
|
|
73
|
+
file: import("../types").IOCozyFile;
|
|
74
|
+
url: string;
|
|
75
|
+
webviewIntent: import('cozy-intent').WebviewService;
|
|
76
|
+
}): Promise<any>;
|
|
71
77
|
export type FileUploadOptions = {
|
|
72
78
|
/**
|
|
73
79
|
* - The file name to upload
|
package/types/types.d.ts
CHANGED
|
@@ -705,6 +705,15 @@ export type CozyMetadata = {
|
|
|
705
705
|
*/
|
|
706
706
|
favorite?: boolean;
|
|
707
707
|
};
|
|
708
|
+
/**
|
|
709
|
+
* - Meta object as specified by JSON-API (https://jsonapi.org/format/#document-meta)
|
|
710
|
+
*/
|
|
711
|
+
export type CozyClientDocumentMeta = {
|
|
712
|
+
/**
|
|
713
|
+
* - Current revision of the document
|
|
714
|
+
*/
|
|
715
|
+
rev?: string;
|
|
716
|
+
};
|
|
708
717
|
/**
|
|
709
718
|
* - A document
|
|
710
719
|
*/
|
|
@@ -741,6 +750,14 @@ export type CozyClientDocument = {
|
|
|
741
750
|
* - Cozy Metadata
|
|
742
751
|
*/
|
|
743
752
|
cozyMetadata?: CozyMetadata;
|
|
753
|
+
/**
|
|
754
|
+
* - Pouch Metadata
|
|
755
|
+
*/
|
|
756
|
+
meta?: CozyClientDocumentMeta;
|
|
757
|
+
/**
|
|
758
|
+
* - When true the document should NOT be replicated to the remote database
|
|
759
|
+
*/
|
|
760
|
+
cozyLocalOnly?: boolean;
|
|
744
761
|
};
|
|
745
762
|
/**
|
|
746
763
|
* - A io.cozy.files document's metadata
|
|
@@ -758,6 +775,10 @@ export type FileMetadata = {
|
|
|
758
775
|
* - the initial title of the note (that will also be used for the file name)
|
|
759
776
|
*/
|
|
760
777
|
title?: string;
|
|
778
|
+
/**
|
|
779
|
+
* - A brief description of the file
|
|
780
|
+
*/
|
|
781
|
+
description?: string;
|
|
761
782
|
/**
|
|
762
783
|
* - Number of a note
|
|
763
784
|
*/
|
|
@@ -795,7 +816,6 @@ export type FileMetadata = {
|
|
|
795
816
|
*/
|
|
796
817
|
target?: {
|
|
797
818
|
title: string;
|
|
798
|
-
description: string;
|
|
799
819
|
category: string;
|
|
800
820
|
};
|
|
801
821
|
/**
|
|
@@ -813,6 +833,10 @@ export type FileDocument = {
|
|
|
813
833
|
* - Id of the file
|
|
814
834
|
*/
|
|
815
835
|
_id: string;
|
|
836
|
+
/**
|
|
837
|
+
* - Rev of the file
|
|
838
|
+
*/
|
|
839
|
+
_rev: string;
|
|
816
840
|
/**
|
|
817
841
|
* - Doctype of the file
|
|
818
842
|
*/
|
package/types/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export function isQueryLoading(col: any): boolean;
|
|
|
2
2
|
export function hasQueryBeenLoaded(col: any): any;
|
|
3
3
|
export function isQueriesLoading(queriesResults: any): boolean;
|
|
4
4
|
export function hasQueriesBeenLoaded(queriesResults: any): boolean;
|
|
5
|
+
export function isReactNativeOfflineError(err: Error): boolean;
|
|
5
6
|
export type CancelablePromise = Promise<any>;
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {Promise} CancelablePromise
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getEmojiByCountry(countryCode: string): string;
|
package/types/node.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { default } from "./CozyClient";
|
|
2
|
-
export { default as CozyLink } from "./CozyLink";
|
|
3
|
-
export { default as StackLink } from "./StackLink";
|
|
4
|
-
export { default as compose } from "lodash/flow";
|
|
5
|
-
export { cancelable } from "./utils";
|
|
6
|
-
export { getQueryFromState } from "./store";
|
|
7
|
-
export { default as Registry } from "./registry";
|
|
8
|
-
export * from "./mock";
|
|
9
|
-
export * from "./cli";
|
|
10
|
-
import * as manifest from "./manifest";
|
|
11
|
-
import * as models from "./models";
|
|
12
|
-
export { manifest, models };
|
|
13
|
-
export { QueryDefinition, Mutations, MutationTypes, getDoctypeFromOperation, Q } from "./queries/dsl";
|
|
14
|
-
export { Association, HasMany, HasOne, HasOneInPlace, HasManyInPlace, HasManyTriggers } from "./associations";
|
|
15
|
-
export { dehydrate, generateWebLink } from "./helpers";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export function isReferencedBy(file: IOCozyFile, referencedBy: Doctype): boolean;
|
|
2
|
-
export function isReferencedById(file: IOCozyFile, referencedBy: Doctype, referencedId: string): boolean;
|
|
3
|
-
export function getReferencedBy(file: IOCozyFile, referencedBy: Doctype): Reference[];
|
|
4
|
-
export function getReferencedById(file: IOCozyFile, referencedBy: Doctype, referencedId: string): Reference[];
|
|
5
|
-
import { IOCozyFile } from "../types";
|
|
6
|
-
import { Doctype } from "../types";
|
|
7
|
-
import { Reference } from "../types";
|