@mintlify/common 1.0.1198 → 1.0.1200
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.
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
export const WILDCARD_GROUP = '*';
|
|
3
|
-
|
|
3
|
+
const groupNameSchema = v.pipe(v.string(), v.minLength(1));
|
|
4
|
+
const groupRuleSchema = v.strictObject({
|
|
5
|
+
includes: v.optional(v.pipe(v.array(groupNameSchema), v.minLength(1))),
|
|
6
|
+
excludes: v.optional(v.pipe(v.array(groupNameSchema), v.check((excludes) => !excludes.includes(WILDCARD_GROUP)))),
|
|
7
|
+
});
|
|
8
|
+
const pageGroupsSchema = v.union([v.array(groupNameSchema), v.array(groupRuleSchema)]);
|
|
9
|
+
export const isPageGroups = (value) => v.is(pageGroupsSchema, value);
|
|
4
10
|
const isStringArray = (groups) => groups.every((entry) => typeof entry === 'string');
|
|
5
11
|
const DENY_ALL = { includes: [], excludes: [] };
|
|
6
12
|
export function normalizeGroups(groups) {
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { fetchYamlDocument } from './fetchYamlDocument.js';
|
|
|
6
6
|
export { truncateCircularReferences } from './truncateCircularReferences.js';
|
|
7
7
|
export { parseOpenApiString, potentiallyParseOpenApiString, parseOpenApiSchemaString, } from './parseOpenApiString.js';
|
|
8
8
|
export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.js';
|
|
9
|
-
export { validate, safeValidate } from './validate.js';
|
|
9
|
+
export { validate, safeValidate, isOpenApi32Version, getEntrypointSpecification, type OpenApiValidateError, type OpenApiValidateResult, type OpenApiVersion, } from './validate.js';
|
|
10
10
|
export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
|
|
11
11
|
export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
12
12
|
export { registerXMintContent, getXMintContent, getAllXMintContent } from './contentRegistry.js';
|
package/dist/openapi/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { fetchYamlDocument } from './fetchYamlDocument.js';
|
|
|
6
6
|
export { truncateCircularReferences } from './truncateCircularReferences.js';
|
|
7
7
|
export { parseOpenApiString, potentiallyParseOpenApiString, parseOpenApiSchemaString, } from './parseOpenApiString.js';
|
|
8
8
|
export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.js';
|
|
9
|
-
export { validate, safeValidate } from './validate.js';
|
|
9
|
+
export { validate, safeValidate, isOpenApi32Version, getEntrypointSpecification, } from './validate.js';
|
|
10
10
|
export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
|
|
11
11
|
export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
12
12
|
export { registerXMintContent, getXMintContent, getAllXMintContent } from './contentRegistry.js';
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { AnyObject, Filesystem, ValidateResult } from '@mintlify/openapi-parser';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type OpenApiVersion = NonNullable<ValidateResult['version']>;
|
|
3
|
+
export type OpenApiValidateError = NonNullable<ValidateResult['errors']>[number] & {
|
|
4
|
+
path?: string;
|
|
5
|
+
};
|
|
6
|
+
export type OpenApiValidateResult = Omit<ValidateResult, 'version' | 'errors'> & {
|
|
7
|
+
version?: OpenApiVersion;
|
|
8
|
+
errors?: OpenApiValidateError[];
|
|
9
|
+
};
|
|
10
|
+
export declare const isOpenApi32Version: (version: unknown) => boolean;
|
|
11
|
+
export declare const getEntrypointSpecification: (document: AnyObject | Filesystem) => AnyObject | undefined;
|
|
12
|
+
export declare const validate: (document: string | AnyObject | Filesystem) => Promise<OpenApiValidateResult>;
|
|
13
|
+
export declare const safeValidate: (document: string | AnyObject | Filesystem) => Promise<OpenApiValidateResult & {
|
|
4
14
|
errorMessage?: string;
|
|
5
15
|
}>;
|
package/dist/openapi/validate.js
CHANGED
|
@@ -7,8 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { validate as scalarValidate } from '@mintlify/openapi-parser';
|
|
10
|
+
import { getEntrypoint, validate as scalarValidate } from '@mintlify/openapi-parser';
|
|
11
11
|
import { checkForExternalRefs } from '../asyncapi/checkForExternalRefs.js';
|
|
12
|
+
export const isOpenApi32Version = (version) => typeof version === 'string' && /^3\.2(\.|$)/.test(version);
|
|
13
|
+
export const getEntrypointSpecification = (document) => { var _a; return Array.isArray(document) ? (_a = getEntrypoint(document)) === null || _a === void 0 ? void 0 : _a.specification : document; };
|
|
12
14
|
export const validate = (document) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
15
|
const result = yield safeValidate(document);
|
|
14
16
|
if ('errorMessage' in result) {
|