MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / applyReadPolicies

Function applyReadPolicies

packages/core/fumadb/src/query/orm/index.ts:119–138  ·  view source on GitHub ↗
(
  table: AnyTable,
  where: Condition | undefined,
  context: unknown,
)

Source from the content-addressed store, hash-verified

117};
118
119const applyReadPolicies = async (
120 table: AnyTable,
121 where: Condition | undefined,
122 context: unknown,
123): Promise<Condition | undefined | false> => {
124 let nextWhere = where;
125
126 for (const policy of table.policies) {
127 const condition = await policy.onRead?.({
128 where: nextWhere,
129 context,
130 builder: createBuilder(table.columns),
131 });
132 const merged = mergePolicyCondition(table, nextWhere, condition);
133 if (merged === false) return false;
134 nextWhere = merged;
135 }
136
137 return nextWhere;
138};
139
140const applyReadPoliciesToOptions = async (
141 table: AnyTable,

Callers 2

countFunction · 0.85

Calls 2

createBuilderFunction · 0.90
mergePolicyConditionFunction · 0.85

Tested by

no test coverage detected