cozy-client 43.5.0 → 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.
@@ -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.5.0";
2706
+ CozyClient.version = "43.5.1";
2707
2707
 
2708
2708
  _microee.default.mixin(CozyClient);
2709
2709
 
@@ -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 _yield$client$getStac, _yield$client$getStac2, note_id, subdomain, protocol, instance, sharecode, public_name, searchParams;
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
- _context.next = 2;
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 2:
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 = 17;
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 17:
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 18:
117
+ case 19:
103
118
  case "end":
104
119
  return _context.stop();
105
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "43.5.0",
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": "650a5cc8243d765a77584091d786fba1f9c84de3"
78
+ "gitHead": "61af4bcb1a0537b2f958cfa956298e5b537889e7"
79
79
  }
@@ -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): Promise<string>;
3
+ export function fetchURL(client: object, file: object, options?: {
4
+ pathname: string;
5
+ }): Promise<string>;