You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@rjsf/utils

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjsf/utils - npm Package Compare versions

Comparing version

to
5.18.6

10

lib/types.d.ts

@@ -110,5 +110,5 @@ import type { ButtonHTMLAttributes, ChangeEvent, ComponentType, HTMLAttributes, ReactElement, ReactNode, StyleHTMLAttributes } from 'react';

/** Type describing a recursive structure of `FieldId`s for an object with a non-empty set of keys */
export type IdSchema<T = any> = FieldId & {
export type IdSchema<T = any> = T extends GenericObjectType ? FieldId & {
[key in keyof T]?: IdSchema<T[key]>;
};
} : FieldId;
/** Type describing a name used for a field in the `PathSchema` */

@@ -120,5 +120,7 @@ export type FieldPath = {

/** Type describing a recursive structure of `FieldPath`s for an object with a non-empty set of keys */
export type PathSchema<T = any> = FieldPath & {
export type PathSchema<T = any> = T extends Array<infer U> ? FieldPath & {
[i: number]: PathSchema<U>;
} : T extends GenericObjectType ? FieldPath & {
[key in keyof T]?: PathSchema<T[key]>;
};
} : FieldPath;
/** The type for error produced by RJSF schema validation */

@@ -125,0 +127,0 @@ export type RJSFValidationError = {

4

package.json
{
"name": "@rjsf/utils",
"version": "5.18.5",
"version": "5.18.6",
"main": "dist/index.js",

@@ -89,3 +89,3 @@ "module": "lib/index.js",

"license": "Apache-2.0",
"gitHead": "d5ef055f1b40c8837c13126777478bfc30dc9ade"
"gitHead": "e0bafbf664e57002a444c849417ce95a2ffd260b"
}

@@ -6,3 +6,3 @@ import get from 'lodash/get';

import isObject from '../isObject';
import { FormContextType, IdSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
import { FormContextType, GenericObjectType, IdSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
import retrieveSchema from './retrieveSchema';

@@ -63,3 +63,3 @@ import getSchemaType from '../getSchemaType';

const $id = id || idPrefix;
const idSchema: IdSchema = { $id } as IdSchema<T>;
const idSchema: IdSchema<T> = { $id } as IdSchema<T>;
if (getSchemaType<S>(schema) === 'object' && PROPERTIES_KEY in schema) {

@@ -69,3 +69,3 @@ for (const name in schema.properties) {

const fieldId = idSchema[ID_KEY] + idSeparator + name;
idSchema[name] = toIdSchemaInternal<T, S, F>(
(idSchema as IdSchema<GenericObjectType>)[name] = toIdSchemaInternal<T, S, F>(
validator,

@@ -84,3 +84,3 @@ isObject(field) ? field : {},

}
return idSchema as IdSchema<T>;
return idSchema;
}

@@ -87,0 +87,0 @@

@@ -18,3 +18,3 @@ import get from 'lodash/get';

import getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';
import { FormContextType, PathSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
import { FormContextType, GenericObjectType, PathSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
import getClosestMatchingOption from './getClosestMatchingOption';

@@ -57,5 +57,5 @@ import retrieveSchema from './retrieveSchema';

let pathSchema: PathSchema = {
let pathSchema: PathSchema<T> = {
[NAME_KEY]: name.replace(/^\./, ''),
} as PathSchema;
} as PathSchema<T>;

@@ -83,3 +83,3 @@ if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {

if (schemaItems[i]) {
pathSchema[i] = toPathSchemaInternal<T, S, F>(
(pathSchema as PathSchema<T[]>)[i] = toPathSchemaInternal<T, S, F>(
validator,

@@ -93,3 +93,3 @@ schemaItems[i] as S,

} else if (schemaAdditionalItems) {
pathSchema[i] = toPathSchemaInternal<T, S, F>(
(pathSchema as PathSchema<T[]>)[i] = toPathSchemaInternal<T, S, F>(
validator,

@@ -108,3 +108,3 @@ schemaAdditionalItems as S,

formData.forEach((element, i: number) => {
pathSchema[i] = toPathSchemaInternal<T, S, F>(
(pathSchema as PathSchema<T[]>)[i] = toPathSchemaInternal<T, S, F>(
validator,

@@ -122,3 +122,3 @@ schemaItems as S,

const field = get(schema, [PROPERTIES_KEY, property]);
pathSchema[property] = toPathSchemaInternal<T, S, F>(
(pathSchema as PathSchema<GenericObjectType>)[property] = toPathSchemaInternal<T, S, F>(
validator,

@@ -135,3 +135,3 @@ field,

}
return pathSchema as PathSchema<T>;
return pathSchema;
}

@@ -138,0 +138,0 @@

@@ -134,6 +134,8 @@ import type {

/** Type describing a recursive structure of `FieldId`s for an object with a non-empty set of keys */
export type IdSchema<T = any> = FieldId & {
/** The set of ids for fields in the recursive object structure */
[key in keyof T]?: IdSchema<T[key]>;
};
export type IdSchema<T = any> = T extends GenericObjectType
? FieldId & {
/** The set of ids for fields in the recursive object structure */
[key in keyof T]?: IdSchema<T[key]>;
}
: FieldId;

@@ -147,6 +149,12 @@ /** Type describing a name used for a field in the `PathSchema` */

/** Type describing a recursive structure of `FieldPath`s for an object with a non-empty set of keys */
export type PathSchema<T = any> = FieldPath & {
/** The set of names for fields in the recursive object structure */
[key in keyof T]?: PathSchema<T[key]>;
};
export type PathSchema<T = any> = T extends Array<infer U>
? FieldPath & {
[i: number]: PathSchema<U>;
}
: T extends GenericObjectType
? FieldPath & {
/** The set of names for fields in the recursive object structure */
[key in keyof T]?: PathSchema<T[key]>;
}
: FieldPath;

@@ -153,0 +161,0 @@ /** The type for error produced by RJSF schema validation */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet