UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

34 lines (33 loc) 925 B
function hasVirtualProps(value) { return typeof value === "object" && value !== null && VIRTUAL_PROP_NAMES.every((name) => name in value); } function enrichRowWithVirtualProps(row, key, collectionId, computeSynced, computeOrigin) { const existingRow = row; return { ...row, $synced: existingRow.$synced ?? computeSynced(), $origin: existingRow.$origin ?? computeOrigin(), $key: existingRow.$key ?? key, $collectionId: existingRow.$collectionId ?? collectionId }; } const VIRTUAL_PROP_NAMES = [ "$synced", "$origin", "$key", "$collectionId" ]; function isVirtualPropName(name) { return VIRTUAL_PROP_NAMES.includes(name); } function hasVirtualPropPath(path) { return path.some((segment) => isVirtualPropName(segment)); } export { VIRTUAL_PROP_NAMES, enrichRowWithVirtualProps, hasVirtualPropPath, hasVirtualProps, isVirtualPropName }; //# sourceMappingURL=virtual-props.js.map