@social-mail/social-mail-web-server 1.4.749 → 1.4.751
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/server/seed/ui/seed-ui.js +1 -1
- package/dist/server/services/files/SnapshotService.d.ts.map +1 -1
- package/dist/server/services/files/SnapshotService.js +119 -59
- package/dist/server/services/files/SnapshotService.js.map +1 -1
- package/dist/server/storage/BaseStorage.d.ts +1 -0
- package/dist/server/storage/BaseStorage.d.ts.map +1 -1
- package/dist/server/storage/BaseStorage.js +5 -1
- package/dist/server/storage/BaseStorage.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/server/seed/ui/seed-ui.ts +1 -1
- package/src/server/services/files/SnapshotService.ts +9 -3
- package/src/server/storage/BaseStorage.ts +6 -1
package/package.json
CHANGED
|
@@ -68,6 +68,8 @@ export default class SnapshotService {
|
|
|
68
68
|
const { db } = this;
|
|
69
69
|
db.verifyFilters = false;
|
|
70
70
|
|
|
71
|
+
await using tx = await db.connection.createTransaction();
|
|
72
|
+
|
|
71
73
|
const sourcePath = folderID + "/%";
|
|
72
74
|
|
|
73
75
|
this.allFiles = await db.appFiles.where({ sourcePath}, (p) => (x) => Sql.text.like(x.path, p.sourcePath)
|
|
@@ -125,7 +127,7 @@ export default class SnapshotService {
|
|
|
125
127
|
|
|
126
128
|
if (html) {
|
|
127
129
|
const htmlFile = await this.tempFileService.createFrom(source.name, Buffer.from(html, "utf8"), "text/html");
|
|
128
|
-
await this.storage.
|
|
130
|
+
await this.storage.updateFile(dest, htmlFile);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
|
|
@@ -138,15 +140,19 @@ export default class SnapshotService {
|
|
|
138
140
|
|
|
139
141
|
if (html) {
|
|
140
142
|
const htmlFile = await this.tempFileService.createFrom(source.name, Buffer.from(html, "utf8"), "text/html");
|
|
141
|
-
await this.storage.
|
|
143
|
+
await this.storage.updateFile(dest, htmlFile);
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
|
|
147
|
+
await db.saveChanges();
|
|
148
|
+
|
|
145
149
|
await this.db.appFiles.where(this.snapshotRoot, (p) => (x) => x.appFileID === p.appFileID)
|
|
146
150
|
.update({ size: this.snapshotSize}, (p) => (x) => ({
|
|
147
151
|
fileSize: Sql.cast.asBigInt(p.size)
|
|
148
152
|
}));
|
|
149
153
|
|
|
154
|
+
await tx.commit();
|
|
155
|
+
|
|
150
156
|
return snapshotRoot;
|
|
151
157
|
|
|
152
158
|
}
|
|
@@ -164,7 +170,7 @@ export default class SnapshotService {
|
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
|
|
167
|
-
console.log(`Adding ${srcChild.path} - ${srcChild.name} in ${dest.path} - ${dest.name}`);
|
|
173
|
+
// console.log(`Adding ${srcChild.path} - ${srcChild.name} in ${dest.path} - ${dest.name}`);
|
|
168
174
|
|
|
169
175
|
const destChild = await db.appFiles.statements.insert({
|
|
170
176
|
... srcChild,
|
|
@@ -155,6 +155,11 @@ export default abstract class BaseStorage {
|
|
|
155
155
|
// return cachedPath;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
async updateFile(appFile: AppFile, file: LocalFile) {
|
|
159
|
+
const fc = await this.saveFileContent(file, void 0, FileType.canBeCompressed(file));
|
|
160
|
+
appFile.fileContentID = fc.fileContentID;
|
|
161
|
+
}
|
|
162
|
+
|
|
158
163
|
async saveFile(file: LocalFile, extra?: Partial<AppFile>) {
|
|
159
164
|
|
|
160
165
|
const scope = globalServices.createScope();
|
|
@@ -170,7 +175,7 @@ export default abstract class BaseStorage {
|
|
|
170
175
|
|
|
171
176
|
let appFile: AppFile;
|
|
172
177
|
|
|
173
|
-
if (parentID) {
|
|
178
|
+
if (parentID && name) {
|
|
174
179
|
appFile = await db.appFiles
|
|
175
180
|
.where({ parentID, name }, (p) =>
|
|
176
181
|
(x) => x.parentID === p.parentID
|