@voltro/plugin-multitenancy 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -40,7 +40,9 @@ import { YieldableError } from 'effect/Cause';
40
40
  */
41
41
  export declare const assertOwnTenant: (inputTenantId: string, subject: Subject) => void;
42
42
 
43
- export declare const tenant: () => MixinDefinition<TenantFields>;
43
+ export declare const tenant: (options?: {
44
+ readonly index?: boolean;
45
+ }) => MixinDefinition<TenantFields>;
44
46
 
45
47
  declare type TenantFields = {
46
48
  tenantId: ColumnDefinition<string>;
package/dist/mixin.d.ts CHANGED
@@ -3,7 +3,9 @@ import { ColumnDefinition } from '@voltro/database';
3
3
  import { MixinDefinition } from '@voltro/database';
4
4
  import { MixinFields } from '@voltro/database';
5
5
 
6
- export declare const tenant: () => MixinDefinition<TenantFields>;
6
+ export declare const tenant: (options?: {
7
+ readonly index?: boolean;
8
+ }) => MixinDefinition<TenantFields>;
7
9
 
8
10
  declare type TenantFields = {
9
11
  tenantId: ColumnDefinition<string>;
package/dist/mixin.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { defineMixin as e, reference as t, requireTenants as n } from "@voltro/database";
2
2
  import { audit as r } from "@voltro/plugin-audit/mixin";
3
3
  //#region src/mixin.ts
4
- var i = () => e({
4
+ var i = (i) => e({
5
5
  id: "voltro/tenant",
6
6
  requires: [r()],
7
- fields: { tenantId: t(n()) },
8
- indexes: [{ fields: ["tenantId"] }],
7
+ fields: { tenantId: t(n(), { index: i?.index ?? !0 }) },
8
+ indexes: i?.index === !1 ? [] : [{ fields: ["tenantId"] }],
9
9
  behaviors: {
10
10
  defaultWhere: () => "tenantId = ctx.subject.tenantId",
11
11
  beforeInsert: () => "tenant.beforeInsert: stamp tenantId from ctx.subject.tenantId"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-multitenancy",
3
- "version": "0.85.0",
3
+ "version": "0.87.0",
4
4
  "description": "Multi-tenancy plugin — ships the `tenant()` schema mixin (auto-scopes reads, fills tenantId on inserts) plus the `assertOwnTenant` write-guard and `TenantMismatch` typed error.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -43,9 +43,9 @@
43
43
  "node": ">=24.0.0"
44
44
  },
45
45
  "dependencies": {
46
- "@voltro/database": "0.85.0",
47
- "@voltro/plugin-audit": "0.85.0",
48
- "@voltro/protocol": "0.85.0"
46
+ "@voltro/database": "0.87.0",
47
+ "@voltro/plugin-audit": "0.87.0",
48
+ "@voltro/protocol": "0.87.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "effect": "4.0.1"