react-native-cloud-storage 2.2.1 → 2.3.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.
Files changed (188) hide show
  1. package/LICENSE +1 -1
  2. package/android/build.gradle +101 -0
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/AndroidManifestNew.xml +2 -0
  6. package/android/src/main/java/com/voicekit/CloudStorageError.kt +86 -0
  7. package/android/src/main/java/com/voicekit/CloudStorageLocalFileSystemModule.kt +236 -0
  8. package/android/src/main/java/com/voicekit/CloudStoragePackage.kt +17 -0
  9. package/android/src/main/java/com/voicekit/FileUtils.kt +41 -0
  10. package/android/src/main/java/com/voicekit/Types.kt +6 -0
  11. package/app.plugin.js +1 -1
  12. package/{lib/commonjs/RNCloudStorage.js → dist/commonjs/cloud-storage.js} +130 -80
  13. package/dist/commonjs/cloud-storage.js.map +1 -0
  14. package/dist/commonjs/expo-plugin/index.js +13 -0
  15. package/dist/commonjs/expo-plugin/index.js.map +1 -0
  16. package/{lib/commonjs/expo-plugin/withRNCloudStorageIos.js → dist/commonjs/expo-plugin/ios.js} +1 -1
  17. package/dist/commonjs/expo-plugin/ios.js.map +1 -0
  18. package/{lib/commonjs/hooks/useCloudFile.js → dist/commonjs/hooks/use-cloud-file.js} +26 -8
  19. package/dist/commonjs/hooks/use-cloud-file.js.map +1 -0
  20. package/{lib/commonjs/hooks/useIsCloudAvailable.js → dist/commonjs/hooks/use-is-cloud-available.js} +3 -3
  21. package/dist/commonjs/hooks/use-is-cloud-available.js.map +1 -0
  22. package/{lib → dist}/commonjs/index.js +10 -10
  23. package/dist/commonjs/index.js.map +1 -0
  24. package/dist/commonjs/storages/cloudkit.js +10 -0
  25. package/dist/commonjs/storages/cloudkit.js.map +1 -0
  26. package/{lib/commonjs → dist/commonjs/storages}/google-drive/client.js +82 -39
  27. package/dist/commonjs/storages/google-drive/client.js.map +1 -0
  28. package/{lib/commonjs → dist/commonjs/storages}/google-drive/index.js +120 -64
  29. package/dist/commonjs/storages/google-drive/index.js.map +1 -0
  30. package/dist/commonjs/storages/google-drive/types.js.map +1 -0
  31. package/dist/commonjs/types/native.js +28 -0
  32. package/dist/commonjs/types/native.js.map +1 -0
  33. package/{lib/commonjs/utils/CloudStorageError.js → dist/commonjs/utils/cloud-storage-error.js} +3 -1
  34. package/dist/commonjs/utils/cloud-storage-error.js.map +1 -0
  35. package/dist/commonjs/utils/constants.js +24 -0
  36. package/dist/commonjs/utils/constants.js.map +1 -0
  37. package/dist/commonjs/utils/local-fs.js +16 -0
  38. package/dist/commonjs/utils/local-fs.js.map +1 -0
  39. package/dist/commonjs/utils/native.js +35 -0
  40. package/dist/commonjs/utils/native.js.map +1 -0
  41. package/{lib/module/RNCloudStorage.js → dist/module/cloud-storage.js} +130 -80
  42. package/dist/module/cloud-storage.js.map +1 -0
  43. package/dist/module/expo-plugin/index.js +8 -0
  44. package/dist/module/expo-plugin/index.js.map +1 -0
  45. package/{lib/module/expo-plugin/withRNCloudStorageIos.js → dist/module/expo-plugin/ios.js} +1 -1
  46. package/dist/module/expo-plugin/ios.js.map +1 -0
  47. package/{lib/module/hooks/useCloudFile.js → dist/module/hooks/use-cloud-file.js} +25 -7
  48. package/dist/module/hooks/use-cloud-file.js.map +1 -0
  49. package/{lib/module/hooks/useIsCloudAvailable.js → dist/module/hooks/use-is-cloud-available.js} +2 -2
  50. package/dist/module/hooks/use-is-cloud-available.js.map +1 -0
  51. package/dist/module/index.js +9 -0
  52. package/dist/module/index.js.map +1 -0
  53. package/dist/module/storages/cloudkit.js +6 -0
  54. package/dist/module/storages/cloudkit.js.map +1 -0
  55. package/{lib/module → dist/module/storages}/google-drive/client.js +82 -39
  56. package/dist/module/storages/google-drive/client.js.map +1 -0
  57. package/{lib/module → dist/module/storages}/google-drive/index.js +119 -62
  58. package/dist/module/storages/google-drive/index.js.map +1 -0
  59. package/dist/module/storages/google-drive/types.js.map +1 -0
  60. package/dist/module/types/native.js +24 -0
  61. package/dist/module/types/native.js.map +1 -0
  62. package/{lib/module/utils/CloudStorageError.js → dist/module/utils/cloud-storage-error.js} +3 -1
  63. package/dist/module/utils/cloud-storage-error.js.map +1 -0
  64. package/dist/module/utils/constants.js +20 -0
  65. package/dist/module/utils/constants.js.map +1 -0
  66. package/dist/module/utils/local-fs.js +12 -0
  67. package/dist/module/utils/local-fs.js.map +1 -0
  68. package/dist/module/utils/native.js +30 -0
  69. package/dist/module/utils/native.js.map +1 -0
  70. package/{lib/typescript/RNCloudStorage.d.ts → dist/typescript/cloud-storage.d.ts} +60 -8
  71. package/dist/typescript/cloud-storage.d.ts.map +1 -0
  72. package/{lib/typescript/expo-plugin/withRNCloudStorage.d.ts → dist/typescript/expo-plugin/index.d.ts} +1 -1
  73. package/dist/typescript/expo-plugin/index.d.ts.map +1 -0
  74. package/{lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts → dist/typescript/expo-plugin/ios.d.ts} +1 -1
  75. package/dist/typescript/expo-plugin/ios.d.ts.map +1 -0
  76. package/{lib/typescript/hooks/useCloudFile.d.ts → dist/typescript/hooks/use-cloud-file.d.ts} +22 -4
  77. package/dist/typescript/hooks/use-cloud-file.d.ts.map +1 -0
  78. package/{lib/typescript/hooks/useIsCloudAvailable.d.ts → dist/typescript/hooks/use-is-cloud-available.d.ts} +2 -2
  79. package/dist/typescript/hooks/use-is-cloud-available.d.ts.map +1 -0
  80. package/dist/typescript/index.d.ts +7 -0
  81. package/dist/typescript/index.d.ts.map +1 -0
  82. package/dist/typescript/storages/cloudkit.d.ts +3 -0
  83. package/dist/typescript/storages/cloudkit.d.ts.map +1 -0
  84. package/{lib/typescript → dist/typescript/storages}/google-drive/client.d.ts +9 -2
  85. package/dist/typescript/storages/google-drive/client.d.ts.map +1 -0
  86. package/dist/typescript/storages/google-drive/index.d.ts +35 -0
  87. package/dist/typescript/storages/google-drive/index.d.ts.map +1 -0
  88. package/dist/typescript/storages/google-drive/types.d.ts.map +1 -0
  89. package/dist/typescript/types/native.d.ts +64 -0
  90. package/dist/typescript/types/native.d.ts.map +1 -0
  91. package/dist/typescript/utils/cloud-storage-error.d.ts +8 -0
  92. package/dist/typescript/utils/cloud-storage-error.d.ts.map +1 -0
  93. package/dist/typescript/utils/constants.d.ts +4 -0
  94. package/dist/typescript/utils/constants.d.ts.map +1 -0
  95. package/{lib → dist}/typescript/utils/helpers.d.ts.map +1 -1
  96. package/dist/typescript/utils/local-fs.d.ts +3 -0
  97. package/dist/typescript/utils/local-fs.d.ts.map +1 -0
  98. package/dist/typescript/utils/native.d.ts +7 -0
  99. package/dist/typescript/utils/native.d.ts.map +1 -0
  100. package/ios/CloudStorage.xcodeproj/project.pbxproj +12 -6
  101. package/ios/{CloudStorage.m → CloudStorageCloudKit.m} +4 -2
  102. package/ios/{CloudStorage.swift → CloudStorageCloudKit.swift} +60 -5
  103. package/ios/CloudStorageLocalFileSystem.m +15 -0
  104. package/ios/CloudStorageLocalFileSystem.swift +215 -0
  105. package/ios/Utils/CloudKitUtils.swift +4 -4
  106. package/ios/Utils/CloudStorageError.swift +8 -0
  107. package/ios/Utils/FileUtils.swift +19 -0
  108. package/ios/Utils/Types.swift +7 -1
  109. package/package.json +44 -103
  110. package/src/{RNCloudStorage.ts → cloud-storage.ts} +147 -85
  111. package/src/expo-plugin/{withRNCloudStorage.ts → index.ts} +2 -2
  112. package/src/hooks/{useCloudFile.ts → use-cloud-file.ts} +24 -6
  113. package/src/hooks/{useIsCloudAvailable.ts → use-is-cloud-available.ts} +1 -1
  114. package/src/index.ts +5 -6
  115. package/src/storages/cloudkit.ts +5 -0
  116. package/src/{google-drive → storages/google-drive}/client.ts +99 -40
  117. package/src/{google-drive → storages/google-drive}/index.ts +172 -89
  118. package/src/types/native.ts +50 -14
  119. package/src/utils/cloud-storage-error.ts +15 -0
  120. package/src/utils/constants.ts +20 -0
  121. package/src/utils/local-fs.ts +19 -0
  122. package/src/utils/native.ts +40 -0
  123. package/lib/commonjs/RNCloudStorage.js.map +0 -1
  124. package/lib/commonjs/expo-plugin/withRNCloudStorage.js +0 -13
  125. package/lib/commonjs/expo-plugin/withRNCloudStorage.js.map +0 -1
  126. package/lib/commonjs/expo-plugin/withRNCloudStorageIos.js.map +0 -1
  127. package/lib/commonjs/google-drive/client.js.map +0 -1
  128. package/lib/commonjs/google-drive/index.js.map +0 -1
  129. package/lib/commonjs/google-drive/types.js.map +0 -1
  130. package/lib/commonjs/hooks/useCloudFile.js.map +0 -1
  131. package/lib/commonjs/hooks/useIsCloudAvailable.js.map +0 -1
  132. package/lib/commonjs/index.js.map +0 -1
  133. package/lib/commonjs/types/native.js +0 -26
  134. package/lib/commonjs/types/native.js.map +0 -1
  135. package/lib/commonjs/utils/CloudStorageError.js.map +0 -1
  136. package/lib/module/RNCloudStorage.js.map +0 -1
  137. package/lib/module/expo-plugin/withRNCloudStorage.js +0 -8
  138. package/lib/module/expo-plugin/withRNCloudStorage.js.map +0 -1
  139. package/lib/module/expo-plugin/withRNCloudStorageIos.js.map +0 -1
  140. package/lib/module/google-drive/client.js.map +0 -1
  141. package/lib/module/google-drive/index.js.map +0 -1
  142. package/lib/module/google-drive/types.js.map +0 -1
  143. package/lib/module/hooks/useCloudFile.js.map +0 -1
  144. package/lib/module/hooks/useIsCloudAvailable.js.map +0 -1
  145. package/lib/module/index.js +0 -10
  146. package/lib/module/index.js.map +0 -1
  147. package/lib/module/types/native.js +0 -22
  148. package/lib/module/types/native.js.map +0 -1
  149. package/lib/module/utils/CloudStorageError.js.map +0 -1
  150. package/lib/typescript/RNCloudStorage.d.ts.map +0 -1
  151. package/lib/typescript/expo-plugin/withRNCloudStorage.d.ts.map +0 -1
  152. package/lib/typescript/expo-plugin/withRNCloudStorageIos.d.ts.map +0 -1
  153. package/lib/typescript/google-drive/client.d.ts.map +0 -1
  154. package/lib/typescript/google-drive/index.d.ts +0 -34
  155. package/lib/typescript/google-drive/index.d.ts.map +0 -1
  156. package/lib/typescript/google-drive/types.d.ts.map +0 -1
  157. package/lib/typescript/hooks/useCloudFile.d.ts.map +0 -1
  158. package/lib/typescript/hooks/useIsCloudAvailable.d.ts.map +0 -1
  159. package/lib/typescript/index.d.ts +0 -8
  160. package/lib/typescript/index.d.ts.map +0 -1
  161. package/lib/typescript/types/native.d.ts +0 -40
  162. package/lib/typescript/types/native.d.ts.map +0 -1
  163. package/lib/typescript/utils/CloudStorageError.d.ts +0 -8
  164. package/lib/typescript/utils/CloudStorageError.d.ts.map +0 -1
  165. package/src/utils/CloudStorageError.ts +0 -14
  166. /package/{lib → dist}/commonjs/expo-plugin/types/index.js +0 -0
  167. /package/{lib → dist}/commonjs/expo-plugin/types/index.js.map +0 -0
  168. /package/{lib/commonjs → dist/commonjs/storages}/google-drive/types.js +0 -0
  169. /package/{lib → dist}/commonjs/types/main.js +0 -0
  170. /package/{lib → dist}/commonjs/types/main.js.map +0 -0
  171. /package/{lib → dist}/commonjs/utils/helpers.js +0 -0
  172. /package/{lib → dist}/commonjs/utils/helpers.js.map +0 -0
  173. /package/{lib → dist}/module/expo-plugin/types/index.js +0 -0
  174. /package/{lib → dist}/module/expo-plugin/types/index.js.map +0 -0
  175. /package/{lib → dist}/module/package.json +0 -0
  176. /package/{lib/module → dist/module/storages}/google-drive/types.js +0 -0
  177. /package/{lib → dist}/module/types/main.js +0 -0
  178. /package/{lib → dist}/module/types/main.js.map +0 -0
  179. /package/{lib → dist}/module/utils/helpers.js +0 -0
  180. /package/{lib → dist}/module/utils/helpers.js.map +0 -0
  181. /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts +0 -0
  182. /package/{lib → dist}/typescript/expo-plugin/types/index.d.ts.map +0 -0
  183. /package/{lib/typescript → dist/typescript/storages}/google-drive/types.d.ts +0 -0
  184. /package/{lib → dist}/typescript/types/main.d.ts +0 -0
  185. /package/{lib → dist}/typescript/types/main.d.ts.map +0 -0
  186. /package/{lib → dist}/typescript/utils/helpers.d.ts +0 -0
  187. /package/src/expo-plugin/{withRNCloudStorageIos.ts → ios.ts} +0 -0
  188. /package/src/{google-drive → storages/google-drive}/types.ts +0 -0
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.GoogleDriveHttpError = void 0;
7
7
  var _types = require("./types");
8
+ var _localFs = require("../../utils/local-fs");
8
9
  const BASE_URL = 'https://www.googleapis.com/drive/v3';
9
10
  const BASE_UPLOAD_URL = 'https://www.googleapis.com/upload/drive/v3';
10
11
  const MULTIPART_BOUNDARY = 'foo_bar_baz';
11
12
  class GoogleDriveHttpError extends Error {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+
12
15
  constructor(message, status, json) {
13
16
  super(message);
14
17
  this.status = status;
@@ -16,22 +19,22 @@ class GoogleDriveHttpError extends Error {
16
19
  }
17
20
  }
18
21
 
19
- // TODO: fetch timeout
20
22
  // TODO: properly handle errors
21
23
  exports.GoogleDriveHttpError = GoogleDriveHttpError;
22
24
  class GoogleDriveApiClient {
25
+ _fetchTimeout = null;
23
26
  constructor(options) {
24
27
  this.options = options;
25
28
  }
26
29
  buildQueryString(query) {
27
- let res = Object.entries(query).filter(([, value]) => value !== undefined).map(([key, value]) => {
30
+ let result = Object.entries(query).filter(([, value]) => value !== undefined).map(([key, value]) => {
28
31
  if (typeof value === 'boolean') return `${encodeURIComponent(key)}=${value ? 'true' : 'false'}`;
29
32
  return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
30
33
  }).join('&');
31
- if (res) {
32
- res = `?${res}`;
34
+ if (result) {
35
+ result = `?${result}`;
33
36
  }
34
- return res;
37
+ return result;
35
38
  }
36
39
  async request(operation, {
37
40
  queryParameters,
@@ -46,7 +49,7 @@ class GoogleDriveApiClient {
46
49
  if (queryParameters) {
47
50
  path += this.buildQueryString(queryParameters);
48
51
  }
49
- clearTimeout(this._fetchTimeout);
52
+ if (this._fetchTimeout !== null) clearTimeout(this._fetchTimeout);
50
53
  const abortController = new AbortController();
51
54
  this._fetchTimeout = setTimeout(() => {
52
55
  abortController.abort();
@@ -64,8 +67,8 @@ class GoogleDriveApiClient {
64
67
  let json = null;
65
68
  try {
66
69
  json = await response.json();
67
- errorMessage = json.error?.message ?? `Request failed with status ${response.status}`;
68
- } catch (e) {
70
+ errorMessage = typeof json === 'object' && json !== null && 'error' in json && typeof json.error === 'object' && json.error !== null && 'message' in json.error && typeof json.error.message === 'string' ? json.error.message : `Request failed with status ${response.status}`;
71
+ } catch {
69
72
  errorMessage = `Request failed with status ${response.status}`;
70
73
  }
71
74
  throw new GoogleDriveHttpError(errorMessage, response.status, json);
@@ -80,13 +83,7 @@ class GoogleDriveApiClient {
80
83
  }
81
84
  buildMultiPartBody(metadata, media) {
82
85
  const body = [];
83
- body.push(`--${MULTIPART_BOUNDARY}\r\n`);
84
- body.push(`Content-Type: ${_types.MimeTypes.JSON}; charset=UTF-8\r\n\r\n`);
85
- body.push(`${JSON.stringify(metadata)}\r\n`);
86
- body.push(`--${MULTIPART_BOUNDARY}\r\n`);
87
- body.push(`Content-Type: ${media.mimeType}\r\n\r\n`);
88
- body.push(`${media.body}\r\n`);
89
- body.push(`--${MULTIPART_BOUNDARY}--`);
86
+ body.push(`--${MULTIPART_BOUNDARY}\r\n`, `Content-Type: ${_types.MimeTypes.JSON}; charset=UTF-8\r\n\r\n`, `${JSON.stringify(metadata)}\r\n`, `--${MULTIPART_BOUNDARY}\r\n`, `Content-Type: ${media.mimeType}\r\n\r\n`, `${media.body}\r\n`, `--${MULTIPART_BOUNDARY}--`);
90
87
  return body.join('');
91
88
  }
92
89
  async listFiles(space) {
@@ -96,7 +93,8 @@ class GoogleDriveApiClient {
96
93
  do {
97
94
  const queryParameters = {
98
95
  fields: `files(${fields.join(',')}),nextPageToken`,
99
- spaces: space
96
+ spaces: space,
97
+ pageToken
100
98
  };
101
99
  const response = await this.request(`/files`, {
102
100
  queryParameters
@@ -130,19 +128,44 @@ class GoogleDriveApiClient {
130
128
  });
131
129
  }
132
130
  async createFile(metadata, media) {
133
- const multipartRequestBody = this.buildMultiPartBody(metadata, media);
134
- await this.request(`/files`, {
135
- queryParameters: {
136
- uploadType: 'multipart'
137
- },
138
- method: 'POST',
139
- headers: {
140
- 'Content-Type': `multipart/related; boundary=${MULTIPART_BOUNDARY}`,
141
- 'Content-Length': multipartRequestBody.length.toString()
142
- },
143
- body: multipartRequestBody,
144
- baseUrl: BASE_UPLOAD_URL
145
- });
131
+ if ('body' in media) {
132
+ const multipartRequestBody = this.buildMultiPartBody(metadata, media);
133
+ await this.request(`/files`, {
134
+ queryParameters: {
135
+ uploadType: 'multipart'
136
+ },
137
+ method: 'POST',
138
+ headers: {
139
+ 'Content-Type': `multipart/related; boundary=${MULTIPART_BOUNDARY}`,
140
+ 'Content-Length': multipartRequestBody.length.toString()
141
+ },
142
+ body: multipartRequestBody,
143
+ baseUrl: BASE_UPLOAD_URL
144
+ });
145
+ } else {
146
+ // First, create an empty file with the required metadata
147
+ const file = await this.request(`/files`, {
148
+ method: 'POST',
149
+ headers: {
150
+ 'Content-Type': _types.MimeTypes.JSON
151
+ },
152
+ body: JSON.stringify({
153
+ ...metadata,
154
+ mimeType: media.mimeType
155
+ })
156
+ });
157
+
158
+ // Then, upload the binary content via the native helper module
159
+ const remoteUri = `${BASE_UPLOAD_URL}/files/${file.id}?uploadType=media`;
160
+ await _localFs.localFileSystem.uploadFile(media.localPath, remoteUri, {
161
+ method: 'PATCH',
162
+ uploadType: 'binary',
163
+ headers: {
164
+ 'Authorization': `Bearer ${this.options.accessToken}`,
165
+ 'Content-Type': media.mimeType
166
+ }
167
+ });
168
+ }
146
169
  }
147
170
  async createDirectory(metadata) {
148
171
  await this.request(`/files`, {
@@ -157,17 +180,37 @@ class GoogleDriveApiClient {
157
180
  });
158
181
  }
159
182
  async updateFile(fileId, media) {
160
- await this.request(`/files/${fileId}`, {
161
- queryParameters: {
162
- uploadType: 'media'
163
- },
164
- method: 'PATCH',
183
+ if ('body' in media) {
184
+ await this.request(`/files/${fileId}`, {
185
+ queryParameters: {
186
+ uploadType: 'media'
187
+ },
188
+ method: 'PATCH',
189
+ headers: {
190
+ 'Content-Type': media.mimeType,
191
+ 'Content-Length': media.body.length.toString()
192
+ },
193
+ body: media.body,
194
+ baseUrl: BASE_UPLOAD_URL
195
+ });
196
+ } else {
197
+ const remoteUri = `${BASE_UPLOAD_URL}/files/${fileId}?uploadType=media`;
198
+ await _localFs.localFileSystem.uploadFile(media.localPath, remoteUri, {
199
+ method: 'PATCH',
200
+ uploadType: 'binary',
201
+ headers: {
202
+ 'Authorization': `Bearer ${this.options.accessToken}`,
203
+ 'Content-Type': media.mimeType
204
+ }
205
+ });
206
+ }
207
+ }
208
+ async downloadFile(fileId, localPath) {
209
+ const remoteUri = `${BASE_URL}/files/${fileId}?alt=media`;
210
+ await _localFs.localFileSystem.downloadFile(remoteUri, localPath, {
165
211
  headers: {
166
- 'Content-Type': media.mimeType,
167
- 'Content-Length': media.body.length.toString()
168
- },
169
- body: media.body,
170
- baseUrl: BASE_UPLOAD_URL
212
+ Authorization: `Bearer ${this.options.accessToken}`
213
+ }
171
214
  });
172
215
  }
173
216
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_types","require","_localFs","BASE_URL","BASE_UPLOAD_URL","MULTIPART_BOUNDARY","GoogleDriveHttpError","Error","constructor","message","status","json","exports","GoogleDriveApiClient","_fetchTimeout","options","buildQueryString","query","result","Object","entries","filter","value","undefined","map","key","encodeURIComponent","join","request","operation","queryParameters","baseUrl","timeout","accessToken","path","clearTimeout","abortController","AbortController","setTimeout","abort","response","fetch","headers","Authorization","signal","ok","errorMessage","error","Accept","text","buildMultiPartBody","metadata","media","body","push","MimeTypes","JSON","stringify","mimeType","listFiles","space","files","pageToken","fields","spaces","nextPageToken","getFile","fileId","getFileText","alt","deleteFile","method","createFile","multipartRequestBody","uploadType","length","toString","file","remoteUri","id","localFileSystem","uploadFile","localPath","createDirectory","FOLDER","updateFile","downloadFile","default"],"sourceRoot":"../../../../src","sources":["storages/google-drive/client.ts"],"mapp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;QACPC,aAAa,EAAE,UAAU,IAAI,CAAC5B,OAAO,CAACkB,WAAW;MACnD;IACF,CAAC,CAAC;EACJ;AACF;AAACrB,OAAA,CAAA2E,OAAA,GAAA1E,oBAAA","ignoreList":[]}
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _native = require("../types/native");
8
- var _CloudStorageError = _interopRequireDefault(require("../utils/CloudStorageError"));
7
+ var _native = require("../../types/native");
8
+ var _cloudStorageError = _interopRequireDefault(require("../../utils/cloud-storage-error"));
9
9
  var _types = require("./types");
10
10
  var _client = _interopRequireWildcard(require("./client"));
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  /**
15
- * A proxy class that wraps the Google Drive API client implementation to match the native iOS interface.
14
+ * A JavaScript-based implementation of the Google Drive API that implements the cloud storage interface.
16
15
  */
17
16
  class GoogleDrive {
18
17
  constructor(options) {
@@ -20,17 +19,17 @@ class GoogleDrive {
20
19
  this.drive = new _client.default(options);
21
20
  return new Proxy(this, {
22
21
  // before calling any function, check if the access token is set
23
- get(target, prop) {
22
+ get(target, property) {
24
23
  const allowedFunctions = ['isCloudAvailable'];
25
- if (typeof target[prop] === 'function' && !allowedFunctions.includes(prop.toString())) {
24
+ if (typeof target[property] === 'function' && !allowedFunctions.includes(property.toString())) {
26
25
  const {
27
26
  accessToken
28
27
  } = options;
29
28
  if (!accessToken?.length) {
30
- throw new _CloudStorageError.default(`Google Drive access token is not set, cannot call function ${prop.toString()}`, _native.CloudStorageErrorCode.ACCESS_TOKEN_MISSING);
29
+ throw new _cloudStorageError.default(`Google Drive access token is not set, cannot call function ${property.toString()}`, _native.NativeCloudStorageErrorCode.ACCESS_TOKEN_MISSING);
31
30
  }
32
31
  }
33
- return target[prop];
32
+ return target[property];
34
33
  }
35
34
  });
36
35
  }
@@ -43,9 +42,13 @@ class GoogleDrive {
43
42
  getRootDirectory(scope) {
44
43
  switch (scope) {
45
44
  case 'documents':
46
- return 'drive';
45
+ {
46
+ return 'drive';
47
+ }
47
48
  case 'app_data':
48
- return 'appDataFolder';
49
+ {
50
+ return 'appDataFolder';
51
+ }
49
52
  }
50
53
  }
51
54
  resolvePathToDirectories(path) {
@@ -68,23 +71,23 @@ class GoogleDrive {
68
71
  the files array - if it does not, it means that the directory is a child of the root directory and the one we're
69
72
  looking for */
70
73
  for (const possibleTopDirectory of possibleTopDirectories) {
71
- if (!files.find(f => f.id === possibleTopDirectory.parents[0] && f.mimeType === _types.MimeTypes.FOLDER)) {
74
+ if (!files.some(f => f.id === possibleTopDirectory.parents[0] && f.mimeType === _types.MimeTypes.FOLDER)) {
72
75
  topDirectoryId = possibleTopDirectory.id;
73
76
  break;
74
77
  }
75
78
  }
76
79
  }
77
80
  if (!topDirectoryId) {
78
- throw new _CloudStorageError.default(`Could not find top directory with name ${directoryTree[0]}`, _native.CloudStorageErrorCode.DIRECTORY_NOT_FOUND);
81
+ throw new _cloudStorageError.default(`Could not find top directory with name ${directoryTree[0]}`, _native.NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
79
82
  }
80
83
 
81
84
  // now, we traverse the directories array and get the id of the last directory from the files array
82
85
  let currentDirectoryId = topDirectoryId;
83
- for (let i = 1; i < directoryTree.length; i++) {
86
+ for (let index = 1; index < directoryTree.length; index++) {
84
87
  const currentDirectory = files.find(f => f.id === currentDirectoryId);
85
- if (!currentDirectory) throw new _CloudStorageError.default(`Could not find directory with id ${currentDirectoryId}`, _native.CloudStorageErrorCode.DIRECTORY_NOT_FOUND);
86
- const nextDirectory = files.find(f => f.name === directoryTree[i] && f.parents[0] === currentDirectoryId);
87
- if (!nextDirectory) throw new _CloudStorageError.default(`Could not find directory with name ${directoryTree[i]}`, _native.CloudStorageErrorCode.DIRECTORY_NOT_FOUND);
88
+ if (!currentDirectory) throw new _cloudStorageError.default(`Could not find directory with id ${currentDirectoryId}`, _native.NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
89
+ const nextDirectory = files.find(f => f.name === directoryTree[index] && f.parents[0] === currentDirectoryId);
90
+ if (!nextDirectory) throw new _cloudStorageError.default(`Could not find directory with name ${directoryTree[index]}`, _native.NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
88
91
  currentDirectoryId = nextDirectory.id;
89
92
  }
90
93
  return currentDirectoryId;
@@ -98,7 +101,7 @@ class GoogleDrive {
98
101
  async getRootDirectoryId(scope) {
99
102
  const files = await this.drive.listFiles(this.getRootDirectory(scope));
100
103
  for (const file of files) {
101
- if (!files.find(f => f.id === file.parents[0])) return file.parents[0] ?? null;
104
+ if (!files.some(f => f.id === file.parents[0])) return file.parents[0] ?? null;
102
105
  }
103
106
  return null;
104
107
  }
@@ -106,15 +109,10 @@ class GoogleDrive {
106
109
  const {
107
110
  strictFilenames
108
111
  } = this.options;
109
- let possibleFiles;
110
- if (parentDirectoryId) {
111
- possibleFiles = files.filter(f => f.name === filename && f.parents[0] === parentDirectoryId);
112
- } else {
113
- possibleFiles = files.filter(f => f.name === filename && !files.find(f2 => f2.id === f.parents[0]));
114
- }
112
+ const possibleFiles = parentDirectoryId ? files.filter(f => f.name === filename && f.parents[0] === parentDirectoryId) : files.filter(f => f.name === filename && !files.some(f2 => f2.id === f.parents[0]));
115
113
  if (possibleFiles.length <= 1) return;
116
114
  if (strictFilenames) {
117
- throw new _CloudStorageError.default(`Multiple files with the same name found at path ${path}: ${possibleFiles.map(f => f.id).join(', ')}`, _native.CloudStorageErrorCode.MULTIPLE_FILES_SAME_NAME);
115
+ throw new _cloudStorageError.default(`Multiple files with the same name found at path ${path}: ${possibleFiles.map(f => f.id).join(', ')}`, _native.NativeCloudStorageErrorCode.MULTIPLE_FILES_SAME_NAME);
118
116
  }
119
117
  }
120
118
  async getFileId(path, scope, throwIf = false) {
@@ -122,7 +120,7 @@ class GoogleDrive {
122
120
  const files = await this.drive.listFiles(this.getRootDirectory(scope));
123
121
  if (path === '' || path === '/') {
124
122
  const rootDirectoryId = await this.getRootDirectoryId(scope);
125
- if (!rootDirectoryId) throw new _CloudStorageError.default(`Root directory in scope ${scope} not found`, _native.CloudStorageErrorCode.DIRECTORY_NOT_FOUND);
123
+ if (!rootDirectoryId) throw new _cloudStorageError.default(`Root directory in scope ${scope} not found`, _native.NativeCloudStorageErrorCode.DIRECTORY_NOT_FOUND);
126
124
  return rootDirectoryId;
127
125
  }
128
126
  const {
@@ -135,24 +133,24 @@ class GoogleDrive {
135
133
  this.checkIfMultipleFilesWithSameName(path, files, filename, null);
136
134
  /* when the file is supposed to be in the root directory, we need to get the file where the name is the filename
137
135
  and the first parent has an id which does not exist in the files array */
138
- file = files.find(f => f.name === filename && !files.find(f2 => f2.id === f.parents[0]));
136
+ file = files.find(f => f.name === filename && !files.some(f2 => f2.id === f.parents[0]));
139
137
  } else {
140
138
  this.checkIfMultipleFilesWithSameName(path, files, filename, parentDirectoryId);
141
139
  file = files.find(f => f.name === filename && f.parents[0] === parentDirectoryId);
142
140
  }
143
- if (!file) throw new _CloudStorageError.default(`File not found`, _native.CloudStorageErrorCode.FILE_NOT_FOUND);
141
+ if (!file) throw new _cloudStorageError.default(`File not found`, _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND);
144
142
  if (file.mimeType === _types.MimeTypes.FOLDER && throwIf === 'directory') {
145
- throw new _CloudStorageError.default(`Path ${path} is a directory`, _native.CloudStorageErrorCode.PATH_IS_DIRECTORY);
143
+ throw new _cloudStorageError.default(`Path ${path} is a directory`, _native.NativeCloudStorageErrorCode.PATH_IS_DIRECTORY);
146
144
  } else if (file.mimeType !== _types.MimeTypes.FOLDER && throwIf === 'file') {
147
- throw new _CloudStorageError.default(`Path ${path} is a file`, _native.CloudStorageErrorCode.FILE_NOT_FOUND);
145
+ throw new _cloudStorageError.default(`Path ${path} is a file`, _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND);
148
146
  }
149
147
  return file.id;
150
- } catch (e) {
151
- if (e instanceof _client.GoogleDriveHttpError && e.json?.error?.status === 'UNAUTHENTICATED') {
152
- throw new _CloudStorageError.default(`Could not authenticate with Google Drive`, _native.CloudStorageErrorCode.AUTHENTICATION_FAILED, e.json);
148
+ } catch (error) {
149
+ if (error instanceof _client.GoogleDriveHttpError && error.json?.error?.status === 'UNAUTHENTICATED') {
150
+ throw new _cloudStorageError.default(`Could not authenticate with Google Drive`, _native.NativeCloudStorageErrorCode.AUTHENTICATION_FAILED, error.json);
153
151
  } else {
154
- if (e instanceof _CloudStorageError.default) throw e;
155
- throw new _CloudStorageError.default(`Could not get file id for path ${path}`, _native.CloudStorageErrorCode.UNKNOWN, e);
152
+ if (error instanceof _cloudStorageError.default) throw error;
153
+ throw new _cloudStorageError.default(`Could not get file id for path ${path}`, _native.NativeCloudStorageErrorCode.UNKNOWN, error);
156
154
  }
157
155
  }
158
156
  }
@@ -160,26 +158,26 @@ class GoogleDrive {
160
158
  try {
161
159
  await this.getFileId(path, scope);
162
160
  return true;
163
- } catch (e) {
164
- if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.FILE_NOT_FOUND) return false;else throw e;
161
+ } catch (error) {
162
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) return false;else throw error;
165
163
  }
166
164
  }
167
165
  async appendToFile(path, data, scope) {
168
166
  let fileId;
169
- let prevContent = '';
167
+ let previousContent = '';
170
168
  try {
171
169
  fileId = await this.getFileId(path, scope);
172
- prevContent = await this.drive.getFileText(fileId);
173
- } catch (e) {
174
- if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.FILE_NOT_FOUND) {
170
+ previousContent = await this.drive.getFileText(fileId);
171
+ } catch (error) {
172
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
175
173
  /* do nothing, simply create the file */
176
174
  } else {
177
- throw e;
175
+ throw error;
178
176
  }
179
177
  }
180
178
  if (fileId) {
181
179
  await this.drive.updateFile(fileId, {
182
- body: prevContent + data,
180
+ body: previousContent + data,
183
181
  mimeType: _types.MimeTypes.TEXT
184
182
  });
185
183
  } else {
@@ -203,22 +201,22 @@ class GoogleDrive {
203
201
  if (overwrite) {
204
202
  try {
205
203
  fileId = await this.getFileId(path, scope);
206
- } catch (e) {
207
- if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.FILE_NOT_FOUND) {
204
+ } catch (error) {
205
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
208
206
  /* do nothing, simply create the file */
209
207
  } else {
210
- throw e;
208
+ throw error;
211
209
  }
212
210
  }
213
211
  } else {
214
212
  try {
215
213
  await this.getFileId(path, scope);
216
- throw new _CloudStorageError.default(`File ${path} already exists`, _native.CloudStorageErrorCode.FILE_ALREADY_EXISTS);
217
- } catch (e) {
218
- if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.FILE_NOT_FOUND) {
214
+ throw new _cloudStorageError.default(`File ${path} already exists`, _native.NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
215
+ } catch (error) {
216
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
219
217
  /* do nothing, simply create the file */
220
218
  } else {
221
- throw e;
219
+ throw error;
222
220
  }
223
221
  }
224
222
  }
@@ -245,26 +243,26 @@ class GoogleDrive {
245
243
  }
246
244
  async listFiles(path, scope) {
247
245
  const allFiles = await this.drive.listFiles(this.getRootDirectory(scope));
248
- if (path !== '') {
246
+ if (path === '') {
247
+ const rootDirectoryId = await this.getRootDirectoryId(scope);
248
+ return [...new Set(allFiles.filter(f => (f.parents ?? [])[0] === rootDirectoryId).map(f => f.name))];
249
+ } else {
249
250
  const fileId = await this.getFileId(path, scope);
250
251
  const files = allFiles.filter(f => (f.parents ?? [])[0] === fileId);
251
- return Array.from(new Set(files.map(f => f.name)));
252
- } else {
253
- const rootDirectoryId = await this.getRootDirectoryId(scope);
254
- return Array.from(new Set(allFiles.filter(f => (f.parents ?? [])[0] === rootDirectoryId).map(f => f.name)));
252
+ return [...new Set(files.map(f => f.name))];
255
253
  }
256
254
  }
257
255
  async createDirectory(path, scope) {
258
256
  try {
259
257
  await this.getFileId(path, scope);
260
- throw new _CloudStorageError.default(`File ${path} already exists`, _native.CloudStorageErrorCode.FILE_ALREADY_EXISTS);
261
- } catch (e) {
262
- if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.FILE_NOT_FOUND) {
258
+ throw new _cloudStorageError.default(`File ${path} already exists`, _native.NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
259
+ } catch (error) {
260
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
263
261
  /* do nothing, simply create the file */
264
- } else if (e instanceof _CloudStorageError.default && e.code === _native.CloudStorageErrorCode.PATH_IS_DIRECTORY) {
265
- throw new _CloudStorageError.default(`Directory ${path} already exists`, _native.CloudStorageErrorCode.FILE_ALREADY_EXISTS);
262
+ } else if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.PATH_IS_DIRECTORY) {
263
+ throw new _cloudStorageError.default(`Directory ${path} already exists`, _native.NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
266
264
  } else {
267
- throw e;
265
+ throw error;
268
266
  }
269
267
  }
270
268
  const files = await this.drive.listFiles(this.getRootDirectory(scope));
@@ -283,8 +281,8 @@ class GoogleDrive {
283
281
  const content = await this.drive.getFileText(fileId);
284
282
  return content;
285
283
  }
286
- async downloadFile(_path, _scope) {
287
- // Downloading files from Google Drive is not necessary / possible, as they need to be downloaded on every read operation via the API anyway
284
+ async triggerSync(_path, _scope) {
285
+ // Triggering file synchronization in Google Drive is not necessary / possible, as they need to be downloaded on every read operation via the API anyway
288
286
  return;
289
287
  }
290
288
  async deleteFile(path, scope) {
@@ -300,7 +298,7 @@ class GoogleDrive {
300
298
  const files = await this.drive.listFiles(this.getRootDirectory(scope));
301
299
  const filesInDirectory = files.filter(f => (f.parents ?? [])[0] === fileId);
302
300
  if (filesInDirectory.length > 0) {
303
- throw new _CloudStorageError.default(`Directory ${path} is not empty`, _native.CloudStorageErrorCode.DELETE_ERROR, filesInDirectory);
301
+ throw new _cloudStorageError.default(`Directory ${path} is not empty`, _native.NativeCloudStorageErrorCode.DELETE_ERROR, filesInDirectory);
304
302
  }
305
303
  }
306
304
  await this.drive.deleteFile(fileId);
@@ -316,6 +314,64 @@ class GoogleDrive {
316
314
  isFile: file.mimeType !== _types.MimeTypes.FOLDER
317
315
  };
318
316
  }
317
+ async downloadFile(remotePath, localPath, scope) {
318
+ const fileId = await this.getFileId(remotePath, scope, 'directory');
319
+ try {
320
+ await this.drive.downloadFile(fileId, localPath);
321
+ } catch (error) {
322
+ if (error instanceof _cloudStorageError.default) throw error;
323
+ throw new _cloudStorageError.default(`Could not download file ${remotePath} to ${localPath}`, _native.NativeCloudStorageErrorCode.UNKNOWN, error);
324
+ }
325
+ }
326
+ async uploadFile(remotePath, localPath, mimeType, scope, overwrite) {
327
+ let fileId;
328
+ if (overwrite) {
329
+ try {
330
+ fileId = await this.getFileId(remotePath, scope);
331
+ } catch (error) {
332
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
333
+ /* File doesn't exist -> we'll create it below */
334
+ } else {
335
+ throw error;
336
+ }
337
+ }
338
+ } else {
339
+ try {
340
+ await this.getFileId(remotePath, scope);
341
+ throw new _cloudStorageError.default(`File ${remotePath} already exists`, _native.NativeCloudStorageErrorCode.FILE_ALREADY_EXISTS);
342
+ } catch (error) {
343
+ if (error instanceof _cloudStorageError.default && error.code === _native.NativeCloudStorageErrorCode.FILE_NOT_FOUND) {
344
+ /* not found -> ok, we'll create */
345
+ } else if (error instanceof _cloudStorageError.default) {
346
+ throw error;
347
+ } else {
348
+ throw error;
349
+ }
350
+ }
351
+ }
352
+ if (fileId) {
353
+ // Overwrite existing file
354
+ await this.drive.updateFile(fileId, {
355
+ mimeType,
356
+ localPath
357
+ });
358
+ } else {
359
+ // Need to create a new file first
360
+ const files = await this.drive.listFiles(this.getRootDirectory(scope));
361
+ const {
362
+ directories,
363
+ filename
364
+ } = this.resolvePathToDirectories(remotePath);
365
+ const parentDirectoryId = this.findParentDirectoryId(files, directories);
366
+ await this.drive.createFile({
367
+ name: filename,
368
+ parents: parentDirectoryId ? [parentDirectoryId] : scope === 'app_data' ? [this.getRootDirectory(scope)] : undefined
369
+ }, {
370
+ mimeType,
371
+ localPath
372
+ });
373
+ }
374
+ }
319
375
  }
320
376
  exports.default = GoogleDrive;
321
377
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_native","require","_cloudStorageError","_interopRequireDefault","_types","_client","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GoogleDrive","constructor","options","drive","GoogleDriveApiClient","Proxy","target","property","allowedFunctions","includes","toString","accessToken","length","CloudStorageError","NativeCloudStorageErrorCode","ACCESS_TOKEN_MISSING","isCloudAvailable","getRootDirectory","scope","resolvePathToDirectories","path","startsWith","slice","endsWith","directories","split","actualFilename","pop","filename","findParentDirectoryId","files","directoryTree","possibleTopDirectories","filter","mimeType","MimeTypes","FOLDER","name","topDirectoryId","id","possibleTopDirectory","some","parents","DIRECTORY_NOT_FOUND","currentDirectoryId","index","currentDirectory","find","nextDirectory","getRootDirectoryId","listFiles","file","checkIfMultipleFilesWithSameName","parentDirectoryId","strictFilenames","possibleFiles","f2","map","join","MULTIPLE_FILES_SAME_NAME","getFileId","throwIf","rootDirectoryId","FILE_NOT_FOUND","PATH_IS_DIRECTORY","error","GoogleDriveHttpError","json","status","AUTHENTICATION_FAILED","UNKNOWN","fileExists","code","appendToFile","data","fileId","previousContent","getFileText","updateFile","body","TEXT","createFile","undefined","overwrite","FILE_ALREADY_EXISTS","allFiles","Set","createDirectory","readFile","content","triggerSync","_path","_scope","deleteFile","deleteDirectory","recursive","filesInDirectory","DELETE_ERROR","statFile","getFile","size","birthtimeMs","Date","createdTime","getTime","mtimeMs","modifiedTime","isDirectory","isFile","downloadFile","remotePath","localPath","uploadFile","exports"],"sourceRoot":"../../../../src","sources":["storages/google-drive/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,uBAAA,CAAAL,OAAA;AAAsE,SAAAK,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA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C,MAAM,IAAIL,0BAAiB,CACzB,QAAQiG,UAAU,iBAAiB,EACnChG,mCAA2B,CAACsE,mBAC9B,CAAC;MACH,CAAC,CAAC,OAAOnB,KAAc,EAAE;QACvB,IAAIA,KAAK,YAAYpD,0BAAiB,IAAIoD,KAAK,CAACO,IAAI,KAAK1D,mCAA2B,CAACiD,cAAc,EAAE;UACnG;QAAA,CACD,MAAM,IAAIE,KAAK,YAAYpD,0BAAiB,EAAE;UAC7C,MAAMoD,KAAK;QACb,CAAC,MAAM;UACL,MAAMA,KAAK;QACb;MACF;IACF;IAEA,IAAIU,MAAM,EAAE;MACV;MACA,MAAM,IAAI,CAACxE,KAAK,CAAC2E,UAAU,CAACH,MAAM,EAAE;QAClCzC,QAAQ;QACR6E;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL;MACA,MAAMjF,KAAK,GAAG,MAAM,IAAI,CAAC3B,KAAK,CAAC+C,SAAS,CAAC,IAAI,CAACjC,gBAAgB,CAACC,KAAK,CAAC,CAAC;MACtE,MAAM;QAAEM,WAAW;QAAEI;MAAS,CAAC,GAAG,IAAI,CAACT,wBAAwB,CAAC2F,UAAU,CAAC;MAC3E,MAAMzD,iBAAiB,GAAG,IAAI,CAACxB,qBAAqB,CAACC,KAAK,EAAEN,WAAW,CAAC;MAExE,MAAM,IAAI,CAACrB,KAAK,CAAC8E,UAAU,CACzB;QACE5C,IAAI,EAAET,QAAQ;QACdc,OAAO,EAAEW,iBAAiB,GACtB,CAACA,iBAAiB,CAAC,GACnBnC,KAAK,KAAK,UAAU,GACpB,CAAC,IAAI,CAACD,gBAAgB,CAACC,KAAK,CAAC,CAAC,GAC9BgE;MACN,CAAC,EACD;QACEhD,QAAQ;QACR6E;MACF,CACF,CAAC;IACH;EACF;AACF;AAACE,OAAA,CAAA1H,OAAA,GAAAS,WAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MimeTypes","exports"],"sourceRoot":"../../../../src","sources":["storages/google-drive/types.ts"],"mappings":";;;;;;IAEYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NativeCloudStorageErrorCode = void 0;
7
+ let NativeCloudStorageErrorCode = exports.NativeCloudStorageErrorCode = /*#__PURE__*/function (NativeCloudStorageErrorCode) {
8
+ NativeCloudStorageErrorCode["INVALID_SCOPE"] = "ERR_INVALID_SCOPE";
9
+ NativeCloudStorageErrorCode["FILE_NOT_FOUND"] = "ERR_FILE_NOT_FOUND";
10
+ NativeCloudStorageErrorCode["PATH_IS_FILE"] = "ERR_PATH_IS_FILE";
11
+ NativeCloudStorageErrorCode["PATH_IS_DIRECTORY"] = "ERR_PATH_IS_DIRECTORY";
12
+ NativeCloudStorageErrorCode["DIRECTORY_NOT_FOUND"] = "ERR_DIRECTORY_NOT_FOUND";
13
+ NativeCloudStorageErrorCode["DIRECTORY_NOT_EMPTY"] = "ERR_DIRECTORY_NOT_EMPTY";
14
+ NativeCloudStorageErrorCode["FILE_ALREADY_EXISTS"] = "ERR_FILE_EXISTS";
15
+ NativeCloudStorageErrorCode["MULTIPLE_FILES_SAME_NAME"] = "ERR_MULTIPLE_FILES_SAME_NAME";
16
+ NativeCloudStorageErrorCode["AUTHENTICATION_FAILED"] = "ERR_AUTHENTICATION_FAILED";
17
+ NativeCloudStorageErrorCode["WRITE_ERROR"] = "ERR_WRITE_ERROR";
18
+ NativeCloudStorageErrorCode["READ_ERROR"] = "ERR_READ_ERROR";
19
+ NativeCloudStorageErrorCode["DELETE_ERROR"] = "ERR_DELETE_ERROR";
20
+ NativeCloudStorageErrorCode["STAT_ERROR"] = "ERR_STAT_ERROR";
21
+ NativeCloudStorageErrorCode["UNKNOWN"] = "ERR_UNKNOWN";
22
+ NativeCloudStorageErrorCode["FILE_NOT_DOWNLOADABLE"] = "ERR_FILE_NOT_DOWNLOADABLE";
23
+ NativeCloudStorageErrorCode["ACCESS_TOKEN_MISSING"] = "ERR_ACCESS_TOKEN_MISSING";
24
+ NativeCloudStorageErrorCode["INVALID_URL"] = "ERR_INVALID_URL";
25
+ NativeCloudStorageErrorCode["NETWORK_ERROR"] = "ERR_NETWORK_ERROR";
26
+ return NativeCloudStorageErrorCode;
27
+ }({});
28
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeCloudStorageErrorCode","exports"],"sourceRoot":"../../../src","sources":["types/native.ts"],"mappings":";;;;;;IAUYA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,0BAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAA3BA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA","ignoreList":[]}