cozy-client 43.4.1 → 43.5.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 +1 -1
- package/dist/models/note.js +23 -8
- package/dist/types.js +92 -0
- package/package.json +2 -2
- package/types/models/note.d.ts +3 -1
- package/types/types.d.ts +176 -0
package/dist/CozyClient.js
CHANGED
|
@@ -2703,7 +2703,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2703
2703
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2704
2704
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2705
2705
|
|
|
2706
|
-
CozyClient.version = "43.
|
|
2706
|
+
CozyClient.version = "43.5.1";
|
|
2707
2707
|
|
|
2708
2708
|
_microee.default.mixin(CozyClient);
|
|
2709
2709
|
|
package/dist/models/note.js
CHANGED
|
@@ -45,6 +45,8 @@ var generateUrlForNote = function generateUrlForNote(notesAppUrl, file) {
|
|
|
45
45
|
*
|
|
46
46
|
* @param {object} client CozyClient instance
|
|
47
47
|
* @param {object} file io.cozy.file object
|
|
48
|
+
* @param {object} options Options
|
|
49
|
+
* @param {string} [options.pathname] Pathname to use in the URL
|
|
48
50
|
* @returns {Promise<string>} url
|
|
49
51
|
*/
|
|
50
52
|
|
|
@@ -53,18 +55,31 @@ exports.generateUrlForNote = generateUrlForNote;
|
|
|
53
55
|
|
|
54
56
|
var fetchURL = /*#__PURE__*/function () {
|
|
55
57
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(client, file) {
|
|
56
|
-
var
|
|
58
|
+
var options,
|
|
59
|
+
_yield$client$getStac,
|
|
60
|
+
_yield$client$getStac2,
|
|
61
|
+
note_id,
|
|
62
|
+
subdomain,
|
|
63
|
+
protocol,
|
|
64
|
+
instance,
|
|
65
|
+
sharecode,
|
|
66
|
+
public_name,
|
|
67
|
+
_options$pathname,
|
|
68
|
+
searchParams,
|
|
69
|
+
_options$pathname2,
|
|
70
|
+
_args = arguments;
|
|
57
71
|
|
|
58
72
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
59
73
|
while (1) {
|
|
60
74
|
switch (_context.prev = _context.next) {
|
|
61
75
|
case 0:
|
|
62
|
-
|
|
76
|
+
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
77
|
+
_context.next = 3;
|
|
63
78
|
return client.getStackClient().collection('io.cozy.notes').fetchURL({
|
|
64
79
|
_id: file.id
|
|
65
80
|
});
|
|
66
81
|
|
|
67
|
-
case
|
|
82
|
+
case 3:
|
|
68
83
|
_yield$client$getStac = _context.sent;
|
|
69
84
|
_yield$client$getStac2 = _yield$client$getStac.data;
|
|
70
85
|
note_id = _yield$client$getStac2.note_id;
|
|
@@ -75,7 +90,7 @@ var fetchURL = /*#__PURE__*/function () {
|
|
|
75
90
|
public_name = _yield$client$getStac2.public_name;
|
|
76
91
|
|
|
77
92
|
if (!sharecode) {
|
|
78
|
-
_context.next =
|
|
93
|
+
_context.next = 18;
|
|
79
94
|
break;
|
|
80
95
|
}
|
|
81
96
|
|
|
@@ -85,21 +100,21 @@ var fetchURL = /*#__PURE__*/function () {
|
|
|
85
100
|
return _context.abrupt("return", (0, _helpers.generateWebLink)({
|
|
86
101
|
cozyUrl: "".concat(protocol, "://").concat(instance),
|
|
87
102
|
searchParams: searchParams,
|
|
88
|
-
pathname: '/public/',
|
|
103
|
+
pathname: (_options$pathname = options.pathname) !== null && _options$pathname !== void 0 ? _options$pathname : '/public/',
|
|
89
104
|
slug: 'notes',
|
|
90
105
|
subDomainType: subdomain
|
|
91
106
|
}));
|
|
92
107
|
|
|
93
|
-
case
|
|
108
|
+
case 18:
|
|
94
109
|
return _context.abrupt("return", (0, _helpers.generateWebLink)({
|
|
95
110
|
cozyUrl: "".concat(protocol, "://").concat(instance),
|
|
96
|
-
pathname: '',
|
|
111
|
+
pathname: (_options$pathname2 = options.pathname) !== null && _options$pathname2 !== void 0 ? _options$pathname2 : '',
|
|
97
112
|
slug: 'notes',
|
|
98
113
|
subDomainType: subdomain,
|
|
99
114
|
hash: "/n/".concat(note_id)
|
|
100
115
|
}));
|
|
101
116
|
|
|
102
|
-
case
|
|
117
|
+
case 19:
|
|
103
118
|
case "end":
|
|
104
119
|
return _context.stop();
|
|
105
120
|
}
|
package/dist/types.js
CHANGED
|
@@ -76,6 +76,98 @@ var _dsl = require("./queries/dsl");
|
|
|
76
76
|
* @typedef {CozyClientDocument & KonnectorsDocument} IOCozyKonnector - An io.cozy.konnectors document
|
|
77
77
|
*/
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @typedef {Object} Developer - name and url for the developer
|
|
81
|
+
* @property {string} name
|
|
82
|
+
* @property {string} url
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} Intent - (application specific) a list of intents provided by this app
|
|
87
|
+
* @property {string} action
|
|
88
|
+
* @property {string[]} type
|
|
89
|
+
* @property {string} href
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @typedef {Object} Locale - an object with language slug as property, each name property is an object of localized informations
|
|
94
|
+
* @property {string} long_description
|
|
95
|
+
* @property {string[]} screenshots
|
|
96
|
+
* @property {string} short_description
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @typedef {Object} Permission - a map of permissions needed by the app
|
|
101
|
+
* @property {string} type
|
|
102
|
+
* @property {string} [description]
|
|
103
|
+
* @property {string[]} [verbs]
|
|
104
|
+
* @property {string} [selector]
|
|
105
|
+
* @property {string[]} [values]
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @typedef {Object} Route - (application specific) a map of routes for the app
|
|
110
|
+
* @property {string} folder
|
|
111
|
+
* @property {string} index
|
|
112
|
+
* @property {boolean} public
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @typedef {Object} Service - (application specific) a map of the services associated with the app (see cozy-stack services doc for more details)
|
|
117
|
+
* @property {string} type
|
|
118
|
+
* @property {string} file
|
|
119
|
+
* @property {string} [debounce]
|
|
120
|
+
* @property {string} trigger
|
|
121
|
+
* @property {string} trigger_id
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @typedef {Object} Terms - an object defining properties for terms that need to be displayed/accepted by the user when installing the application
|
|
126
|
+
* @property {string} url
|
|
127
|
+
* @property {string} version
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @typedef {Object} AcceptDocumentsFromFlagship - The acceptance document details from cozy-flagship.
|
|
132
|
+
* @property {string[]} accepted_mime_types
|
|
133
|
+
* @property {number} max_number_of_files
|
|
134
|
+
* @property {number} max_size_per_file_in_MB
|
|
135
|
+
* @property {string} route_to_upload - The route provided by the cozy-app to trigger the upload user flow
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {Object} AppsDocument
|
|
140
|
+
* See https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.apps/
|
|
141
|
+
*
|
|
142
|
+
* @property {AcceptDocumentsFromFlagship} [accept_documents_from_flagship] - The acceptance document details from flagship.
|
|
143
|
+
* @property {boolean} [accept_from_flagship] - Whether to accept file upload from cozy-flagship.
|
|
144
|
+
* @property {string[]} categories - array of categories for your apps (see authorized categories), it will be ['others'] by default if empty
|
|
145
|
+
* @property {string} checksum
|
|
146
|
+
* @property {string} created_at
|
|
147
|
+
* @property {Developer} developer - name and url for the developer
|
|
148
|
+
* @property {string} editor - the editor’s name to display on the cozy-bar
|
|
149
|
+
* @property {string} icon - path to the icon for the home
|
|
150
|
+
* @property {Intent[]} intents - (application specific) a list of intents provided by this app
|
|
151
|
+
* @property {string[]} langs - Languages available in the app
|
|
152
|
+
* @property {string} licence - the SPDX license identifier
|
|
153
|
+
* @property {Object.<string, Locale>} locales - an object with language slug as property, each name property is an object of localized informations
|
|
154
|
+
* @property {string} name - the name to display on the home
|
|
155
|
+
* @property {string} name_prefix - the prefix to display with the name
|
|
156
|
+
* @property {null} notifications
|
|
157
|
+
* @property {Object.<string, Permission>} permissions - a map of permissions needed by the app
|
|
158
|
+
* @property {Object.<string, Route>} routes - (application specific) a map of routes for the app
|
|
159
|
+
* @property {string[]} screenshots - an array of paths to the screenshots of the application
|
|
160
|
+
* @property {Object.<string, Service>} services - (application specific) a map of the services associated with the app
|
|
161
|
+
* @property {string} slug - the default slug that should never change (alpha-numeric lowercase)
|
|
162
|
+
* @property {string} source - where the files of the app can be downloaded
|
|
163
|
+
* @property {string} state
|
|
164
|
+
* @property {Terms} terms - an object defining properties for terms that need to be displayed/accepted by the user when installing the application
|
|
165
|
+
* @property {"webapp"} type - type of application
|
|
166
|
+
* @property {string} updated_at
|
|
167
|
+
* @property {string} version - the current version number
|
|
168
|
+
* @typedef {CozyClientDocument & AppsDocument} IOCozyApp - An io.cozy.apps document
|
|
169
|
+
*/
|
|
170
|
+
|
|
79
171
|
/**
|
|
80
172
|
* @typedef {object} TriggersDocument
|
|
81
173
|
* @property {String} [_id] - document identifier
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -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": "61af4bcb1a0537b2f958cfa956298e5b537889e7"
|
|
79
79
|
}
|
package/types/models/note.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export function generatePrivateUrl(notesAppUrl: string, file: object, options?: {}): string;
|
|
2
2
|
export function generateUrlForNote(notesAppUrl: any, file: any): string;
|
|
3
|
-
export function fetchURL(client: object, file: object
|
|
3
|
+
export function fetchURL(client: object, file: object, options?: {
|
|
4
|
+
pathname: string;
|
|
5
|
+
}): Promise<string>;
|
package/types/types.d.ts
CHANGED
|
@@ -181,6 +181,182 @@ export type KonnectorsDocument = {
|
|
|
181
181
|
* - An io.cozy.konnectors document
|
|
182
182
|
*/
|
|
183
183
|
export type IOCozyKonnector = CozyClientDocument & KonnectorsDocument;
|
|
184
|
+
/**
|
|
185
|
+
* - name and url for the developer
|
|
186
|
+
*/
|
|
187
|
+
export type Developer = {
|
|
188
|
+
name: string;
|
|
189
|
+
url: string;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* - (application specific) a list of intents provided by this app
|
|
193
|
+
*/
|
|
194
|
+
export type Intent = {
|
|
195
|
+
action: string;
|
|
196
|
+
type: string[];
|
|
197
|
+
href: string;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* - an object with language slug as property, each name property is an object of localized informations
|
|
201
|
+
*/
|
|
202
|
+
export type Locale = {
|
|
203
|
+
long_description: string;
|
|
204
|
+
screenshots: string[];
|
|
205
|
+
short_description: string;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* - a map of permissions needed by the app
|
|
209
|
+
*/
|
|
210
|
+
export type Permission = {
|
|
211
|
+
type: string;
|
|
212
|
+
description?: string;
|
|
213
|
+
verbs?: string[];
|
|
214
|
+
selector?: string;
|
|
215
|
+
values?: string[];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* - (application specific) a map of routes for the app
|
|
219
|
+
*/
|
|
220
|
+
export type Route = {
|
|
221
|
+
folder: string;
|
|
222
|
+
index: string;
|
|
223
|
+
public: boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* - (application specific) a map of the services associated with the app (see cozy-stack services doc for more details)
|
|
227
|
+
*/
|
|
228
|
+
export type Service = {
|
|
229
|
+
type: string;
|
|
230
|
+
file: string;
|
|
231
|
+
debounce?: string;
|
|
232
|
+
trigger: string;
|
|
233
|
+
trigger_id: string;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* - an object defining properties for terms that need to be displayed/accepted by the user when installing the application
|
|
237
|
+
*/
|
|
238
|
+
export type Terms = {
|
|
239
|
+
url: string;
|
|
240
|
+
version: string;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* - The acceptance document details from cozy-flagship.
|
|
244
|
+
*/
|
|
245
|
+
export type AcceptDocumentsFromFlagship = {
|
|
246
|
+
accepted_mime_types: string[];
|
|
247
|
+
max_number_of_files: number;
|
|
248
|
+
max_size_per_file_in_MB: number;
|
|
249
|
+
/**
|
|
250
|
+
* - The route provided by the cozy-app to trigger the upload user flow
|
|
251
|
+
*/
|
|
252
|
+
route_to_upload: string;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* See https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.apps/
|
|
256
|
+
*/
|
|
257
|
+
export type AppsDocument = {
|
|
258
|
+
/**
|
|
259
|
+
* - The acceptance document details from flagship.
|
|
260
|
+
*/
|
|
261
|
+
accept_documents_from_flagship?: AcceptDocumentsFromFlagship;
|
|
262
|
+
/**
|
|
263
|
+
* - Whether to accept file upload from cozy-flagship.
|
|
264
|
+
*/
|
|
265
|
+
accept_from_flagship?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* - array of categories for your apps (see authorized categories), it will be ['others'] by default if empty
|
|
268
|
+
*/
|
|
269
|
+
categories: string[];
|
|
270
|
+
checksum: string;
|
|
271
|
+
created_at: string;
|
|
272
|
+
/**
|
|
273
|
+
* - name and url for the developer
|
|
274
|
+
*/
|
|
275
|
+
developer: Developer;
|
|
276
|
+
/**
|
|
277
|
+
* - the editor’s name to display on the cozy-bar
|
|
278
|
+
*/
|
|
279
|
+
editor: string;
|
|
280
|
+
/**
|
|
281
|
+
* - path to the icon for the home
|
|
282
|
+
*/
|
|
283
|
+
icon: string;
|
|
284
|
+
/**
|
|
285
|
+
* - (application specific) a list of intents provided by this app
|
|
286
|
+
*/
|
|
287
|
+
intents: Intent[];
|
|
288
|
+
/**
|
|
289
|
+
* - Languages available in the app
|
|
290
|
+
*/
|
|
291
|
+
langs: string[];
|
|
292
|
+
/**
|
|
293
|
+
* - the SPDX license identifier
|
|
294
|
+
*/
|
|
295
|
+
licence: string;
|
|
296
|
+
/**
|
|
297
|
+
* - an object with language slug as property, each name property is an object of localized informations
|
|
298
|
+
*/
|
|
299
|
+
locales: {
|
|
300
|
+
[x: string]: Locale;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* - the name to display on the home
|
|
304
|
+
*/
|
|
305
|
+
name: string;
|
|
306
|
+
/**
|
|
307
|
+
* - the prefix to display with the name
|
|
308
|
+
*/
|
|
309
|
+
name_prefix: string;
|
|
310
|
+
notifications: null;
|
|
311
|
+
/**
|
|
312
|
+
* - a map of permissions needed by the app
|
|
313
|
+
*/
|
|
314
|
+
permissions: {
|
|
315
|
+
[x: string]: Permission;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* - (application specific) a map of routes for the app
|
|
319
|
+
*/
|
|
320
|
+
routes: {
|
|
321
|
+
[x: string]: Route;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* - an array of paths to the screenshots of the application
|
|
325
|
+
*/
|
|
326
|
+
screenshots: string[];
|
|
327
|
+
/**
|
|
328
|
+
* - (application specific) a map of the services associated with the app
|
|
329
|
+
*/
|
|
330
|
+
services: {
|
|
331
|
+
[x: string]: Service;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* - the default slug that should never change (alpha-numeric lowercase)
|
|
335
|
+
*/
|
|
336
|
+
slug: string;
|
|
337
|
+
/**
|
|
338
|
+
* - where the files of the app can be downloaded
|
|
339
|
+
*/
|
|
340
|
+
source: string;
|
|
341
|
+
state: string;
|
|
342
|
+
/**
|
|
343
|
+
* - an object defining properties for terms that need to be displayed/accepted by the user when installing the application
|
|
344
|
+
*/
|
|
345
|
+
terms: Terms;
|
|
346
|
+
/**
|
|
347
|
+
* - type of application
|
|
348
|
+
*/
|
|
349
|
+
type: "webapp";
|
|
350
|
+
updated_at: string;
|
|
351
|
+
/**
|
|
352
|
+
* - the current version number
|
|
353
|
+
*/
|
|
354
|
+
version: string;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* - An io.cozy.apps document
|
|
358
|
+
*/
|
|
359
|
+
export type IOCozyApp = CozyClientDocument & AppsDocument;
|
|
184
360
|
export type TriggersDocument = {
|
|
185
361
|
/**
|
|
186
362
|
* - document identifier
|