@lumerahq/cli 0.23.0-dev.1 → 0.23.0-dev.3
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/index.js
CHANGED
|
@@ -226,25 +226,25 @@ async function main() {
|
|
|
226
226
|
switch (command) {
|
|
227
227
|
// Resource commands
|
|
228
228
|
case "plan":
|
|
229
|
-
await import("./resources-
|
|
229
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.plan(args.slice(1)));
|
|
230
230
|
break;
|
|
231
231
|
case "apply":
|
|
232
|
-
await import("./resources-
|
|
232
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.apply(args.slice(1)));
|
|
233
233
|
break;
|
|
234
234
|
case "pull":
|
|
235
|
-
await import("./resources-
|
|
235
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.pull(args.slice(1)));
|
|
236
236
|
break;
|
|
237
237
|
case "destroy":
|
|
238
|
-
await import("./resources-
|
|
238
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.destroy(args.slice(1)));
|
|
239
239
|
break;
|
|
240
240
|
case "list":
|
|
241
|
-
await import("./resources-
|
|
241
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.list(args.slice(1)));
|
|
242
242
|
break;
|
|
243
243
|
case "show":
|
|
244
|
-
await import("./resources-
|
|
244
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.show(args.slice(1)));
|
|
245
245
|
break;
|
|
246
246
|
case "diff":
|
|
247
|
-
await import("./resources-
|
|
247
|
+
await import("./resources-QCCLRDOL.js").then((m) => m.diff(args.slice(1)));
|
|
248
248
|
break;
|
|
249
249
|
// Development
|
|
250
250
|
case "dev":
|
|
@@ -124,9 +124,9 @@ var collectionSchemaRule = {
|
|
|
124
124
|
const id = parsed.id;
|
|
125
125
|
const name = parsed.name;
|
|
126
126
|
const fields = parsed.fields;
|
|
127
|
-
const audit = parsed.audit;
|
|
128
127
|
const indexes = parsed.indexes;
|
|
129
128
|
const search = parsed.search;
|
|
129
|
+
const audit = parsed.audit;
|
|
130
130
|
const localFieldTypes = /* @__PURE__ */ new Map();
|
|
131
131
|
if (Array.isArray(fields)) {
|
|
132
132
|
for (const field of fields) {
|
|
@@ -1555,8 +1555,8 @@ function convertCollectionToApiFormat(local) {
|
|
|
1555
1555
|
name: local.name,
|
|
1556
1556
|
schema,
|
|
1557
1557
|
indexes,
|
|
1558
|
-
|
|
1559
|
-
|
|
1558
|
+
search: local.search ?? null,
|
|
1559
|
+
...local.audit !== void 0 ? { audit: local.audit } : {}
|
|
1560
1560
|
};
|
|
1561
1561
|
}
|
|
1562
1562
|
function mapFieldType(type) {
|
|
@@ -1564,8 +1564,8 @@ function mapFieldType(type) {
|
|
|
1564
1564
|
text: "text",
|
|
1565
1565
|
number: "number",
|
|
1566
1566
|
bool: "bool",
|
|
1567
|
-
email: "
|
|
1568
|
-
url: "
|
|
1567
|
+
email: "text",
|
|
1568
|
+
url: "text",
|
|
1569
1569
|
date: "date",
|
|
1570
1570
|
select: "select",
|
|
1571
1571
|
relation: "relation",
|
|
@@ -1674,14 +1674,15 @@ async function planCollections(api, localCollections) {
|
|
|
1674
1674
|
for (const local of localCollections) {
|
|
1675
1675
|
const remote = remoteById.get(local.id);
|
|
1676
1676
|
if (!remote) {
|
|
1677
|
-
const details = [`${local.fields.length} fields`];
|
|
1678
|
-
if (local.audit) details.push("record audit enabled");
|
|
1679
1677
|
changes.push({
|
|
1680
1678
|
type: "create",
|
|
1681
1679
|
resource: "collection",
|
|
1682
1680
|
id: local.id,
|
|
1683
1681
|
name: local.name,
|
|
1684
|
-
details:
|
|
1682
|
+
details: [
|
|
1683
|
+
`${local.fields.length} fields`,
|
|
1684
|
+
...local.audit !== void 0 ? [local.audit ? "audit enabled" : "audit disabled"] : []
|
|
1685
|
+
].join(", "),
|
|
1685
1686
|
fieldDetails: local.fields.map((f) => ({
|
|
1686
1687
|
action: "+",
|
|
1687
1688
|
name: f.name,
|
|
@@ -1715,7 +1716,7 @@ async function planCollections(api, localCollections) {
|
|
|
1715
1716
|
if (modified.length > 0) details.push(`~${modified.length} field${modified.length > 1 ? "s" : ""} (${modified.join(", ")})`);
|
|
1716
1717
|
if (indexesChanged) details.push("indexes changed");
|
|
1717
1718
|
if (searchChanged) details.push("search changed");
|
|
1718
|
-
if (auditChanged) details.push(local.audit ? "
|
|
1719
|
+
if (auditChanged) details.push(local.audit ? "audit enabled" : "audit disabled");
|
|
1719
1720
|
const fieldDetails = [];
|
|
1720
1721
|
for (const name of added) {
|
|
1721
1722
|
const f = localFieldMap.get(name);
|
|
@@ -2185,17 +2186,15 @@ async function applyApp(args) {
|
|
|
2185
2186
|
const distDir = resolve(projectRoot, "dist");
|
|
2186
2187
|
await deploy({ token, appName, appTitle, distDir, apiUrl });
|
|
2187
2188
|
}
|
|
2188
|
-
async function pullCollections(api, platformDir, filterName,
|
|
2189
|
+
async function pullCollections(api, platformDir, filterName, projectId) {
|
|
2189
2190
|
const collectionsDir = join2(platformDir, "collections");
|
|
2190
2191
|
mkdirSync(collectionsDir, { recursive: true });
|
|
2191
2192
|
const collections = await api.listCollections();
|
|
2192
2193
|
for (const collection of collections) {
|
|
2193
2194
|
if (collection.system || collection.managed) continue;
|
|
2194
|
-
if (
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
}
|
|
2198
|
-
const localName = stripNamespacePrefix(collection.name, appName);
|
|
2195
|
+
if (projectId && collection.project_id !== projectId) continue;
|
|
2196
|
+
if (!projectId && collection.project_id) continue;
|
|
2197
|
+
const localName = collection.name;
|
|
2199
2198
|
if (filterName && localName !== filterName && collection.name !== filterName && collection.id !== filterName) {
|
|
2200
2199
|
continue;
|
|
2201
2200
|
}
|
|
@@ -2606,7 +2605,11 @@ async function listResources(api, platformDir, filterType, appName, projectId) {
|
|
|
2606
2605
|
if (!filterType || filterType === "collections") {
|
|
2607
2606
|
const localCollections = loadLocalCollections(platformDir);
|
|
2608
2607
|
const remoteCollections = await api.listCollections();
|
|
2609
|
-
const
|
|
2608
|
+
const projectCollections = remoteCollections.filter((collection) => {
|
|
2609
|
+
if (collection.system || collection.managed) return false;
|
|
2610
|
+
return projectId ? collection.project_id === projectId : !collection.project_id;
|
|
2611
|
+
});
|
|
2612
|
+
const remoteByName = new Map(projectCollections.map((collection) => [collection.name, collection]));
|
|
2610
2613
|
const localNames = new Set(localCollections.map((c) => c.name));
|
|
2611
2614
|
for (const local of localCollections) {
|
|
2612
2615
|
const remote = remoteByName.get(local.name);
|
|
@@ -2627,15 +2630,9 @@ async function listResources(api, platformDir, filterType, appName, projectId) {
|
|
|
2627
2630
|
}
|
|
2628
2631
|
}
|
|
2629
2632
|
}
|
|
2630
|
-
for (const remote of
|
|
2631
|
-
if (
|
|
2632
|
-
|
|
2633
|
-
const prefix = remote.name.split(NAMESPACE_SEPARATOR)[0];
|
|
2634
|
-
if (prefix !== sanitizeSlugForCollectionName(appName)) continue;
|
|
2635
|
-
}
|
|
2636
|
-
const stripped = stripNamespacePrefix(remote.name, appName);
|
|
2637
|
-
if (!localNames.has(stripped)) {
|
|
2638
|
-
results.push({ name: stripped, type: "collections", status: "remote-only" });
|
|
2633
|
+
for (const remote of projectCollections) {
|
|
2634
|
+
if (!localNames.has(remote.name)) {
|
|
2635
|
+
results.push({ name: remote.name, type: "collections", status: "remote-only" });
|
|
2639
2636
|
}
|
|
2640
2637
|
}
|
|
2641
2638
|
}
|
|
@@ -2819,10 +2816,9 @@ async function destroyResources(api, platformDir, resourceType, resourceName, sk
|
|
|
2819
2816
|
if (!resourceType || resourceType === "collections") {
|
|
2820
2817
|
const localCollections = loadLocalCollections(platformDir, resourceName || void 0);
|
|
2821
2818
|
const remoteCollections = await api.listCollections();
|
|
2822
|
-
const remoteById = new Map(remoteCollections.map((c) => [c.id, c]));
|
|
2823
2819
|
const remoteByName = new Map(remoteCollections.map((c) => [c.name, c]));
|
|
2824
2820
|
for (const local of localCollections) {
|
|
2825
|
-
const remote =
|
|
2821
|
+
const remote = remoteByName.get(local.name);
|
|
2826
2822
|
if (remote) {
|
|
2827
2823
|
toDelete.push({ type: "collection", id: local.id, name: local.name, remoteId: remote.id });
|
|
2828
2824
|
}
|
|
@@ -3597,7 +3593,7 @@ async function pull(args) {
|
|
|
3597
3593
|
console.log();
|
|
3598
3594
|
if (!type || type === "collections") {
|
|
3599
3595
|
console.log(pc2.bold(" Collections:"));
|
|
3600
|
-
await pullCollections(api, platformDir, name || void 0,
|
|
3596
|
+
await pullCollections(api, platformDir, name || void 0, projectId);
|
|
3601
3597
|
console.log();
|
|
3602
3598
|
if (!name) {
|
|
3603
3599
|
console.log(pc2.bold(" Resource shares:"));
|
|
@@ -3928,9 +3924,9 @@ export {
|
|
|
3928
3924
|
applyCollections,
|
|
3929
3925
|
convertCollectionToApiFormat,
|
|
3930
3926
|
destroy,
|
|
3931
|
-
destroyResources,
|
|
3932
3927
|
diff,
|
|
3933
3928
|
list,
|
|
3929
|
+
loadLocalCollections,
|
|
3934
3930
|
plan,
|
|
3935
3931
|
planCollections,
|
|
3936
3932
|
pull,
|
package/package.json
CHANGED