@feathersjs/schema
Advanced tools
Comparing version 5.0.25 to 5.0.26
@@ -6,2 +6,8 @@ # Change Log | ||
## [5.0.26](https://github.com/feathersjs/feathers/compare/v5.0.25...v5.0.26) (2024-06-09) | ||
### Bug Fixes | ||
- **schema:** Allow regular functions in resolvers ([#3487](https://github.com/feathersjs/feathers/issues/3487)) ([187868e](https://github.com/feathersjs/feathers/commit/187868edd9c0c9d885c482b85be7a90655c86ca2)) | ||
## [5.0.25](https://github.com/feathersjs/feathers/compare/v5.0.24...v5.0.25) (2024-05-03) | ||
@@ -8,0 +14,0 @@ |
import { Schema } from './schema'; | ||
export type PropertyResolver<T, V, C> = ((value: V | undefined, obj: T, context: C, status: ResolverStatus<T, C>) => Promise<V | undefined>) & { | ||
type PromiseOrLiteral<V> = Promise<V> | V; | ||
export type PropertyResolver<T, V, C> = ((value: V | undefined, obj: T, context: C, status: ResolverStatus<T, C>) => PromiseOrLiteral<V | undefined>) & { | ||
[IS_VIRTUAL]?: boolean; | ||
}; | ||
export type VirtualResolver<T, V, C> = (obj: T, context: C, status: ResolverStatus<T, C>) => Promise<V | undefined>; | ||
export type VirtualResolver<T, V, C> = (obj: T, context: C, status: ResolverStatus<T, C>) => PromiseOrLiteral<V | undefined>; | ||
export declare const IS_VIRTUAL: unique symbol; | ||
@@ -18,3 +19,3 @@ /** | ||
}; | ||
export type ResolverConverter<T, C> = (obj: any, context: C, status: ResolverStatus<T, C>) => Promise<T | undefined>; | ||
export type ResolverConverter<T, C> = (obj: any, context: C, status: ResolverStatus<T, C>) => PromiseOrLiteral<T | undefined>; | ||
export interface ResolverOptions<T, C> { | ||
@@ -71,1 +72,2 @@ schema?: Schema<T>; | ||
export declare function resolve<T, C>(options: ResolverConfig<T, C>): Resolver<T, C>; | ||
export {}; |
{ | ||
"name": "@feathersjs/schema", | ||
"description": "A common data schema definition format", | ||
"version": "5.0.25", | ||
"version": "5.0.26", | ||
"homepage": "https://feathersjs.com", | ||
@@ -57,6 +57,6 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/adapter-commons": "^5.0.25", | ||
"@feathersjs/commons": "^5.0.25", | ||
"@feathersjs/errors": "^5.0.25", | ||
"@feathersjs/feathers": "^5.0.25", | ||
"@feathersjs/adapter-commons": "^5.0.26", | ||
"@feathersjs/commons": "^5.0.26", | ||
"@feathersjs/errors": "^5.0.26", | ||
"@feathersjs/feathers": "^5.0.26", | ||
"@feathersjs/hooks": "^0.9.0", | ||
@@ -69,3 +69,3 @@ "@types/json-schema": "^7.0.15", | ||
"devDependencies": { | ||
"@feathersjs/memory": "^5.0.25", | ||
"@feathersjs/memory": "^5.0.26", | ||
"@types/mocha": "^10.0.6", | ||
@@ -81,3 +81,3 @@ "@types/node": "^20.12.8", | ||
}, | ||
"gitHead": "01bc3339efd27df1b3e8d4f6a82152faf6c5ced3" | ||
"gitHead": "3fe6843c1a478a2887ca91b6f79eda3b61d35ef3" | ||
} |
import { BadRequest } from '@feathersjs/errors' | ||
import { Schema } from './schema' | ||
type PromiseOrLiteral<V> = Promise<V> | V | ||
export type PropertyResolver<T, V, C> = (( | ||
@@ -9,3 +11,3 @@ value: V | undefined, | ||
status: ResolverStatus<T, C> | ||
) => Promise<V | undefined>) & { [IS_VIRTUAL]?: boolean } | ||
) => PromiseOrLiteral<V | undefined>) & { [IS_VIRTUAL]?: boolean } | ||
@@ -16,3 +18,3 @@ export type VirtualResolver<T, V, C> = ( | ||
status: ResolverStatus<T, C> | ||
) => Promise<V | undefined> | ||
) => PromiseOrLiteral<V | undefined> | ||
@@ -45,3 +47,3 @@ export const IS_VIRTUAL = Symbol.for('@feathersjs/schema/virtual') | ||
status: ResolverStatus<T, C> | ||
) => Promise<T | undefined> | ||
) => PromiseOrLiteral<T | undefined> | ||
@@ -48,0 +50,0 @@ export interface ResolverOptions<T, C> { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149051
2786