@keywaysh/cli 0.1.8 → 0.1.10
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.js +23 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -101,7 +101,7 @@ var INTERNAL_POSTHOG_HOST = "https://eu.i.posthog.com";
|
|
|
101
101
|
// package.json
|
|
102
102
|
var package_default = {
|
|
103
103
|
name: "@keywaysh/cli",
|
|
104
|
-
version: "0.1.
|
|
104
|
+
version: "0.1.10",
|
|
105
105
|
description: "One link to all your secrets",
|
|
106
106
|
type: "module",
|
|
107
107
|
bin: {
|
|
@@ -452,6 +452,9 @@ async function getSyncDiff(accessToken, repoFullName, options) {
|
|
|
452
452
|
keywayEnvironment: options.keywayEnvironment || "production",
|
|
453
453
|
providerEnvironment: options.providerEnvironment || "production"
|
|
454
454
|
});
|
|
455
|
+
if (options.serviceId) {
|
|
456
|
+
params.set("serviceId", options.serviceId);
|
|
457
|
+
}
|
|
455
458
|
const response = await fetchWithTimeout(
|
|
456
459
|
`${API_BASE_URL}/v1/integrations/vaults/${owner}/${repo}/sync/diff?${params}`,
|
|
457
460
|
{
|
|
@@ -477,6 +480,9 @@ async function getSyncPreview(accessToken, repoFullName, options) {
|
|
|
477
480
|
direction: options.direction || "push",
|
|
478
481
|
allowDelete: String(options.allowDelete || false)
|
|
479
482
|
});
|
|
483
|
+
if (options.serviceId) {
|
|
484
|
+
params.set("serviceId", options.serviceId);
|
|
485
|
+
}
|
|
480
486
|
const response = await fetchWithTimeout(
|
|
481
487
|
`${API_BASE_URL}/v1/integrations/vaults/${owner}/${repo}/sync/preview?${params}`,
|
|
482
488
|
{
|
|
@@ -506,6 +512,7 @@ async function executeSync(accessToken, repoFullName, options) {
|
|
|
506
512
|
body: JSON.stringify({
|
|
507
513
|
connectionId: options.connectionId,
|
|
508
514
|
projectId: options.projectId,
|
|
515
|
+
serviceId: options.serviceId,
|
|
509
516
|
keywayEnvironment: options.keywayEnvironment || "production",
|
|
510
517
|
providerEnvironment: options.providerEnvironment || "production",
|
|
511
518
|
direction: options.direction || "push",
|
|
@@ -2441,13 +2448,16 @@ Connection to ${providerDisplayName} failed.`));
|
|
|
2441
2448
|
}
|
|
2442
2449
|
}
|
|
2443
2450
|
}
|
|
2451
|
+
let diff;
|
|
2444
2452
|
if (needsDirectionPrompt) {
|
|
2445
2453
|
const effectiveKeywayEnv = keywayEnv || "production";
|
|
2446
2454
|
const effectiveProviderEnv = providerEnv || mapToProviderEnvironment(provider, effectiveKeywayEnv);
|
|
2447
2455
|
console.log(pc10.gray("\nComparing secrets..."));
|
|
2448
|
-
|
|
2456
|
+
diff = await getSyncDiff(accessToken, repoFullName, {
|
|
2449
2457
|
connectionId: connection.id,
|
|
2450
2458
|
projectId: selectedProject.id,
|
|
2459
|
+
serviceId: selectedProject.serviceId,
|
|
2460
|
+
// Railway: service ID for service-specific variables
|
|
2451
2461
|
keywayEnvironment: effectiveKeywayEnv,
|
|
2452
2462
|
providerEnvironment: effectiveProviderEnv
|
|
2453
2463
|
});
|
|
@@ -2457,7 +2467,13 @@ Connection to ${providerDisplayName} failed.`));
|
|
|
2457
2467
|
return;
|
|
2458
2468
|
}
|
|
2459
2469
|
}
|
|
2460
|
-
if (needsDirectionPrompt) {
|
|
2470
|
+
if (needsDirectionPrompt && diff) {
|
|
2471
|
+
let defaultDirection = 0;
|
|
2472
|
+
if (diff.keywayCount === 0 && diff.providerCount > 0) {
|
|
2473
|
+
defaultDirection = 1;
|
|
2474
|
+
} else if (diff.providerCount === 0 && diff.keywayCount > 0) {
|
|
2475
|
+
defaultDirection = 0;
|
|
2476
|
+
}
|
|
2461
2477
|
const { selectedDirection } = await prompts7({
|
|
2462
2478
|
type: "select",
|
|
2463
2479
|
name: "selectedDirection",
|
|
@@ -2465,7 +2481,8 @@ Connection to ${providerDisplayName} failed.`));
|
|
|
2465
2481
|
choices: [
|
|
2466
2482
|
{ title: `Keyway \u2192 ${providerName}`, value: "push" },
|
|
2467
2483
|
{ title: `${providerName} \u2192 Keyway`, value: "pull" }
|
|
2468
|
-
]
|
|
2484
|
+
],
|
|
2485
|
+
initial: defaultDirection
|
|
2469
2486
|
});
|
|
2470
2487
|
if (!selectedDirection) {
|
|
2471
2488
|
console.log(pc10.gray("Cancelled."));
|
|
@@ -2592,6 +2609,8 @@ async function executeSyncOperation(accessToken, repoFullName, connectionId, pro
|
|
|
2592
2609
|
const result = await executeSync(accessToken, repoFullName, {
|
|
2593
2610
|
connectionId,
|
|
2594
2611
|
projectId: project.id,
|
|
2612
|
+
serviceId: project.serviceId,
|
|
2613
|
+
// Railway: service ID for service-specific variables
|
|
2595
2614
|
keywayEnvironment: keywayEnv,
|
|
2596
2615
|
providerEnvironment: providerEnv,
|
|
2597
2616
|
direction,
|