import { type AuthState, type User, type ConnectionStatus, type TransactionChunk, type RoomSchemaShape, type InstaQLOptions, type InstantConfig, type PageInfoResponse, type InstaQLLifecycleState, type InstaQLResponse, type ValidQuery, Auth, Storage, Streams, InstantCoreDatabase, InstantSchemaDef, RoomsOf, IInstantDatabase } from '@instantdb/core'; import type { Accessor } from 'solid-js'; import { InstantSolidRoom } from './InstantSolidRoom.js'; export type InfiniteQueryState, Q extends ValidQuery, UseDates extends boolean> = { isLoading: boolean; error: { message: string; } | undefined; data: InstaQLResponse | undefined; canLoadNextPage: boolean; loadNextPage: () => void; }; export declare class InstantSolidDatabase, UseDates extends boolean = false, Rooms extends RoomSchemaShape = RoomsOf> implements IInstantDatabase { tx: import("@instantdb/core").TxChunk; auth: Auth; storage: Storage; streams: Streams; core: InstantCoreDatabase; constructor(core: InstantCoreDatabase); /** * Returns a unique ID for a given `name`. It's stored in local storage, * so you will get the same ID across sessions. * * @example * const deviceId = await db.getLocalId('device'); */ getLocalId: (name: string) => Promise; /** * Use this to write data! You can create, update, delete, and link objects * * @see https://instantdb.com/docs/instaml * * @example * const goalId = id(); * db.transact(db.tx.goals[goalId].update({title: "Get fit"})) */ transact: (chunks: TransactionChunk | TransactionChunk[]) => Promise; /** * One time query for the logged in state. * * @see https://instantdb.com/docs/auth * @example * const user = await db.getAuth(); * console.log('logged in as', user.email) */ getAuth(): Promise; /** * Use this for one-off queries. * Returns local data if available, otherwise fetches from the server. * * @see https://instantdb.com/docs/instaql * * @example * const resp = await db.queryOnce({ goals: {} }); * console.log(resp.data.goals) */ queryOnce: >(query: Q, opts?: InstaQLOptions) => Promise<{ data: InstaQLResponse; pageInfo: PageInfoResponse; }>; /** * Use this to query your data! * * @see https://instantdb.com/docs/instaql * * @example * const state = db.useQuery({ goals: {} }); * // state().isLoading, state().error, state().data */ useQuery: >(query: (() => null | Q) | null | Q, opts?: InstaQLOptions) => Accessor>; /** * Subscribe to a query and incrementally load more items. * * Only one top level namespace in the query is allowed. * * @see https://instantdb.com/docs/instaql * * @example * const state = db.useInfiniteQuery({ * posts: { * $: { * limit: 20, * order: { createdAt: 'desc' }, * }, * }, * }); * // state().data, state().isLoading, state().error, * // state().canLoadNextPage, state().loadNextPage() */ useInfiniteQuery: >(query: (() => null | Q) | null | Q, opts?: InstaQLOptions) => Accessor>; /** * Listen for the logged in state. This is useful * for deciding when to show a login screen. * * @see https://instantdb.com/docs/auth * @example * function App() { * const auth = db.useAuth(); * // auth().isLoading, auth().user, auth().error * } */ useAuth: () => Accessor; /** * Subscribe to the currently logged in user. * If the user is not logged in, this will throw an Error. * * @see https://instantdb.com/docs/auth * @example * function UserDisplay() { * const user = db.useUser(); * return
Logged in as: {user().email}
* } */ useUser: () => Accessor; /** * Listen for connection status changes to Instant. * * @see https://www.instantdb.com/docs/patterns#connection-status * @example * function App() { * const status = db.useConnectionStatus(); * return
Connection state: {status()}
* } */ useConnectionStatus: () => Accessor; /** * A hook that returns a unique ID for a given `name`. localIds are * stored in local storage, so you will get the same ID across sessions. * * Initially returns `null`, and then loads the localId. * * @example * const deviceId = db.useLocalId('device'); * // deviceId() is null initially, then the ID string */ useLocalId: (name: string) => Accessor; /** * Obtain a handle to a room, which allows you to listen to topics and presence data * * @see https://instantdb.com/docs/presence-and-topics * * @example * const room = db.room('chat', roomId); * const presence = db.rooms.usePresence(room); */ room(type?: RoomType, id?: string): InstantSolidRoom; /** * Hooks for working with rooms * * @see https://instantdb.com/docs/presence-and-topics * * @example * const room = db.room('chat', roomId); * const presence = db.rooms.usePresence(room); * const publish = db.rooms.usePublishTopic(room, 'emoji'); */ rooms: { useTopicEffect: typeof import("./InstantSolidRoom.js").useTopicEffect; usePublishTopic: typeof import("./InstantSolidRoom.js").usePublishTopic; usePresence: typeof import("./InstantSolidRoom.js").usePresence; useSyncPresence: typeof import("./InstantSolidRoom.js").useSyncPresence; useTypingIndicator: typeof import("./InstantSolidRoom.js").useTypingIndicator; }; } /** * The first step: init your application! * * Visit https://instantdb.com/dash to get your `appId` :) * * @example * import { init } from "@instantdb/solidjs" * * const db = init({ appId: "my-app-id" }) * * // You can also provide a schema for type safety and editor autocomplete! * * import { init } from "@instantdb/solidjs" * import schema from "../instant.schema.ts"; * * const db = init({ appId: "my-app-id", schema }) */ export declare function init, UseDates extends boolean = false>(config: Omit, 'useDateObjects'> & { useDateObjects?: UseDates; }): InstantSolidDatabase; //# sourceMappingURL=InstantSolidDatabase.d.ts.map