@dossierhq/core
Version:
The core Dossier library used by clients and server alike, used to interact with schema and entities directly, as well as remotely through a client.
13 lines (12 loc) • 1.52 kB
TypeScript
import type { ErrorType, Result } from '../ErrorResult.js';
import type { PublishedSchema } from '../schema/PublishedSchema.js';
import type { Schema } from '../schema/Schema.js';
import type { Component, EntityLike } from '../Types.js';
import type { ContentValuePath } from './ContentPath.js';
import { type ContentTransformerEntityFieldsOptions, type ContentTransformerOptions } from './ContentTransformer.js';
type ContentNormalizerOptions = ContentTransformerOptions;
export type ContentNormalizerEntityFieldsOptions = ContentTransformerEntityFieldsOptions;
export declare function normalizeEntityFields<TEntity extends EntityLike<string, object>>(schema: Schema | PublishedSchema, path: ContentValuePath, entity: Readonly<TEntity>, options?: ContentNormalizerEntityFieldsOptions): Result<TEntity['fields'], typeof ErrorType.BadRequest | typeof ErrorType.Generic>;
export declare function normalizeComponent<TComponent extends Component<string, object>>(schema: Schema | PublishedSchema, path: ContentValuePath, component: Readonly<TComponent>, options?: ContentNormalizerOptions): Result<TComponent, typeof ErrorType.BadRequest | typeof ErrorType.Generic>;
export declare function normalizeContentField<TSchema extends Schema | PublishedSchema>(schema: TSchema, path: ContentValuePath, fieldSpec: TSchema['spec']['entityTypes' | 'componentTypes'][number]['fields'][number], value: unknown, options?: ContentNormalizerOptions): Result<unknown, typeof ErrorType.BadRequest | typeof ErrorType.Generic>;
export {};