@axis-ds/mcp 1.3.0 → 1.3.1
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/index.js +37 -4
- package/dist/registry/index.json +1 -1
- package/dist/registry/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -663,6 +663,31 @@ function bundledFallbackMessage(version, reason, kind = "access", label = DEFAUL
|
|
|
663
663
|
function fallbackKindOf(error) {
|
|
664
664
|
return error instanceof RegistryAccessError ? "access" : "invalid";
|
|
665
665
|
}
|
|
666
|
+
function registryContentDiff(remote, bundled) {
|
|
667
|
+
const r = new Map(remote.items.map((i) => [i.name, i.sha256]));
|
|
668
|
+
const b = new Map(bundled.items.map((i) => [i.name, i.sha256]));
|
|
669
|
+
const differ = [];
|
|
670
|
+
let comparable = true;
|
|
671
|
+
for (const name of [.../* @__PURE__ */ new Set([...r.keys(), ...b.keys()])].sort()) {
|
|
672
|
+
if (!r.has(name) || !b.has(name)) {
|
|
673
|
+
differ.push(name);
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
const rs = r.get(name);
|
|
677
|
+
const bs = b.get(name);
|
|
678
|
+
if (rs === void 0 || bs === void 0) {
|
|
679
|
+
comparable = false;
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
if (rs !== bs) differ.push(name);
|
|
683
|
+
}
|
|
684
|
+
return { comparable, differ };
|
|
685
|
+
}
|
|
686
|
+
function contentMismatchMessage(remoteVersion, bundledVersion, differ, label = DEFAULT_BUNDLED_LABEL) {
|
|
687
|
+
const shown = differ.slice(0, 5).join(", ");
|
|
688
|
+
const more = differ.length > 5 ? ` \uC678 ${differ.length - 5}\uAC1C` : "";
|
|
689
|
+
return `\uC6D0\uACA9 \uB808\uC9C0\uC2A4\uD2B8\uB9AC(version ${remoteVersion})\uC640 ${label}(version ${bundledVersion})\uC758 \uB0B4\uC6A9\uC774 \uB2E4\uB978 \uD56D\uBAA9\uC774 ${differ.length}\uAC1C \uC788\uC2B5\uB2C8\uB2E4(${shown}${more}). \uC6D0\uACA9 \uB808\uC9C0\uC2A4\uD2B8\uB9AC\uB97C \uC6B0\uC120 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.`;
|
|
690
|
+
}
|
|
666
691
|
function versionMismatchMessage(remoteVersion, bundledVersion, label = DEFAULT_BUNDLED_LABEL) {
|
|
667
692
|
return `\uC6D0\uACA9 \uB808\uC9C0\uC2A4\uD2B8\uB9AC(version ${remoteVersion})\uC640 ${label}(version ${bundledVersion})\uC758 version \uC774 \uB2E4\uB985\uB2C8\uB2E4. \uC6D0\uACA9 \uB808\uC9C0\uC2A4\uD2B8\uB9AC\uB97C \uC6B0\uC120 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.`;
|
|
668
693
|
}
|
|
@@ -768,7 +793,7 @@ var RegistryClient = class {
|
|
|
768
793
|
const data = await fetchRegistryJson(`${this.baseUrl}/index.json`, this.fetchOptions());
|
|
769
794
|
const index = validateRegistryIndex(data, `${this.baseUrl}/index.json`);
|
|
770
795
|
this.mode = "remote";
|
|
771
|
-
this.warnVersionMismatch(index
|
|
796
|
+
this.warnVersionMismatch(index);
|
|
772
797
|
return index;
|
|
773
798
|
} catch (error) {
|
|
774
799
|
remoteError = messageOf(error);
|
|
@@ -790,10 +815,18 @@ var RegistryClient = class {
|
|
|
790
815
|
return { error: messageOf(error) };
|
|
791
816
|
}
|
|
792
817
|
}
|
|
793
|
-
warnVersionMismatch(
|
|
818
|
+
warnVersionMismatch(remote) {
|
|
794
819
|
const bundled = this.loadBundledIndex();
|
|
795
|
-
if ("index" in bundled
|
|
796
|
-
|
|
820
|
+
if (!("index" in bundled)) return;
|
|
821
|
+
const diff = registryContentDiff(remote, bundled.index);
|
|
822
|
+
if (diff.comparable) {
|
|
823
|
+
if (diff.differ.length > 0) {
|
|
824
|
+
this.notify(contentMismatchMessage(remote.version, bundled.index.version, diff.differ, this.bundledLabel));
|
|
825
|
+
}
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (bundled.index.version !== remote.version) {
|
|
829
|
+
this.notify(versionMismatchMessage(remote.version, bundled.index.version, this.bundledLabel));
|
|
797
830
|
}
|
|
798
831
|
}
|
|
799
832
|
async switchToBundled(reason, kind = "access") {
|
package/dist/registry/index.json
CHANGED