@bobbykim/manguito-cms-cli 0.4.4 → 0.4.6

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-4F2CRXPG.mjs
52
+ // ../api/dist/chunk-4Y4G564P.mjs
53
53
  init_esm_shims();
54
54
  import crypto from "crypto";
55
55
 
@@ -1212,7 +1212,7 @@ Subquery.prototype.getSQL = function() {
1212
1212
  return new SQL([this]);
1213
1213
  };
1214
1214
 
1215
- // ../api/dist/chunk-4F2CRXPG.mjs
1215
+ // ../api/dist/chunk-4Y4G564P.mjs
1216
1216
  function quoteIdent(name) {
1217
1217
  if (!/^[a-z][a-z0-9_-]*$/.test(name)) throw new Error(`Unsafe identifier: ${name}`);
1218
1218
  return `"${name}"`;
@@ -1516,10 +1516,16 @@ function isColumnBacked(field) {
1516
1516
  function createFieldKeyMap(fields) {
1517
1517
  const labelToColumn = /* @__PURE__ */ new Map();
1518
1518
  const columnToLabel = /* @__PURE__ */ new Map();
1519
+ const droppedKeys = /* @__PURE__ */ new Set();
1519
1520
  for (const f of fields) {
1520
1521
  if (!isColumnBacked(f)) continue;
1521
- labelToColumn.set(f.name, f.db_column.column_name);
1522
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);
1523
1529
  }
1524
1530
  for (const f of fields) {
1525
1531
  const columnOwner = columnToLabel.get(f.name);
@@ -1529,10 +1535,16 @@ function createFieldKeyMap(fields) {
1529
1535
  );
1530
1536
  }
1531
1537
  }
1538
+ for (const f of fields) {
1539
+ if (isColumnBacked(f) && f.removed === true) {
1540
+ columnToLabel.delete(f.db_column.column_name);
1541
+ }
1542
+ }
1532
1543
  const diverges = [...labelToColumn].some(([label, column]) => label !== column);
1533
1544
  function remap(input, lookup) {
1534
1545
  const out = {};
1535
1546
  for (const key of Object.keys(input)) {
1547
+ if (droppedKeys.has(key)) continue;
1536
1548
  out[lookup.get(key) ?? key] = input[key];
1537
1549
  }
1538
1550
  return out;
@@ -11,7 +11,7 @@ import {
11
11
  init_esm_shims,
12
12
  isColumnBacked,
13
13
  resolveRelationField
14
- } from "./chunk-UNBMPHIT.js";
14
+ } from "./chunk-LFMOJRYP.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-TPEULQ5W.mjs
10789
+ // ../api/dist/handler-45O5OX2C.mjs
10790
10790
  init_esm_shims();
10791
10791
 
10792
- // ../api/dist/chunk-B5LWIR4U.mjs
10792
+ // ../api/dist/chunk-HEYT5CH5.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-B5LWIR4U.mjs
30125
+ // ../api/dist/chunk-HEYT5CH5.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-B5LWIR4U.mjs
30883
+ // ../api/dist/chunk-HEYT5CH5.mjs
30884
30884
  var DateTimeScalar = new GraphQLScalarType({
30885
30885
  name: "DateTime",
30886
30886
  description: "ISO-8601 date-time string",
@@ -30975,14 +30975,14 @@ var SortOrderEnum = new GraphQLEnumType({
30975
30975
  values: { ASC: { value: "asc" }, DESC: { value: "desc" } }
30976
30976
  });
30977
30977
  var SORTABLE = [
30978
- { gql: "title", column: "title" },
30979
- { gql: "createdAt", column: "created_at" },
30980
- { gql: "updatedAt", column: "updated_at" }
30978
+ { gql: "title", value: "title" },
30979
+ { gql: "createdAt", value: "created_at" },
30980
+ { gql: "updatedAt", value: "updated_at" }
30981
30981
  ];
30982
30982
  function buildSortFieldEnum(typeName) {
30983
30983
  return new GraphQLEnumType({
30984
30984
  name: `${typeName}SortField`,
30985
- values: Object.fromEntries(SORTABLE.map((s) => [s.gql, { value: s.column }]))
30985
+ values: Object.fromEntries(SORTABLE.map((s) => [s.gql, { value: s.value }]))
30986
30986
  });
30987
30987
  }
30988
30988
  function comparableFilterInput(name, scalar) {
@@ -31108,11 +31108,13 @@ function collectionResolver(typeName, nameMap, fieldKeys) {
31108
31108
  throw codeError("INVALID_PAGINATION", "perPage must be between 1 and 100");
31109
31109
  }
31110
31110
  const repo = ctx.repos[typeName];
31111
+ const sortBy = args.sortBy ?? "created_at";
31112
+ const sortColumn = fieldKeys?.columnFor(sortBy) ?? sortBy;
31111
31113
  const result = await repo.findMany({
31112
31114
  published_only: true,
31113
31115
  page,
31114
31116
  per_page: perPage,
31115
- sort_by: args.sortBy ?? "created_at",
31117
+ sort_by: sortColumn,
31116
31118
  sort_order: args.sortOrder ?? "asc",
31117
31119
  filters: translateFilters(args.filter, nameMap, fieldKeys?.columnFor)
31118
31120
  });