- @objectql/types@4.2.2
- a0aa26a: Unify all package versions and release a patch
- Updated dependencies [a0aa26a]
- @objectql/types@4.2.1
- Initial Release: Multi-tenancy plugin for automatic tenant isolation
- Query Filtering: Auto-inject
tenant_idfilters on all queries viabeforeFindhook - Auto-set Tenant ID: Automatically set
tenant_idon new records viabeforeCreatehook - Cross-tenant Protection: Verify
tenant_idon updates and deletes viabeforeUpdateandbeforeDeletehooks - Strict Mode: Prevent cross-tenant data access with configurable error handling
- Custom Tenant Resolver: Support custom functions to extract tenant ID from context
- Schema Isolation: Support for shared tables, table-prefix, and separate-schema modes
- Exempt Objects: Configure objects that should not be tenant-isolated
- Audit Logging: Track all tenant-related operations with in-memory audit log
- Comprehensive Tests: Unit and integration tests with Memory driver
- TypeScript Support: Full type definitions with Zod schema validation
- Plugin-based implementation (not core modification)
- Hook-based filter injection (operates at Hook layer, above SQL generation)
- Zero changes to core query compilation pipeline
- Compatible with
@objectql/plugin-securityfor tenant-scoped RBAC
MultiTenancyPlugin: Main plugin class implementingRuntimePlugininterfaceTenantResolver: Extracts tenant ID from request contextQueryFilterInjector: Injects tenant filters into queriesMutationGuard: Verifies tenant isolation on mutationsTenantIsolationError: Custom error for tenant violations
All configuration options are validated via Zod schema:
enabled: Enable/disable plugin (default: true)tenantField: Field name for tenant ID (default: 'tenant_id')strictMode: Prevent cross-tenant access (default: true)tenantResolver: Custom tenant extraction functionschemaIsolation: Isolation mode (default: 'none')exemptObjects: Objects exempt from isolation (default: [])autoAddTenantField: Auto-create tenant_id field (default: true)validateTenantContext: Validate tenant presence (default: true)throwOnMissingTenant: Error on missing tenant (default: true)enableAudit: Enable audit logging (default: true)
- README with comprehensive usage examples
- JSDoc comments on all public APIs
- Integration examples with plugin-security