UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

38 lines (32 loc) • 1.22 kB
import { collectionOptionsBrand, hasCollectionOptionsBrandValue, } from './collection-options-brand.js' import type { StandardSchemaV1 } from '@standard-schema/spec' import type { CollectionConfig, UtilsRecord } from './types.js' export { collectionOptionsBrand } export const collectionOptionsFactory: unique symbol = Symbol.for( `@tanstack/db.collectionOptions.factory`, ) as never /** Adapter-owned admission hook for options that contain mutable per-Collection state. */ export const collectionOptionsClaim: unique symbol = Symbol.for( `@tanstack/db.collectionOptions.claim`, ) as never export type CollectionOptionsIdentity< T extends object = Record<string, unknown>, TKey extends string | number = string | number, TSchema extends StandardSchemaV1 = never, TUtils extends UtilsRecord = UtilsRecord, TClient = unknown, > = { readonly id: string readonly [collectionOptionsBrand]: true readonly [collectionOptionsFactory]: ( client: TClient, ) => CollectionConfig<T, TKey, TSchema, TUtils> } export function hasCollectionOptionsBrand( value: unknown, ): value is CollectionOptionsIdentity<any, string | number, any, any, any> { return hasCollectionOptionsBrandValue(value) }