import { buildOrgScopeTenantCacheTag } from "@open-mercato/core/modules/directory/utils/organizationScope";
const metadata = {
  event: "directory.organization.*",
  persistent: false,
  id: "directory:invalidate-org-scope-cache"
};
async function handle(payload, ctx) {
  const data = payload ?? {};
  const tenantId = typeof data.tenantId === "string" ? data.tenantId : null;
  if (!tenantId) return;
  let cache = null;
  try {
    cache = ctx.resolve("cache");
  } catch {
    return;
  }
  if (!cache) return;
  try {
    await cache.deleteByTags([buildOrgScopeTenantCacheTag(tenantId)]);
  } catch {
  }
}
export {
  handle as default,
  metadata
};
//# sourceMappingURL=invalidateOrgScopeCache.js.map
