( table: AnyTable, where: Condition | undefined, context: unknown, )
| 111 | }; |
| 112 | |
| 113 | const 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 | |
| 134 | const applyReadPoliciesToOptions = async ( |
| 135 | table: AnyTable, |
no test coverage detected