@strapi/utils
Advanced tools
Comparing version 0.0.0-experimental.19b15f2f555510eb5507d89fcaf5efa172002608 to 0.0.0-experimental.19d775295eb622de3e659110caf22fcd2cd5d10d
@@ -1,14 +0,8 @@ | ||
type AnyFunc = (...args: any) => any; | ||
type PipeArgs<F extends AnyFunc[], PrevReturn = Parameters<F[0]>[0]> = F extends [ | ||
(arg: any) => infer B | ||
] ? [ | ||
(arg: PrevReturn extends Promise<infer PrevResolvedReturn> ? PrevResolvedReturn : PrevReturn) => B | ||
] : F extends [(arg: any) => infer B, ...infer Tail] ? Tail extends AnyFunc[] ? [ | ||
(arg: PrevReturn extends Promise<infer PrevResolvedReturn> ? PrevResolvedReturn : PrevReturn) => B, | ||
...PipeArgs<Tail, B> | ||
] : [] : []; | ||
export declare function pipe<F extends AnyFunc[], FirstFn extends F[0]>(...fns: PipeArgs<F> extends F ? F : PipeArgs<F>): (...args: Parameters<FirstFn>) => Promise<F extends [...AnyFunc[], (...arg: any) => infer R] ? R extends Promise<infer InnerType> ? InnerType : R : never>; | ||
type AnyFunc<TA extends any[] = any[], TR = any> = (...args: TA) => TR; | ||
type MakeProm<T> = Promise<T extends PromiseLike<infer I> ? I : T>; | ||
type PipeReturn<F extends AnyFunc[]> = MakeProm<ReturnType<F[0]>>; | ||
export declare function pipe<T extends AnyFunc[]>(...fns: PipeReturn<T> extends never ? never : T): (...args: Parameters<T[0]>) => PipeReturn<T>; | ||
export declare const map: (...args: any[]) => any; | ||
export declare const reduce: (mixedArray: any[]) => <T>(iteratee: AnyFunc, initialValue?: T | undefined) => Promise<T | undefined>; | ||
export declare const reduce: (mixedArray: any[]) => <T>(iteratee: AnyFunc, initialValue?: T) => Promise<T | undefined>; | ||
export {}; | ||
//# sourceMappingURL=async.d.ts.map |
@@ -31,2 +31,9 @@ import type { Model, Kind, Attribute, RelationalAttribute, ComponentAttribute, DynamicZoneAttribute, WithRequired } from './types'; | ||
declare const isDraft: <T extends object>(data: T, model: Model) => boolean; | ||
declare const isSchema: (data: unknown) => data is Model; | ||
declare const isComponentSchema: (data: unknown) => data is Model & { | ||
modelType: 'component'; | ||
}; | ||
declare const isContentTypeSchema: (data: unknown) => data is Model & { | ||
modelType: 'contentType'; | ||
}; | ||
declare const isSingleType: ({ kind }: { | ||
@@ -41,10 +48,13 @@ kind?: string | undefined; | ||
declare const isPrivateAttribute: (model: Model, attributeName: string) => boolean; | ||
declare const isScalarAttribute: (attribute: Attribute) => boolean; | ||
declare const isMediaAttribute: (attribute: Attribute) => boolean; | ||
declare const isRelationalAttribute: (attribute: Attribute) => attribute is RelationalAttribute; | ||
declare const isScalarAttribute: (attribute?: Attribute) => boolean | undefined; | ||
declare const getDoesAttributeRequireValidation: (attribute: Attribute) => any; | ||
declare const isMediaAttribute: (attribute?: Attribute) => boolean; | ||
declare const isRelationalAttribute: (attribute?: Attribute) => attribute is RelationalAttribute; | ||
declare const hasRelationReordering: (attribute?: Attribute) => boolean; | ||
declare const isComponentAttribute: (attribute: Attribute) => attribute is ComponentAttribute | DynamicZoneAttribute; | ||
declare const isDynamicZoneAttribute: (attribute: Attribute) => attribute is DynamicZoneAttribute; | ||
declare const isMorphToRelationalAttribute: (attribute: Attribute) => boolean; | ||
declare const isDynamicZoneAttribute: (attribute?: Attribute) => attribute is DynamicZoneAttribute; | ||
declare const isMorphToRelationalAttribute: (attribute?: Attribute) => boolean; | ||
declare const getComponentAttributes: (schema: Model) => string[]; | ||
declare const getScalarAttributes: (schema: Model) => string[]; | ||
declare const getRelationalAttributes: (schema: Model) => string[]; | ||
/** | ||
@@ -62,3 +72,3 @@ * Checks if an attribute is of type `type` | ||
declare const getContentTypeRoutePrefix: (contentType: WithRequired<Model, 'info'>) => string; | ||
export { isScalarAttribute, isMediaAttribute, isRelationalAttribute, isComponentAttribute, isDynamicZoneAttribute, isMorphToRelationalAttribute, isTypedAttribute, getPrivateAttributes, isPrivateAttribute, constants, getNonWritableAttributes, getComponentAttributes, getScalarAttributes, getWritableAttributes, isWritableAttribute, getNonVisibleAttributes, getVisibleAttributes, getTimestamps, getCreatorFields, isVisibleAttribute, getOptions, isDraft, hasDraftAndPublish, isSingleType, isCollectionType, isKind, getContentTypeRoutePrefix, }; | ||
export { isSchema, isContentTypeSchema, isComponentSchema, isScalarAttribute, isMediaAttribute, isRelationalAttribute, hasRelationReordering, isComponentAttribute, isDynamicZoneAttribute, isMorphToRelationalAttribute, isTypedAttribute, getPrivateAttributes, isPrivateAttribute, constants, getNonWritableAttributes, getComponentAttributes, getScalarAttributes, getRelationalAttributes, getWritableAttributes, isWritableAttribute, getNonVisibleAttributes, getVisibleAttributes, getTimestamps, getCreatorFields, isVisibleAttribute, getOptions, isDraft, hasDraftAndPublish, isSingleType, isCollectionType, isKind, getContentTypeRoutePrefix, getDoesAttributeRequireValidation, }; | ||
//# sourceMappingURL=content-types.d.ts.map |
@@ -69,12 +69,15 @@ import { Model } from './types'; | ||
} | ||
declare const _default: { | ||
convertSortQueryParams: (sortQuery: SortParams) => OrderByQuery; | ||
convertStartQueryParams: (startQuery: unknown) => number; | ||
convertLimitQueryParams: (limitQuery: unknown) => number | undefined; | ||
convertPopulateQueryParams: (populate: PopulateParams, schema?: Model | undefined, depth?: number) => PopulateQuery; | ||
convertFiltersQueryParams: (filters: unknown, schema?: Model | undefined) => WhereQuery; | ||
convertFieldsQueryParams: (fields: FieldsParams, depth?: number) => SelectQuery | undefined; | ||
transformParamsToQuery: (uid: string, params: Params) => Query; | ||
interface TransformerOptions { | ||
getModel: (uid: string) => Model | undefined; | ||
} | ||
declare const createTransformer: ({ getModel }: TransformerOptions) => { | ||
private_convertSortQueryParams: (sortQuery: SortParams) => OrderByQuery; | ||
private_convertStartQueryParams: (startQuery: unknown) => number; | ||
private_convertLimitQueryParams: (limitQuery: unknown) => number | undefined; | ||
private_convertPopulateQueryParams: (populate: PopulateParams, schema?: Model, depth?: number) => PopulateQuery; | ||
private_convertFiltersQueryParams: (filters: FiltersParams, schema?: Model) => WhereQuery; | ||
private_convertFieldsQueryParams: (fields: FieldsParams, schema?: Model, depth?: number) => SelectQuery | undefined; | ||
transformQueryParams: (uid: string, params: Params) => Query; | ||
}; | ||
export default _default; | ||
export { createTransformer }; | ||
//# sourceMappingURL=convert-query-params.d.ts.map |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/** | ||
* Utils file containing file treatment utils | ||
*/ | ||
import { Readable, Writable, WritableOptions } from 'node:stream'; | ||
import { Writable, WritableOptions } from 'node:stream'; | ||
declare const kbytesToBytes: (kbytes: number) => number; | ||
declare const bytesToKbytes: (bytes: number) => number; | ||
declare const bytesToHumanReadable: (bytes: number) => string; | ||
declare const streamToBuffer: (stream: Readable) => Promise<unknown>; | ||
declare const getStreamSize: (stream: Readable) => Promise<unknown>; | ||
declare const streamToBuffer: (stream: NodeJS.ReadableStream) => Promise<Buffer>; | ||
declare const getStreamSize: (stream: NodeJS.ReadableStream) => Promise<unknown>; | ||
/** | ||
@@ -15,4 +20,4 @@ * Create a writeable Node.js stream that discards received data. | ||
*/ | ||
declare function writableDiscardStream(options: WritableOptions): Writable; | ||
declare function writableDiscardStream(options?: WritableOptions): Writable; | ||
export { streamToBuffer, bytesToHumanReadable, bytesToKbytes, kbytesToBytes, getStreamSize, writableDiscardStream, }; | ||
//# sourceMappingURL=file.d.ts.map |
@@ -5,6 +5,3 @@ export { default as parseType } from './parse-type'; | ||
export { default as providerFactory } from './provider-factory'; | ||
export { default as sanitize } from './sanitize'; | ||
export { default as validate } from './validate'; | ||
export { default as traverseEntity } from './traverse-entity'; | ||
export { default as convertQueryParams } from './convert-query-params'; | ||
export { default as importDefault } from './import-default'; | ||
@@ -14,2 +11,5 @@ export { default as machineID } from './machine-id'; | ||
export { isOperator, isOperatorOfType } from './operators'; | ||
export * as queryParams from './convert-query-params'; | ||
export * as sanitize from './sanitize'; | ||
export * as validate from './validate'; | ||
export * as pagination from './pagination'; | ||
@@ -27,3 +27,4 @@ export * as packageManager from './package-manager'; | ||
export * as hooks from './hooks'; | ||
export * from './zod'; | ||
export * from './primitives'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,10 +11,40 @@ interface PaginationArgs { | ||
} | ||
declare const withDefaultPagination: (args: Partial<PaginationArgs>, { defaults, maxLimit }?: { | ||
export interface PagePatinationInformation { | ||
page: number; | ||
pageSize: number; | ||
pageCount: number; | ||
total: number; | ||
} | ||
export interface OffsetPaginationInformation { | ||
start: number; | ||
limit: number; | ||
total: number; | ||
} | ||
declare const withDefaultPagination: <T extends Partial<PaginationArgs>>(args: T, { defaults, maxLimit }?: { | ||
defaults?: {} | undefined; | ||
maxLimit?: number | undefined; | ||
}) => Partial<PaginationArgs> & { | ||
}) => { | ||
start: number; | ||
limit: number; | ||
}; | ||
export { withDefaultPagination }; | ||
} & Partial<T>; | ||
/** | ||
* Transform pagination information into a paginated response: | ||
* { | ||
* page: number, | ||
* pageSize: number, | ||
* pageCount: number, | ||
* total: number | ||
* } | ||
*/ | ||
declare const transformPagedPaginationInfo: (paginationInfo: Partial<PaginationArgs>, total: number) => PagePatinationInformation; | ||
/** | ||
* Transform pagination information into a offset response: | ||
* { | ||
* start: number, | ||
* limit: number, | ||
* total: number | ||
* } | ||
*/ | ||
declare const transformOffsetPaginationInfo: (paginationInfo: Partial<PaginationArgs>, total: number) => OffsetPaginationInformation; | ||
export { withDefaultPagination, transformPagedPaginationInfo, transformOffsetPaginationInfo }; | ||
//# sourceMappingURL=pagination.d.ts.map |
@@ -1,27 +0,1 @@ | ||
/** | ||
* Policies util | ||
*/ | ||
import type Koa from 'koa'; | ||
interface PolicyInfo { | ||
name: string; | ||
config: unknown; | ||
} | ||
type PolicyConfig = string | PolicyInfo | (() => PolicyInfo); | ||
interface PolicyContext { | ||
pluginName?: string; | ||
apiName?: string; | ||
} | ||
interface RouteInfo { | ||
method: string; | ||
endpoint: string; | ||
controller: string; | ||
action: string; | ||
plugin: string; | ||
} | ||
declare const globalPolicy: ({ method, endpoint, controller, action, plugin }: RouteInfo) => (ctx: Koa.Context, next: () => void) => Promise<void>; | ||
declare const resolvePolicies: (config: PolicyConfig[], policyContext: PolicyContext) => { | ||
handler: any; | ||
config: {}; | ||
}[]; | ||
declare const getPolicy: (policyConfig: PolicyConfig, policyContext?: PolicyContext) => any; | ||
interface Options { | ||
@@ -41,3 +15,3 @@ name: string; | ||
} & object; | ||
export { getPolicy as get, resolvePolicies as resolve, globalPolicy, createPolicy, createPolicyContext, }; | ||
export { createPolicy, createPolicyContext }; | ||
//# sourceMappingURL=policy.d.ts.map |
@@ -12,20 +12,19 @@ import { AsyncSeriesHook, AsyncParallelHook } from './hooks'; | ||
type Item = Record<string, unknown>; | ||
export interface Provider { | ||
export interface Provider<T = unknown> { | ||
hooks: ProviderHooksMap; | ||
register(key: string, item: Item): Promise<Provider>; | ||
register(key: string, item: T): Promise<Provider>; | ||
delete(key: string): Promise<Provider>; | ||
get(key: string): Item | undefined; | ||
getWhere(filters?: Record<string, unknown>): Item[]; | ||
values(): Item[]; | ||
get(key: string): T | undefined; | ||
values(): T[]; | ||
keys(): string[]; | ||
has(key: string): boolean; | ||
size(): number; | ||
clear(): Promise<Provider>; | ||
clear(): Promise<Provider<T>>; | ||
} | ||
export type ProviderFactory = (options?: Options) => Provider; | ||
export type ProviderFactory<T> = (options?: Options) => Provider<T>; | ||
/** | ||
* A Provider factory | ||
*/ | ||
declare const providerFactory: ProviderFactory; | ||
declare const providerFactory: <T = Item>(options?: Options) => Provider<T>; | ||
export default providerFactory; | ||
//# sourceMappingURL=provider-factory.d.ts.map |
import type { Attribute, Model } from './types'; | ||
declare const getRelationalFields: (contentType: Model) => string[]; | ||
declare const isOneToAny: (attribute: Attribute) => boolean; | ||
declare const isManyToAny: (attribute: Attribute) => boolean; | ||
declare const isAnyToOne: (attribute: Attribute) => boolean; | ||
declare const isAnyToMany: (attribute: Attribute) => boolean; | ||
export declare const getRelationalFields: (contentType: Model) => string[]; | ||
export declare const isOneToAny: (attribute: Attribute) => boolean; | ||
export declare const isManyToAny: (attribute: Attribute) => boolean; | ||
export declare const isAnyToOne: (attribute: Attribute) => boolean; | ||
export declare const isAnyToMany: (attribute: Attribute) => boolean; | ||
export declare const isPolymorphic: (attribute: any) => any; | ||
export declare const constants: { | ||
MANY_RELATIONS: string[]; | ||
}; | ||
export { getRelationalFields, isOneToAny, isManyToAny, isAnyToOne, isAnyToMany }; | ||
export declare const VALID_RELATION_ORDERING_KEYS: { | ||
[key: string]: (value: any) => boolean; | ||
}; | ||
//# sourceMappingURL=relations.d.ts.map |
@@ -0,24 +1,33 @@ | ||
import { CurriedFunction1 } from 'lodash'; | ||
import * as visitors from './visitors'; | ||
import * as sanitizers from './sanitizers'; | ||
import type { Model } from '../types'; | ||
import type { Model, Data } from '../types'; | ||
export interface Options { | ||
auth?: unknown; | ||
} | ||
export interface Sanitizer { | ||
(schema: Model): CurriedFunction1<Data, Promise<Data>>; | ||
} | ||
export interface SanitizeFunc { | ||
(data: unknown, schema: Model, options?: Options): Promise<unknown>; | ||
} | ||
declare const _default: { | ||
contentAPI: { | ||
input: SanitizeFunc; | ||
output: SanitizeFunc; | ||
query: (query: Record<string, unknown>, schema: Model, { auth }?: Options) => Promise<Record<string, unknown>>; | ||
filters: SanitizeFunc; | ||
sort: SanitizeFunc; | ||
fields: SanitizeFunc; | ||
populate: SanitizeFunc; | ||
}; | ||
sanitizers: typeof sanitizers; | ||
visitors: typeof visitors; | ||
export interface APIOptions { | ||
sanitizers?: Sanitizers; | ||
getModel: (model: string) => Model; | ||
} | ||
export interface Sanitizers { | ||
input?: Sanitizer[]; | ||
output?: Sanitizer[]; | ||
} | ||
declare const createAPISanitizers: (opts: APIOptions) => { | ||
input: SanitizeFunc; | ||
output: SanitizeFunc; | ||
query: (query: Record<string, unknown>, schema: Model, { auth }?: Options) => Promise<Record<string, unknown>>; | ||
filters: SanitizeFunc; | ||
sort: SanitizeFunc; | ||
fields: SanitizeFunc; | ||
populate: SanitizeFunc; | ||
}; | ||
export default _default; | ||
export { createAPISanitizers, sanitizers, visitors }; | ||
export type APISanitiers = ReturnType<typeof createAPISanitizers>; | ||
//# sourceMappingURL=index.d.ts.map |
/// <reference types="lodash" /> | ||
import type { Model, Data } from '../types'; | ||
declare const sanitizePasswords: (schema: Model) => (entity: Data) => Promise<Data>; | ||
declare const defaultSanitizeOutput: (schema: Model, entity: Data) => Promise<Data>; | ||
declare const defaultSanitizeFilters: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
declare const defaultSanitizeSort: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
declare const defaultSanitizeFields: import("lodash").CurriedFunction2<Model, unknown, Promise<any>>; | ||
declare const defaultSanitizePopulate: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
import type { Parent } from '../traverse/factory'; | ||
interface Context { | ||
schema: Model; | ||
getModel: (model: string) => Model; | ||
parent?: Parent; | ||
} | ||
declare const sanitizePasswords: (ctx: Context) => (entity: Data) => Promise<Data>; | ||
declare const defaultSanitizeOutput: (ctx: Context, entity: Data) => Promise<Data>; | ||
declare const defaultSanitizeFilters: import("lodash").CurriedFunction2<Context, unknown, Promise<unknown>>; | ||
declare const defaultSanitizeSort: import("lodash").CurriedFunction2<Context, unknown, Promise<unknown>>; | ||
declare const defaultSanitizeFields: import("lodash").CurriedFunction2<Context, unknown, Promise<unknown>>; | ||
declare const defaultSanitizePopulate: import("lodash").CurriedFunction2<Context, unknown, Promise<unknown>>; | ||
export { sanitizePasswords, defaultSanitizeOutput, defaultSanitizeFilters, defaultSanitizeSort, defaultSanitizeFields, defaultSanitizePopulate, }; | ||
//# sourceMappingURL=sanitizers.d.ts.map |
/// <reference types="lodash" /> | ||
import type { AnyAttribute, Model, Data } from './types'; | ||
import type { Attribute, AnyAttribute, Model, Data } from './types'; | ||
export type VisitorUtils = ReturnType<typeof createVisitorUtils>; | ||
@@ -9,4 +9,6 @@ export interface VisitorOptions { | ||
value: Data[keyof Data]; | ||
attribute: AnyAttribute; | ||
attribute?: AnyAttribute; | ||
path: Path; | ||
getModel(uid: string): Model; | ||
parent?: Parent; | ||
} | ||
@@ -19,3 +21,11 @@ export type Visitor = (visitorOptions: VisitorOptions, visitorUtils: VisitorUtils) => void; | ||
export interface TraverseOptions { | ||
schema: Model; | ||
path?: Path; | ||
parent?: Parent; | ||
getModel(uid: string): Model; | ||
} | ||
export interface Parent { | ||
attribute?: Attribute; | ||
key: string | null; | ||
path: Path; | ||
schema: Model; | ||
@@ -22,0 +32,0 @@ } |
@@ -6,5 +6,13 @@ import { AnyAttribute, Attribute, ComponentAttribute, DynamicZoneAttribute, Model, RelationalAttribute } from '../types'; | ||
} | ||
export interface Parent { | ||
attribute?: Attribute; | ||
key: string | null; | ||
path: Path; | ||
schema: Model; | ||
} | ||
export interface TraverseOptions { | ||
schema: Model; | ||
path?: Path; | ||
schema: Model; | ||
parent?: Parent; | ||
getModel(uid: string): Model; | ||
} | ||
@@ -16,4 +24,6 @@ export interface VisitorOptions { | ||
key: string; | ||
attribute: AnyAttribute; | ||
attribute?: AnyAttribute; | ||
path: Path; | ||
parent?: Parent; | ||
getModel(uid: string): Model; | ||
} | ||
@@ -54,3 +64,3 @@ export type Traverse = (visitor: Visitor, options: TraverseOptions, data: unknown) => Promise<unknown>; | ||
remove(key: string): void; | ||
set(key: string, valeu: unknown): void; | ||
set(key: string, value: unknown): void; | ||
recurse: Traverse; | ||
@@ -66,8 +76,8 @@ } | ||
visitor: Visitor; | ||
parent?: Parent; | ||
getModel(uid: string): Model; | ||
} | ||
declare const _default: () => { | ||
traverse: Traverse; | ||
intercept<T>(predicate: (data: unknown) => data is T, handler: (visitor: Visitor, options: TraverseOptions, data: T, recurseOptions: { | ||
recurse: Traverse; | ||
}) => void): any; | ||
intercept<T>(predicate: Interceptor<T>['predicate'], handler: Interceptor<T>['handler']): any; | ||
parse<T_1>(predicate: (data: unknown) => data is T_1, parser: (data: T_1) => ParseUtils<T_1>): any; | ||
@@ -74,0 +84,0 @@ ignore(predicate: Ignore): any; |
@@ -1,2 +0,1 @@ | ||
export { default as factory } from './factory'; | ||
export { default as traverseQueryFilters } from './query-filters'; | ||
@@ -3,0 +2,0 @@ export { default as traverseQuerySort } from './query-sort'; |
@@ -5,4 +5,10 @@ import type * as Koa from 'koa'; | ||
id?: ID; | ||
__component?: string; | ||
__type?: string; | ||
[key: string]: string | number | ID | boolean | null | undefined | Date | Data | Data[]; | ||
}; | ||
export type Config = Record<string, unknown>; | ||
export interface RelationOrderingOptions { | ||
strict?: boolean; | ||
} | ||
export interface Attribute { | ||
@@ -9,0 +15,0 @@ type: string; |
@@ -0,23 +1,31 @@ | ||
import { CurriedFunction1 } from 'lodash'; | ||
import * as visitors from './visitors'; | ||
import * as validators from './validators'; | ||
import { Model } from '../types'; | ||
import { Model, Data } from '../types'; | ||
export interface Options { | ||
auth?: unknown; | ||
} | ||
export interface Validator { | ||
(schema: Model): CurriedFunction1<Data, Promise<Data>>; | ||
} | ||
export interface ValidateFunc { | ||
(data: unknown, schema: Model, options?: Options): Promise<void>; | ||
} | ||
declare const _default: { | ||
contentAPI: { | ||
input: ValidateFunc; | ||
query: (query: Record<string, unknown>, schema: Model, { auth }?: Options) => Promise<void>; | ||
filters: ValidateFunc; | ||
sort: ValidateFunc; | ||
fields: ValidateFunc; | ||
populate: ValidateFunc; | ||
}; | ||
validators: typeof validators; | ||
visitors: typeof visitors; | ||
interface APIOptions { | ||
validators?: Validators; | ||
getModel: (model: string) => Model; | ||
} | ||
export interface Validators { | ||
input?: Validator[]; | ||
} | ||
declare const createAPIValidators: (opts: APIOptions) => { | ||
input: ValidateFunc; | ||
query: (query: Record<string, unknown>, schema: Model, { auth }?: Options) => Promise<void>; | ||
filters: ValidateFunc; | ||
sort: ValidateFunc; | ||
fields: ValidateFunc; | ||
populate: ValidateFunc; | ||
}; | ||
export default _default; | ||
export { createAPIValidators, validators, visitors }; | ||
export type APIValidators = ReturnType<typeof createAPIValidators>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,6 @@ | ||
export declare const throwInvalidParam: ({ key, path }: { | ||
export declare const throwInvalidKey: ({ key, path }: { | ||
key: string; | ||
path?: string | null | undefined; | ||
path?: string | null; | ||
}) => never; | ||
export declare const asyncCurry: <A extends unknown[], R>(fn: (...args: A) => Promise<R>) => ((...args: Partial<A>) => any); | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -1,9 +0,29 @@ | ||
/// <reference types="lodash" /> | ||
import type { Model, Data } from '../types'; | ||
declare const throwPasswords: (schema: Model) => (entity: Data) => Promise<Data>; | ||
declare const defaultValidateFilters: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
declare const defaultValidateSort: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
declare const defaultValidateFields: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
declare const defaultValidatePopulate: import("lodash").CurriedFunction2<Model, unknown, Promise<unknown>>; | ||
export { throwPasswords, defaultValidateFilters, defaultValidateSort, defaultValidateFields, defaultValidatePopulate, }; | ||
import type { Model } from '../types'; | ||
import type { Parent, Path } from '../traverse/factory'; | ||
interface Context { | ||
schema: Model; | ||
getModel: (model: string) => Model; | ||
} | ||
interface PopulateContext extends Context { | ||
path?: Path; | ||
parent?: Parent; | ||
} | ||
export declare const FILTER_TRAVERSALS: string[]; | ||
export declare const validateFilters: (ctx?: Context | undefined, filters?: unknown, include?: string[] | undefined) => any; | ||
export declare const defaultValidateFilters: (ctx?: Context | undefined, filters?: unknown) => any; | ||
export declare const SORT_TRAVERSALS: string[]; | ||
export declare const validateSort: (ctx?: Context | undefined, sort?: unknown, include?: string[] | undefined) => any; | ||
export declare const defaultValidateSort: (ctx?: Context | undefined, sort?: unknown) => any; | ||
export declare const FIELDS_TRAVERSALS: string[]; | ||
export declare const validateFields: (ctx?: Context | undefined, fields?: unknown, include?: string[] | undefined) => any; | ||
export declare const defaultValidateFields: (ctx?: Context | undefined, fields?: unknown) => any; | ||
export declare const POPULATE_TRAVERSALS: string[]; | ||
export declare const validatePopulate: (ctx?: PopulateContext | undefined, populate?: unknown, includes?: { | ||
fields?: string[] | undefined; | ||
sort?: string[] | undefined; | ||
filters?: string[] | undefined; | ||
populate?: string[] | undefined; | ||
} | undefined) => any; | ||
export declare const defaultValidatePopulate: (ctx?: Context | undefined, populate?: unknown) => any; | ||
export {}; | ||
//# sourceMappingURL=validators.d.ts.map |
@@ -8,2 +8,3 @@ export { default as throwPassword } from './throw-password'; | ||
export { default as throwRestrictedFields } from './throw-restricted-fields'; | ||
export { default as throwUnrecognizedFields } from './throw-unrecognized-fields'; | ||
//# sourceMappingURL=index.d.ts.map |
import * as yup from 'yup'; | ||
declare const handleYupError: (error: yup.ValidationError, errorMessage?: string) => never; | ||
declare const validateYupSchema: (schema: yup.AnySchema, options?: {}) => (body: unknown, errorMessage?: string) => Promise<any>; | ||
declare const validateYupSchemaSync: (schema: yup.AnySchema, options?: {}) => (body: unknown, errorMessage?: string) => any; | ||
declare const validateYupSchema: <TSchema extends yup.AnySchema>(schema: TSchema, options?: {}) => (body: unknown, errorMessage?: string) => Promise<yup.InferType<TSchema>>; | ||
declare const validateYupSchemaSync: <TSchema extends yup.AnySchema>(schema: yup.AnySchema, options?: {}) => (body: unknown, errorMessage?: string) => yup.InferType<TSchema>; | ||
export { handleYupError, validateYupSchema, validateYupSchemaSync }; | ||
//# sourceMappingURL=validators.d.ts.map |
{ | ||
"name": "@strapi/utils", | ||
"version": "0.0.0-experimental.19b15f2f555510eb5507d89fcaf5efa172002608", | ||
"version": "0.0.0-experimental.19d775295eb622de3e659110caf22fcd2cd5d10d", | ||
"description": "Shared utilities for the Strapi packages", | ||
@@ -50,3 +50,3 @@ "keywords": [ | ||
"execa": "5.1.1", | ||
"http-errors": "1.8.1", | ||
"http-errors": "2.0.0", | ||
"lodash": "4.17.21", | ||
@@ -56,18 +56,19 @@ "node-machine-id": "1.1.12", | ||
"preferred-pm": "3.1.2", | ||
"yup": "0.32.9" | ||
"yup": "0.32.9", | ||
"zod": "^3.22.4" | ||
}, | ||
"devDependencies": { | ||
"@strapi/pack-up": "0.0.0-experimental.19b15f2f555510eb5507d89fcaf5efa172002608", | ||
"@strapi/pack-up": "5.0.2", | ||
"@types/http-errors": "2.0.4", | ||
"@types/koa": "2.13.4", | ||
"@types/node": "18.18.4", | ||
"eslint-config-custom": "0.0.0-experimental.19b15f2f555510eb5507d89fcaf5efa172002608", | ||
"koa": "2.13.4", | ||
"koa-body": "4.2.0", | ||
"tsconfig": "0.0.0-experimental.19b15f2f555510eb5507d89fcaf5efa172002608" | ||
"@types/node": "18.19.24", | ||
"eslint-config-custom": "0.0.0-experimental.19d775295eb622de3e659110caf22fcd2cd5d10d", | ||
"koa": "2.15.2", | ||
"koa-body": "6.0.1", | ||
"tsconfig": "0.0.0-experimental.19d775295eb622de3e659110caf22fcd2cd5d10d" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0 <=20.x.x", | ||
"node": ">=18.0.0 <=22.x.x", | ||
"npm": ">=6.0.0" | ||
}, | ||
"gitHead": "19b15f2f555510eb5507d89fcaf5efa172002608" | ||
} | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
801143
127
7992
10
8
1
80
+ Addedzod@^3.22.4
+ Addeddepd@2.0.0(transitive)
+ Addedhttp-errors@2.0.0(transitive)
+ Addedstatuses@2.0.1(transitive)
+ Addedzod@3.24.1(transitive)
- Removeddepd@1.1.2(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removedstatuses@1.5.0(transitive)
Updatedhttp-errors@2.0.0