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

Function applyReadPolicies

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

Source from the content-addressed store, hash-verified

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

Callers 2

countFunction · 0.85

Calls 2

createBuilderFunction · 0.90
mergePolicyConditionFunction · 0.85

Tested by

no test coverage detected