"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeboxValidator = void 0;
// This export is documented as supported in typebox's documentation.
// eslint-disable-next-line import/no-internal-modules
const compiler_1 = require("@sinclair/typebox/compiler");
/**
 * A {@link JsonValidator} implementation which uses TypeBox's JSON schema validator.
 * @alpha
 * @privateRemarks - Take care to not reference this validator directly in SharedTree code:
 * the intent of factoring JSON validation into an interface is to make validation more pay-to-play
 * (i.e. a JSON validator is only included in an application's bundle if that application references it).
 *
 * Defining this validator in its own file also helps to ensure it is tree-shakeable.
 */
exports.typeboxValidator = {
    compile: (schema) => {
        const compiledFormat = compiler_1.TypeCompiler.Compile(schema);
        return {
            check: (data) => compiledFormat.Check(data),
        };
    },
};
//# sourceMappingURL=typeboxValidator.js.map