@tanstack/db
Version:
A reactive client store for building super fast apps on sync
33 lines (32 loc) • 1.04 kB
JavaScript
function isCollection(value) {
return typeof value === `object` && value !== null && typeof value.subscribeChanges === `function` && typeof value.startSyncImmediate === `function` && typeof value.id === `string`;
}
function getPublicCollection(collection) {
return collection?.publicCollection ?? collection;
}
function isSingleResultCollection(collection) {
return collection.config?.singleResult === true;
}
function isFailedStatus(status) {
return status === `error` || status === `crashed`;
}
function getLiveQueryStatusFlags(status, health) {
return {
isLoading: status === `loading`,
isReady: status === `ready`,
isIdle: status === `idle`,
isLoadingError: status === `error`,
isCrashed: status === `crashed`,
isCleanedUp: status === `cleaned-up`,
isSyncError: status === `ready` && health?.hasErrors === true,
health
};
}
export {
getLiveQueryStatusFlags,
getPublicCollection,
isCollection,
isFailedStatus,
isSingleResultCollection
};
//# sourceMappingURL=live-query-primitives.js.map