{"version":3,"file":"config-errors.cjs","names":["CollectionConfigurationError"],"sources":["../../../src/collection/config-errors.ts"],"sourcesContent":["// Internal development diagnostics; keep these out of the public exports.\nimport { CollectionConfigurationError } from '../errors'\n\nexport class CollectionRequiresGetKeyError extends CollectionConfigurationError {\n  constructor() {\n    super(\n      `Collection requires a \"getKey\" function in the config.\\n\\n` +\n        `The getKey function extracts a unique identifier from each item.\\n\\n` +\n        `Example:\\n` +\n        `  createCollection({\\n` +\n        `    getKey: (item) => item.id,\\n` +\n        `    sync: { sync: () => {} },\\n` +\n        `  })`,\n    )\n  }\n}\n\nexport class InvalidGetKeyError extends CollectionConfigurationError {\n  constructor(actualType: string) {\n    super(\n      `\"getKey\" must be a function, but received ${actualType}.\\n\\n` +\n        `Example:\\n` +\n        `  createCollection({\\n` +\n        `    getKey: (item) => item.id,\\n` +\n        `    sync: { sync: () => {} },\\n` +\n        `  })`,\n    )\n  }\n}\n\nexport class InvalidSyncConfigError extends CollectionConfigurationError {\n  constructor(actualType: string) {\n    super(\n      `\"sync\" must be an object with a \"sync\" function, but received ${actualType}.\\n\\n` +\n        `Example:\\n` +\n        `  createCollection({\\n` +\n        `    getKey: (item) => item.id,\\n` +\n        `    sync: {\\n` +\n        `      sync: ({ begin, write, commit, markReady }) => {\\n` +\n        `        // your sync logic\\n` +\n        `      },\\n` +\n        `    },\\n` +\n        `  })`,\n    )\n  }\n}\n\nexport class InvalidSyncFunctionError extends CollectionConfigurationError {\n  constructor(actualType: string) {\n    super(\n      `\"sync.sync\" must be a function, but received ${actualType}.\\n\\n` +\n        `The sync property should be an object containing a sync function:\\n` +\n        `  sync: {\\n` +\n        `    sync: ({ begin, write, commit, markReady }) => {\\n` +\n        `      // your sync logic\\n` +\n        `    },\\n` +\n        `  }`,\n    )\n  }\n}\n\nexport class InvalidCallbackOptionError extends CollectionConfigurationError {\n  constructor(optionName: string, actualType: string) {\n    super(`\"${optionName}\" must be a function, but received ${actualType}.`)\n  }\n}\n\nexport class InvalidOptionTypeError extends CollectionConfigurationError {\n  constructor(optionName: string, expectedType: string, actualType: string) {\n    super(\n      `\"${optionName}\" must be ${expectedType}, but received ${actualType}.`,\n    )\n  }\n}\n"],"mappings":";AAGA,IAAa,gCAAb,cAAmDA,eAAAA,6BAA6B;CAC9E,cAAc;EACZ,MACE,qOAOF;CACF;AACF;AAEA,IAAa,qBAAb,cAAwCA,eAAAA,6BAA6B;CACnE,YAAY,YAAoB;EAC9B,MACE,6CAA6C,WAAA;;;;;;KAM/C;CACF;AACF;AAEA,IAAa,yBAAb,cAA4CA,eAAAA,6BAA6B;CACvE,YAAY,YAAoB;EAC9B,MACE,iEAAiE,WAAA;;;;;;;;;;KAUnE;CACF;AACF;AAEA,IAAa,2BAAb,cAA8CA,eAAAA,6BAA6B;CACzE,YAAY,YAAoB;EAC9B,MACE,gDAAgD,WAAA;;;;;;;IAOlD;CACF;AACF;AAEA,IAAa,6BAAb,cAAgDA,eAAAA,6BAA6B;CAC3E,YAAY,YAAoB,YAAoB;EAClD,MAAM,IAAI,WAAA,qCAAgD,WAAA,EAAa;CACzE;AACF;AAEA,IAAa,yBAAb,cAA4CA,eAAAA,6BAA6B;CACvE,YAAY,YAAoB,cAAsB,YAAoB;EACxE,MACE,IAAI,WAAA,YAAuB,aAAA,iBAA8B,WAAA,EAC3D;CACF;AACF"}