@mintlify/scraping 4.0.1238 → 4.0.1240

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/scraping",
3
- "version": "4.0.1238",
3
+ "version": "4.0.1240",
4
4
  "description": "Scrape documentation frameworks to Mintlify docs",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -43,7 +43,7 @@
43
43
  "format:check": "oxfmt --check"
44
44
  },
45
45
  "dependencies": {
46
- "@mintlify/common": "1.0.1356",
46
+ "@mintlify/common": "1.0.1358",
47
47
  "fast-xml-parser": "5.7.3",
48
48
  "fs-extra": "11.1.1",
49
49
  "graphql": "16.11.0",
@@ -64,7 +64,7 @@
64
64
  "devDependencies": {
65
65
  "@mintlify/models": "0.0.392",
66
66
  "@mintlify/ts-config": "2.0.2",
67
- "@mintlify/validation": "0.1.968",
67
+ "@mintlify/validation": "0.1.969",
68
68
  "@tsconfig/recommended": "1.0.2",
69
69
  "@types/hast": "3.0.4",
70
70
  "@types/mdast": "4.0.4",
@@ -87,5 +87,5 @@
87
87
  "optional": true
88
88
  }
89
89
  },
90
- "gitHead": "c04cf8e39c4b17b9c90fe1bf7727ef2526ccb423"
90
+ "gitHead": "25d1ce0732d16198df5c56261546595074b4c20e"
91
91
  }
@@ -10,12 +10,14 @@ import {
10
10
  registerXMintContent,
11
11
  prepareStringToBeValidFilename,
12
12
  generateUniqueFilenameWithoutExtension,
13
+ getOperationSlugBase,
13
14
  createOpenApiBadgeResolver,
14
15
  createOpenApiTagResolver,
15
16
  findOpenApiNavGroup,
16
17
  isOpenApi32,
17
18
  mergePageGroups,
18
19
  type LoadedOverlay,
20
+ type OpenApiSlugSource,
19
21
  } from '@mintlify/common';
20
22
  import type { DecoratedNavigationPage, PageMetaTags } from '@mintlify/models';
21
23
  import { getPathItemOperations, XMint } from '@mintlify/validation';
@@ -144,6 +146,7 @@ export type GenerateOpenApiPagesOptions = {
144
146
  resolveBadge?: ReturnType<typeof createOpenApiBadgeResolver>;
145
147
  writeFile?: (filename: string, content: string) => void | Promise<void>;
146
148
  overlays?: readonly LoadedOverlay[];
149
+ slug?: OpenApiSlugSource;
147
150
  };
148
151
 
149
152
  export type OpenApiPageGenerationResult<N, DN> = {
@@ -204,9 +207,12 @@ export function processOpenApiPath<N, DN>(
204
207
 
205
208
  const tagPath = resolveTags(operation?.tags);
206
209
  const tagName = tagPath.at(-1)?.name;
207
- let title =
208
- prepareStringToBeValidFilename(operation?.summary) ??
209
- `${method.toLowerCase()}-${prepareStringToBeValidFilename(path)}`;
210
+ let title = getOperationSlugBase({
211
+ slugSource: options.slug,
212
+ operationId: operation?.operationId,
213
+ summary: operation?.summary,
214
+ fallback: () => `${method.toLowerCase()}-${prepareStringToBeValidFilename(path)}`,
215
+ });
210
216
 
211
217
  let folder = prepareStringToBeValidFilename(tagName) ?? '';
212
218
  let base = posix.join(options.outDir ?? '', folder, title);
@@ -340,9 +346,13 @@ export function processOpenApiWebhook<N, DN>(
340
346
 
341
347
  const tagPath = resolveTags(operation?.tags);
342
348
  const tagName = tagPath.at(-1)?.name;
343
- let title =
344
- prepareStringToBeValidFilename(operation?.summary) ??
345
- `${prepareStringToBeValidFilename(webhook)}`;
349
+ const summaryTitle = prepareStringToBeValidFilename(operation?.summary);
350
+ let title = getOperationSlugBase({
351
+ slugSource: options.slug,
352
+ operationId: operation?.operationId,
353
+ summary: operation?.summary,
354
+ fallback: () => `${prepareStringToBeValidFilename(webhook)}`,
355
+ });
346
356
  let folder = prepareStringToBeValidFilename(tagName) ?? '';
347
357
  let base = posix.join(options.outDir ?? '', folder, title);
348
358
 
@@ -376,7 +386,9 @@ export function processOpenApiWebhook<N, DN>(
376
386
  : xMint?.metadata;
377
387
 
378
388
  const page: DecoratedNavigationPage = {
379
- title: slugToTitle(filenameWithoutExtension),
389
+ title: slugToTitle(
390
+ options.slug === 'operationId' && summaryTitle ? summaryTitle : filenameWithoutExtension
391
+ ),
380
392
  description: operation?.description,
381
393
  version: options.version,
382
394
  deprecated: operation?.deprecated,