@aptly-as/express-scope 1.0.0 → 1.0.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/lib/Scope.d.ts +5 -5
- package/lib/ScopeHandler.d.ts +1 -1
- package/lib/ScopeMiddleware.d.ts +3 -3
- package/lib/types.d.ts +1 -1
- package/package.json +5 -6
package/lib/Scope.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
1
|
+
import type { NextFunction, Request, Response } from 'express';
|
|
2
2
|
import { ScopeAccess, ScopeFn, ScopeRolesSchema, ScopeModuleSchema, ScopeRequest, ScopeRequestItem, ScopeRequestValidate } from './types.js';
|
|
3
3
|
export default class Scope<R extends Request, SCOPE extends string, MODULE extends ScopeModuleSchema<string, SCOPE>, USER extends ScopeRolesSchema<string, SCOPE>, ORG extends ScopeRolesSchema<string, SCOPE>> {
|
|
4
4
|
private _modules;
|
|
@@ -14,13 +14,13 @@ export default class Scope<R extends Request, SCOPE extends string, MODULE exten
|
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated use access instead
|
|
16
16
|
*/
|
|
17
|
-
crud(scope: SCOPE | SCOPE[], access: ScopeAccess, validate?: ScopeRequestValidate<R>): (req: R, res: Response, next?: NextFunction | undefined) => boolean | void | Response
|
|
18
|
-
access(scope: SCOPE | SCOPE[], access: ScopeAccess, validate?: ScopeRequestValidate<R>): (req: R, res: Response, next?: NextFunction) => boolean | void | Response
|
|
17
|
+
crud(scope: SCOPE | SCOPE[], access: ScopeAccess, validate?: ScopeRequestValidate<R>): (req: R, res: Response<any, Record<string, any>>, next?: NextFunction | undefined) => boolean | void | Response<any, Record<string, any>>;
|
|
18
|
+
access(scope: SCOPE | SCOPE[], access: ScopeAccess, validate?: ScopeRequestValidate<R>): (req: R, res: Response, next?: NextFunction) => boolean | void | Response<any, Record<string, any>>;
|
|
19
19
|
/**
|
|
20
20
|
* @deprecated use list instead
|
|
21
21
|
*/
|
|
22
|
-
validate(crudArray: ScopeRequestItem<R, SCOPE> | Array<ScopeRequestItem<R, SCOPE>>): (req: R, res: Response, next?: NextFunction | undefined) => boolean | void | Response
|
|
23
|
-
list(crudArray: ScopeRequestItem<R, SCOPE> | Array<ScopeRequestItem<R, SCOPE>>): (req: R, res: Response, next?: NextFunction) => boolean | void | Response
|
|
22
|
+
validate(crudArray: ScopeRequestItem<R, SCOPE> | Array<ScopeRequestItem<R, SCOPE>>): (req: R, res: Response<any, Record<string, any>>, next?: NextFunction | undefined) => boolean | void | Response<any, Record<string, any>>;
|
|
23
|
+
list(crudArray: ScopeRequestItem<R, SCOPE> | Array<ScopeRequestItem<R, SCOPE>>): (req: R, res: Response, next?: NextFunction) => boolean | void | Response<any, Record<string, any>>;
|
|
24
24
|
get<K extends 'json' | 'next' | 'return' = 'json'>(action?: K, key?: K extends 'next' ? keyof R : undefined): (req: R, res: Response, next: NextFunction) => any;
|
|
25
25
|
req(req: R, res: Response): ScopeRequest<R, SCOPE>;
|
|
26
26
|
private _getScopeArray;
|
package/lib/ScopeHandler.d.ts
CHANGED
package/lib/ScopeMiddleware.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Request } from 'express';
|
|
1
|
+
import type { Request } from 'express';
|
|
2
2
|
import Scope from './Scope.js';
|
|
3
3
|
import { ScopeValidateFn } from './types.js';
|
|
4
4
|
export declare class ScopeMiddleware<R extends Request, S extends string> {
|
|
@@ -9,6 +9,6 @@ export declare class ScopeMiddleware<R extends Request, S extends string> {
|
|
|
9
9
|
readonly DELETE: ScopeValidateFn<R>;
|
|
10
10
|
constructor(_scope: Scope<R, S, any, any, any>, scope: S | S[]);
|
|
11
11
|
get scope(): Scope<R, S, any, any, any>;
|
|
12
|
-
get list(): (crudArray: import("./types.js").ScopeRequestItem<R, S> | import("./types.js").ScopeRequestItem<R, S>[]) => (req: R, res: import("express").Response, next?: import("express").NextFunction | undefined) => boolean | void | import("express").Response
|
|
13
|
-
get validate(): (crudArray: import("./types.js").ScopeRequestItem<R, S> | import("./types.js").ScopeRequestItem<R, S>[]) => (req: R, res: import("express").Response, next?: import("express").NextFunction | undefined) => boolean | void | import("express").Response
|
|
12
|
+
get list(): (crudArray: import("./types.js").ScopeRequestItem<R, S> | import("./types.js").ScopeRequestItem<R, S>[]) => (req: R, res: import("express").Response<any, Record<string, any>>, next?: import("express").NextFunction | undefined) => boolean | void | import("express").Response<any, Record<string, any>>;
|
|
13
|
+
get validate(): (crudArray: import("./types.js").ScopeRequestItem<R, S> | import("./types.js").ScopeRequestItem<R, S>[]) => (req: R, res: import("express").Response<any, Record<string, any>>, next?: import("express").NextFunction | undefined) => boolean | void | import("express").Response<any, Record<string, any>>;
|
|
14
14
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
1
|
+
import type { NextFunction, Request, Response } from 'express';
|
|
2
2
|
export type ScopeAccessValue = 'C' | 'CR' | 'CRU' | 'CRUD' | 'R' | 'RU' | 'RUD' | 'U' | 'UD' | 'D';
|
|
3
3
|
export type ScopeAccess = 'C' | 'R' | 'U' | 'D';
|
|
4
4
|
export type ScopeAccessSchema<SCOPE extends string> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptly-as/express-scope",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -23,22 +23,21 @@
|
|
|
23
23
|
"author": "Emil A Olsen (EmilsWebbod)",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/express": "^4.17.
|
|
26
|
+
"@types/express": "^4.17.17",
|
|
27
27
|
"@types/sinon": "^10.0.15",
|
|
28
28
|
"@vitest/ui": "^0.31.1",
|
|
29
|
-
"coveralls": "^3.0.7",
|
|
30
29
|
"express": "^4.17.1",
|
|
31
30
|
"husky": "^8.0.3",
|
|
32
31
|
"lint-staged": "^13.2.2",
|
|
33
|
-
"nyc": "^14.1.1",
|
|
34
32
|
"prettier": "^2.8.8",
|
|
35
|
-
"pretty-quick": "^2.0.1",
|
|
36
33
|
"sinon": "^15.0.4",
|
|
37
|
-
"ts-node": "^8.5.0",
|
|
38
34
|
"tslint": "^5.20.1",
|
|
39
35
|
"typescript": "^5.0.4",
|
|
40
36
|
"vitest": "^0.31.1"
|
|
41
37
|
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"express": "*"
|
|
40
|
+
},
|
|
42
41
|
"files": [
|
|
43
42
|
"lib"
|
|
44
43
|
],
|