@holoyan/adonisjs-permissions 2.0.0-beta.1 → 2.0.0-beta.2
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/README.md
CHANGED
|
@@ -14,8 +14,8 @@ Checkout other AdonisJS packages
|
|
|
14
14
|
|
|
15
15
|
## Release Notes
|
|
16
16
|
|
|
17
|
-
Version: >=
|
|
18
|
-
*
|
|
17
|
+
Version: >= v2.0.0-beta.2
|
|
18
|
+
* Fixed `permissionQueryHelpers()` mixin leaking internal relations (`_roles`, `_permissions`, `_model_roles`) into the public `related()` API, which caused incorrect IDE type inference on user-defined relations
|
|
19
19
|
|
|
20
20
|
## Table of Contents
|
|
21
21
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { NormalizeConstructor } from '@adonisjs/core/types/helpers';
|
|
2
2
|
import { BaseModel } from '@adonisjs/lucid/orm';
|
|
3
3
|
import { AclModel, ModelIdType } from '../types.js';
|
|
4
|
-
import type { ManyToMany, HasMany } from '@adonisjs/lucid/types/relations';
|
|
5
4
|
import Role from '../models/role.js';
|
|
6
5
|
import { LucidModel, LucidRow, ModelQueryBuilderContract } from '@adonisjs/lucid/types/model';
|
|
7
|
-
import { ModelRole, Permission } from '../../index.js';
|
|
8
6
|
import ModelPermission from '../models/model_permission.js';
|
|
9
7
|
export declare function hasPermissions(): <Model extends NormalizeConstructor<typeof BaseModel>>(superclass: Model) => {
|
|
10
8
|
new (...args: any[]): {
|
|
@@ -362,11 +360,11 @@ export declare function hasPermissions(): <Model extends NormalizeConstructor<ty
|
|
|
362
360
|
} & Model;
|
|
363
361
|
export declare function permissionQueryHelpers(): <Model extends NormalizeConstructor<typeof BaseModel>>(superclass: Model) => {
|
|
364
362
|
new (...args: any[]): {
|
|
365
|
-
_roles:
|
|
363
|
+
_roles: undefined;
|
|
366
364
|
_whereRoles<TargetClass extends Model>(query: ModelQueryBuilderContract<LucidModel, LucidRow>, targetClass: TargetClass, ...roles: string[]): ModelQueryBuilderContract<LucidModel, LucidRow>;
|
|
367
|
-
_permissions:
|
|
365
|
+
_permissions: undefined;
|
|
368
366
|
_whereDirectPermissions<TargetClass extends Model>(query: ModelQueryBuilderContract<LucidModel, LucidRow>, targetClass: TargetClass, permissions: string[], target?: AclModel | Function): ModelQueryBuilderContract<LucidModel, LucidRow>;
|
|
369
|
-
_model_roles:
|
|
367
|
+
_model_roles: undefined;
|
|
370
368
|
_whereRolePermissions<TargetClass extends Model>(query: ModelQueryBuilderContract<LucidModel, LucidRow>, targetClass: TargetClass, permissions: string[], target?: AclModel | Function): ModelQueryBuilderContract<LucidModel, LucidRow>;
|
|
371
369
|
_wherePermissions<TargetClass extends Model>(query: ModelQueryBuilderContract<LucidModel, LucidRow>, targetClass: TargetClass, permissions: string[], target?: AclModel | Function): void;
|
|
372
370
|
$attributes: import("@adonisjs/lucid/types/model").ModelObject;
|
|
@@ -401,7 +399,7 @@ export declare function permissionQueryHelpers(): <Model extends NormalizeConstr
|
|
|
401
399
|
$hydrateOriginals(): void;
|
|
402
400
|
fill(value: Partial<import("@adonisjs/lucid/types/model").ModelAttributes</*elided*/ any>>, allowExtraProperties?: boolean): /*elided*/ any;
|
|
403
401
|
merge(value: Partial<import("@adonisjs/lucid/types/model").ModelAttributes</*elided*/ any>>, allowExtraProperties?: boolean): /*elided*/ any;
|
|
404
|
-
isDirty(fields?: undefined[] | undefined): boolean;
|
|
402
|
+
isDirty(fields?: "_roles" | "_permissions" | "_model_roles" | ("_roles" | "_permissions" | "_model_roles" | undefined)[] | undefined): boolean;
|
|
405
403
|
enableForceUpdate(): /*elided*/ any;
|
|
406
404
|
save(): Promise</*elided*/ any>;
|
|
407
405
|
saveQuietly(): Promise</*elided*/ any>;
|
|
@@ -425,7 +423,7 @@ export declare function permissionQueryHelpers(): <Model extends NormalizeConstr
|
|
|
425
423
|
toObject(): import("@adonisjs/lucid/types/model").ModelObject;
|
|
426
424
|
toJSON(): import("@adonisjs/lucid/types/model").ModelObject;
|
|
427
425
|
toAttributes(): Record<string, any>;
|
|
428
|
-
related<Name_2 extends
|
|
426
|
+
related<Name_2 extends undefined>(relation: Name_2): NonNullable</*elided*/ any[Name_2]> extends import("@adonisjs/lucid/types/relations").ModelRelations<LucidModel, LucidModel> ? (import("@adonisjs/lucid/types/relations").ModelRelations<LucidModel, LucidModel> & /*elided*/ any[Name_2] & {})["client"] : never;
|
|
429
427
|
};
|
|
430
428
|
connection?: string | undefined;
|
|
431
429
|
after: {
|