跳到主要内容

buildOfflineWriteRepositoryRules()

function buildOfflineWriteRepositoryRules(
entities,
syncConfig,
repoSyncs
): (
| Rule<RxDBChange, StringKey<RxDBChange>, RuleValueDefault>
| RuleGroupBase<RxDBChange, StringKey<RxDBChange>, Rule<RxDBChange, StringKey<RxDBChange>, RuleValueDefault>>)[];

Defined in: packages/rxdb/src/sync-contract/pushable-repository-rules.ts:45

按「离线可写但没有 changelog 端点的仓库」构造 OR 组,形状与 buildPushableRepositoryRules 完全一致。

Parameters​

ParameterTypeDescription
entitiesreadonly EntityType[]config.entities,仓库集合真源
syncConfig| SyncOptions | EntitySyncResolver实例解析器 rxdb.entitySync(含实例覆盖);传 config.sync 时只按实体声明 > 全局回退解析
repoSyncsRxDBSync[]当前分支上已存在的同步记录

Returns​

( | Rule<RxDBChange, StringKey<RxDBChange>, RuleValueDefault> | RuleGroupBase<RxDBChange, StringKey<RxDBChange>, Rule<RxDBChange, StringKey<RxDBChange>, RuleValueDefault>>)[]

每个待重放仓库一条 AND 规则;没有这类仓库时返回空数组

Remarks​

判据是 offlineWrite && !push(现阶段只有 querycache),与 buildPushableRepositoryRules 的 push 恰好互补:两组规则永不重叠, 因此把两侧的计数直接相加不会重复计算同一行。