UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

82 lines (76 loc) • 2.35 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const errors = require("../errors.cjs"); class CollectionRequiresGetKeyError extends errors.CollectionConfigurationError { constructor() { super( `Collection requires a "getKey" function in the config. The getKey function extracts a unique identifier from each item. Example: createCollection({ getKey: (item) => item.id, sync: { sync: () => {} }, })` ); } } class InvalidGetKeyError extends errors.CollectionConfigurationError { constructor(actualType) { super( `"getKey" must be a function, but received ${actualType}. Example: createCollection({ getKey: (item) => item.id, sync: { sync: () => {} }, })` ); } } class InvalidSyncConfigError extends errors.CollectionConfigurationError { constructor(actualType) { super( `"sync" must be an object with a "sync" function, but received ${actualType}. Example: createCollection({ getKey: (item) => item.id, sync: { sync: ({ begin, write, commit, markReady }) => { // your sync logic }, }, })` ); } } class InvalidSyncFunctionError extends errors.CollectionConfigurationError { constructor(actualType) { super( `"sync.sync" must be a function, but received ${actualType}. The sync property should be an object containing a sync function: sync: { sync: ({ begin, write, commit, markReady }) => { // your sync logic }, }` ); } } class InvalidCallbackOptionError extends errors.CollectionConfigurationError { constructor(optionName, actualType) { super(`"${optionName}" must be a function, but received ${actualType}.`); } } class InvalidOptionTypeError extends errors.CollectionConfigurationError { constructor(optionName, expectedType, actualType) { super( `"${optionName}" must be ${expectedType}, but received ${actualType}.` ); } } exports.CollectionRequiresGetKeyError = CollectionRequiresGetKeyError; exports.InvalidCallbackOptionError = InvalidCallbackOptionError; exports.InvalidGetKeyError = InvalidGetKeyError; exports.InvalidOptionTypeError = InvalidOptionTypeError; exports.InvalidSyncConfigError = InvalidSyncConfigError; exports.InvalidSyncFunctionError = InvalidSyncFunctionError; //# sourceMappingURL=config-errors.cjs.map