@lumerahq/cli 0.9.4 → 0.10.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.
|
@@ -56,10 +56,11 @@ var ApiClient = class {
|
|
|
56
56
|
}
|
|
57
57
|
// Automations
|
|
58
58
|
async listAutomations(params) {
|
|
59
|
-
|
|
60
|
-
if (params?.external_id)
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const qs = new URLSearchParams();
|
|
60
|
+
if (params?.external_id) qs.set("external_id", params.external_id);
|
|
61
|
+
if (params?.include_code) qs.set("include_code", "true");
|
|
62
|
+
const query = qs.toString();
|
|
63
|
+
const path = `/api/automations${query ? `?${query}` : ""}`;
|
|
63
64
|
const result = await this.request(path);
|
|
64
65
|
return result.automations || [];
|
|
65
66
|
}
|
package/dist/index.js
CHANGED
|
@@ -92,29 +92,29 @@ async function main() {
|
|
|
92
92
|
switch (command) {
|
|
93
93
|
// Resource commands
|
|
94
94
|
case "plan":
|
|
95
|
-
await import("./resources-
|
|
95
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.plan(args.slice(1)));
|
|
96
96
|
break;
|
|
97
97
|
case "apply":
|
|
98
|
-
await import("./resources-
|
|
98
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.apply(args.slice(1)));
|
|
99
99
|
break;
|
|
100
100
|
case "pull":
|
|
101
|
-
await import("./resources-
|
|
101
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.pull(args.slice(1)));
|
|
102
102
|
break;
|
|
103
103
|
case "destroy":
|
|
104
|
-
await import("./resources-
|
|
104
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.destroy(args.slice(1)));
|
|
105
105
|
break;
|
|
106
106
|
case "list":
|
|
107
|
-
await import("./resources-
|
|
107
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.list(args.slice(1)));
|
|
108
108
|
break;
|
|
109
109
|
case "show":
|
|
110
|
-
await import("./resources-
|
|
110
|
+
await import("./resources-PGBVCS2K.js").then((m) => m.show(args.slice(1)));
|
|
111
111
|
break;
|
|
112
112
|
// Development
|
|
113
113
|
case "dev":
|
|
114
114
|
await import("./dev-BHBF4ECH.js").then((m) => m.dev(args.slice(1)));
|
|
115
115
|
break;
|
|
116
116
|
case "run":
|
|
117
|
-
await import("./run-
|
|
117
|
+
await import("./run-WIRQDYYX.js").then((m) => m.run(args.slice(1)));
|
|
118
118
|
break;
|
|
119
119
|
// Project
|
|
120
120
|
case "init":
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-CDZZ3JYU.js";
|
|
4
4
|
import {
|
|
5
5
|
createApiClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WRAZC6SJ.js";
|
|
7
7
|
import {
|
|
8
8
|
loadEnv
|
|
9
9
|
} from "./chunk-2CR762KB.js";
|
|
@@ -452,7 +452,7 @@ async function planCollections(api, localCollections) {
|
|
|
452
452
|
}
|
|
453
453
|
async function planAutomations(api, localAutomations) {
|
|
454
454
|
const changes = [];
|
|
455
|
-
const remoteAutomations = await api.listAutomations();
|
|
455
|
+
const remoteAutomations = await api.listAutomations({ include_code: true });
|
|
456
456
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id).map((a) => [a.external_id, a]));
|
|
457
457
|
for (const { automation, code } of localAutomations) {
|
|
458
458
|
const remote = remoteByExternalId.get(automation.external_id);
|
|
@@ -526,9 +526,11 @@ async function applyCollections(api, localCollections) {
|
|
|
526
526
|
const hasRelations = localCollections.some((c) => c.fields.some((f) => f.type === "relation"));
|
|
527
527
|
if (hasRelations) {
|
|
528
528
|
for (const local of localCollections) {
|
|
529
|
+
const relationFieldNames = new Set(local.fields.filter((f) => f.type === "relation").map((f) => f.name));
|
|
529
530
|
const withoutRelations = {
|
|
530
531
|
...local,
|
|
531
|
-
fields: local.fields.filter((f) => f.type !== "relation")
|
|
532
|
+
fields: local.fields.filter((f) => f.type !== "relation"),
|
|
533
|
+
indexes: local.indexes?.filter((idx) => !idx.fields.some((f) => relationFieldNames.has(f)))
|
|
532
534
|
};
|
|
533
535
|
const apiFormat = convertCollectionToApiFormat(withoutRelations);
|
|
534
536
|
try {
|
|
@@ -742,7 +744,7 @@ async function pullCollections(api, platformDir, filterName) {
|
|
|
742
744
|
async function pullAutomations(api, platformDir, filterName) {
|
|
743
745
|
const automationsDir = join(platformDir, "automations");
|
|
744
746
|
mkdirSync(automationsDir, { recursive: true });
|
|
745
|
-
const automations = await api.listAutomations();
|
|
747
|
+
const automations = await api.listAutomations({ include_code: true });
|
|
746
748
|
for (const automation of automations) {
|
|
747
749
|
if (!automation.external_id || automation.managed) continue;
|
|
748
750
|
if (filterName && automation.external_id !== filterName && automation.name !== filterName) {
|
|
@@ -847,7 +849,7 @@ async function listResources(api, platformDir, filterType) {
|
|
|
847
849
|
}
|
|
848
850
|
if (!filterType || filterType === "automations") {
|
|
849
851
|
const localAutomations = loadLocalAutomations(platformDir);
|
|
850
|
-
const remoteAutomations = await api.listAutomations();
|
|
852
|
+
const remoteAutomations = await api.listAutomations({ include_code: true });
|
|
851
853
|
const remoteByExternalId = new Map(remoteAutomations.filter((a) => a.external_id && !a.managed).map((a) => [a.external_id, a]));
|
|
852
854
|
const localIds = new Set(localAutomations.map((a) => a.automation.external_id));
|
|
853
855
|
for (const { automation, code } of localAutomations) {
|