@envmanager-cli/cli 0.1.6 → 0.1.7
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/bin/envmanager.js +10 -5
- package/dist/bin/envmanager.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/envmanager.js
CHANGED
|
@@ -1479,7 +1479,9 @@ async function subscribeToVariableChanges(environmentId, onEvent, onStatus) {
|
|
|
1479
1479
|
table: "variables"
|
|
1480
1480
|
},
|
|
1481
1481
|
(payload) => {
|
|
1482
|
-
const
|
|
1482
|
+
const newRecord = payload.new;
|
|
1483
|
+
const oldRecord = payload.old;
|
|
1484
|
+
const record = newRecord && Object.keys(newRecord).length > 0 ? newRecord : oldRecord;
|
|
1483
1485
|
if (!record) return;
|
|
1484
1486
|
const recordEnvId = record.environment_id;
|
|
1485
1487
|
if (recordEnvId !== environmentId) {
|
|
@@ -1493,8 +1495,7 @@ async function subscribeToVariableChanges(environmentId, onEvent, onStatus) {
|
|
|
1493
1495
|
is_secret: record.is_secret,
|
|
1494
1496
|
timestamp: Date.now() / 1e3
|
|
1495
1497
|
};
|
|
1496
|
-
if (payload.eventType === "UPDATE" &&
|
|
1497
|
-
const oldRecord = payload.old;
|
|
1498
|
+
if (payload.eventType === "UPDATE" && oldRecord) {
|
|
1498
1499
|
if (oldRecord.key !== record.key) {
|
|
1499
1500
|
event.old_key = oldRecord.key;
|
|
1500
1501
|
}
|
|
@@ -1664,9 +1665,12 @@ function mergeWithRemote(local, remoteVariables, strategy) {
|
|
|
1664
1665
|
result.set(key, value);
|
|
1665
1666
|
}
|
|
1666
1667
|
break;
|
|
1667
|
-
case "remote_wins":
|
|
1668
|
+
case "remote_wins": {
|
|
1669
|
+
const remoteKeys = new Set(remoteVariables.map((v) => v.key));
|
|
1668
1670
|
for (const [key, value] of local) {
|
|
1669
|
-
|
|
1671
|
+
if (remoteKeys.has(key)) {
|
|
1672
|
+
result.set(key, value);
|
|
1673
|
+
}
|
|
1670
1674
|
}
|
|
1671
1675
|
for (const v of remoteVariables) {
|
|
1672
1676
|
if (v.value !== null) {
|
|
@@ -1674,6 +1678,7 @@ function mergeWithRemote(local, remoteVariables, strategy) {
|
|
|
1674
1678
|
}
|
|
1675
1679
|
}
|
|
1676
1680
|
break;
|
|
1681
|
+
}
|
|
1677
1682
|
case "merge_new":
|
|
1678
1683
|
for (const [key, value] of local) {
|
|
1679
1684
|
result.set(key, value);
|