{"size": 1666, "ext": "js", "max_stars_repo_path": "packages/kbn-config-schema/target/out/types/literal_type.js", "max_stars_repo_name": "dockspage/kibana-snapshot", "max_stars_repo_stars_event_min_datetime": "2019-04-09T00:50:11.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-15T13:44:49.000Z", "max_issues_repo_path": "packages/kbn-config-schema/target/out/types/literal_type.js", "max_issues_repo_name": "dockspage/kibana-snapshot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/kbn-config-schema/target/out/types/literal_type.js", "max_forks_repo_name": "dockspage/kibana-snapshot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 42.7179487179, "max_line_length": 93, "alphanum_fraction": 0.6734693878}
"use strict";
/*
 * Licensed to Elasticsearch B.V. under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const internals_1 = require("../internals");
const type_1 = require("./type");
class LiteralType extends type_1.Type {
    constructor(value) {
        super(internals_1.internals.any(), {
            // Before v13.3.0 Joi.any().value() didn't provide raw value if validation
            // fails, so to display this value in error message we should provide
            // custom validation function. Once we upgrade Joi, we'll be able to use
            // `value()` with custom `any.allowOnly` error handler instead.
            validate(valueToValidate) {
                if (valueToValidate !== value) {
                    return `expected value to equal [${value}] but got [${valueToValidate}]`;
                }
            },
        });
    }
}
exports.LiteralType = LiteralType;
