UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

17 lines • 736 B
/** * The SQL predicate a tenant scope reads as, over `column` (already quoted, e.g. `"tenant_ref"` or * `r."tenant_ref"`): `IN (…)`, `OR … IS NULL` when the scope includes rows with no tenant, and a * predicate matching nothing when the scope is empty. */ export function tenantPredicate(scope, column = '"tenant_ref"') { const parts = []; if (scope.tenants.length > 0) { parts.push(`${column} IN (${scope.tenants.map(() => '?').join(', ')})`); } if (scope.includeNull) parts.push(`${column} IS NULL`); if (parts.length === 0) return { sql: '1 = 0', bindings: [] }; return { sql: `(${parts.join(' OR ')})`, bindings: [...scope.tenants] }; } //# sourceMappingURL=tenant-sql.js.map