npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@neushimmer/joi

v0.0.7-beta9

Published

A Typescript Pulgin of @hapi/joi

Downloads

6

Readme

Shimmer Joi Pulgin

A Typescript Pulgin of @hapi/joi

How To Use

import { Joi,TypeOf } from '@neushimmer/joi';
type SuccessedGet = {
    success:true,
    data:any
}
type FailedGet = {
    success:false,
    message:any,
    code:number
}
export type InterfaceGet = SuccessedGet|FailedGet
export interface Service {
    getTickets():Promise<Ticket[]>
    getSeats(ticket:Ticket):Promise<Seat[][]>
    postInfo(info:TicketPost):Promise<InterfaceGet>
    postError(errorInfo:any):Promise<InterfaceGet>
}
var TicketQuestionSchema = Joi.object({
    id:Joi.number().required(),
    type:Joi.string().valid('select','radio','text').required(),
    title:Joi.string().required(),
    description:Joi.string().required(),
    optionList:Joi.when(Joi.ref('type'),{is:['select','radio'],then:Joi.array().items('string')})
})
var TicketModuleSchema = Joi.object({
    id:Joi.number().required(),
    title:Joi.string().required(),
    questionList:Joi.array().items(TicketQuestionSchema).required()
})
var TicketSchema = Joi.object({
    id:Joi.number().required(),
    title:Joi.string().required(),
    baseInfos:Joi.array().items(TicketQuestionSchema),
    description:Joi.string().required(),
    remainingQuantity:Joi.number().min(0).required(),
    price:Joi.number().min(0).required(),
    type:Joi.string().valid('normal','moreinfo').default('normal'),
    modules:Joi.when(Joi.ref('type'),{is:'moreinfo',then:Joi.array().items(TicketModuleSchema).required()})
})

var TicketPostInfoQuestionSchema = Joi.object({
    title:Joi.string().required(),
    answer:Joi.string().required()
})
var TicketPostInfoModuleSchema = Joi.object({
    id:Joi.number().required(),
    questionList:Joi.array().items(TicketPostInfoQuestionSchema)
})

var ErrorPostSchema = Joi.object({
    message:Joi.string().required(),
    env:Joi.string()
})
var SeatInfoSchema = Joi.object({
    position:Joi.object({
        x:Joi.number().min(0).required(),
        y:Joi.number().min(0).required()
    }).required(),
    status:Joi.string().valid('enable','disable','lock','used').required()
})
var TicketPostInfoTickets = Joi.object({
    id:Joi.number().required(),
    baseInfos:Joi.array().items(TicketPostInfoQuestionSchema),
    type:Joi.string().valid('normal','moreinfo').default('normal'),
    moduleInfos:Joi.when(Joi.ref('type'),{is:'moreinfo',then:Joi.array().items(TicketPostInfoModuleSchema).required()})
})
var TicketPostInfoSchema = Joi.object({
    tickets:Joi.array().items(TicketPostInfoTickets).min(1),
    lockedSeat:Joi.array().items(SeatInfoSchema),
    totalInfo:Joi.object({
        totalTickets:Joi.number().min(0),
        totalPrice:Joi.number().min(0)
    })
    
})

export var Ticket = TicketSchema;
export type Ticket = TypeOf<typeof TicketSchema>

export var TicketQuestion = TicketQuestionSchema;
export type TicketQuestion = TypeOf<typeof TicketQuestionSchema>

export var TicketModule = TicketModuleSchema;
export type TicketModule = TypeOf<typeof TicketModuleSchema>

export var Seat = SeatInfoSchema;
export type Seat = TypeOf<typeof SeatInfoSchema>

export var TicketPost = TicketPostInfoSchema;
export type TicketPost = TypeOf<typeof TicketPostInfoSchema>

export var TicketPostTickets = TicketPostInfoTickets;
export type TicketPostTickets = TypeOf<typeof TicketPostInfoTickets>

export var TicketPostModule = TicketPostInfoModuleSchema;
export type TicketPostModule = TypeOf<typeof TicketPostInfoModuleSchema>

export var TicketPostQuestion = TicketPostInfoQuestionSchema;
export type TicketPostQuestion = TypeOf<typeof TicketPostInfoQuestionSchema>

export var ErrorPost = ErrorPostSchema;
export type ErrorPost = TypeOf<typeof ErrorPostSchema>