@rhino-dev/rhino-nestjs 4.7.2 → 4.8.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/README.md +2 -2
- package/dist/interfaces/rhino-config.interface.d.ts +17 -0
- package/dist/policies/resource-policy.d.ts +9 -0
- package/dist/policies/resource-policy.js +12 -0
- package/dist/policies/resource-policy.js.map +1 -1
- package/dist/services/query-builder.service.d.ts +62 -2
- package/dist/services/query-builder.service.js +192 -19
- package/dist/services/query-builder.service.js.map +1 -1
- package/dist/services/resource.service.js +19 -10
- package/dist/services/resource.service.js.map +1 -1
- package/dist/services/scope.service.d.ts +19 -1
- package/dist/services/scope.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/stubs/skills/rhino-policy.md +3 -1
|
@@ -3,6 +3,12 @@ export interface ScopeContext {
|
|
|
3
3
|
user?: any;
|
|
4
4
|
organization?: any;
|
|
5
5
|
userRole?: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Arguments the client sent for a named scope, bound by name to the
|
|
8
|
+
* parameters the scope class declares in `static params`. Empty for a scope
|
|
9
|
+
* that declares none.
|
|
10
|
+
*/
|
|
11
|
+
args?: Record<string, any>;
|
|
6
12
|
}
|
|
7
13
|
export interface RhinoScope {
|
|
8
14
|
apply(where: Record<string, any>, context: ScopeContext): Record<string, any>;
|
|
@@ -15,7 +21,19 @@ export interface RhinoScope {
|
|
|
15
21
|
* to drop the org / filter / search / soft-delete constraints.
|
|
16
22
|
*/
|
|
17
23
|
export interface RhinoNamedScope {
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Return a Prisma where-fragment; Rhino ANDs it with the existing where.
|
|
26
|
+
* Client-supplied arguments arrive as `context.args`, keyed by the parameter
|
|
27
|
+
* names the class declares:
|
|
28
|
+
*
|
|
29
|
+
* class WindowScope implements RhinoNamedScope {
|
|
30
|
+
* static params = ['from', 'to'];
|
|
31
|
+
* static optionalParams = ['to'];
|
|
32
|
+
* apply(ctx: ScopeContext) {
|
|
33
|
+
* return { createdAt: { gte: ctx.args!.from, lte: ctx.args!.to } };
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
19
37
|
apply(context: ScopeContext): Record<string, any>;
|
|
20
38
|
}
|
|
21
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.service.js","sourceRoot":"","sources":["../../src/services/scope.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAE5C,+DAA2D;
|
|
1
|
+
{"version":3,"file":"scope.service.js","sourceRoot":"","sources":["../../src/services/scope.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAE5C,+DAA2D;AA0C3D;;;GAGG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,KAAK,CAAC,KAA0B,EAAE,GAAsB,EAAE,GAAiB;QACzE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;QAChC,IAAI,MAAM,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAC1B,KAAK,MAAM,UAAU,IAAI,MAAM,EAAE,CAAC;YAChC,MAAM,KAAK,GAAG,IAAK,UAAkB,EAAE,CAAC;YACxC,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBACtC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC;YAC9C,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,UAAU,CACR,IAAY,EACZ,KAA0B,EAC1B,GAAsB,EACtB,GAAiB;QAEjB,MAAM,UAAU,GACd,GAAG,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC;YAC5E,CAAC,CAAC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