@gudhub/core 1.0.45 → 1.0.48
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/GUDHUB/Managers/FileManager/FileManager.js +33 -23
- package/GUDHUB/config.js +2 -2
- package/package.json +1 -1
- package/umd/library.min.js +76 -48
- package/umd/library.min.js.map +1 -1
|
@@ -74,7 +74,7 @@ export class FileManager {
|
|
|
74
74
|
if(await this.isFileExists(app_id, file_id)) {
|
|
75
75
|
let file = await this.getFile(app_id, file_id);
|
|
76
76
|
let data = await this.req.get({
|
|
77
|
-
url: file.url,
|
|
77
|
+
url: file.url + '?timestamp=' + file.last_update,
|
|
78
78
|
externalResource: true
|
|
79
79
|
});
|
|
80
80
|
return {
|
|
@@ -107,19 +107,23 @@ export class FileManager {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
addFileToStorage(app_id, file) {
|
|
110
|
+
addFileToStorage(app_id, element_id, file) {
|
|
111
111
|
const app = this.storage.getApp(app_id);
|
|
112
112
|
if (app) {
|
|
113
113
|
app.file_list.push(file);
|
|
114
114
|
this.storage.updateApp(app);
|
|
115
|
+
this.pipeService.emit("gh_file_upload", { app_id, item_id: file.item_id, element_id }, file);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
addFilesToStorage(app_id, files) {
|
|
119
|
+
addFilesToStorage(app_id, element_id, files) {
|
|
119
120
|
const app = this.storage.getApp(app_id);
|
|
120
121
|
if (app) {
|
|
121
122
|
app.file_list.push(...files);
|
|
122
123
|
this.storage.updateApp(app);
|
|
124
|
+
files.forEach(file => {
|
|
125
|
+
this.pipeService.emit("gh_file_upload", { app_id, item_id: file.item_id, element_id }, file);
|
|
126
|
+
});
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
|
|
@@ -152,29 +156,35 @@ export class FileManager {
|
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
async getFile(app_id, file_id) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return file.file_id == file_id
|
|
159
|
+
const app = await this.appProcessor.getApp(app_id);
|
|
160
|
+
return new Promise((resolve,reject) => {
|
|
161
|
+
let findedFile = app.file_list.find((file) => {
|
|
162
|
+
return file.file_id == file_id
|
|
159
163
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
if(findedFile) {
|
|
165
|
+
resolve(findedFile)
|
|
166
|
+
} else {
|
|
167
|
+
resolve('')
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
}
|
|
165
171
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
async getFiles(app_id, filesId = []) {
|
|
173
|
+
|
|
174
|
+
const app = await this.appProcessor.getApp(app_id);
|
|
175
|
+
return new Promise((resolve, reject) => {
|
|
176
|
+
let findedFiles = app.file_list.filter((file) => {
|
|
170
177
|
return filesId.some(id => {
|
|
171
178
|
return id == file.file_id;
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
if(findedFiles) {
|
|
182
|
+
resolve(findedFiles);
|
|
183
|
+
} else {
|
|
184
|
+
resolve('')
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
}
|
|
178
188
|
|
|
179
189
|
async uploadFile(fileData, app_id, item_id) {
|
|
180
190
|
const file = await this.uploadFileApi(fileData, app_id, item_id);
|
|
@@ -184,7 +194,7 @@ export class FileManager {
|
|
|
184
194
|
|
|
185
195
|
async uploadFileFromString(fileObject) {
|
|
186
196
|
const file = await this.uploadFileFromStringApi(fileObject);
|
|
187
|
-
this.addFileToStorage(file.app_id, file);
|
|
197
|
+
this.addFileToStorage(file.app_id, fileObject.element_id, file);
|
|
188
198
|
return file;
|
|
189
199
|
}
|
|
190
200
|
|
package/GUDHUB/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export const server_url = "https://gudhub.com/GudHub";
|
|
2
2
|
//export const server_url = "https://gudhub.com/GudHub_Temp";
|
|
3
3
|
//export const server_url = "https://integration.gudhub.com/GudHub_Test";
|
|
4
|
-
export const server_url = "http://localhost:9000";
|
|
4
|
+
//export const server_url = "http://localhost:9000";
|
|
5
5
|
export const wss_url = "wss://gudhub.com/GudHub/ws/app/";
|
|
6
6
|
|
|
7
7
|
// FOR TESTS
|