Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@feathersjs/schema

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feathersjs/schema - npm Package Compare versions

Comparing version 5.0.0-pre.30 to 5.0.0-pre.31

7

CHANGELOG.md

@@ -6,2 +6,9 @@ # Change Log

# [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
### Features
- **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
- **cli:** Improve generated schema definitions ([#2783](https://github.com/feathersjs/feathers/issues/2783)) ([474a9fd](https://github.com/feathersjs/feathers/commit/474a9fda2107e9bcf357746320a8e00cda8182b6))
# [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)

@@ -8,0 +15,0 @@

15

lib/json-schema.d.ts
import { JSONSchema } from 'json-schema-to-ts';
import { TObject } from '@sinclair/typebox';
import { JSONSchemaDefinition, Ajv, Validator } from './schema';
export declare type DataSchemaMap = {
create: JSONSchemaDefinition | TObject;
update?: JSONSchemaDefinition | TObject;
patch?: JSONSchemaDefinition | TObject;
create: JSONSchemaDefinition;
update?: JSONSchemaDefinition;
patch?: JSONSchemaDefinition;
};

@@ -21,3 +20,3 @@ export declare type DataValidatorMap = {

*/
export declare const getValidator: <T = any, R = T>(schema: JSONSchemaDefinition | TObject, validator: Ajv) => Validator<T, R>;
export declare const getValidator: <T = any, R = T>(schema: JSONSchemaDefinition, validator: Ajv) => Validator<T, R>;
/**

@@ -33,3 +32,3 @@ * Returns compiled validation functions to validate data for the `create`, `update` and `patch`

*/
export declare const getDataValidator: (def: JSONSchemaDefinition | TObject | DataSchemaMap, validator: Ajv) => DataValidatorMap;
export declare const getDataValidator: (def: JSONSchemaDefinition | DataSchemaMap, validator: Ajv) => DataValidatorMap;
export declare type PropertyQuery<D extends JSONSchema> = {

@@ -89,3 +88,3 @@ anyOf: [

*
* @param definition A map of property definitions
* @param definitions A map of property definitions
* @returns The JSON schema definition for the Feathers query syntax for multiple properties

@@ -95,3 +94,3 @@ */

[key: string]: import("json-schema-to-ts").JSONSchema7;
}>(definition: T) => { [K in keyof T]: PropertyQuery<T[K]>; };
}>(definitions: T) => { [K in keyof T]: PropertyQuery<T[K]>; };
/**

@@ -98,0 +97,0 @@ * Creates a JSON schema for the complete Feathers query syntax including `$limit`, $skip`

@@ -80,8 +80,9 @@ "use strict";

*
* @param definition A map of property definitions
* @param definitions A map of property definitions
* @returns The JSON schema definition for the Feathers query syntax for multiple properties
*/
const queryProperties = (definition) => Object.keys(definition).reduce((res, key) => {
const queryProperties = (definitions) => Object.keys(definitions).reduce((res, key) => {
const result = res;
result[key] = (0, exports.queryProperty)(definition[key]);
const definition = definitions[key];
result[key] = (0, exports.queryProperty)(definition);
return result;

@@ -88,0 +89,0 @@ }, {});

{
"name": "@feathersjs/schema",
"description": "A common data schema definition format",
"version": "5.0.0-pre.30",
"version": "5.0.0-pre.31",
"homepage": "https://feathersjs.com",

@@ -57,5 +57,5 @@ "main": "lib/",

"dependencies": {
"@feathersjs/commons": "^5.0.0-pre.30",
"@feathersjs/errors": "^5.0.0-pre.30",
"@feathersjs/feathers": "^5.0.0-pre.30",
"@feathersjs/commons": "^5.0.0-pre.31",
"@feathersjs/errors": "^5.0.0-pre.31",
"@feathersjs/feathers": "^5.0.0-pre.31",
"@feathersjs/hooks": "^0.7.5",

@@ -65,7 +65,6 @@ "@types/json-schema": "^7.0.11",

"ajv-formats": "^2.1.1",
"json-schema": "^0.4.0",
"json-schema-to-ts": "^2.5.5"
},
"devDependencies": {
"@feathersjs/memory": "^5.0.0-pre.30",
"@feathersjs/memory": "^5.0.0-pre.31",
"@types/mocha": "^10.0.0",

@@ -78,3 +77,3 @@ "@types/node": "^18.8.2",

},
"gitHead": "b535c91197f4b997520e0a0e608793eeba791931"
"gitHead": "4500dbeb8cea566678cf88b3313a88efd93a2ed9"
}
import { _ } from '@feathersjs/commons'
import { JSONSchema } from 'json-schema-to-ts'
import { TObject } from '@sinclair/typebox'
import { JSONSchemaDefinition, Ajv, Validator } from './schema'
export type DataSchemaMap = {
create: JSONSchemaDefinition | TObject
update?: JSONSchemaDefinition | TObject
patch?: JSONSchemaDefinition | TObject
create: JSONSchemaDefinition
update?: JSONSchemaDefinition
patch?: JSONSchemaDefinition
}

@@ -25,6 +24,3 @@

*/
export const getValidator = <T = any, R = T>(
schema: JSONSchemaDefinition | TObject,
validator: Ajv
): Validator<T, R> =>
export const getValidator = <T = any, R = T>(schema: JSONSchemaDefinition, validator: Ajv): Validator<T, R> =>
validator.compile({

@@ -46,3 +42,3 @@ $async: true,

export const getDataValidator = (
def: JSONSchemaDefinition | TObject | DataSchemaMap,
def: JSONSchemaDefinition | DataSchemaMap,
validator: Ajv

@@ -134,10 +130,11 @@ ): DataValidatorMap => {

*
* @param definition A map of property definitions
* @param definitions A map of property definitions
* @returns The JSON schema definition for the Feathers query syntax for multiple properties
*/
export const queryProperties = <T extends { [key: string]: JSONSchema }>(definition: T) =>
Object.keys(definition).reduce((res, key) => {
export const queryProperties = <T extends { [key: string]: JSONSchema }>(definitions: T) =>
Object.keys(definitions).reduce((res, key) => {
const result = res as any
const definition = definitions[key]
result[key] = queryProperty(definition[key])
result[key] = queryProperty(definition)

@@ -144,0 +141,0 @@ return result

Sorry, the diff of this file is not supported yet

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