@atlashub/smartstack-cli 4.0.0 → 4.1.0
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 +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -125690,6 +125690,9 @@ async function handleResponse(response) {
|
|
|
125690
125690
|
case 410:
|
|
125691
125691
|
error.message = `License revoked or expired: ${message}`;
|
|
125692
125692
|
break;
|
|
125693
|
+
case 422:
|
|
125694
|
+
error.message = `Unprocessable entity: ${message}`;
|
|
125695
|
+
break;
|
|
125693
125696
|
case 429:
|
|
125694
125697
|
error.message = `Rate limited: ${message}`;
|
|
125695
125698
|
break;
|
|
@@ -125826,7 +125829,7 @@ csxveQKoRdG8wCb3BY4//8F0qLz21lqwPIM+cGZhUM1+ycYvC7HEke5xMxy6cCAS
|
|
|
125826
125829
|
GwIDAQAB
|
|
125827
125830
|
-----END PUBLIC KEY-----`;
|
|
125828
125831
|
var LEGACY_ISSUER = "atlashub.io";
|
|
125829
|
-
var NEW_ISSUER = "license.
|
|
125832
|
+
var NEW_ISSUER = "license.atlashub.ch";
|
|
125830
125833
|
var LEGACY_PRODUCT_IDS = ["smartstack-cli", "smartstackcli"];
|
|
125831
125834
|
var NEW_PRODUCT_TIERS = ["standard", "plus", "premium"];
|
|
125832
125835
|
function detectJwtFormat(token) {
|
|
@@ -125841,7 +125844,11 @@ function detectJwtFormat(token) {
|
|
|
125841
125844
|
async function saveLicenseKey(licenseKey) {
|
|
125842
125845
|
const licensePath = getLicenseFilePath();
|
|
125843
125846
|
await import_fs_extra11.default.ensureDir(getSmartStackDir());
|
|
125844
|
-
|
|
125847
|
+
const writeOptions = { encoding: "utf-8" };
|
|
125848
|
+
if (process.platform !== "win32") {
|
|
125849
|
+
writeOptions.mode = 384;
|
|
125850
|
+
}
|
|
125851
|
+
await import_fs_extra11.default.writeFile(licensePath, licenseKey.trim(), writeOptions);
|
|
125845
125852
|
}
|
|
125846
125853
|
async function loadLicenseKey() {
|
|
125847
125854
|
const licensePath = getLicenseFilePath();
|
|
@@ -126296,6 +126303,8 @@ async function activateLicense(licenseKey) {
|
|
|
126296
126303
|
error = "Maximum number of machine activations reached. Deactivate another machine first.";
|
|
126297
126304
|
} else if (apiErr?.status === 410) {
|
|
126298
126305
|
error = "This license has been revoked or has expired.";
|
|
126306
|
+
} else if (apiErr?.status === 422) {
|
|
126307
|
+
error = "This machine fingerprint is already linked to another active license for this client.";
|
|
126299
126308
|
} else if (apiErr?.status === 404) {
|
|
126300
126309
|
error = "License not found on the server.";
|
|
126301
126310
|
}
|
|
@@ -126568,13 +126577,13 @@ function createLicenseCommand() {
|
|
|
126568
126577
|
});
|
|
126569
126578
|
const apiKeyCmd = license.command("api-key").description("Manage API key for CI/CD authentication");
|
|
126570
126579
|
apiKeyCmd.command("set <key>").description("Configure an API key for machine-to-machine authentication").action(async (key) => {
|
|
126571
|
-
if (!key.startsWith("
|
|
126572
|
-
logger.error('Invalid API key format. Keys should start with "
|
|
126580
|
+
if (!key.startsWith("sslk_")) {
|
|
126581
|
+
logger.error('Invalid API key format. Keys should start with "sslk_"');
|
|
126573
126582
|
process.exit(1);
|
|
126574
126583
|
}
|
|
126575
126584
|
await saveApiKey(key);
|
|
126576
126585
|
logger.success("API key configured successfully");
|
|
126577
|
-
console.log(source_default.gray(` Key prefix: ${key.substring(0,
|
|
126586
|
+
console.log(source_default.gray(` Key prefix: ${key.substring(0, 12)}...`));
|
|
126578
126587
|
});
|
|
126579
126588
|
apiKeyCmd.command("remove").description("Remove the stored API key").action(async () => {
|
|
126580
126589
|
const existing = await getApiKey();
|