@bearei/server-common 0.0.122 → 0.0.124
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/access/access.guard.js +2 -2
- package/dist/access/access.guard.js.map +1 -1
- package/dist/{action-logs/action-logs.interface.d.ts → action-log/action-log.interface.d.ts} +3 -3
- package/dist/{action-logs/action-logs.interface.js → action-log/action-log.interface.js} +1 -1
- package/dist/action-log/action-log.interface.js.map +1 -0
- package/dist/action-log/action-log.module.d.ts +2 -0
- package/dist/{action-logs/action-logs.module.js → action-log/action-log.module.js} +9 -9
- package/dist/action-log/action-log.module.js.map +1 -0
- package/dist/action-log/action-log.service.d.ts +9 -0
- package/dist/{action-logs/action-logs.service.js → action-log/action-log.service.js} +10 -12
- package/dist/action-log/action-log.service.js.map +1 -0
- package/dist/action-log/index.d.ts +3 -0
- package/dist/{action-logs → action-log}/index.js +3 -3
- package/dist/action-log/index.js.map +1 -0
- package/dist/authentication/authentication.interface.d.ts +2 -2
- package/dist/authentication/authentication.service.d.ts +2 -2
- package/dist/authentication/authentication.service.js +2 -2
- package/dist/authentication/authentication.service.js.map +1 -1
- package/dist/base/base.interface.d.ts +6 -6
- package/dist/base/base.module.js +2 -2
- package/dist/base/base.module.js.map +1 -1
- package/dist/base/base.service.d.ts +12 -12
- package/dist/base/base.service.js +62 -114
- package/dist/base/base.service.js.map +1 -1
- package/dist/decorators/authentication-permission.decorator.d.ts +3 -0
- package/dist/decorators/authentication-permission.decorator.js +8 -0
- package/dist/decorators/authentication-permission.decorator.js.map +1 -0
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +1 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/external/external.interface.d.ts +3 -3
- package/dist/external/external.service.d.ts +3 -3
- package/dist/external/external.service.js +7 -11
- package/dist/external/external.service.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/jwt/jwt.module.js +5 -20
- package/dist/jwt/jwt.module.js.map +1 -1
- package/dist/permission/index.d.ts +2 -0
- package/dist/{permissions → permission}/index.js +2 -2
- package/dist/permission/index.js.map +1 -0
- package/dist/{permissions/permissions.guard.js → permission/permission.guard.js} +5 -5
- package/dist/permission/permission.guard.js.map +1 -0
- package/dist/permission/permission.interface.d.ts +58 -0
- package/dist/permission/permission.interface.js +63 -0
- package/dist/permission/permission.interface.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/action-logs/action-logs.interface.js.map +0 -1
- package/dist/action-logs/action-logs.module.d.ts +0 -2
- package/dist/action-logs/action-logs.module.js.map +0 -1
- package/dist/action-logs/action-logs.service.d.ts +0 -9
- package/dist/action-logs/action-logs.service.js.map +0 -1
- package/dist/action-logs/index.d.ts +0 -3
- package/dist/action-logs/index.js.map +0 -1
- package/dist/decorators/authentication-permissions.decorator.d.ts +0 -3
- package/dist/decorators/authentication-permissions.decorator.js +0 -8
- package/dist/decorators/authentication-permissions.decorator.js.map +0 -1
- package/dist/permissions/index.d.ts +0 -2
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/permissions.guard.js.map +0 -1
- package/dist/permissions/permissions.interface.d.ts +0 -58
- package/dist/permissions/permissions.interface.js +0 -63
- package/dist/permissions/permissions.interface.js.map +0 -1
- /package/dist/{permissions/permissions.guard.d.ts → permission/permission.guard.d.ts} +0 -0
|
@@ -63,8 +63,8 @@ let AccessGuard = class AccessGuard {
|
|
|
63
63
|
serviceName: this.configService.get('service.name')
|
|
64
64
|
})(subject).then(handleCompareResult(request));
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
66
|
+
const disabledGuestAccess = subject === 'guest' && !requiredAccesses?.includes(access_interface_1.Access.GUEST);
|
|
67
|
+
if (disabledGuestAccess) {
|
|
68
68
|
(0, utils_1.throwHTTPError)({
|
|
69
69
|
code: '401002',
|
|
70
70
|
message: 'Guest user do not have access to current resource'
|
|
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{action-logs/action-logs.interface.d.ts → action-log/action-log.interface.d.ts}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Action, ActionResult, RequestHeaders } from '../app.interface';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ActionLogOptions {
|
|
3
3
|
action: Action;
|
|
4
|
-
|
|
4
|
+
enabledLog?: boolean;
|
|
5
5
|
headers: RequestHeaders;
|
|
6
6
|
message?: string;
|
|
7
7
|
raw: Record<string, unknown>;
|
|
8
8
|
serviceName: string;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface CreateActionLogOptions extends ActionLogOptions {
|
|
11
11
|
result: ActionResult;
|
|
12
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-log.interface.js","sourceRoot":"","sources":["../../src/action-log/action-log.interface.ts"],"names":[],"mappings":""}
|
|
@@ -6,18 +6,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.ActionLogModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const external_1 = require("../external");
|
|
12
|
-
const
|
|
13
|
-
let
|
|
12
|
+
const action_log_service_1 = require("./action-log.service");
|
|
13
|
+
let ActionLogModule = class ActionLogModule {
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
15
|
+
exports.ActionLogModule = ActionLogModule;
|
|
16
|
+
exports.ActionLogModule = ActionLogModule = __decorate([
|
|
17
17
|
(0, common_1.Module)({
|
|
18
|
-
exports: [
|
|
18
|
+
exports: [action_log_service_1.ActionLogService],
|
|
19
19
|
imports: [external_1.ExternalModule],
|
|
20
|
-
providers: [
|
|
20
|
+
providers: [action_log_service_1.ActionLogService]
|
|
21
21
|
})
|
|
22
|
-
],
|
|
23
|
-
//# sourceMappingURL=action-
|
|
22
|
+
], ActionLogModule);
|
|
23
|
+
//# sourceMappingURL=action-log.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-log.module.js","sourceRoot":"","sources":["../../src/action-log/action-log.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAqC;AACrC,0CAA0C;AAC1C,6DAAqD;AAO9C,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAL3B,IAAA,eAAM,EAAC;QACA,OAAO,EAAE,CAAC,qCAAgB,CAAC;QAC3B,OAAO,EAAE,CAAC,yBAAc,CAAC;QACzB,SAAS,EAAE,CAAC,qCAAgB,CAAC;KACpC,CAAC;GACW,eAAe,CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExternalService } from '../external';
|
|
2
|
+
import { ActionLogOptions, CreateActionLogOptions } from './action-log.interface';
|
|
3
|
+
export declare class ActionLogService {
|
|
4
|
+
private readonly externalService;
|
|
5
|
+
constructor(externalService: ExternalService);
|
|
6
|
+
success(options: ActionLogOptions): (data: Record<string, unknown>) => Promise<void>;
|
|
7
|
+
failure(options: ActionLogOptions): (data: Record<string, unknown>) => Promise<void>;
|
|
8
|
+
create({ headers, enabledLog, ...options }: CreateActionLogOptions): (data: Record<string, unknown>) => Promise<void>;
|
|
9
|
+
}
|
|
@@ -9,11 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.ActionLogService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const app_interface_1 = require("../app.interface");
|
|
15
15
|
const external_1 = require("../external");
|
|
16
|
-
let
|
|
16
|
+
let ActionLogService = class ActionLogService {
|
|
17
17
|
externalService;
|
|
18
18
|
constructor(externalService) {
|
|
19
19
|
this.externalService = externalService;
|
|
@@ -24,20 +24,18 @@ let ActionLogsService = class ActionLogsService {
|
|
|
24
24
|
failure(options) {
|
|
25
25
|
return async (data) => this.create({ ...options, result: app_interface_1.ActionResult.FAILURE })(data);
|
|
26
26
|
}
|
|
27
|
-
create({ headers,
|
|
27
|
+
create({ headers, enabledLog = true, ...options }) {
|
|
28
28
|
return async (data) => {
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
...args,
|
|
32
|
-
data
|
|
33
|
-
});
|
|
29
|
+
if (!enabledLog) {
|
|
30
|
+
return;
|
|
34
31
|
}
|
|
32
|
+
await this.externalService.createActionLogs(headers)({ ...options, data });
|
|
35
33
|
};
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
36
|
+
exports.ActionLogService = ActionLogService;
|
|
37
|
+
exports.ActionLogService = ActionLogService = __decorate([
|
|
40
38
|
(0, common_1.Injectable)(),
|
|
41
39
|
__metadata("design:paramtypes", [external_1.ExternalService])
|
|
42
|
-
],
|
|
43
|
-
//# sourceMappingURL=action-
|
|
40
|
+
], ActionLogService);
|
|
41
|
+
//# sourceMappingURL=action-log.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-log.service.js","sourceRoot":"","sources":["../../src/action-log/action-log.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AACzC,oDAA6C;AAC7C,0CAA2C;AAIpC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACQ;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,OAAO,CAAC,OAAyB;QACzB,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CACvC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7E,CAAC;IAED,OAAO,CAAC,OAAyB;QACzB,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CACvC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7E,CAAC;IAED,MAAM,CAAC,EAAC,OAAO,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,OAAO,EAAyB;QAC/D,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE;YACvC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACV,OAAM;YACd,CAAC;YAED,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAC,GAAG,OAAO,EAAE,IAAI,EAAC,CAAC,CAAA;QAChF,CAAC,CAAA;IACT,CAAC;CACR,CAAA;AAtBY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAEyC,0BAAe;GADxD,gBAAgB,CAsB5B"}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./action-
|
|
18
|
-
__exportStar(require("./action-
|
|
19
|
-
__exportStar(require("./action-
|
|
17
|
+
__exportStar(require("./action-log.interface"), exports);
|
|
18
|
+
__exportStar(require("./action-log.module"), exports);
|
|
19
|
+
__exportStar(require("./action-log.service"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action-log/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,sDAAmC;AACnC,uDAAoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
1
|
+
import { AuthenticationExternalPermissionOptions } from '../external';
|
|
2
|
+
export type AuthenticationPermissionOptions = AuthenticationExternalPermissionOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RequestHeaders } from '../app.interface';
|
|
2
2
|
import { ExternalService } from '../external';
|
|
3
|
-
import {
|
|
3
|
+
import { AuthenticationPermissionOptions } from './authentication.interface';
|
|
4
4
|
export declare class AuthenticationService {
|
|
5
5
|
private readonly externalService;
|
|
6
6
|
constructor(externalService: ExternalService);
|
|
7
|
-
|
|
7
|
+
authenticationPermission(headers: RequestHeaders): (options: AuthenticationPermissionOptions) => Promise<any>;
|
|
8
8
|
}
|
|
@@ -17,8 +17,8 @@ let AuthenticationService = class AuthenticationService {
|
|
|
17
17
|
constructor(externalService) {
|
|
18
18
|
this.externalService = externalService;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
return async (options) => this.externalService.
|
|
20
|
+
authenticationPermission(headers) {
|
|
21
|
+
return async (options) => this.externalService.authenticationUserPermission(headers)(options);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
exports.AuthenticationService = AuthenticationService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../src/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AAEzC,0CAA2C;AAIpC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACG;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,
|
|
1
|
+
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../src/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AAEzC,0CAA2C;AAIpC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACG;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,wBAAwB,CAAC,OAAuB;QACxC,OAAO,KAAK,EAAE,OAAwC,EAAE,EAAE,CAClD,IAAI,CAAC,eAAe,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAA;IACnF,CAAC;CACR,CAAA;AAPY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAEyC,0BAAe;GADxD,qBAAqB,CAOjC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { DeepPartial, FindManyOptions, FindOptionsWhere, Repository } from 'typeorm';
|
|
2
|
-
import {
|
|
2
|
+
import { ActionLogOptions } from '../action-log';
|
|
3
3
|
import { IndexDTO, NotIdDTO } from '../app.dto';
|
|
4
4
|
import { HTTPError, RequestHeaders } from '../app.interface';
|
|
5
5
|
import { ThrowHTTPErrorOptions } from '../utils';
|
|
6
|
-
export interface BaseServiceOptions<T> extends Pick<
|
|
6
|
+
export interface BaseServiceOptions<T> extends Pick<ActionLogOptions, 'enabledLog'> {
|
|
7
7
|
entityOptions: DeepPartial<T>;
|
|
8
8
|
findOptions: FindOptionsWhere<T>;
|
|
9
9
|
headers: RequestHeaders;
|
|
10
|
-
preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | '
|
|
10
|
+
preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'actionLogOptions'>;
|
|
11
11
|
serviceName: string;
|
|
12
12
|
}
|
|
13
13
|
export type CreateOptions<T> = Omit<BaseServiceOptions<T>, 'findOptions'>;
|
|
14
14
|
export type DelOptions<T> = Omit<BaseServiceOptions<T>, 'entityOptions'>;
|
|
15
15
|
export type UpdateOptions<T> = Omit<BaseServiceOptions<T>, 'preValidateOptions'> & {
|
|
16
|
-
preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | '
|
|
16
|
+
preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'actionLogOptions'> & {
|
|
17
17
|
validateKeys?: (keyof FindOptionsWhere<T>)[];
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -40,10 +40,10 @@ export interface UpdateAssociationOptions<T> extends Omit<BaseServiceOptions<T>,
|
|
|
40
40
|
entityIds: string[];
|
|
41
41
|
}
|
|
42
42
|
export interface FindOneOptions<T> extends Omit<BaseServiceOptions<T>, 'headers' | 'entityOptions'> {
|
|
43
|
-
|
|
43
|
+
actionLogOptions?: ActionLogOptions;
|
|
44
44
|
}
|
|
45
45
|
export interface PreValidateOptions<T> {
|
|
46
|
-
|
|
46
|
+
actionLogOptions?: ActionLogOptions;
|
|
47
47
|
findOptions: FindOptionsWhere<T> & NotIdDTO;
|
|
48
48
|
orValidateKeysGroups?: (keyof FindOptionsWhere<T>)[][];
|
|
49
49
|
serviceName: string;
|
package/dist/base/base.module.js
CHANGED
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.BaseModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const
|
|
11
|
+
const action_log_1 = require("../action-log");
|
|
12
12
|
const base_service_1 = require("./base.service");
|
|
13
13
|
let BaseModule = class BaseModule {
|
|
14
14
|
};
|
|
@@ -16,7 +16,7 @@ exports.BaseModule = BaseModule;
|
|
|
16
16
|
exports.BaseModule = BaseModule = __decorate([
|
|
17
17
|
(0, common_1.Module)({
|
|
18
18
|
exports: [base_service_1.BaseService],
|
|
19
|
-
imports: [
|
|
19
|
+
imports: [action_log_1.ActionLogModule],
|
|
20
20
|
providers: [base_service_1.BaseService]
|
|
21
21
|
})
|
|
22
22
|
], BaseModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.module.js","sourceRoot":"","sources":["../../src/base/base.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"base.module.js","sourceRoot":"","sources":["../../src/base/base.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAqC;AACrC,8CAA6C;AAC7C,iDAA0C;AAOnC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IALtB,IAAA,eAAM,EAAC;QACA,OAAO,EAAE,CAAC,0BAAW,CAAC;QACtB,OAAO,EAAE,CAAC,4BAAe,CAAC;QAC1B,SAAS,EAAE,CAAC,0BAAW,CAAC;KAC/B,CAAC;GACW,UAAU,CAAG"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EntityManager, Repository } from 'typeorm';
|
|
2
|
-
import {
|
|
2
|
+
import { ActionLogOptions, ActionLogService } from '../action-log';
|
|
3
3
|
import { CommonEntity } from '../app.entity';
|
|
4
4
|
import { CountOptions, CountResult, CreateOptions, DelOptions, FindOneOptions, FindOptions, PreValidateOptions, ThrowErrorOptions, UpdateAssociationOptions, UpdateOptions } from './base.interface';
|
|
5
5
|
export declare class BaseService {
|
|
6
|
-
private readonly
|
|
7
|
-
constructor(
|
|
8
|
-
create<T extends CommonEntity>({
|
|
9
|
-
del<T extends CommonEntity>({ findOptions, serviceName, headers,
|
|
10
|
-
update<T extends CommonEntity>({
|
|
6
|
+
private readonly actionLogService;
|
|
7
|
+
constructor(actionLogService: ActionLogService);
|
|
8
|
+
create<T extends CommonEntity>({ enabledLog, entityOptions, headers, preValidateOptions, serviceName }: CreateOptions<T>): (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<T>>;
|
|
9
|
+
del<T extends CommonEntity>({ findOptions, serviceName, headers, enabledLog }: DelOptions<T>): (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<void>>;
|
|
10
|
+
update<T extends CommonEntity>({ enabledLog, entityOptions, findOptions, headers, preValidateOptions, serviceName }: UpdateOptions<T>): (repository: Repository<T>) => (rawEntity?: T) => Promise<(entityManager?: EntityManager) => Promise<T>>;
|
|
11
11
|
find<T extends CommonEntity>({ findOptions, findManyOptions }: FindOptions<T>): (repository: Repository<T>) => Promise<{
|
|
12
12
|
limit: string;
|
|
13
13
|
offset: string;
|
|
@@ -15,14 +15,14 @@ export declare class BaseService {
|
|
|
15
15
|
total: string;
|
|
16
16
|
}>;
|
|
17
17
|
count<T extends CommonEntity>({ findOptions, findManyOptions }: CountOptions<T>): (repository: Repository<T>) => Promise<CountResult>;
|
|
18
|
-
findOne<T extends CommonEntity>({ serviceName, findOptions,
|
|
18
|
+
findOne<T extends CommonEntity>({ serviceName, findOptions, actionLogOptions }: FindOneOptions<T>): (repository: Repository<T>) => Promise<T>;
|
|
19
19
|
updateAssociation<T extends CommonEntity & {
|
|
20
20
|
protected?: boolean;
|
|
21
|
-
}>({ addEntityOptions,
|
|
22
|
-
preValidate<T extends CommonEntity>({
|
|
23
|
-
checkProhibited<T extends CommonEntity>(
|
|
21
|
+
}>({ addEntityOptions, enabledLog, entityIds: rawEntityIds, findOptions, headers, serviceName }: UpdateAssociationOptions<T>): (associationKey: string) => (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<T[]>>;
|
|
22
|
+
preValidate<T extends CommonEntity>({ actionLogOptions, findOptions, orValidateKeysGroups, serviceName, validateMethod }: PreValidateOptions<T>): Promise<(repository: Repository<T>) => Promise<void>>;
|
|
23
|
+
checkProhibited<T extends CommonEntity>(actionLogOptions?: ActionLogOptions): (entity: T & {
|
|
24
24
|
protected?: boolean;
|
|
25
25
|
}) => Promise<void>;
|
|
26
|
-
|
|
27
|
-
throwError({ errorType, ...
|
|
26
|
+
actionLogSuccess<T extends CommonEntity>(actionLogOptions: ActionLogOptions): (entity: T | T[]) => Promise<void>;
|
|
27
|
+
throwError({ errorType, ...restOptions }: ThrowErrorOptions): (actionLogOptions: ActionLogOptions) => Promise<void>;
|
|
28
28
|
}
|