@tanstack/db
Version:
A reactive client store for building super fast apps on sync
57 lines (53 loc) • 2.01 kB
JavaScript
import { CollectionConfigurationError } from "../errors.js";
var CollectionRequiresGetKeyError = class extends CollectionConfigurationError {
constructor() {
super("Collection requires a \"getKey\" function in the config.\n\nThe getKey function extracts a unique identifier from each item.\n\nExample:\n createCollection({\n getKey: (item) => item.id,\n sync: { sync: () => {} },\n })");
}
};
var InvalidGetKeyError = class extends CollectionConfigurationError {
constructor(actualType) {
super(`"getKey" must be a function, but received ${actualType}.
Example:
createCollection({
getKey: (item) => item.id,
sync: { sync: () => {} },
})`);
}
};
var InvalidSyncConfigError = class extends 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
},
},
})`);
}
};
var InvalidSyncFunctionError = class extends 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
},
}`);
}
};
var InvalidCallbackOptionError = class extends CollectionConfigurationError {
constructor(optionName, actualType) {
super(`"${optionName}" must be a function, but received ${actualType}.`);
}
};
var InvalidOptionTypeError = class extends CollectionConfigurationError {
constructor(optionName, expectedType, actualType) {
super(`"${optionName}" must be ${expectedType}, but received ${actualType}.`);
}
};
export { CollectionRequiresGetKeyError, InvalidCallbackOptionError, InvalidGetKeyError, InvalidOptionTypeError, InvalidSyncConfigError, InvalidSyncFunctionError };
//# sourceMappingURL=config-errors.js.map