mc8yp 1.0.1 → 1.0.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/dist/cli.mjs +5 -6
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -44,7 +44,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region package.json
|
|
46
46
|
var name = "mc8yp";
|
|
47
|
-
var version = "1.0.
|
|
47
|
+
var version = "1.0.3";
|
|
48
48
|
var description = "Cumulocity IoT MCP Server - Model Context Protocol integration for IoT device management";
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
@@ -66001,7 +66001,6 @@ async function getAuthenticatedClient(input) {
|
|
|
66001
66001
|
if (!parsed.success) throw new Error("tenantUrl is required in CLI mode");
|
|
66002
66002
|
const { tenantUrl } = parsed.output;
|
|
66003
66003
|
const credentials = await globalThis._getCredentialsByTenantUrl(tenantUrl);
|
|
66004
|
-
if (!credentials) throw new Error(`No credentials found for ${tenantUrl}`);
|
|
66005
66004
|
if ("user" in credentials && "password" in credentials && credentials.user && credentials.password) return Client.authenticate({
|
|
66006
66005
|
user: credentials.user,
|
|
66007
66006
|
password: credentials.password
|
|
@@ -67555,13 +67554,13 @@ async function getStoredC8yAuth() {
|
|
|
67555
67554
|
}
|
|
67556
67555
|
async function getCredentialsByTenantUrl(tenantUrl) {
|
|
67557
67556
|
const cleanedUrl = cleanTenantUrl(tenantUrl);
|
|
67558
|
-
const
|
|
67557
|
+
const found = await findCredentialsAsync(name, cleanedUrl);
|
|
67558
|
+
if (found.length === 0) throw new Error(`No stored credentials found for tenant URL: ${cleanedUrl}`);
|
|
67559
|
+
const { password: jsonString } = found[0];
|
|
67559
67560
|
try {
|
|
67560
|
-
const jsonString = await entry.getPassword();
|
|
67561
|
-
if (!jsonString) return null;
|
|
67562
67561
|
return JSON.parse(jsonString);
|
|
67563
67562
|
} catch {
|
|
67564
|
-
|
|
67563
|
+
throw new Error(`Stored credentials for tenant URL ${cleanedUrl} are corrupted`);
|
|
67565
67564
|
}
|
|
67566
67565
|
}
|
|
67567
67566
|
async function setStoredC8yAuth(creds) {
|