@smartsoft001/nestjs 2.182.0 → 2.184.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/nestjs",
3
- "version": "2.182.0",
3
+ "version": "2.184.0",
4
4
  "description": "Shared NestJS building blocks: SharedModule with its JWT and permission configuration, PermissionService, the JWT strategy, the @User decorator and the application exception filter.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,8 +9,8 @@
9
9
  "main": "./src/index.js",
10
10
  "types": "./src/index.d.ts",
11
11
  "dependencies": {
12
- "@smartsoft001/domain-core": "2.182.0",
13
- "@smartsoft001/users": "2.182.0",
12
+ "@smartsoft001/domain-core": "2.184.0",
13
+ "@smartsoft001/users": "2.184.0",
14
14
  "passport-jwt": "^4.0.1",
15
15
  "tslib": "^2.3.0"
16
16
  },
@@ -1,3 +1,4 @@
1
+ import { IUser } from '@smartsoft001/users';
1
2
  export interface ISharedPermissions {
2
3
  create: Array<string>;
3
4
  read: Array<string>;
@@ -12,5 +13,15 @@ export declare class SharedConfig {
12
13
  };
13
14
  permissions?: ISharedPermissions;
14
15
  type?: any;
16
+ /**
17
+ * Decides change subscriptions; no policy means no subscription. Called once when a client
18
+ * subscribes, without `type`, and again before each event with the change `type`. On a
19
+ * `'delete'` event the resource is already gone, so do not load it to decide.
20
+ */
21
+ changePolicy?: (context: {
22
+ id: string;
23
+ user: IUser;
24
+ type?: 'create' | 'update' | 'delete';
25
+ }) => boolean | Promise<boolean>;
15
26
  }
16
27
  export type PermissionType = 'create' | 'read' | 'update' | 'delete' | string;
@@ -7,6 +7,12 @@ let SharedConfig = class SharedConfig {
7
7
  tokenConfig;
8
8
  permissions;
9
9
  type;
10
+ /**
11
+ * Decides change subscriptions; no policy means no subscription. Called once when a client
12
+ * subscribes, without `type`, and again before each event with the change `type`. On a
13
+ * `'delete'` event the resource is already gone, so do not load it to decide.
14
+ */
15
+ changePolicy;
10
16
  };
11
17
  exports.SharedConfig = SharedConfig;
12
18
  exports.SharedConfig = SharedConfig = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"shared.config.js","sourceRoot":"","sources":["../../../../../../packages/shared/nestjs/src/lib/shared.config.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAWrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,WAAW,CAGT;IACF,WAAW,CAAsB;IACjC,IAAI,CAAO;CACZ,CAAA;AAPY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAOxB"}
1
+ {"version":3,"file":"shared.config.js","sourceRoot":"","sources":["../../../../../../packages/shared/nestjs/src/lib/shared.config.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAarC,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,WAAW,CAGT;IACF,WAAW,CAAsB;IACjC,IAAI,CAAO;IACX;;;;OAIG;IACH,YAAY,CAIqB;CAClC,CAAA;AAjBY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAiBxB"}