@tanstack/db
Version:
A reactive client store for building super fast apps on sync
1 lines • 1.42 kB
Source Map (JSON)
{"version":3,"file":"collection-options.cjs","sources":["../../src/collection-options.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec'\nimport type { CollectionConfig, UtilsRecord } from './types.js'\n\nexport const collectionOptionsBrand: unique symbol = Symbol.for(\n `@tanstack/db.collectionOptions`,\n) as never\n\nexport const collectionOptionsFactory: unique symbol = Symbol.for(\n `@tanstack/db.collectionOptions.factory`,\n) as never\n\nexport type CollectionOptionsIdentity<\n T extends object = Record<string, unknown>,\n TKey extends string | number = string | number,\n TSchema extends StandardSchemaV1 = never,\n TUtils extends UtilsRecord = UtilsRecord,\n TClient = unknown,\n> = {\n readonly id: string\n readonly [collectionOptionsBrand]: true\n readonly [collectionOptionsFactory]: (\n client: TClient,\n ) => CollectionConfig<T, TKey, TSchema, TUtils>\n}\n\nexport function hasCollectionOptionsBrand(\n value: unknown,\n): value is CollectionOptionsIdentity<any, string | number, any, any, any> {\n return (\n typeof value === `object` &&\n value !== null &&\n (value as Record<PropertyKey, unknown>)[collectionOptionsBrand] === true\n )\n}\n"],"names":[],"mappings":";;AAGO,MAAM,yBAAwC,uBAAO;AAAA,EAC1D;AACF;AAEO,MAAM,2BAA0C,uBAAO;AAAA,EAC5D;AACF;AAgBO,SAAS,0BACd,OACyE;AACzE,SACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAuC,sBAAsB,MAAM;AAExE;;;;"}