{"version":3,"file":"validate-indexing.cjs","names":["CollectionConfigurationError","codedMessage"],"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"],"mappings":";;AAKA,SAAgB,2BACd,QACM;CACN,IAAI,OAAO,cAAc,WAAW,CAAC,OAAO,kBAC1C,MAAM,IAAIA,eAAAA,6BACR,sCAAA,SAAS,KAAA,QAAA,IAAA,aAA8B,eACnC,yNAIAC,sBAAAA,aAAa,GAAG,CACtB;AAEJ"}