@eide/foir-cli 0.4.8 → 0.4.9
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 +16 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4906,10 +4906,17 @@ async function reconcileHooks(client, configId, hooks, summary) {
|
|
|
4906
4906
|
}
|
|
4907
4907
|
}
|
|
4908
4908
|
async function reconcileSegments(client, configId, segments, summary) {
|
|
4909
|
-
const
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
);
|
|
4909
|
+
const [scoped, all] = await Promise.all([
|
|
4910
|
+
client.segments.listSegments({ configId, limit: 200 }),
|
|
4911
|
+
client.segments.listSegments({ limit: 200 })
|
|
4912
|
+
]);
|
|
4913
|
+
const existingByKey = /* @__PURE__ */ new Map();
|
|
4914
|
+
for (const s of all.segments ?? []) {
|
|
4915
|
+
existingByKey.set(s.key, s);
|
|
4916
|
+
}
|
|
4917
|
+
for (const s of scoped.segments ?? []) {
|
|
4918
|
+
existingByKey.set(s.key, s);
|
|
4919
|
+
}
|
|
4913
4920
|
const manifestKeys = /* @__PURE__ */ new Set();
|
|
4914
4921
|
for (const seg of segments) {
|
|
4915
4922
|
if (!seg.key || !seg.name) continue;
|
|
@@ -4938,11 +4945,12 @@ async function reconcileSegments(client, configId, segments, summary) {
|
|
|
4938
4945
|
summary.segments.created++;
|
|
4939
4946
|
}
|
|
4940
4947
|
}
|
|
4941
|
-
|
|
4948
|
+
const scopedByKey = new Map(
|
|
4949
|
+
(scoped.segments ?? []).map((s) => [s.key, s])
|
|
4950
|
+
);
|
|
4951
|
+
for (const [key, ex] of scopedByKey) {
|
|
4942
4952
|
if (!manifestKeys.has(key)) {
|
|
4943
|
-
await client.segments.deleteSegment(
|
|
4944
|
-
ex.id
|
|
4945
|
-
);
|
|
4953
|
+
await client.segments.deleteSegment(ex.id);
|
|
4946
4954
|
summary.segments.deleted++;
|
|
4947
4955
|
}
|
|
4948
4956
|
}
|