@did-space/fs-driver 0.3.10 → 0.3.12
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/operator/index.js +26 -22
- package/package.json +3 -3
package/dist/operator/index.js
CHANGED
|
@@ -182,8 +182,8 @@ class FsSpaceOperator {
|
|
|
182
182
|
if (!options.recursive) {
|
|
183
183
|
const objectNames = fs_extra_1.default.readdirSync(path);
|
|
184
184
|
return Promise.all(objectNames.map((objectName) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
const
|
|
186
|
-
const fileStat = fs_extra_1.default.statSync(
|
|
185
|
+
const absolutePath = (0, path_1.join)(this.options.root, options.key, objectName);
|
|
186
|
+
const fileStat = fs_extra_1.default.statSync(absolutePath);
|
|
187
187
|
const isDir = fileStat.isDirectory();
|
|
188
188
|
const directorySuffixes = isDir ? '/' : '';
|
|
189
189
|
const key = (0, path_1.join)(options.key, objectName, directorySuffixes);
|
|
@@ -191,7 +191,7 @@ class FsSpaceOperator {
|
|
|
191
191
|
let { size } = fileStat;
|
|
192
192
|
let lastModified = new Date(fileStat.mtime).getTime();
|
|
193
193
|
if (isDir) {
|
|
194
|
-
const pathStatus = yield this.getStatusAsOwner(
|
|
194
|
+
const pathStatus = yield this.getStatusAsOwner(absolutePath);
|
|
195
195
|
size = pathStatus.size;
|
|
196
196
|
lastModified = pathStatus.lastModified;
|
|
197
197
|
}
|
|
@@ -203,6 +203,7 @@ class FsSpaceOperator {
|
|
|
203
203
|
lastModified,
|
|
204
204
|
editable: core_1.Space.editable(key),
|
|
205
205
|
mimeType: mime_types_1.default.lookup(objectName) || 'unknown',
|
|
206
|
+
absolutePath: absolutePath + directorySuffixes,
|
|
206
207
|
};
|
|
207
208
|
})));
|
|
208
209
|
}
|
|
@@ -221,6 +222,7 @@ class FsSpaceOperator {
|
|
|
221
222
|
lastModified: new Date(file.stats.mtime).getTime(),
|
|
222
223
|
editable: true,
|
|
223
224
|
mimeType: mime_types_1.default.lookup((0, path_1.basename)(key)) || 'unknown',
|
|
225
|
+
absolutePath: file.path,
|
|
224
226
|
};
|
|
225
227
|
});
|
|
226
228
|
}
|
|
@@ -228,28 +230,30 @@ class FsSpaceOperator {
|
|
|
228
230
|
});
|
|
229
231
|
}
|
|
230
232
|
list(options) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const objectKey = (0, path_1.join)(this.options.root, options.key);
|
|
235
|
+
if (!fs_extra_1.default.existsSync(objectKey)) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
const fileStat = yield (0, fs_extra_1.stat)(objectKey);
|
|
239
|
+
const objectName = (0, path_1.basename)(objectKey);
|
|
240
|
+
const directorySuffixes = fileStat.isDirectory() ? '/' : '';
|
|
241
|
+
const key = (0, path_1.join)(options.key, directorySuffixes);
|
|
242
|
+
return {
|
|
243
|
+
key,
|
|
244
|
+
name: (0, path_1.join)(objectName, directorySuffixes),
|
|
245
|
+
isDir: fileStat.isDirectory(),
|
|
246
|
+
size: fileStat.size,
|
|
247
|
+
lastModified: new Date(fileStat.mtime).getTime(),
|
|
248
|
+
editable: core_1.Space.editable(key),
|
|
249
|
+
mimeType: mime_types_1.default.lookup(objectName) || 'unknown',
|
|
250
|
+
absolutePath: objectKey,
|
|
251
|
+
};
|
|
252
|
+
});
|
|
249
253
|
}
|
|
250
254
|
writeAsOwner(key, data, options) {
|
|
251
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
debug('writeAsOwner.before', JSON.stringify({ key, options }));
|
|
256
|
+
debug('writeAsOwner.before', JSON.stringify({ key, options: (0, lodash_1.omit)(options, 'data') }));
|
|
253
257
|
let objectPath = (0, path_1.join)(this.options.root, key);
|
|
254
258
|
if (options === null || options === void 0 ? void 0 : options.useGlobal) {
|
|
255
259
|
const prefix = this.options.root.split('/').slice(0, -1).join('/');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-space/fs-driver",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@did-space/core": "0.3.
|
|
39
|
+
"@did-space/core": "0.3.12",
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
41
|
"filehound": "^1.17.6",
|
|
42
42
|
"fs-extra": "^10.1.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"ts-jest": "^28.0.6",
|
|
61
61
|
"typescript": "^4.9.5"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "fa52ffb46e1427ab93da9f59b9b2b692818b1d02"
|
|
64
64
|
}
|