import type { SomeSchema, SomeSchemaDef } from '../../core/internal.js'; import type { SomeName, StoredRecords } from '../../core/types.js'; import type { ObjectValues, OnlyStrings } from '../../lib/utils.js'; import type { RecordController } from '../../record/types/controller.js'; import type { StoredRecord } from '../../record/types/StoredRecord.js'; import type { StoredADT } from './Builder.js'; import type { Any } from 'ts-toolbelt'; export type SomeShortHandRecordSchemaDefs = Record; export type SomeShortHandRecordSchemas = Record; type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; type LastOf = UnionToIntersection T : never> extends () => infer R ? R : never; type Push = [...T, V]; type TuplifyUnion, N = [T] extends [never] ? true : false> = true extends N ? [] : Push>, L>; export declare namespace DataController { export type createFromShortHandRecordSchemas = DataController, StoredRecordsFromShortHandRecordSchemas>; type StoredRecordsFromShortHandRecordSchemas = OnlyStoredRecords]: StoredRecord.AddSchema>; }>>>; export type createFromShortHandRecordSchemaDefs = DataController, StoredRecordsFromShortHandRecordSchemaDefs>; type StoredRecordsFromShortHandRecordSchemaDefs = OnlyStoredRecords]: StoredRecord.AddSchemaDef>; }>>>; type OnlyStoredRecords = t extends StoredRecords ? t : never; export {}; } export type DataController = Any.Compute & ADTMethods, 'flat'>; /** * Build up the API on the ADT itself: * * ```ts * const A = Alge.create('A')... * // A.<...> <-- Methods here * ``` */ type ADTMethods = { from: Any.Compute & StoredRecords.GetAdtLevelDecoderMethods>; to: Any.Compute & StoredRecords.GetAdtLevelEncoderMethods>; schema: StoredRecords.ZodUnion; }; /** * build up the API for each record defined in the ADT: * * ```ts * const A = Alge.create('A').record('B',...)... * // A.B.<...> <-- Methods here * ``` */ export type RecordsMethods = { [V in Vs[number] as V[`name`]]: Any.Compute, 'flat'>; }; export type DecoderMethods = { [N in Name]: (value: string) => null | StoredRecords.Union; } & { [N in Name as `${N}OrThrow`]: (value: string) => StoredRecords.Union; }; export type EncoderMethods = { [N in Name]: Encoder; }; export type Encoder = (adt: StoredRecords.Union) => string; export {}; //# sourceMappingURL=Controller.d.ts.map