@bobbykim/manguito-cms-cli 0.11.2 → 0.11.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.
@@ -25308,6 +25308,7 @@ function validateCrossReferences(registry2, globalMaxFileSize) {
25308
25308
  errors.push(...checkFieldRefs(registry2));
25309
25309
  errors.push(...checkCircularParagraphRefs(registry2));
25310
25310
  errors.push(...checkParagraphRelations(registry2));
25311
+ errors.push(...checkTableNameCollisions(registry2));
25311
25312
  if (globalMaxFileSize !== void 0) {
25312
25313
  errors.push(...checkMaxSizeLimit(registry2, globalMaxFileSize));
25313
25314
  }
@@ -25328,6 +25329,58 @@ function checkParagraphRelations(registry2) {
25328
25329
  }
25329
25330
  return errors;
25330
25331
  }
25332
+ var POSTGRES_IDENTIFIER_LIMIT = 63;
25333
+ function rawFieldPath(owner, field) {
25334
+ if (owner.schema_type !== "content-type") return `fields[${field.order}].name`;
25335
+ const t = owner.ui.tabs.findIndex((tab) => tab.fields.includes(field.name));
25336
+ const i = t < 0 ? -1 : owner.ui.tabs[t].fields.indexOf(field.name);
25337
+ return t < 0 ? `fields[${field.order}].name` : `fields[${t}].tab.fields[${i}].name`;
25338
+ }
25339
+ function checkTableNameCollisions(registry2) {
25340
+ const uses = [];
25341
+ for (const p of Object.values(registry2.paragraph_types)) {
25342
+ uses.push({ table: p.db.table_name, file: p.source_file, what: `type "${p.name}"`, shorten: `shorten the name of type "${p.name}"` });
25343
+ }
25344
+ for (const owner of [...Object.values(registry2.content_types), ...Object.values(registry2.taxonomy_types)]) {
25345
+ uses.push({
25346
+ table: owner.db.table_name,
25347
+ file: owner.source_file,
25348
+ what: `type "${owner.name}"`,
25349
+ shorten: `shorten the name of type "${owner.name}"`
25350
+ });
25351
+ for (const jt of owner.db.junction_tables) {
25352
+ const field = owner.fields.find((f) => f.db_column?.junction?.table_name === jt.table_name);
25353
+ if (!field) continue;
25354
+ const prefix = `junction_${owner.db.table_name}_`.length;
25355
+ const room = POSTGRES_IDENTIFIER_LIMIT - prefix;
25356
+ uses.push({
25357
+ table: jt.table_name,
25358
+ file: owner.source_file,
25359
+ what: `field "${field.name}" of "${owner.name}"`,
25360
+ shorten: room < 1 ? `shorten the name of type "${owner.name}": its link table names already have ${prefix} characters before the field name` : `shorten field "${field.name}" to at most ${room} characters, or the name of type "${owner.name}"`,
25361
+ path: rawFieldPath(owner, field)
25362
+ });
25363
+ }
25364
+ }
25365
+ const errors = [];
25366
+ const first = /* @__PURE__ */ new Map();
25367
+ for (const use of uses) {
25368
+ const stored = use.table.slice(0, POSTGRES_IDENTIFIER_LIMIT);
25369
+ const earlier = first.get(stored);
25370
+ if (!earlier) {
25371
+ first.set(stored, use);
25372
+ continue;
25373
+ }
25374
+ const tooLong = use.table.length > POSTGRES_IDENTIFIER_LIMIT ? use : earlier;
25375
+ errors.push({
25376
+ file: use.file,
25377
+ code: "TABLE_NAME_COLLISION",
25378
+ message: earlier.table === use.table ? `The ${use.what} would store its data in table "${use.table}", the same table as the ${earlier.what}. Rename one of the two so their tables differ.` : `The ${use.what} and the ${earlier.what} would get tables "${use.table}" and "${earlier.table}". Postgres keeps only the first ${POSTGRES_IDENTIFIER_LIMIT} characters of a name, which are the same, so they would be one table. To keep "${tooLong.table}" within ${POSTGRES_IDENTIFIER_LIMIT} characters, ${tooLong.shorten}.`,
25379
+ ...use.path !== void 0 && { path: use.path }
25380
+ });
25381
+ }
25382
+ return errors;
25383
+ }
25331
25384
  function checkDuplicateSchemaNames(allSchemas) {
25332
25385
  const errors = [];
25333
25386
  const seen = /* @__PURE__ */ new Map();
@@ -25904,7 +25957,17 @@ function checkDuplicateColumns(fields, sourceFile, schemaName) {
25904
25957
  for (const f of fields) {
25905
25958
  if (!hasStorageColumn(f)) continue;
25906
25959
  const column = f.column ?? f.name;
25907
- const first = owner.get(column);
25960
+ const stored = column.slice(0, 63);
25961
+ const firstUse = owner.get(stored);
25962
+ if (firstUse !== void 0 && firstUse.column !== column) {
25963
+ errors.push({
25964
+ file: sourceFile,
25965
+ code: "DUPLICATE_COLUMN",
25966
+ message: `Fields "${firstUse.field}" and "${f.name}" in schema "${schemaName}" resolve to columns "${firstUse.column}" and "${column}". Postgres keeps only the first 63 characters of a column name, which are the same, so they would be one column. Shorten one of the field names to at most 63 characters.`
25967
+ });
25968
+ continue;
25969
+ }
25970
+ const first = firstUse?.field;
25908
25971
  if (first !== void 0) {
25909
25972
  errors.push({
25910
25973
  file: sourceFile,
@@ -25913,7 +25976,7 @@ function checkDuplicateColumns(fields, sourceFile, schemaName) {
25913
25976
  });
25914
25977
  continue;
25915
25978
  }
25916
- owner.set(column, f.name);
25979
+ owner.set(stored, { field: f.name, column });
25917
25980
  }
25918
25981
  return errors;
25919
25982
  }
@@ -12,7 +12,7 @@ import {
12
12
  isColumnBacked,
13
13
  relationCardinality,
14
14
  resolveRelationField
15
- } from "./chunk-WTZBHFCV.js";
15
+ } from "./chunk-N75KN2YC.js";
16
16
 
17
17
  // ../../node_modules/.pnpm/@whatwg-node+fetch@0.10.13/node_modules/@whatwg-node/fetch/dist/shouldSkipPonyfill.js
18
18
  var require_shouldSkipPonyfill = __commonJS({
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ import {
55
55
  validateCrossReferences,
56
56
  verifyPassword,
57
57
  walkSchemaDirectory
58
- } from "./chunk-WTZBHFCV.js";
58
+ } from "./chunk-N75KN2YC.js";
59
59
 
60
60
  // ../../node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js
61
61
  var require_postgres_array = __commonJS({
@@ -24774,7 +24774,7 @@ function registerUserRoutes(app, db, requirePermission, requireHierarchy) {
24774
24774
  }
24775
24775
  var API_VERSION = (() => {
24776
24776
  try {
24777
- return "0.9.1";
24777
+ return "0.9.2";
24778
24778
  } catch {
24779
24779
  return "0.0.0";
24780
24780
  }
@@ -25457,7 +25457,7 @@ function createCmsApp(options) {
25457
25457
  handler: null,
25458
25458
  error: null
25459
25459
  }));
25460
- const ready = import("./handler-MFF32JB4-MEMKPHHQ.js").then(({ createGraphQLHandler }) => {
25460
+ const ready = import("./handler-MFF32JB4-NUVEJZXC.js").then(({ createGraphQLHandler }) => {
25461
25461
  gqlPasses.forEach((pass, i) => {
25462
25462
  const mount = mounts[i];
25463
25463
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobbykim/manguito-cms-cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "license": "MIT",
5
5
  "author": "Bobby Kim <bobby.sihun.kim@gmail.com>",
6
6
  "homepage": "https://github.com/bobbykim89/manguito-cms",
@@ -29,10 +29,10 @@
29
29
  "tsup": "^8.5.1",
30
30
  "typescript": "^6.0.3",
31
31
  "vite": "^8.1.3",
32
- "@bobbykim/manguito-cms-admin": "0.6.0",
33
- "@bobbykim/manguito-cms-db": "0.2.0",
34
- "@bobbykim/manguito-cms-core": "0.10.0",
35
- "@bobbykim/manguito-cms-api": "0.9.1"
32
+ "@bobbykim/manguito-cms-core": "0.11.0",
33
+ "@bobbykim/manguito-cms-db": "0.2.1",
34
+ "@bobbykim/manguito-cms-api": "0.9.2",
35
+ "@bobbykim/manguito-cms-admin": "0.6.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^25.9.5",