( table: AnyTable, where: Condition | undefined, context: unknown, )
| 117 | }; |
| 118 | |
| 119 | const 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 | |
| 140 | const applyReadPoliciesToOptions = async ( |
| 141 | table: AnyTable, |
no test coverage detected