mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			847 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			847 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
'use strict';
 | 
						|
 | 
						|
const joi = require('joi');
 | 
						|
 | 
						|
const countSchema = joi
 | 
						|
    .object()
 | 
						|
    .options({ stripUnknown: true })
 | 
						|
    .keys({
 | 
						|
        yes: joi
 | 
						|
            .number()
 | 
						|
            .required()
 | 
						|
            .min(0)
 | 
						|
            .default(0),
 | 
						|
        no: joi
 | 
						|
            .number()
 | 
						|
            .required()
 | 
						|
            .min(0)
 | 
						|
            .default(0),
 | 
						|
    });
 | 
						|
 | 
						|
const clientMetricsSchema = joi
 | 
						|
    .object()
 | 
						|
    .options({ stripUnknown: true })
 | 
						|
    .keys({
 | 
						|
        appName: joi.string().required(),
 | 
						|
        instanceId: joi.string().required(),
 | 
						|
        bucket: joi
 | 
						|
            .object()
 | 
						|
            .required()
 | 
						|
            .keys({
 | 
						|
                start: joi.date().required(),
 | 
						|
                stop: joi.date().required(),
 | 
						|
                toggles: joi.object().pattern(/.*/, countSchema),
 | 
						|
            }),
 | 
						|
    });
 | 
						|
 | 
						|
module.exports = { clientMetricsSchema };
 |