@dnax/core 0.70.2 → 0.70.3
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/driver/mongo/utils.ts +6 -6
- package/lib/bento/index.ts +1 -1
- package/lib/media/sftp.ts +29 -31
- package/package.json +2 -3
package/driver/mongo/utils.ts
CHANGED
|
@@ -139,12 +139,6 @@ function buildPipeline(params: findParam, col?: Collection | undefined | null) {
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
if (params?.$sortInclude) {
|
|
143
|
-
pipeline.push({
|
|
144
|
-
$sort: params?.$sortInclude,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
142
|
if (params?.$projectInclude) {
|
|
149
143
|
pipeline.push({
|
|
150
144
|
$project: params.$projectInclude,
|
|
@@ -164,6 +158,12 @@ function buildPipeline(params: findParam, col?: Collection | undefined | null) {
|
|
|
164
158
|
});
|
|
165
159
|
}
|
|
166
160
|
|
|
161
|
+
if (params?.$sortInclude) {
|
|
162
|
+
pipeline.push({
|
|
163
|
+
$sort: params?.$sortInclude,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
167
|
return pipeline || [];
|
|
168
168
|
}
|
|
169
169
|
|
package/lib/bento/index.ts
CHANGED
package/lib/media/sftp.ts
CHANGED
|
@@ -29,46 +29,42 @@ class FilesystemSftpAdapter {
|
|
|
29
29
|
this.type = "sftp";
|
|
30
30
|
this.conn = new Client({
|
|
31
31
|
captureRejections: true,
|
|
32
|
-
|
|
33
32
|
//captureRejections: true,
|
|
34
33
|
});
|
|
34
|
+
|
|
35
|
+
this.connect()
|
|
36
|
+
.then((e) => {
|
|
37
|
+
e.conn.end();
|
|
38
|
+
})
|
|
39
|
+
.catch((err) => {
|
|
40
|
+
consola.error(`SFTP: Failed to connect ${this.config.host}`.red);
|
|
41
|
+
});
|
|
42
|
+
// this.conn.
|
|
35
43
|
return this;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
async syncCollectionMedia(col: Collection) {
|
|
39
47
|
if (!this.config?.remoteDir) this.config.remoteDir = "/home/" + col?.slug;
|
|
40
|
-
await this.connect()
|
|
41
|
-
.then((e) => {
|
|
42
|
-
let visibility = col?.media?.visibility || "public";
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
persistent: true,
|
|
53
|
-
ignoreInitial: true,
|
|
54
|
-
ignored: this.config.ignorePatterns || [],
|
|
55
|
-
});
|
|
49
|
+
let visibility = col?.media?.visibility || "public";
|
|
50
|
+
let dirToWatch = path.join(process.cwd(), BASE_DIR, col?.slug, visibility);
|
|
51
|
+
dirToWatch = path.resolve(dirToWatch);
|
|
52
|
+
const watcher = chokidar.watch(dirToWatch, {
|
|
53
|
+
persistent: true,
|
|
54
|
+
ignoreInitial: true,
|
|
55
|
+
ignored: this.config.ignorePatterns || [],
|
|
56
|
+
});
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
.catch((err) => {
|
|
69
|
-
consola.error(`SFTP: Failed to connect ${this.config.host}`.red);
|
|
70
|
-
consola.error(err?.message || err);
|
|
71
|
-
});
|
|
58
|
+
watcher.on("all", (event, filePath) => {
|
|
59
|
+
if (event == "change" || event == "add") {
|
|
60
|
+
//consola.info(`SFTP: ${event} ${filePath}`);
|
|
61
|
+
let remotePath = path.join(
|
|
62
|
+
this.config.remoteDir,
|
|
63
|
+
path.basename(filePath)
|
|
64
|
+
);
|
|
65
|
+
this.put(filePath, remotePath);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
connect(): Promise<{ sftp: SFTPWrapper; conn: Client }> {
|
|
@@ -98,6 +94,7 @@ class FilesystemSftpAdapter {
|
|
|
98
94
|
remotePath,
|
|
99
95
|
{
|
|
100
96
|
mode: 0o777,
|
|
97
|
+
// concurrency
|
|
101
98
|
},
|
|
102
99
|
(err) => {
|
|
103
100
|
conn.end();
|
|
@@ -107,6 +104,7 @@ class FilesystemSftpAdapter {
|
|
|
107
104
|
if (err) {
|
|
108
105
|
reject(err?.message);
|
|
109
106
|
}
|
|
107
|
+
|
|
110
108
|
resolve(true);
|
|
111
109
|
}
|
|
112
110
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnax/core",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.3",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {},
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
"@types/minio": "^7.1.1",
|
|
14
14
|
"@types/nodemailer": "^6.4.17",
|
|
15
15
|
"@types/pidusage": "^2.0.5",
|
|
16
|
-
"@types/ssh2-sftp-client": "^9.0.4",
|
|
17
16
|
"@types/uuid": "^10.0.0"
|
|
18
17
|
},
|
|
19
18
|
"peerDependencies": {
|
|
20
|
-
"typescript": "^5.
|
|
19
|
+
"typescript": "^5.9.2"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
22
|
"@colors/colors": "^1.6.0",
|