@lumerahq/cli 0.19.4 → 0.19.5
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/{chunk-5T22627H.js → chunk-RUJRTLHA.js} +1 -1
- package/dist/{chunk-UH5X43VV.js → chunk-WY6UMJNI.js} +2 -0
- package/dist/{deps-GCOH3TXL.js → deps-73XZXRYP.js} +2 -2
- package/dist/{dev-JLSTLIMZ.js → dev-LDLUZ2VO.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/{init-CBZAIERZ.js → init-7YWMMTBF.js} +1 -1
- package/dist/{register-N2LF3CCK.js → register-KJMSMMD6.js} +1 -1
- package/dist/{resources-RHF2MDF7.js → resources-UMGSN6QA.js} +71 -34
- package/dist/{run-XJLB4AFD.js → run-C23KZI4Z.js} +1 -1
- package/package.json +1 -1
|
@@ -117,6 +117,7 @@ var ApiClient = class {
|
|
|
117
117
|
const qs = new URLSearchParams();
|
|
118
118
|
if (params?.external_id) qs.set("external_id", params.external_id);
|
|
119
119
|
if (params?.include_code) qs.set("include_code", "true");
|
|
120
|
+
if (params?.project_id) qs.set("project_id", params.project_id);
|
|
120
121
|
qs.set("limit", "100");
|
|
121
122
|
const all = [];
|
|
122
123
|
let offset = 0;
|
|
@@ -179,6 +180,7 @@ var ApiClient = class {
|
|
|
179
180
|
const query = new URLSearchParams();
|
|
180
181
|
if (params?.collection_id) query.set("collection_id", params.collection_id);
|
|
181
182
|
if (params?.external_id) query.set("external_id", params.external_id);
|
|
183
|
+
if (params?.project_id) query.set("project_id", params.project_id);
|
|
182
184
|
const queryString = query.toString();
|
|
183
185
|
const path = queryString ? `/api/pb/hooks?${queryString}` : "/api/pb/hooks";
|
|
184
186
|
const result = await this.request(path);
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
deps,
|
|
3
3
|
projectResourceDepsEnabled,
|
|
4
4
|
syncDeps
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RUJRTLHA.js";
|
|
6
6
|
import "./chunk-2CR762KB.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WY6UMJNI.js";
|
|
8
8
|
import "./chunk-ZH3NVYEQ.js";
|
|
9
9
|
import "./chunk-FJFIWC7G.js";
|
|
10
10
|
import "./chunk-PNKVD2UK.js";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
projectResourceDepsEnabled,
|
|
6
6
|
syncDeps
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RUJRTLHA.js";
|
|
8
8
|
import {
|
|
9
9
|
loadEnv
|
|
10
10
|
} from "./chunk-2CR762KB.js";
|
|
11
11
|
import {
|
|
12
12
|
createApiClient
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WY6UMJNI.js";
|
|
14
14
|
import {
|
|
15
15
|
findProjectRoot,
|
|
16
16
|
getApiUrl,
|
package/dist/index.js
CHANGED
|
@@ -219,39 +219,39 @@ async function main() {
|
|
|
219
219
|
switch (command) {
|
|
220
220
|
// Resource commands
|
|
221
221
|
case "plan":
|
|
222
|
-
await import("./resources-
|
|
222
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.plan(args.slice(1)));
|
|
223
223
|
break;
|
|
224
224
|
case "apply":
|
|
225
|
-
await import("./resources-
|
|
225
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.apply(args.slice(1)));
|
|
226
226
|
break;
|
|
227
227
|
case "pull":
|
|
228
|
-
await import("./resources-
|
|
228
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.pull(args.slice(1)));
|
|
229
229
|
break;
|
|
230
230
|
case "destroy":
|
|
231
|
-
await import("./resources-
|
|
231
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.destroy(args.slice(1)));
|
|
232
232
|
break;
|
|
233
233
|
case "list":
|
|
234
|
-
await import("./resources-
|
|
234
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.list(args.slice(1)));
|
|
235
235
|
break;
|
|
236
236
|
case "show":
|
|
237
|
-
await import("./resources-
|
|
237
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.show(args.slice(1)));
|
|
238
238
|
break;
|
|
239
239
|
case "diff":
|
|
240
|
-
await import("./resources-
|
|
240
|
+
await import("./resources-UMGSN6QA.js").then((m) => m.diff(args.slice(1)));
|
|
241
241
|
break;
|
|
242
242
|
// Development
|
|
243
243
|
case "dev":
|
|
244
|
-
await import("./dev-
|
|
244
|
+
await import("./dev-LDLUZ2VO.js").then((m) => m.dev(args.slice(1)));
|
|
245
245
|
break;
|
|
246
246
|
case "run":
|
|
247
|
-
await import("./run-
|
|
247
|
+
await import("./run-C23KZI4Z.js").then((m) => m.run(args.slice(1)));
|
|
248
248
|
break;
|
|
249
249
|
// Project
|
|
250
250
|
case "init":
|
|
251
|
-
await import("./init-
|
|
251
|
+
await import("./init-7YWMMTBF.js").then((m) => m.init(args.slice(1)));
|
|
252
252
|
break;
|
|
253
253
|
case "register":
|
|
254
|
-
await import("./register-
|
|
254
|
+
await import("./register-KJMSMMD6.js").then((m) => m.register(args.slice(1)));
|
|
255
255
|
break;
|
|
256
256
|
case "templates":
|
|
257
257
|
await import("./templates-LNUOTNLN.js").then((m) => m.templates(subcommand, args.slice(2)));
|
|
@@ -268,7 +268,7 @@ async function main() {
|
|
|
268
268
|
break;
|
|
269
269
|
// Dependencies
|
|
270
270
|
case "deps":
|
|
271
|
-
await import("./deps-
|
|
271
|
+
await import("./deps-73XZXRYP.js").then((m) => m.deps(args.slice(1)));
|
|
272
272
|
break;
|
|
273
273
|
// Auth
|
|
274
274
|
case "login":
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
projectResourceDepsEnabled,
|
|
6
6
|
syncDeps
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RUJRTLHA.js";
|
|
8
8
|
import {
|
|
9
9
|
loadEnv
|
|
10
10
|
} from "./chunk-2CR762KB.js";
|
|
11
11
|
import {
|
|
12
12
|
createApiClient
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WY6UMJNI.js";
|
|
14
14
|
import {
|
|
15
15
|
findProjectRoot,
|
|
16
16
|
getApiUrl,
|
|
@@ -294,6 +294,23 @@ function stripNamespacePrefix(name, appName) {
|
|
|
294
294
|
}
|
|
295
295
|
return name;
|
|
296
296
|
}
|
|
297
|
+
function buildCollectionIdMap(collections, appName) {
|
|
298
|
+
const result = /* @__PURE__ */ new Map();
|
|
299
|
+
const add = (key, id) => {
|
|
300
|
+
const trimmed = (key || "").trim();
|
|
301
|
+
if (trimmed) result.set(trimmed, id);
|
|
302
|
+
};
|
|
303
|
+
for (const collection of collections) {
|
|
304
|
+
add(collection.id, collection.id);
|
|
305
|
+
add(collection.name, collection.id);
|
|
306
|
+
const stripped = stripNamespacePrefix(collection.name, appName);
|
|
307
|
+
add(stripped, collection.id);
|
|
308
|
+
if (collection.name.includes(NAMESPACE_SEPARATOR)) {
|
|
309
|
+
add(collection.name.split(NAMESPACE_SEPARATOR).slice(1).join(NAMESPACE_SEPARATOR), collection.id);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
297
314
|
function computeLineDiff(oldText, newText) {
|
|
298
315
|
const oldLines = (oldText || "").trimEnd().split("\n");
|
|
299
316
|
const newLines = (newText || "").trimEnd().split("\n");
|
|
@@ -974,6 +991,16 @@ function mapFieldType(type) {
|
|
|
974
991
|
};
|
|
975
992
|
return typeMap[type] || type;
|
|
976
993
|
}
|
|
994
|
+
function normalizeConstraintValue(fieldType, value) {
|
|
995
|
+
if (value === void 0 || value === null) return void 0;
|
|
996
|
+
if (["text", "email", "url", "editor"].includes(fieldType) && value === 0) {
|
|
997
|
+
return void 0;
|
|
998
|
+
}
|
|
999
|
+
if (fieldType === "date" && value === "") {
|
|
1000
|
+
return void 0;
|
|
1001
|
+
}
|
|
1002
|
+
return value;
|
|
1003
|
+
}
|
|
977
1004
|
function fieldsDiffer(local, remote) {
|
|
978
1005
|
if (mapFieldType(local.type) !== remote.type) return true;
|
|
979
1006
|
if ((local.required || false) !== (remote.required || false)) return true;
|
|
@@ -1002,11 +1029,11 @@ function fieldsDiffer(local, remote) {
|
|
|
1002
1029
|
const remoteDecimalPrecision = opts.decimalPrecision !== void 0 ? opts.decimalPrecision : 2;
|
|
1003
1030
|
if (localDecimalPrecision !== remoteDecimalPrecision) return true;
|
|
1004
1031
|
}
|
|
1005
|
-
const localMin = local.
|
|
1006
|
-
const remoteMin =
|
|
1032
|
+
const localMin = normalizeConstraintValue(local.type, local.min);
|
|
1033
|
+
const remoteMin = normalizeConstraintValue(local.type, opts.min);
|
|
1007
1034
|
if (localMin !== remoteMin) return true;
|
|
1008
|
-
const localMax = local.
|
|
1009
|
-
const remoteMax =
|
|
1035
|
+
const localMax = normalizeConstraintValue(local.type, local.max);
|
|
1036
|
+
const remoteMax = normalizeConstraintValue(local.type, opts.max);
|
|
1010
1037
|
if (localMax !== remoteMax) return true;
|
|
1011
1038
|
return false;
|
|
1012
1039
|
}
|
|
@@ -1100,9 +1127,12 @@ async function planCollections(api, localCollections) {
|
|
|
1100
1127
|
}
|
|
1101
1128
|
return changes;
|
|
1102
1129
|
}
|
|
1103
|
-
async function planAutomations(api, localAutomations) {
|
|
1130
|
+
async function planAutomations(api, localAutomations, projectId) {
|
|
1104
1131
|
const changes = [];
|
|
1105
|
-
const remoteAutomations = await api.listAutomations({
|
|
1132
|
+
const remoteAutomations = await api.listAutomations({
|
|
1133
|
+
include_code: true,
|
|
1134
|
+
...projectId ? { project_id: projectId } : {}
|
|
1135
|
+
});
|
|
1106
1136
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id).map((a) => [a.external_id, a]));
|
|
1107
1137
|
const remotePresetCache = /* @__PURE__ */ new Map();
|
|
1108
1138
|
const getRemotePresets = (automationId) => {
|
|
@@ -1285,9 +1315,9 @@ async function pullMailboxes(api, platformDir, filterName) {
|
|
|
1285
1315
|
console.log(pc2.yellow(` \u26A0 mailbox '${filterName}' not found on remote`));
|
|
1286
1316
|
}
|
|
1287
1317
|
}
|
|
1288
|
-
async function planHooks(api, localHooks, collections) {
|
|
1318
|
+
async function planHooks(api, localHooks, collections, projectId) {
|
|
1289
1319
|
const changes = [];
|
|
1290
|
-
const remoteHooks = await api.listHooks();
|
|
1320
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
1291
1321
|
const remoteByExternalId = new Map(remoteHooks.filter((h) => h.external_id).map((h) => [h.external_id, h]));
|
|
1292
1322
|
for (const { hook, script, fileName } of localHooks) {
|
|
1293
1323
|
const remote = remoteByExternalId.get(hook.external_id);
|
|
@@ -1375,7 +1405,7 @@ async function applyCollections(api, localCollections) {
|
|
|
1375
1405
|
}
|
|
1376
1406
|
async function applyAutomations(api, localAutomations, projectId) {
|
|
1377
1407
|
let errors = 0;
|
|
1378
|
-
const remoteAutomations = await api.listAutomations();
|
|
1408
|
+
const remoteAutomations = await api.listAutomations(projectId ? { project_id: projectId } : void 0);
|
|
1379
1409
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id).map((a) => [a.external_id, a]));
|
|
1380
1410
|
for (const { automation, code } of localAutomations) {
|
|
1381
1411
|
const remote = remoteByExternalId.get(automation.external_id);
|
|
@@ -1487,7 +1517,7 @@ async function setSchedule(api, automationId, schedule, localPresets) {
|
|
|
1487
1517
|
}
|
|
1488
1518
|
async function applyHooks(api, localHooks, collections, projectId) {
|
|
1489
1519
|
let errors = 0;
|
|
1490
|
-
const remoteHooks = await api.listHooks();
|
|
1520
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
1491
1521
|
const remoteByExternalId = new Map(remoteHooks.filter((h) => h.external_id).map((h) => [h.external_id, h]));
|
|
1492
1522
|
for (const { hook, script, fileName } of localHooks) {
|
|
1493
1523
|
const remote = remoteByExternalId.get(hook.external_id);
|
|
@@ -1597,7 +1627,10 @@ async function pullCollections(api, platformDir, filterName, appName) {
|
|
|
1597
1627
|
async function pullAutomations(api, platformDir, filterName, projectId) {
|
|
1598
1628
|
const automationsDir = join2(platformDir, "automations");
|
|
1599
1629
|
mkdirSync(automationsDir, { recursive: true });
|
|
1600
|
-
const automations = await api.listAutomations({
|
|
1630
|
+
const automations = await api.listAutomations({
|
|
1631
|
+
include_code: true,
|
|
1632
|
+
...projectId ? { project_id: projectId } : {}
|
|
1633
|
+
});
|
|
1601
1634
|
for (const automation of automations) {
|
|
1602
1635
|
if (!automation.external_id || automation.managed) continue;
|
|
1603
1636
|
if (projectId && automation.project_id && automation.project_id !== projectId) continue;
|
|
@@ -1647,7 +1680,7 @@ async function pullAutomations(api, platformDir, filterName, projectId) {
|
|
|
1647
1680
|
async function pullHooks(api, platformDir, filterName, appName, projectId) {
|
|
1648
1681
|
const hooksDir = join2(platformDir, "hooks");
|
|
1649
1682
|
mkdirSync(hooksDir, { recursive: true });
|
|
1650
|
-
const hooks = await api.listHooks();
|
|
1683
|
+
const hooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
1651
1684
|
for (const hook of hooks) {
|
|
1652
1685
|
if (!hook.external_id) continue;
|
|
1653
1686
|
if (projectId && hook.project_id && hook.project_id !== projectId) continue;
|
|
@@ -1925,7 +1958,10 @@ async function listResources(api, platformDir, filterType, appName, projectId) {
|
|
|
1925
1958
|
}
|
|
1926
1959
|
if (!filterType || filterType === "automations") {
|
|
1927
1960
|
const localAutomations = loadLocalAutomations(platformDir, void 0, appName);
|
|
1928
|
-
const remoteAutomations = await api.listAutomations({
|
|
1961
|
+
const remoteAutomations = await api.listAutomations({
|
|
1962
|
+
include_code: true,
|
|
1963
|
+
...projectId ? { project_id: projectId } : {}
|
|
1964
|
+
});
|
|
1929
1965
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id && !a.managed).map((a) => [a.external_id, a]));
|
|
1930
1966
|
const localIds = new Set(localAutomations.map((a) => a.automation.external_id));
|
|
1931
1967
|
for (const { automation, code } of localAutomations) {
|
|
@@ -1951,7 +1987,7 @@ async function listResources(api, platformDir, filterType, appName, projectId) {
|
|
|
1951
1987
|
}
|
|
1952
1988
|
if (!filterType || filterType === "hooks") {
|
|
1953
1989
|
const localHooks = loadLocalHooks(platformDir, void 0, appName);
|
|
1954
|
-
const remoteHooks = await api.listHooks();
|
|
1990
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
1955
1991
|
const remoteByExternalId = new Map(remoteHooks.filter((h) => h.external_id).map((h) => [h.external_id, h]));
|
|
1956
1992
|
const localIds = new Set(localHooks.map((h) => h.hook.external_id));
|
|
1957
1993
|
for (const { hook, script } of localHooks) {
|
|
@@ -2111,7 +2147,7 @@ async function destroyResources(api, platformDir, resourceType, resourceName, sk
|
|
|
2111
2147
|
if (!resourceType || resourceType === "automations") {
|
|
2112
2148
|
try {
|
|
2113
2149
|
const localAutomations = loadLocalAutomations(platformDir, resourceName || void 0, appName);
|
|
2114
|
-
const remoteAutomations = await api.listAutomations();
|
|
2150
|
+
const remoteAutomations = await api.listAutomations(projectId ? { project_id: projectId } : void 0);
|
|
2115
2151
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id).map((a) => [a.external_id, a]));
|
|
2116
2152
|
for (const { automation } of localAutomations) {
|
|
2117
2153
|
const remote = remoteByExternalId.get(automation.external_id);
|
|
@@ -2124,7 +2160,7 @@ async function destroyResources(api, platformDir, resourceType, resourceName, sk
|
|
|
2124
2160
|
}
|
|
2125
2161
|
if (!resourceType || resourceType === "hooks") {
|
|
2126
2162
|
const localHooks = loadLocalHooks(platformDir, resourceName || void 0, appName);
|
|
2127
|
-
const remoteHooks = await api.listHooks();
|
|
2163
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
2128
2164
|
const remoteByExternalId = new Map(remoteHooks.filter((h) => h.external_id).map((h) => [h.external_id, h]));
|
|
2129
2165
|
for (const { hook } of localHooks) {
|
|
2130
2166
|
const remote = remoteByExternalId.get(hook.external_id);
|
|
@@ -2365,7 +2401,7 @@ async function showResource(api, platformDir, resourceType, resourceName, appNam
|
|
|
2365
2401
|
console.log();
|
|
2366
2402
|
} else if (resourceType === "automations") {
|
|
2367
2403
|
const localAutomations = loadLocalAutomations(platformDir, resourceName, appName);
|
|
2368
|
-
const remoteAutomations = await api.listAutomations();
|
|
2404
|
+
const remoteAutomations = await api.listAutomations(projectId ? { project_id: projectId } : void 0);
|
|
2369
2405
|
const local = localAutomations[0];
|
|
2370
2406
|
const remote = remoteAutomations.find((a) => a.external_id === resourceName || a.name === resourceName);
|
|
2371
2407
|
if (!local && !remote) {
|
|
@@ -2388,7 +2424,7 @@ async function showResource(api, platformDir, resourceType, resourceName, appNam
|
|
|
2388
2424
|
console.log();
|
|
2389
2425
|
} else if (resourceType === "hooks") {
|
|
2390
2426
|
const localHooks = loadLocalHooks(platformDir, resourceName, appName);
|
|
2391
|
-
const remoteHooks = await api.listHooks();
|
|
2427
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
2392
2428
|
const local = localHooks[0];
|
|
2393
2429
|
const remote = remoteHooks.find((h) => h.external_id === resourceName);
|
|
2394
2430
|
if (!local && !remote) {
|
|
@@ -2526,7 +2562,7 @@ async function plan(args) {
|
|
|
2526
2562
|
let collections;
|
|
2527
2563
|
try {
|
|
2528
2564
|
const remoteCollections = await api.listCollections();
|
|
2529
|
-
collections =
|
|
2565
|
+
collections = buildCollectionIdMap(remoteCollections, appName);
|
|
2530
2566
|
} catch {
|
|
2531
2567
|
collections = /* @__PURE__ */ new Map();
|
|
2532
2568
|
}
|
|
@@ -2541,14 +2577,14 @@ async function plan(args) {
|
|
|
2541
2577
|
if (!type || type === "automations") {
|
|
2542
2578
|
localAutomations = loadLocalAutomations(platformDir, name || void 0, appName);
|
|
2543
2579
|
if (localAutomations.length > 0) {
|
|
2544
|
-
const changes = await planAutomations(api, localAutomations);
|
|
2580
|
+
const changes = await planAutomations(api, localAutomations, projectId);
|
|
2545
2581
|
allChanges.push(...changes);
|
|
2546
2582
|
}
|
|
2547
2583
|
}
|
|
2548
2584
|
if (!type || type === "hooks") {
|
|
2549
2585
|
const localHooks = loadLocalHooks(platformDir, name || void 0, appName);
|
|
2550
2586
|
if (localHooks.length > 0) {
|
|
2551
|
-
const changes = await planHooks(api, localHooks, collections);
|
|
2587
|
+
const changes = await planHooks(api, localHooks, collections, projectId);
|
|
2552
2588
|
allChanges.push(...changes);
|
|
2553
2589
|
}
|
|
2554
2590
|
}
|
|
@@ -2663,8 +2699,7 @@ async function apply(args) {
|
|
|
2663
2699
|
let collections;
|
|
2664
2700
|
try {
|
|
2665
2701
|
const remoteCollections = await api.listCollections();
|
|
2666
|
-
collections =
|
|
2667
|
-
for (const c of remoteCollections) collections.set(c.id, c.id);
|
|
2702
|
+
collections = buildCollectionIdMap(remoteCollections, appName);
|
|
2668
2703
|
} catch {
|
|
2669
2704
|
collections = /* @__PURE__ */ new Map();
|
|
2670
2705
|
}
|
|
@@ -2675,8 +2710,8 @@ async function apply(args) {
|
|
|
2675
2710
|
const localAgents = !type || type === "agents" ? loadLocalAgents(platformDir, name || void 0, appName) : [];
|
|
2676
2711
|
const localMailboxes = !type || type === "mailboxes" ? loadLocalMailboxes(platformDir, name || void 0) : [];
|
|
2677
2712
|
if (localCollections.length > 0) allChanges.push(...await planCollections(api, localCollections));
|
|
2678
|
-
if (localAutomations.length > 0) allChanges.push(...await planAutomations(api, localAutomations));
|
|
2679
|
-
if (localHooks.length > 0) allChanges.push(...await planHooks(api, localHooks, collections));
|
|
2713
|
+
if (localAutomations.length > 0) allChanges.push(...await planAutomations(api, localAutomations, projectId));
|
|
2714
|
+
if (localHooks.length > 0) allChanges.push(...await planHooks(api, localHooks, collections, projectId));
|
|
2680
2715
|
if (localAgents.length > 0) allChanges.push(...await planAgents(api, localAgents, projectId));
|
|
2681
2716
|
if (localMailboxes.length > 0) allChanges.push(...await planMailboxes(api, localMailboxes));
|
|
2682
2717
|
if (name) {
|
|
@@ -2754,8 +2789,7 @@ async function apply(args) {
|
|
|
2754
2789
|
}
|
|
2755
2790
|
try {
|
|
2756
2791
|
const remoteCollections = await api.listCollections();
|
|
2757
|
-
collections =
|
|
2758
|
-
for (const c of remoteCollections) collections.set(c.id, c.id);
|
|
2792
|
+
collections = buildCollectionIdMap(remoteCollections, appName);
|
|
2759
2793
|
} catch {
|
|
2760
2794
|
}
|
|
2761
2795
|
if (localAutomations.length > 0) {
|
|
@@ -2816,7 +2850,7 @@ async function pull(args) {
|
|
|
2816
2850
|
let collections;
|
|
2817
2851
|
try {
|
|
2818
2852
|
const remoteCollections = await api.listCollections();
|
|
2819
|
-
collections =
|
|
2853
|
+
collections = buildCollectionIdMap(remoteCollections, appName);
|
|
2820
2854
|
} catch {
|
|
2821
2855
|
collections = /* @__PURE__ */ new Map();
|
|
2822
2856
|
}
|
|
@@ -2832,7 +2866,7 @@ async function pull(args) {
|
|
|
2832
2866
|
if (!type || type === "automations") {
|
|
2833
2867
|
const localAutomations = loadLocalAutomations(platformDir, name || void 0, appName);
|
|
2834
2868
|
if (localAutomations.length > 0) {
|
|
2835
|
-
const changes = await planAutomations(api, localAutomations);
|
|
2869
|
+
const changes = await planAutomations(api, localAutomations, projectId);
|
|
2836
2870
|
for (const c of changes) {
|
|
2837
2871
|
if (c.type === "update") conflicts.push(`automations/${c.name}`);
|
|
2838
2872
|
}
|
|
@@ -2841,7 +2875,7 @@ async function pull(args) {
|
|
|
2841
2875
|
if (!type || type === "hooks") {
|
|
2842
2876
|
const localHooks = loadLocalHooks(platformDir, name || void 0, appName);
|
|
2843
2877
|
if (localHooks.length > 0) {
|
|
2844
|
-
const changes = await planHooks(api, localHooks, collections);
|
|
2878
|
+
const changes = await planHooks(api, localHooks, collections, projectId);
|
|
2845
2879
|
for (const c of changes) {
|
|
2846
2880
|
if (c.type === "update") conflicts.push(`hooks/${c.name}`);
|
|
2847
2881
|
}
|
|
@@ -3120,7 +3154,10 @@ async function diff(args) {
|
|
|
3120
3154
|
}
|
|
3121
3155
|
} else if (type === "automations") {
|
|
3122
3156
|
const localAutomations = loadLocalAutomations(platformDir, name, appName);
|
|
3123
|
-
const remoteAutomations = await api.listAutomations({
|
|
3157
|
+
const remoteAutomations = await api.listAutomations({
|
|
3158
|
+
include_code: true,
|
|
3159
|
+
...projectId ? { project_id: projectId } : {}
|
|
3160
|
+
});
|
|
3124
3161
|
const local = localAutomations[0];
|
|
3125
3162
|
const localExtId = local?.automation.external_id;
|
|
3126
3163
|
const remote = remoteAutomations.find(
|
|
@@ -3150,7 +3187,7 @@ async function diff(args) {
|
|
|
3150
3187
|
}
|
|
3151
3188
|
} else if (type === "hooks") {
|
|
3152
3189
|
const localHooks = loadLocalHooks(platformDir, name, appName);
|
|
3153
|
-
const remoteHooks = await api.listHooks();
|
|
3190
|
+
const remoteHooks = await api.listHooks(projectId ? { project_id: projectId } : void 0);
|
|
3154
3191
|
const local = localHooks[0];
|
|
3155
3192
|
const localExtId = local?.hook.external_id;
|
|
3156
3193
|
const remote = remoteHooks.find(
|