base-schema.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. /*
  3. Copyright 2018 Google LLC
  4. Use of this source code is governed by an MIT-style
  5. license that can be found in the LICENSE file or at
  6. https://opensource.org/licenses/MIT.
  7. */
  8. const joi = require('@hapi/joi');
  9. const defaults = require('./defaults');
  10. const regExpObject = require('./reg-exp-object'); // Define some common constraints used by all methods.
  11. module.exports = joi.object().keys({
  12. dontCacheBustURLsMatching: regExpObject,
  13. globFollow: joi.boolean().default(defaults.globFollow),
  14. globIgnores: joi.array().items(joi.string()).default(defaults.globIgnores),
  15. globPatterns: joi.array().items(joi.string()).default(defaults.globPatterns),
  16. globStrict: joi.boolean().default(defaults.globStrict),
  17. manifestTransforms: joi.array().items(joi.func().arity(1)),
  18. maximumFileSizeToCacheInBytes: joi.number().min(1).default(defaults.maximumFileSizeToCacheInBytes),
  19. modifyURLPrefix: joi.object(),
  20. // templatedURLs is an object where any property name is valid, and the values
  21. // can be either a string or an array of strings.
  22. templatedURLs: joi.object().pattern(/./, [joi.string(), joi.array().items(joi.string())])
  23. });