@tanstack/db
Version:
A reactive client store for building super fast apps on sync
33 lines (32 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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
};
}
exports.getLiveQueryStatusFlags = getLiveQueryStatusFlags;
exports.getPublicCollection = getPublicCollection;
exports.isCollection = isCollection;
exports.isFailedStatus = isFailedStatus;
exports.isSingleResultCollection = isSingleResultCollection;
//# sourceMappingURL=live-query-primitives.cjs.map