@mintlify/cli 4.0.1707 → 4.0.1708

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.
@@ -5784,7 +5784,8 @@ var BLOCK_TYPES = {
5784
5784
  promptDescription: "PromptDescription",
5785
5785
  color: "Color",
5786
5786
  tree: "Tree",
5787
- visibility: "Visibility"
5787
+ visibility: "Visibility",
5788
+ database: "Database"
5788
5789
  };
5789
5790
  var CALLOUT_TYPES = [
5790
5791
  "Info",
@@ -6071,6 +6072,22 @@ var VISIBILITY_ATTRS = [
6071
6072
  description: "Humans: visible on the web, excluded from Markdown output. Agents: hidden on the web, included in Markdown output. Signed in / signed out: shown on the web by login state; signed-in content is excluded from Markdown output. { groups: [...] }: shown to signed-in users in any listed group. { groups: { excludes: [...] } }: hidden from users in any excluded group."
6072
6073
  }
6073
6074
  ];
6075
+ var DATABASE_VIEW_OPTIONS = ["table", "board"];
6076
+ var DATABASE_ATTRS = [
6077
+ {
6078
+ name: "id",
6079
+ type: "string",
6080
+ required: true,
6081
+ placeholder: "00000000-0000-0000-0000-000000000000",
6082
+ description: "UUID of the database."
6083
+ },
6084
+ {
6085
+ name: "view",
6086
+ type: "string",
6087
+ options: DATABASE_VIEW_OPTIONS,
6088
+ description: "Table or board. Omitted means table."
6089
+ }
6090
+ ];
6074
6091
  var UPDATE_ATTRS = [
6075
6092
  {
6076
6093
  name: "label",
@@ -6495,6 +6512,11 @@ var nodes = {
6495
6512
  group: "block",
6496
6513
  atom: true,
6497
6514
  attrs: attrs(Object.assign({ treeData: [] }, HIDDEN_ATTRS))
6515
+ },
6516
+ [BLOCK_TYPES.database]: {
6517
+ group: "block",
6518
+ atom: true,
6519
+ attrs: Object.assign(Object.assign({}, toProseMirrorAttrs(DATABASE_ATTRS)), attrs(HIDDEN_ATTRS))
6498
6520
  }
6499
6521
  };
6500
6522
  var marks = {
@@ -6532,6 +6554,13 @@ function createSchema(extra) {
6532
6554
  return new Schema({ nodes: mergedNodes, marks: mergedMarks });
6533
6555
  }
6534
6556
 
6557
+ // ../editor/dist/converter/utils/database.js
6558
+ var DEFAULT_DATABASE_VIEW = "table";
6559
+ var DATABASE_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6560
+ var isDatabaseId = (value) => typeof value === "string" && DATABASE_ID_PATTERN.test(value);
6561
+ var isDatabaseView = (value) => DATABASE_VIEW_OPTIONS.some((view) => view === value);
6562
+ var resolveDatabaseView = (value) => isDatabaseView(value) ? value : DEFAULT_DATABASE_VIEW;
6563
+
6535
6564
  // ../editor/dist/converter/utils/comment-thread-ids.js
6536
6565
  function parseCommentThreadIds(value) {
6537
6566
  if (typeof value !== "string")
@@ -12436,6 +12465,9 @@ function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
12436
12465
  if (node.name === BLOCK_TYPES.tree) {
12437
12466
  return handleTree(node);
12438
12467
  }
12468
+ if (node.name === BLOCK_TYPES.database) {
12469
+ return handleDatabase(node, ctx);
12470
+ }
12439
12471
  const targetType = isCallout ? BLOCK_TYPES.callout : node.name;
12440
12472
  if ((isCallout || node.name !== BLOCK_TYPES.step && Object.values(BLOCK_TYPES).includes(node.name)) && (ctx.hasGroupParent || !isContainerOnlyComponent(targetType, (_b = ctx.schema) !== null && _b !== void 0 ? _b : mintlifySchema))) {
12441
12473
  const parsedAttrs = parseMdxAttributes(node.attributes);
@@ -12689,6 +12721,14 @@ function handleTree(node) {
12689
12721
  attrs: Object.assign({ treeData: parseTreeChildren(node) }, extraTreeAttrs)
12690
12722
  };
12691
12723
  }
12724
+ function handleDatabase(node, ctx) {
12725
+ var _a;
12726
+ const parsed = parseMdxAttributes(node.attributes);
12727
+ const isValid = ctx.databases === true && !!((_a = ctx.schema) !== null && _a !== void 0 ? _a : mintlifySchema).nodes[BLOCK_TYPES.database] && node.children.length === 0 && !(EXPRESSION_ATTRS_KEY in parsed) && !(NAMED_EXPRESSION_ATTRS_KEY in parsed) && isDatabaseId(parsed.id) && (parsed.view === void 0 || isDatabaseView(parsed.view));
12728
+ if (!isValid)
12729
+ return { type: BLOCK_TYPES.unknownTag, attrs: { mdxJsxNode: node } };
12730
+ return { type: BLOCK_TYPES.database, attrs: partitionAttrs(parsed, DATABASE_ATTRS) };
12731
+ }
12692
12732
  var CELL_SPAN_ATTRS = /* @__PURE__ */ new Set(["colspan", "colSpan", "rowspan", "rowSpan"]);
12693
12733
  var TABLE_CLASS_ATTRS = /* @__PURE__ */ new Set(["class", "className"]);
12694
12734
  function hasTableClass(node) {
@@ -13394,7 +13434,13 @@ function mdastToPm(mdast, source = "", options) {
13394
13434
  delete node.position;
13395
13435
  }
13396
13436
  });
13397
- const context = { source, frontmatter, schema, definitions };
13437
+ const context = {
13438
+ source,
13439
+ frontmatter,
13440
+ schema,
13441
+ definitions,
13442
+ databases: (options === null || options === void 0 ? void 0 : options.databases) === true
13443
+ };
13398
13444
  const content = transformNode(mdast, context);
13399
13445
  const rawJsonContent = Array.isArray(content) ? content : (_b = content.content) !== null && _b !== void 0 ? _b : [];
13400
13446
  const jsonContent = normalizeBlockContent(rawJsonContent, schema);
@@ -13845,6 +13891,23 @@ function serializeJsxAttribute(attrs2, key, value) {
13845
13891
  const serialized = serializePropValue(value);
13846
13892
  return serialized ? `${key}=${serialized}` : null;
13847
13893
  }
13894
+ var ATTRIBUTE_VALUE_ESCAPES = {
13895
+ "&": "&",
13896
+ '"': """,
13897
+ "<": "&lt;",
13898
+ ">": "&gt;",
13899
+ "\n": "&#xA;",
13900
+ "\r": "&#xD;",
13901
+ "`": "&#x60;",
13902
+ "~": "&#x7E;"
13903
+ };
13904
+ var escapeAttributeValue = (value) => value.replace(/[&"<>\n\r`~]/g, (char) => {
13905
+ var _a;
13906
+ return (_a = ATTRIBUTE_VALUE_ESCAPES[char]) !== null && _a !== void 0 ? _a : char;
13907
+ });
13908
+ function serializeLiteralJsxAttribute(attrs2, key, value) {
13909
+ return typeof value === "string" ? `${key}="${escapeAttributeValue(value)}"` : serializeJsxAttribute(attrs2, key, value);
13910
+ }
13848
13911
  var isAttributeRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
13849
13912
  function getNamedExpressionAttr(attrs2, key) {
13850
13913
  const raw = attrs2[NAMED_EXPRESSION_ATTRS_KEY];
@@ -15404,6 +15467,12 @@ function writeTreeChild(state, child) {
15404
15467
  state.write("</Tree.Folder>");
15405
15468
  state.ensureNewLine();
15406
15469
  }
15470
+ function renderDatabase(state, node) {
15471
+ const props = ["id", "view"].map((key) => serializeJsxAttribute(node.attrs, key, node.attrs[key])).filter(Boolean);
15472
+ const propString = props.length > 0 ? ` ${props.join(" ")}` : "";
15473
+ state.write(`<Database${propString}${extraAttrsPropString(node.attrs, serializeLiteralJsxAttribute)} />`);
15474
+ state.closeBlock();
15475
+ }
15407
15476
  function renderTree(state, node) {
15408
15477
  var _a;
15409
15478
  const treeData = (_a = node.attrs.treeData) !== null && _a !== void 0 ? _a : [];
@@ -15438,14 +15507,14 @@ function mergeExtraAttrs(attrs2) {
15438
15507
  return attrs2;
15439
15508
  return Object.assign(Object.assign({}, attrs2), extra);
15440
15509
  }
15441
- function extraAttrsPropString(nodeAttrs) {
15510
+ function extraAttrsPropString(nodeAttrs, serializeAttribute = serializeJsxAttribute) {
15442
15511
  const extra = nodeAttrs[EXTRA_ATTRS_KEY];
15443
15512
  if (!extra || typeof extra !== "object")
15444
15513
  return "";
15445
15514
  const entries = Object.entries(extra);
15446
15515
  if (entries.length === 0)
15447
15516
  return "";
15448
- const props = entries.map(([key, value]) => serializeJsxAttribute(extra, key, value)).filter(Boolean);
15517
+ const props = entries.map(([key, value]) => serializeAttribute(extra, key, value)).filter(Boolean);
15449
15518
  return props.length > 0 ? " " + props.join(" ") : "";
15450
15519
  }
15451
15520
 
@@ -15500,7 +15569,8 @@ var BLOCK_LINE_TYPES = /* @__PURE__ */ new Set([
15500
15569
  BLOCK_TYPES.promptBlock,
15501
15570
  BLOCK_TYPES.color,
15502
15571
  BLOCK_TYPES.tree,
15503
- BLOCK_TYPES.visibility
15572
+ BLOCK_TYPES.visibility,
15573
+ BLOCK_TYPES.database
15504
15574
  ]);
15505
15575
  var LAZY_CONTINUATION_TYPES = /* @__PURE__ */ new Set(["blockquote", "bulletList", "orderedList"]);
15506
15576
  var IMAGE_TYPES = /* @__PURE__ */ new Set(["image", BLOCK_TYPES.image]);
@@ -15780,6 +15850,9 @@ function renderNode(state, node, _parent, _index) {
15780
15850
  case BLOCK_TYPES.tree:
15781
15851
  renderTree(state, node);
15782
15852
  break;
15853
+ case BLOCK_TYPES.database:
15854
+ renderDatabase(state, node);
15855
+ break;
15783
15856
  case BLOCK_TYPES.mermaidBlock:
15784
15857
  renderMermaidBlock(state, node);
15785
15858
  break;
@@ -17402,6 +17475,7 @@ export {
17402
17475
  CALLOUT_TYPES,
17403
17476
  COMMENT_THREAD_IDS_ATTR,
17404
17477
  DEFAULT_CODE_BLOCK_LANGUAGE,
17478
+ DEFAULT_DATABASE_VIEW,
17405
17479
  DEFAULT_MERMAID_PLACEMENT,
17406
17480
  EDITOR_COMPONENT_NAMES,
17407
17481
  FRONTMATTER_ATTRIBUTES_WITH_ARRAY_VALUES,
@@ -17423,6 +17497,8 @@ export {
17423
17497
  getDiffMarkerComment,
17424
17498
  getImageAlignFromClassName,
17425
17499
  getImageWidthFromStyle,
17500
+ isDatabaseId,
17501
+ isDatabaseView,
17426
17502
  isJSXContent,
17427
17503
  isNonEmptyFrontmatterValue,
17428
17504
  mdastToMdx,
@@ -17442,6 +17518,7 @@ export {
17442
17518
  pmJsonToMdast,
17443
17519
  pmToMdx,
17444
17520
  pmToMdxPreservingSource,
17521
+ resolveDatabaseView,
17445
17522
  safeJsonParse,
17446
17523
  sanitizeDomAttrs,
17447
17524
  serializeCommentThreadIds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1707",
3
+ "version": "4.0.1708",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -82,7 +82,7 @@
82
82
  "keytar": "7.9.0"
83
83
  },
84
84
  "devDependencies": {
85
- "@mintlify/editor": "0.0.556",
85
+ "@mintlify/editor": "0.0.557",
86
86
  "@mintlify/ts-config": "2.0.2",
87
87
  "@tsconfig/recommended": "1.0.2",
88
88
  "@types/detect-port": "1.3.2",
@@ -101,5 +101,5 @@
101
101
  "vitest": "2.1.9",
102
102
  "vitest-mock-process": "1.0.4"
103
103
  },
104
- "gitHead": "0ad30201edb281c1a5e6db5b54ef4c0f992d0883"
104
+ "gitHead": "f93688d39cba2195bb011ef7001cfd32dcb2d868"
105
105
  }