@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.
@@ -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
 
@@ -35,7 +35,7 @@ function useCache(
35
35
  stores: {
36
36
  dataCache: bentostore().useL1Layer(
37
37
  memoryDriver({
38
- maxSize: "100mb",
38
+ maxSize: options?.maxSize || "200mb",
39
39
  })
40
40
  ),
41
41
  },
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
- let dirToWatch = path.join(
45
- process.cwd(),
46
- BASE_DIR,
47
- col?.slug,
48
- visibility
49
- );
50
- dirToWatch = path.resolve(dirToWatch);
51
- const watcher = chokidar.watch(dirToWatch, {
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
- watcher.on("all", (event, filePath) => {
58
- if (event == "change" || event == "add") {
59
- //consola.info(`SFTP: ${event} ${filePath}`);
60
- let remotePath = path.join(
61
- this.config.remoteDir,
62
- path.basename(filePath)
63
- );
64
- this.put(filePath, remotePath);
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.2",
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.8.3"
19
+ "typescript": "^5.9.2"
21
20
  },
22
21
  "dependencies": {
23
22
  "@colors/colors": "^1.6.0",