@mintlify/scraping 4.0.361 → 4.0.362

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.361",
3
+ "version": "4.0.362",
4
4
  "description": "Scrape documentation frameworks to Mintlify docs",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -77,5 +77,5 @@
77
77
  "typescript": "^5.5.3",
78
78
  "vitest": "^2.0.4"
79
79
  },
80
- "gitHead": "1d5e4b6d8c14cf8ecff494a4eded6c565d7c2697"
80
+ "gitHead": "3b4c472d21ffa6f591bbb48886476a5e1b6b3a00"
81
81
  }
@@ -27,6 +27,9 @@ export type OpenApiExtensions = {
27
27
  'x-mint'?: XMint;
28
28
  'x-excluded'?: boolean;
29
29
  'x-hidden'?: boolean;
30
+ 'x-private'?: string;
31
+ 'x-for-clients'?: string[];
32
+ 'x-for-feature-flags'?: string[];
30
33
  };
31
34
 
32
35
  export const getOpenApiDefinition = async (
@@ -160,6 +163,10 @@ export function processOpenApiPath<N, DN>(
160
163
  return;
161
164
  }
162
165
  const xMint = operation?.['x-mint'];
166
+ const xAuthGroups = getXCustomTagsAllowlist({
167
+ pathObject: pathItemObject,
168
+ operationObject: operation,
169
+ });
163
170
 
164
171
  if (xMint?.href) {
165
172
  xMint.href = optionallyAddLeadingSlash(xMint.href);
@@ -202,12 +209,24 @@ export function processOpenApiPath<N, DN>(
202
209
  ],
203
210
  openapiMetaTag
204
211
  );
212
+
213
+ let xMintMetadata = xMint?.metadata;
214
+ if (xAuthGroups.length > 0) {
215
+ xMintMetadata = {
216
+ ...xMintMetadata,
217
+ groups: [
218
+ ...(Array.isArray(xMintMetadata?.groups) ? xMintMetadata.groups : []),
219
+ ...xAuthGroups,
220
+ ],
221
+ };
222
+ }
223
+
205
224
  const page: DecoratedNavigationPage = {
206
225
  title: titleTag ?? slugToTitle(filenameWithoutExtension),
207
226
  description,
208
227
  deprecated: operation?.deprecated,
209
228
  version: options.version,
210
- ...xMint?.metadata,
229
+ ...xMintMetadata,
211
230
  openapi: openapiMetaTag,
212
231
  href: resolve('/', filenameWithoutExtension),
213
232
  };
@@ -232,7 +251,7 @@ export function processOpenApiPath<N, DN>(
232
251
  openApiMetaTag: openapiMetaTag,
233
252
  version: options.version,
234
253
  deprecated: operation?.deprecated,
235
- metadata: xMint?.metadata,
254
+ metadata: xMintMetadata,
236
255
  extraContent: xMint?.content,
237
256
  })
238
257
  );
@@ -332,3 +351,50 @@ export function processOpenApiWebhook<N, DN>(
332
351
  }
333
352
  });
334
353
  }
354
+
355
+ export const getXCustomTagsAllowlist = ({
356
+ pathObject,
357
+ operationObject,
358
+ }: {
359
+ pathObject: OpenAPIV3.PathItemObject<OpenApiExtensions>;
360
+ operationObject: OpenAPIV3.OperationObject<OpenApiExtensions> | undefined;
361
+ }): string[] => {
362
+ const allowedGroups: string[] = [];
363
+ if ('x-private' in pathObject && typeof pathObject['x-private'] === 'string') {
364
+ allowedGroups.push(pathObject['x-private']);
365
+ }
366
+
367
+ if (
368
+ operationObject &&
369
+ 'x-private' in operationObject &&
370
+ typeof operationObject['x-private'] === 'string'
371
+ ) {
372
+ allowedGroups.push(operationObject['x-private']);
373
+ }
374
+
375
+ if ('x-for-clients' in pathObject && Array.isArray(pathObject['x-for-clients'])) {
376
+ allowedGroups.push(...pathObject['x-for-clients']);
377
+ }
378
+
379
+ if (
380
+ operationObject &&
381
+ 'x-for-clients' in operationObject &&
382
+ Array.isArray(operationObject['x-for-clients'])
383
+ ) {
384
+ allowedGroups.push(...operationObject['x-for-clients']);
385
+ }
386
+
387
+ if ('x-for-feature-flags' in pathObject && Array.isArray(pathObject['x-for-feature-flags'])) {
388
+ allowedGroups.push(...pathObject['x-for-feature-flags']);
389
+ }
390
+
391
+ if (
392
+ operationObject &&
393
+ 'x-for-feature-flags' in operationObject &&
394
+ Array.isArray(operationObject['x-for-feature-flags'])
395
+ ) {
396
+ allowedGroups.push(...operationObject['x-for-feature-flags']);
397
+ }
398
+
399
+ return allowedGroups;
400
+ };