@bobbykim/manguito-cms-cli 0.4.6 → 0.6.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.
|
@@ -49,7 +49,7 @@ var init_esm_shims = __esm({
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
// ../api/dist/chunk-
|
|
52
|
+
// ../api/dist/chunk-D5AO4BTL.mjs
|
|
53
53
|
init_esm_shims();
|
|
54
54
|
import crypto from "crypto";
|
|
55
55
|
|
|
@@ -1212,7 +1212,87 @@ Subquery.prototype.getSQL = function() {
|
|
|
1212
1212
|
return new SQL([this]);
|
|
1213
1213
|
};
|
|
1214
1214
|
|
|
1215
|
-
// ../api/dist/chunk-
|
|
1215
|
+
// ../api/dist/chunk-D5AO4BTL.mjs
|
|
1216
|
+
function isColumnBacked(field) {
|
|
1217
|
+
const col = field.db_column;
|
|
1218
|
+
if (col === null) return false;
|
|
1219
|
+
if (col.column_name === "") return false;
|
|
1220
|
+
if (col.junction) return false;
|
|
1221
|
+
return true;
|
|
1222
|
+
}
|
|
1223
|
+
function buildFieldKeyMap(pairs, allLabels, droppedKeys) {
|
|
1224
|
+
const labelToColumn = /* @__PURE__ */ new Map();
|
|
1225
|
+
const columnToLabel = /* @__PURE__ */ new Map();
|
|
1226
|
+
for (const { label, column } of pairs) {
|
|
1227
|
+
labelToColumn.set(label, column);
|
|
1228
|
+
columnToLabel.set(column, label);
|
|
1229
|
+
}
|
|
1230
|
+
for (const label of allLabels) {
|
|
1231
|
+
const columnOwner = columnToLabel.get(label);
|
|
1232
|
+
if (columnOwner !== void 0 && columnOwner !== label) {
|
|
1233
|
+
throw new Error(
|
|
1234
|
+
`Fatal: field key map failed to build \u2014 field label "${label}" collides with the storage column of field "${columnOwner}". A field label may not reuse another field's column name. Rename the field, then run \`manguito validate\` to check your schema.`
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
for (const label of labelToColumn.keys()) {
|
|
1239
|
+
if (droppedKeys.has(label)) labelToColumn.delete(label);
|
|
1240
|
+
}
|
|
1241
|
+
for (const column of columnToLabel.keys()) {
|
|
1242
|
+
if (droppedKeys.has(column)) columnToLabel.delete(column);
|
|
1243
|
+
}
|
|
1244
|
+
const diverges = [...labelToColumn].some(([label, column]) => label !== column);
|
|
1245
|
+
function remap(input, lookup) {
|
|
1246
|
+
const out = {};
|
|
1247
|
+
for (const key of Object.keys(input)) {
|
|
1248
|
+
if (droppedKeys.has(key)) continue;
|
|
1249
|
+
out[lookup.get(key) ?? key] = input[key];
|
|
1250
|
+
}
|
|
1251
|
+
return out;
|
|
1252
|
+
}
|
|
1253
|
+
return {
|
|
1254
|
+
toStorage: (input) => remap(input, labelToColumn),
|
|
1255
|
+
toLabels: (row) => remap(row, columnToLabel),
|
|
1256
|
+
columnFor: (label) => labelToColumn.get(label),
|
|
1257
|
+
labelFor: (column) => columnToLabel.get(column),
|
|
1258
|
+
labels: [...labelToColumn.keys()],
|
|
1259
|
+
diverges
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
function createFieldKeyMap(fields) {
|
|
1263
|
+
const droppedKeys = /* @__PURE__ */ new Set();
|
|
1264
|
+
const pairs = [];
|
|
1265
|
+
for (const f of fields) {
|
|
1266
|
+
if (!isColumnBacked(f)) continue;
|
|
1267
|
+
pairs.push({ label: f.name, column: f.db_column.column_name });
|
|
1268
|
+
if (f.removed === true) {
|
|
1269
|
+
droppedKeys.add(f.name);
|
|
1270
|
+
droppedKeys.add(f.db_column.column_name);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return buildFieldKeyMap(
|
|
1274
|
+
pairs,
|
|
1275
|
+
fields.map((f) => f.name),
|
|
1276
|
+
droppedKeys
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
function createFieldKeyMapFromProjection(projectionType, allFields) {
|
|
1280
|
+
const pairs = projectionType.fields.map((f) => ({ label: f.exposed_as, column: f.column_name }));
|
|
1281
|
+
const projected = new Set(pairs.map((p) => p.label));
|
|
1282
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
1283
|
+
for (const f of allFields) {
|
|
1284
|
+
if (!isColumnBacked(f)) continue;
|
|
1285
|
+
dropped.add(f.name);
|
|
1286
|
+
dropped.add(f.db_column.column_name);
|
|
1287
|
+
}
|
|
1288
|
+
for (const p of pairs) dropped.delete(p.column);
|
|
1289
|
+
for (const label of projected) dropped.delete(label);
|
|
1290
|
+
return buildFieldKeyMap(
|
|
1291
|
+
pairs,
|
|
1292
|
+
allFields.map((f) => f.name),
|
|
1293
|
+
dropped
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1216
1296
|
function quoteIdent(name) {
|
|
1217
1297
|
if (!/^[a-z][a-z0-9_-]*$/.test(name)) throw new Error(`Unsafe identifier: ${name}`);
|
|
1218
1298
|
return `"${name}"`;
|
|
@@ -1506,58 +1586,6 @@ async function resolveRelationBareIds(db, rows, fieldName, rel) {
|
|
|
1506
1586
|
}
|
|
1507
1587
|
}
|
|
1508
1588
|
}
|
|
1509
|
-
function isColumnBacked(field) {
|
|
1510
|
-
const col = field.db_column;
|
|
1511
|
-
if (col === null) return false;
|
|
1512
|
-
if (col.column_name === "") return false;
|
|
1513
|
-
if (col.junction) return false;
|
|
1514
|
-
return true;
|
|
1515
|
-
}
|
|
1516
|
-
function createFieldKeyMap(fields) {
|
|
1517
|
-
const labelToColumn = /* @__PURE__ */ new Map();
|
|
1518
|
-
const columnToLabel = /* @__PURE__ */ new Map();
|
|
1519
|
-
const droppedKeys = /* @__PURE__ */ new Set();
|
|
1520
|
-
for (const f of fields) {
|
|
1521
|
-
if (!isColumnBacked(f)) continue;
|
|
1522
|
-
columnToLabel.set(f.db_column.column_name, f.name);
|
|
1523
|
-
if (f.removed === true) {
|
|
1524
|
-
droppedKeys.add(f.name);
|
|
1525
|
-
droppedKeys.add(f.db_column.column_name);
|
|
1526
|
-
continue;
|
|
1527
|
-
}
|
|
1528
|
-
labelToColumn.set(f.name, f.db_column.column_name);
|
|
1529
|
-
}
|
|
1530
|
-
for (const f of fields) {
|
|
1531
|
-
const columnOwner = columnToLabel.get(f.name);
|
|
1532
|
-
if (columnOwner !== void 0 && columnOwner !== f.name) {
|
|
1533
|
-
throw new Error(
|
|
1534
|
-
`Fatal: field key map failed to build \u2014 field label "${f.name}" collides with the storage column of field "${columnOwner}". A field label may not reuse another field's column name. Rename the field, then run \`manguito validate\` to check your schema.`
|
|
1535
|
-
);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
for (const f of fields) {
|
|
1539
|
-
if (isColumnBacked(f) && f.removed === true) {
|
|
1540
|
-
columnToLabel.delete(f.db_column.column_name);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
const diverges = [...labelToColumn].some(([label, column]) => label !== column);
|
|
1544
|
-
function remap(input, lookup) {
|
|
1545
|
-
const out = {};
|
|
1546
|
-
for (const key of Object.keys(input)) {
|
|
1547
|
-
if (droppedKeys.has(key)) continue;
|
|
1548
|
-
out[lookup.get(key) ?? key] = input[key];
|
|
1549
|
-
}
|
|
1550
|
-
return out;
|
|
1551
|
-
}
|
|
1552
|
-
return {
|
|
1553
|
-
toStorage: (input) => remap(input, labelToColumn),
|
|
1554
|
-
toLabels: (row) => remap(row, columnToLabel),
|
|
1555
|
-
columnFor: (label) => labelToColumn.get(label),
|
|
1556
|
-
labelFor: (column) => columnToLabel.get(column),
|
|
1557
|
-
labels: [...labelToColumn.keys()],
|
|
1558
|
-
diverges
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
1589
|
|
|
1562
1590
|
export {
|
|
1563
1591
|
__require,
|
|
@@ -1590,12 +1618,13 @@ export {
|
|
|
1590
1618
|
Placeholder,
|
|
1591
1619
|
fillPlaceholders,
|
|
1592
1620
|
View,
|
|
1621
|
+
isColumnBacked,
|
|
1622
|
+
createFieldKeyMap,
|
|
1623
|
+
createFieldKeyMapFromProjection,
|
|
1593
1624
|
persistParagraphField,
|
|
1594
1625
|
deleteParagraphField,
|
|
1595
1626
|
persistJunctionField,
|
|
1596
1627
|
buildRelationsMap,
|
|
1597
1628
|
resolveRelationField,
|
|
1598
|
-
resolveRelationBareIds
|
|
1599
|
-
isColumnBacked,
|
|
1600
|
-
createFieldKeyMap
|
|
1629
|
+
resolveRelationBareIds
|
|
1601
1630
|
};
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
init_esm_shims,
|
|
12
12
|
isColumnBacked,
|
|
13
13
|
resolveRelationField
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-STFSR5LP.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/.pnpm/@whatwg-node+fetch@0.10.13/node_modules/@whatwg-node/fetch/dist/shouldSkipPonyfill.js
|
|
17
17
|
var require_shouldSkipPonyfill = __commonJS({
|
|
@@ -10786,10 +10786,10 @@ var require_parser = __commonJS({
|
|
|
10786
10786
|
}
|
|
10787
10787
|
});
|
|
10788
10788
|
|
|
10789
|
-
// ../api/dist/handler-
|
|
10789
|
+
// ../api/dist/handler-X7JDHJAL.mjs
|
|
10790
10790
|
init_esm_shims();
|
|
10791
10791
|
|
|
10792
|
-
// ../api/dist/chunk-
|
|
10792
|
+
// ../api/dist/chunk-ARZXLNZS.mjs
|
|
10793
10793
|
init_esm_shims();
|
|
10794
10794
|
|
|
10795
10795
|
// ../../node_modules/.pnpm/graphql-yoga@5.21.2_graphql@16.14.2/node_modules/graphql-yoga/esm/index.js
|
|
@@ -30122,7 +30122,7 @@ function createYoga(options) {
|
|
|
30122
30122
|
});
|
|
30123
30123
|
}
|
|
30124
30124
|
|
|
30125
|
-
// ../api/dist/chunk-
|
|
30125
|
+
// ../api/dist/chunk-ARZXLNZS.mjs
|
|
30126
30126
|
var import_dataloader = __toESM(require_dataloader(), 1);
|
|
30127
30127
|
|
|
30128
30128
|
// ../../node_modules/.pnpm/@escape.tech+graphql-armor@3.2.0_@envelop+core@5.5.1_@escape.tech+graphql-armor-types@0.7.0/node_modules/@escape.tech/graphql-armor/dist/graphql-armor.esm.js
|
|
@@ -30880,7 +30880,7 @@ var EnvelopArmor = class {
|
|
|
30880
30880
|
}
|
|
30881
30881
|
};
|
|
30882
30882
|
|
|
30883
|
-
// ../api/dist/chunk-
|
|
30883
|
+
// ../api/dist/chunk-ARZXLNZS.mjs
|
|
30884
30884
|
var DateTimeScalar = new GraphQLScalarType({
|
|
30885
30885
|
name: "DateTime",
|
|
30886
30886
|
description: "ISO-8601 date-time string",
|