nimblybase 0.1.2 → 0.1.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 +15 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -349,7 +349,7 @@ function when(iso) {
|
|
|
349
349
|
|
|
350
350
|
// src/api.ts
|
|
351
351
|
var DEFAULT_API_URL = "https://api-uat.nimblybase.com";
|
|
352
|
-
var VERSION = "0.1.
|
|
352
|
+
var VERSION = "0.1.3";
|
|
353
353
|
function dashboardUrl(api) {
|
|
354
354
|
const match = /^https:\/\/api(-[a-z0-9]+)?\.(.+)$/.exec(api);
|
|
355
355
|
return match ? `https://app${match[1] ?? ""}.${match[2]}` : null;
|
|
@@ -1651,7 +1651,13 @@ async function readSchema(path) {
|
|
|
1651
1651
|
throw new CliError(`${path} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`, EXIT.usage);
|
|
1652
1652
|
}
|
|
1653
1653
|
}
|
|
1654
|
-
|
|
1654
|
+
function unwrapSchema(parsed) {
|
|
1655
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return parsed;
|
|
1656
|
+
if ("schema" in parsed) return parsed.schema;
|
|
1657
|
+
if (!("lineage" in parsed)) return parsed;
|
|
1658
|
+
const { lineage: _lineage, ...schema } = parsed;
|
|
1659
|
+
return schema;
|
|
1660
|
+
}
|
|
1655
1661
|
var lineageOf = (parsed) => {
|
|
1656
1662
|
const raw = parsed?.lineage;
|
|
1657
1663
|
return typeof raw === "string" && raw.trim() !== "" ? raw.trim() : void 0;
|
|
@@ -1749,7 +1755,8 @@ async function push(flags) {
|
|
|
1749
1755
|
json({ plan, applied });
|
|
1750
1756
|
return;
|
|
1751
1757
|
}
|
|
1752
|
-
|
|
1758
|
+
const statements = applied.statements === void 0 ? "" : ` (${applied.statements} SQL statement${applied.statements === 1 ? "" : "s"})`;
|
|
1759
|
+
out(`${paint("green", "\u2713")} Applied ${applied.applied} change${applied.applied === 1 ? "" : "s"}${statements} to ${project.slug}.`);
|
|
1753
1760
|
}
|
|
1754
1761
|
async function migrations(flags) {
|
|
1755
1762
|
const ctx = await context(flags.api);
|
|
@@ -1772,7 +1779,9 @@ function describePlan(plan, slug, path) {
|
|
|
1772
1779
|
}
|
|
1773
1780
|
out(`${plan.operations.length} change${plan.operations.length === 1 ? "" : "s"} between ${path} and ${slug}:`);
|
|
1774
1781
|
out();
|
|
1775
|
-
for (const op of plan.operations)
|
|
1782
|
+
for (const op of plan.operations) {
|
|
1783
|
+
for (const statement of describe(op)) out(` ${statement}`);
|
|
1784
|
+
}
|
|
1776
1785
|
out();
|
|
1777
1786
|
if (plan.unsupported.length > 0) {
|
|
1778
1787
|
for (const u of plan.unsupported) note(`${paint("yellow", "cannot apply")} ${u.reason}`);
|
|
@@ -1783,7 +1792,8 @@ function describePlan(plan, slug, path) {
|
|
|
1783
1792
|
}
|
|
1784
1793
|
function describe(op) {
|
|
1785
1794
|
const marker = op.destructive ? paint("red", "-") : paint("green", "+");
|
|
1786
|
-
|
|
1795
|
+
const statements = Array.isArray(op.sql) ? op.sql : [op.sql];
|
|
1796
|
+
return statements.map((sql2) => `${marker} ${sql2}`);
|
|
1787
1797
|
}
|
|
1788
1798
|
|
|
1789
1799
|
// src/commands/sql.ts
|