import type { InstaQLEntity, InstaQLResult, InstaQLParams, Remove$, } from './queryTypes.ts'; import type { IContainEntitiesAndLinks, InstantSchemaDef, } from './schemaTypes.ts'; import type { IInstantDatabase } from './coreTypes.ts'; /** * @deprecated * `InstantQuery` is deprecated. Use `InstaQLParams` instead. * * @example * // Before * const db = init_experimental({ ...config, schema }); * type DB = typeof db; * const myQuery = { ... } satisfies InstantQuery; * * // After * type Schema = typeof schema; * const myQuery = { ... } satisfies InstaQLParams; */ export type InstantQuery> = DB extends IInstantDatabase ? InstaQLParams : never; /** * @deprecated * `InstantQueryResult` is deprecated. Use `InstaQLResult` instead. * * @example * // Before * const db = init_experimental({ ...config, schema }); * type DB = typeof db; * type MyQueryResult = InstantQueryResult; * * // After * type Schema = typeof schema; * type MyQueryResult = InstaQLResult; */ export type InstantQueryResult, Q> = DB extends IInstantDatabase ? Q extends InstaQLParams | undefined ? InstaQLResult> : never : never; /** * @deprecated * `InstantSchema` is deprecated. Use typeof schema directly: * @example * // Before * const db = init_experimental({ ...config, schema }); * type Schema = InstantSchema; * * // After * type Schema = typeof schema; */ export type InstantSchema> = DB extends IInstantDatabase ? Schema : never; /** * @deprecated * `InstantEntity` is deprecated. Use `InstaQLEntity` instead. * * @example * // Before * const db = init_experimental({ ...config, schema }); * type DB = typeof db; * type MyEntity = InstantEntity; * * // After * type Schema = typeof schema; * type MyEntity = InstaQLEntity; */ export type InstantEntity< DB extends IInstantDatabase, EntityName extends DB extends IInstantDatabase ? Schema extends IContainEntitiesAndLinks ? keyof Entities : never : never, Query extends | (DB extends IInstantDatabase ? Schema extends IContainEntitiesAndLinks ? { [QueryPropName in keyof Entities[EntityName]['links']]?: any; } : never : never) | {} = {}, > = DB extends IInstantDatabase ? InstaQLEntity : never; /** * @deprecated * `InstantSchemaDatabase` is deprecated. You generally don't need to * create a return type for a DB. But, if you like you can use `IInstantDatabase`: * * @example * // Before * type DB = InstantSchemaDatabase; * * // After * type DB = IInstantDatabase; */ export type InstantSchemaDatabase< Schema extends InstantSchemaDef, _T1 extends any = any, _T2 extends any = any, > = IInstantDatabase;