New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-kda

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-kda - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

template/src/@types/json.schema.d.ts

2

package.json
{
"name": "create-kda",
"version": "0.0.9",
"version": "0.0.10",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "https://github.com/kdajs/create-kda.git",

@@ -11,3 +11,5 @@ {

"clean": "rimraf dist",
"build": "swc ./src -d dist",
"json.schema": "kda json.schema ./src/@types/json.schema.d.ts",
"build:ts": "swc ./src -d dist",
"build": "run-s json.schema build:ts",
"type:check": "tsc -b tsconfig.json",

@@ -31,2 +33,3 @@ "check": "run-s type:check",

"dayjs": "^1.10.4",
"jsonschema": "^1.4.0",
"kda": "{{kdaVersion}}",

@@ -33,0 +36,0 @@ "shortid": "^2.2.16"

@@ -10,2 +10,17 @@ import { State, Model, UDPSocketClient } from 'kda'

export interface Utils {
now: () => string
today: () => string
uuid: () => string
jsonSchemaValidator: (data: any, schema: object) => string | undefined
}
export interface Models {
User: Model<User>
}
export interface UDPSocketClients {
Test: UDPSocketClient
}
declare global {

@@ -19,12 +34,2 @@ namespace NodeJS {

interface Utils {
now: () => string
today: () => string
uuid: () => string
}
interface Models {
User: Model<User>
}
interface CommonState extends State {

@@ -35,6 +40,2 @@ // models: Models

interface UDPSocketClients {
Test: UDPSocketClient
}
interface HttpState extends CommonState {

@@ -41,0 +42,0 @@ udpSocketClients: UDPSocketClients

@@ -0,1 +1,2 @@

import { UDPSocketClients } from './@types/global.d'
import router from './router'

@@ -2,0 +3,0 @@ import createModels from './models'

import { Controller } from 'kda'
const Hello: Controller<HttpState> = async (ctx, next) => {
const Hello: Controller<HttpState> = async ctx => {
ctx.body = `${ctx.state.utils.now()} - Hello, KDA!`

@@ -5,0 +5,0 @@ }

@@ -0,4 +1,4 @@

import { Models, NODE_ENV } from './@types/global.d'
import { createModels } from 'kda'
import User from './models/user'
import { NODE_ENV } from './@types/global.d'

@@ -5,0 +5,0 @@ const testConfig = {

@@ -0,3 +1,5 @@

import { Utils } from './@types/global.d'
import day from 'dayjs'
import shortid from 'shortid'
import { Validator } from 'jsonschema'

@@ -16,8 +18,19 @@ function today (): string {

const validator = new Validator()
function jsonSchemaValidator (data: any, schema: object): string | undefined {
let errors: string | undefined
const result = validator.validate(data, schema, { allowUnknownAttributes: true })
if (result.errors.length > 0) {
errors = result.errors.map(v => v.message).join('\n')
}
return errors
}
const utils: Utils = {
now,
today,
uuid
uuid,
jsonSchemaValidator
}
export default utils
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc