@mintlify/common 1.0.375 → 1.0.376
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/dist/asyncapi/prepAsyncApiFrontmatter.js +2 -2
- package/dist/fs/optionallyLeadingSlash.js +2 -1
- package/dist/openapi/prepOpenApiFrontmatter.js +2 -2
- package/dist/schema/common.d.ts +2 -0
- package/dist/schema/common.js +9 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { parse } from 'path';
|
|
2
2
|
import { parseAsyncApiString } from '../asyncapi/parseAsyncApiString.js';
|
|
3
3
|
import { normalizeRelativePath } from '../fs/normalizeRelativePath.js';
|
|
4
|
-
import { schemaFileFrontmatterIsOriginalFileLocation } from '../schema/common.js';
|
|
4
|
+
import { schemaFileFrontmatterIsOriginalFileLocation, isRemoteSchemaUrl, } from '../schema/common.js';
|
|
5
5
|
export function prepAsyncApiFrontmatter(currPath, asyncApiFrontmatter) {
|
|
6
6
|
if (!asyncApiFrontmatter)
|
|
7
7
|
return undefined;
|
|
8
8
|
const asyncApiObj = parseAsyncApiString(asyncApiFrontmatter);
|
|
9
9
|
if ((asyncApiObj === null || asyncApiObj === void 0 ? void 0 : asyncApiObj.filename) && schemaFileFrontmatterIsOriginalFileLocation(asyncApiObj.filename)) {
|
|
10
|
-
if (asyncApiObj.filename
|
|
10
|
+
if (isRemoteSchemaUrl(asyncApiObj.filename)) {
|
|
11
11
|
return `${asyncApiObj.filename} ${asyncApiObj.channelId}`;
|
|
12
12
|
}
|
|
13
13
|
const currDir = parse(currPath).dir;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isRemoteSchemaUrl } from '../schema/common.js';
|
|
1
2
|
export function optionallyAddLeadingSlash(filePath) {
|
|
2
|
-
if (filePath.startsWith('/') || filePath
|
|
3
|
+
if (filePath.startsWith('/') || isRemoteSchemaUrl(filePath)) {
|
|
3
4
|
return filePath;
|
|
4
5
|
}
|
|
5
6
|
return '/' + filePath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse, isAbsolute } from 'path';
|
|
2
2
|
import { normalizeRelativePath } from '../fs/normalizeRelativePath.js';
|
|
3
|
-
import { schemaFileFrontmatterIsOriginalFileLocation } from '../schema/common.js';
|
|
3
|
+
import { schemaFileFrontmatterIsOriginalFileLocation, isRemoteSchemaUrl, } from '../schema/common.js';
|
|
4
4
|
import { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
5
5
|
import { potentiallyParseOpenApiString } from './parseOpenApiString.js';
|
|
6
6
|
export function prepOpenApiFrontmatter(currPath, openapiFrontmatter) {
|
|
@@ -8,7 +8,7 @@ export function prepOpenApiFrontmatter(currPath, openapiFrontmatter) {
|
|
|
8
8
|
return undefined;
|
|
9
9
|
const openapiObj = potentiallyParseOpenApiString(openapiFrontmatter);
|
|
10
10
|
if ((openapiObj === null || openapiObj === void 0 ? void 0 : openapiObj.filename) && schemaFileFrontmatterIsOriginalFileLocation(openapiObj.filename)) {
|
|
11
|
-
if (openapiObj.filename
|
|
11
|
+
if (isRemoteSchemaUrl(openapiObj.filename)) {
|
|
12
12
|
return buildOpenApiMetaTag({
|
|
13
13
|
filePath: openapiObj.filename,
|
|
14
14
|
method: openapiObj.method.toLowerCase(),
|
package/dist/schema/common.d.ts
CHANGED
package/dist/schema/common.js
CHANGED
|
@@ -4,3 +4,12 @@ export const schemaFileFrontmatterIsOriginalFileLocation = (filenameFromFrontmat
|
|
|
4
4
|
filenameFromFrontmatter.toLowerCase().endsWith('.yaml') ||
|
|
5
5
|
filenameFromFrontmatter.toLowerCase().endsWith('.yml'));
|
|
6
6
|
};
|
|
7
|
+
export const isRemoteSchemaUrl = (url) => {
|
|
8
|
+
return url.startsWith('https:') || url.startsWith('http:');
|
|
9
|
+
};
|
|
10
|
+
export const isAllowedLocalSchemaUrl = (url, localSchema) => {
|
|
11
|
+
if (localSchema) {
|
|
12
|
+
return isRemoteSchemaUrl(url);
|
|
13
|
+
}
|
|
14
|
+
return url.startsWith('https:');
|
|
15
|
+
};
|