@tanstack/db
Version:
A reactive client store for building super fast apps on sync
1 lines • 1.29 kB
Source Map (JSON)
{"version":3,"file":"validate-indexing.cjs","sources":["../../../src/collection/validate-indexing.ts"],"sourcesContent":["import { CollectionConfigurationError } from '../errors.js'\nimport { codedMessage, devBuild } from '../error-message.js'\nimport type { CollectionConfig } from '../types.js'\n\n/** Apply the same admission rule before construction or cached preload reuse. */\nexport function validateCollectionIndexing(\n config: Pick<CollectionConfig, `autoIndex` | `defaultIndexType`>,\n): void {\n if (config.autoIndex === `eager` && !config.defaultIndexType) {\n throw new CollectionConfigurationError(\n devBuild() && process.env.NODE_ENV !== `production`\n ? `autoIndex: 'eager' requires defaultIndexType to be set. ` +\n `Import an index type and set it:\\n` +\n ` import { BasicIndex } from '@tanstack/db'\\n` +\n ` createCollection({ defaultIndexType: BasicIndex, autoIndex: 'eager', ... })`\n : codedMessage(206),\n )\n }\n}\n"],"names":["CollectionConfigurationError","devBuild","codedMessage"],"mappings":";;;;AAKO,SAAS,2BACd,QACM;AACN,MAAI,OAAO,cAAc,WAAW,CAAC,OAAO,kBAAkB;AAC5D,UAAM,IAAIA,OAAAA;AAAAA,MACRC,aAAAA,SAAA,KAAc,QAAQ,IAAI,aAAa,eACnC;AAAA;AAAA,iFAIAC,aAAAA,aAAa,GAAG;AAAA,IAAA;AAAA,EAExB;AACF;;"}