simple-dynamsoft-mcp 7.2.1 → 7.2.2
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/package.json +1 -1
- package/src/data/download-utils.js +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-dynamsoft-mcp",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.2",
|
|
4
4
|
"description": "MCP server for Dynamsoft SDKs - Capture Vision, Barcode Reader (Mobile/Python/Web), Dynamic Web TWAIN, and Document Viewer. Provides documentation, code snippets, and API guidance.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dirname, join } from "node:path";
|
|
1
|
+
import { basename, dirname, join } from "node:path";
|
|
2
2
|
import { existsSync, renameSync, rmSync } from "node:fs";
|
|
3
3
|
|
|
4
4
|
function sleepMs(delayMs) {
|
|
@@ -54,9 +54,16 @@ async function withRetry(operation, {
|
|
|
54
54
|
throw lastError || new Error("Retry operation failed");
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
function buildBackupPath(targetPath, { pathApi, now } = {}) {
|
|
58
|
+
const activePathApi = pathApi || { basename, dirname, join };
|
|
59
|
+
const nowValue = typeof now === "function" ? now : Date.now;
|
|
60
|
+
const parent = activePathApi.dirname(targetPath);
|
|
61
|
+
const repoName = activePathApi.basename(targetPath) || "repo";
|
|
62
|
+
return activePathApi.join(parent, `${repoName}.bak-${nowValue()}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
57
65
|
function replaceDirectoryWithRollback(targetPath, stagedPath) {
|
|
58
|
-
const
|
|
59
|
-
const backupPath = join(parent, `${targetPath.split("/").pop() || "repo"}.bak-${Date.now()}`);
|
|
66
|
+
const backupPath = buildBackupPath(targetPath);
|
|
60
67
|
let movedExisting = false;
|
|
61
68
|
try {
|
|
62
69
|
if (existsSync(targetPath)) {
|
|
@@ -94,6 +101,7 @@ function buildHydrationFailureMessage({ reason, scopeSummary }) {
|
|
|
94
101
|
export {
|
|
95
102
|
shouldRetryDownloadError,
|
|
96
103
|
withRetry,
|
|
104
|
+
buildBackupPath,
|
|
97
105
|
replaceDirectoryWithRollback,
|
|
98
106
|
buildHydrationFailureMessage
|
|
99
107
|
};
|