UNPKG

@overture-stack/lyric

Version:
26 lines (25 loc) 1.73 kB
import { type DataRecord, type Schema } from '@overture-stack/lectern-client'; import type { SubmissionInsertData } from '@overture-stack/lyric-data-model/models'; import type { EntityData, SchemasDictionary } from './types.js'; /** * Creates a parser function that converts raw string-based records into typed values using the given schema. * Uses Lectern client parsing function * @param schema The schema definition used to interpret and convert field values. * @returns A function that takes a record with string values and returns a typed data record based on the schema. */ export declare const getSchemaParser: (schema: Schema) => (record: Record<string, string>) => DataRecord; /** * Parses raw records into typed data records based on the provided schema. * @param dataRecords An array of unprocessed records with unknown value types. * @param schema The schema definition used to convert and validate each record's fields. * @returns An array of valid typed data records. */ export declare const convertToTypedRecords: (dataRecords: Record<string, unknown>[], schema: Schema) => DataRecord[]; /** * Converts a collection of raw entity records into typed batches ready for insertion, * using schema definitions to validate and transform the data. * @param records A map of entity names to arrays of raw records. Each record is untyped and unvalidated. * @param schemasDictionary A dictionary of schema definitions used to validate and convert each entity's records. * @returns A map of entity names to `SubmissionInsertData` batches containing typed records. */ export declare const parseRecordsToInsert: (records: EntityData, schemasDictionary: SchemasDictionary) => Record<string, SubmissionInsertData>;