@bearei/server-common 0.0.3 → 0.0.5
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/action-log/action-log.service.js +1 -1
- package/dist/action-log/action-log.service.js.map +1 -1
- package/dist/app.decorator.js +4 -1
- package/dist/app.decorator.js.map +1 -1
- package/dist/app.dto.d.ts +1 -2
- package/dist/app.dto.js +4 -9
- package/dist/app.dto.js.map +1 -1
- package/dist/app.entity.js +2 -10
- package/dist/app.entity.js.map +1 -1
- package/dist/app.interface.d.ts +0 -5
- package/dist/app.interface.js.map +1 -1
- package/dist/authentication/access/access.guard.d.ts +1 -1
- package/dist/authentication/access/access.guard.js +8 -8
- package/dist/authentication/access/access.guard.js.map +1 -1
- package/dist/authentication/access-interceptor/access-interceptor.d.ts +4 -0
- package/dist/authentication/access-interceptor/access-interceptor.js +24 -0
- package/dist/authentication/access-interceptor/access-interceptor.js.map +1 -0
- package/dist/authentication/access-interceptor/index.d.ts +1 -0
- package/dist/authentication/access-interceptor/index.js +18 -0
- package/dist/authentication/access-interceptor/index.js.map +1 -0
- package/dist/authentication/auth/auth.interface.d.ts +1 -2
- package/dist/authentication/auth/auth.service.d.ts +4 -3
- package/dist/authentication/auth/auth.service.js +4 -4
- package/dist/authentication/auth/auth.service.js.map +1 -1
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/index.js +1 -0
- package/dist/authentication/index.js.map +1 -1
- package/dist/authentication/permission/permission.guard.js +1 -1
- package/dist/authentication/permission/permission.guard.js.map +1 -1
- package/dist/base/base.interface.d.ts +3 -5
- package/dist/base/base.service.d.ts +4 -4
- package/dist/base/base.service.js +107 -79
- package/dist/base/base.service.js.map +1 -1
- package/dist/base/index.d.ts +1 -0
- package/dist/base/index.js +1 -0
- package/dist/base/index.js.map +1 -1
- package/dist/common.d.ts +1 -0
- package/dist/common.js +36 -1
- package/dist/common.js.map +1 -1
- package/dist/external/external.interface.d.ts +11 -15
- package/dist/external/external.module.js +4 -1
- package/dist/external/external.module.js.map +1 -1
- package/dist/external/external.service.d.ts +6 -5
- package/dist/external/external.service.js +35 -37
- package/dist/external/external.service.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/redis/redis.module.js +4 -1
- package/dist/redis/redis.module.js.map +1 -1
- package/dist/redis/redis.service.js +4 -1
- package/dist/redis/redis.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/util/error.util.d.ts +2 -2
- package/dist/util/error.util.js +9 -6
- package/dist/util/error.util.js.map +1 -1
- package/dist/util/format.util.d.ts +1 -1
- package/dist/util/format.util.js +1 -1
- package/dist/util/format.util.js.map +1 -1
- package/dist/util/util.interface.d.ts +1 -1
- package/package.json +10 -7
|
@@ -24,7 +24,7 @@ let ActionLogService = class ActionLogService {
|
|
|
24
24
|
return async (data) => this.create({ ...options, result: app_interface_1.ActionResult.FAILURE })(data);
|
|
25
25
|
}
|
|
26
26
|
create({ headers, enableLogging = true, ...args }) {
|
|
27
|
-
return async (data) => enableLogging && (await this.externalService.createActionLog({
|
|
27
|
+
return async (data) => enableLogging && (await this.externalService.createActionLog(headers)({ ...args, data }));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
exports.ActionLogService = ActionLogService;
|
|
@@ -1 +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;IACzB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,OAAO,CAAC,OAAyB;QAC7B,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACjH,CAAC;IAED,OAAO,CAAC,OAAyB;QAC7B,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACjH,CAAC;IAED,MAAM,CAAC,EAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,IAAI,EAAyB;QACnE,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAC3C,aAAa,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,
|
|
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;IACzB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,OAAO,CAAC,OAAyB;QAC7B,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACjH,CAAC;IAED,OAAO,CAAC,OAAyB;QAC7B,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,4BAAY,CAAC,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACjH,CAAC;IAED,MAAM,CAAC,EAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,IAAI,EAAyB;QACnE,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAC3C,aAAa,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC,CAAA;IAC/F,CAAC;CACJ,CAAA;AAfY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAEqC,0BAAe;GADpD,gBAAgB,CAe5B"}
|
package/dist/app.decorator.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Public = exports.AuthPermission = exports.IS_PUBLIC_KEY = exports.AUTH_PERMISSIONS_KEY = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
7
|
+
const common_1 = __importDefault(require("@nestjs/common"));
|
|
5
8
|
exports.AUTH_PERMISSIONS_KEY = 'authPermission';
|
|
6
9
|
exports.IS_PUBLIC_KEY = 'isPublic';
|
|
7
10
|
const AuthPermission = (permissions) => common_1.default.SetMetadata(exports.AUTH_PERMISSIONS_KEY, permissions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.decorator.js","sourceRoot":"","sources":["../src/app.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.decorator.js","sourceRoot":"","sources":["../src/app.decorator.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AAGtB,QAAA,oBAAoB,GAAG,gBAAgB,CAAA;AACvC,QAAA,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAM,cAAc,GAAG,CAAC,WAAyB,EAAE,EAAE,CAAC,gBAAM,CAAC,WAAW,CAAC,4BAAoB,EAAE,WAAW,CAAC,CAAA;AAArG,QAAA,cAAc,kBAAuF;AAE3G,MAAM,MAAM,GAAG,CAAC,QAAkB,EAAE,EAAE,CAAC,gBAAM,CAAC,WAAW,CAAC,qBAAa,EAAE,QAAQ,CAAC,CAAA;AAA5E,QAAA,MAAM,UAAsE"}
|
package/dist/app.dto.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ValidationOptions } from 'class-validator';
|
|
2
|
-
import {
|
|
2
|
+
import { Order } from './app.interface';
|
|
3
3
|
export declare const IsNanoid: (validationOptions?: ValidationOptions) => (object: Record<string, any>, propertyName: string) => void;
|
|
4
4
|
export declare class IndexDTO {
|
|
5
5
|
projectId?: string;
|
|
@@ -9,7 +9,6 @@ export declare class IndexDTO {
|
|
|
9
9
|
size?: number;
|
|
10
10
|
count?: boolean;
|
|
11
11
|
order?: keyof typeof Order;
|
|
12
|
-
language?: keyof typeof Language;
|
|
13
12
|
ids?: string[];
|
|
14
13
|
createdAtRange?: string[];
|
|
15
14
|
}
|
package/dist/app.dto.js
CHANGED
|
@@ -48,7 +48,6 @@ __decorate([
|
|
|
48
48
|
], IndexDTO.prototype, "id", void 0);
|
|
49
49
|
__decorate([
|
|
50
50
|
(0, class_validator_1.IsNumber)({ allowNaN: false }),
|
|
51
|
-
(0, class_validator_1.Max)(1024),
|
|
52
51
|
(0, class_validator_1.Min)(1),
|
|
53
52
|
(0, class_transformer_1.Transform)(({ value }) => parseInt(value)),
|
|
54
53
|
__metadata("design:type", Number)
|
|
@@ -61,28 +60,24 @@ __decorate([
|
|
|
61
60
|
__metadata("design:type", Number)
|
|
62
61
|
], IndexDTO.prototype, "size", void 0);
|
|
63
62
|
__decorate([
|
|
64
|
-
(0, class_transformer_1.Transform)(({ value }) => value === 'true'),
|
|
65
63
|
(0, class_validator_1.IsBoolean)(),
|
|
64
|
+
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value === 'true' : value)),
|
|
66
65
|
__metadata("design:type", Boolean)
|
|
67
66
|
], IndexDTO.prototype, "count", void 0);
|
|
68
67
|
__decorate([
|
|
69
68
|
(0, class_validator_1.IsEnum)(common_1.ORDER),
|
|
70
69
|
__metadata("design:type", Object)
|
|
71
70
|
], IndexDTO.prototype, "order", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, class_validator_1.IsEnum)(common_1.LANGUAGE),
|
|
74
|
-
__metadata("design:type", Object)
|
|
75
|
-
], IndexDTO.prototype, "language", void 0);
|
|
76
71
|
__decorate([
|
|
77
72
|
(0, class_validator_1.ArrayMaxSize)(1024),
|
|
78
|
-
(0, class_validator_1.ArrayMinSize)(
|
|
73
|
+
(0, class_validator_1.ArrayMinSize)(0),
|
|
79
74
|
(0, exports.IsNanoid)({ each: true }),
|
|
80
75
|
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value.split(',') : value)),
|
|
81
76
|
__metadata("design:type", Array)
|
|
82
77
|
], IndexDTO.prototype, "ids", void 0);
|
|
83
78
|
__decorate([
|
|
84
79
|
(0, class_validator_1.ArrayMaxSize)(2),
|
|
85
|
-
(0, class_validator_1.ArrayMinSize)(
|
|
80
|
+
(0, class_validator_1.ArrayMinSize)(0),
|
|
86
81
|
(0, exports.IsNanoid)({ each: true }),
|
|
87
82
|
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value.split(',') : value)),
|
|
88
83
|
__metadata("design:type", Array)
|
|
@@ -99,7 +94,7 @@ class ByIdsDTO {
|
|
|
99
94
|
exports.ByIdsDTO = ByIdsDTO;
|
|
100
95
|
__decorate([
|
|
101
96
|
(0, class_validator_1.ArrayMaxSize)(1024),
|
|
102
|
-
(0, class_validator_1.ArrayMinSize)(
|
|
97
|
+
(0, class_validator_1.ArrayMinSize)(0),
|
|
103
98
|
(0, exports.IsNanoid)({ each: true }),
|
|
104
99
|
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value.split(',') : value)),
|
|
105
100
|
__metadata("design:type", String)
|
package/dist/app.dto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.dto.js","sourceRoot":"","sources":["../src/app.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAUwB;AAExB,
|
|
1
|
+
{"version":3,"file":"app.dto.js","sourceRoot":"","sources":["../src/app.dto.ts"],"names":[],"mappings":"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"}
|
package/dist/app.entity.js
CHANGED
|
@@ -21,7 +21,6 @@ exports.AppEntity = AppEntity;
|
|
|
21
21
|
__decorate([
|
|
22
22
|
(0, typeorm_1.PrimaryColumn)({
|
|
23
23
|
length: 32,
|
|
24
|
-
name: 'id',
|
|
25
24
|
nullable: false,
|
|
26
25
|
type: 'varchar'
|
|
27
26
|
}),
|
|
@@ -30,7 +29,6 @@ __decorate([
|
|
|
30
29
|
__decorate([
|
|
31
30
|
(0, typeorm_1.Column)({
|
|
32
31
|
length: 32,
|
|
33
|
-
name: 'project_id',
|
|
34
32
|
nullable: false,
|
|
35
33
|
type: 'varchar'
|
|
36
34
|
}),
|
|
@@ -38,9 +36,8 @@ __decorate([
|
|
|
38
36
|
], AppEntity.prototype, "projectId", void 0);
|
|
39
37
|
__decorate([
|
|
40
38
|
(0, typeorm_1.Column)({
|
|
41
|
-
default: '',
|
|
39
|
+
default: 'ei',
|
|
42
40
|
length: 32,
|
|
43
|
-
name: 'scope_id',
|
|
44
41
|
nullable: false,
|
|
45
42
|
type: 'varchar'
|
|
46
43
|
}),
|
|
@@ -48,7 +45,6 @@ __decorate([
|
|
|
48
45
|
], AppEntity.prototype, "scopeId", void 0);
|
|
49
46
|
__decorate([
|
|
50
47
|
(0, typeorm_1.Column)({
|
|
51
|
-
name: 'created_at',
|
|
52
48
|
nullable: false,
|
|
53
49
|
type: 'date'
|
|
54
50
|
}),
|
|
@@ -56,7 +52,6 @@ __decorate([
|
|
|
56
52
|
], AppEntity.prototype, "createdAt", void 0);
|
|
57
53
|
__decorate([
|
|
58
54
|
(0, typeorm_1.Column)({
|
|
59
|
-
name: 'updated_at',
|
|
60
55
|
nullable: false,
|
|
61
56
|
type: 'date'
|
|
62
57
|
}),
|
|
@@ -64,16 +59,13 @@ __decorate([
|
|
|
64
59
|
], AppEntity.prototype, "updatedAt", void 0);
|
|
65
60
|
__decorate([
|
|
66
61
|
(0, typeorm_1.Column)({
|
|
67
|
-
name: 'deleted_at',
|
|
68
62
|
type: 'date'
|
|
69
63
|
}),
|
|
70
64
|
__metadata("design:type", Date)
|
|
71
65
|
], AppEntity.prototype, "deletedAt", void 0);
|
|
72
66
|
__decorate([
|
|
73
67
|
(0, typeorm_1.VersionColumn)({
|
|
74
|
-
|
|
75
|
-
nullable: false,
|
|
76
|
-
type: 'bigint'
|
|
68
|
+
nullable: false
|
|
77
69
|
}),
|
|
78
70
|
__metadata("design:type", String)
|
|
79
71
|
], AppEntity.prototype, "version", void 0);
|
package/dist/app.entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../src/app.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA6B;AAC7B,qCAA6F;AAGtF,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,oBAAU;
|
|
1
|
+
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../src/app.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA6B;AAC7B,qCAA6F;AAGtF,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,oBAAU;IA8CrC,YAAY;QACR,IAAI,CAAC,EAAE,GAAG,IAAA,eAAM,GAAE,CAAA;IACtB,CAAC;CACJ,CAAA;AAjDY,8BAAS;AAMlB;IALC,IAAA,uBAAa,EAAC;QACX,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;KAClB,CAAC;;qCACQ;AAOV;IALC,IAAA,gBAAM,EAAC;QACJ,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;KAClB,CAAC;;4CACe;AAQjB;IANC,IAAA,gBAAM,EAAC;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;KAClB,CAAC;;0CACa;AAMf;IAJC,IAAA,gBAAM,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;KACf,CAAC;8BACS,IAAI;4CAAA;AAMf;IAJC,IAAA,gBAAM,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;KACf,CAAC;8BACS,IAAI;4CAAA;AAKf;IAHC,IAAA,gBAAM,EAAC;QACJ,IAAI,EAAE,MAAM;KACf,CAAC;8BACS,IAAI;4CAAA;AAKf;IAHC,IAAA,uBAAa,EAAC;QACX,QAAQ,EAAE,KAAK;KAClB,CAAC;;0CACa;AAGf;IADC,IAAA,sBAAY,GAAE;;;;6CAGd;oBAhDQ,SAAS;IADrB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;GACR,SAAS,CAiDrB"}
|
package/dist/app.interface.d.ts
CHANGED
|
@@ -3,15 +3,12 @@ export declare enum Language {
|
|
|
3
3
|
EN_US = "enUS",
|
|
4
4
|
ZH_CN = "zhCN"
|
|
5
5
|
}
|
|
6
|
-
export type LanguageType = 'EN_US' | 'ZH_CN';
|
|
7
6
|
export declare enum Order {
|
|
8
7
|
ASC = "asc",
|
|
9
8
|
DESC = "desc"
|
|
10
9
|
}
|
|
11
|
-
export type OrderType = 'ASC' | 'DESC';
|
|
12
10
|
export type CustomHeaders = Record<'x-project-id' | 'x-scope-id' | 'x-authorization' | 'x-ip' | 'x-client' | 'x-request-id' | 'x-internal', string>;
|
|
13
11
|
export type APIHeaders = Record<string, string> | CustomHeaders | AxiosRequestConfig['headers'];
|
|
14
|
-
export type APIErrorType = 'FORBIDDEN' | 'HTTP_EXCEPTION' | 'INTERNAL_SERVER_ERROR' | 'NOT_FOUND' | 'UNAUTHORIZED' | 'UNPROCESSABLE_ENTITY';
|
|
15
12
|
export declare enum APIError {
|
|
16
13
|
FORBIDDEN = "forbidden",
|
|
17
14
|
HTTP_EXCEPTION = "HttpException",
|
|
@@ -20,12 +17,10 @@ export declare enum APIError {
|
|
|
20
17
|
UNAUTHORIZED = "unauthorized",
|
|
21
18
|
UNPROCESSABLE_ENTITY = "unprocessableEntity"
|
|
22
19
|
}
|
|
23
|
-
export type ActionResultType = 'FAILURE' | 'SUCCESS';
|
|
24
20
|
export declare enum ActionResult {
|
|
25
21
|
FAILURE = "failure",
|
|
26
22
|
SUCCESS = "success"
|
|
27
23
|
}
|
|
28
|
-
export type ActionType = 'CREATE' | 'DELETE' | 'EXPORT' | 'IMPORT' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'UPDATE';
|
|
29
24
|
export declare enum Action {
|
|
30
25
|
CREATE = "create",
|
|
31
26
|
DELETE = "delete",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,0BAAc,CAAA;IACd,0BAAc,CAAA;AAClB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;
|
|
1
|
+
{"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,0BAAc,CAAA;IACd,0BAAc,CAAA;AAClB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED,IAAY,KAGX;AAHD,WAAY,KAAK;IACb,oBAAW,CAAA;IACX,sBAAa,CAAA;AACjB,CAAC,EAHW,KAAK,qBAAL,KAAK,QAGhB;AAQD,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,mCAAuB,CAAA;IACvB,4CAAgC,CAAA;IAChC,2DAA+C,CAAA;IAC/C,kCAAsB,CAAA;IACtB,yCAA6B,CAAA;IAC7B,wDAA4C,CAAA;AAChD,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACvB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,MASX;AATD,WAAY,MAAM;IACd,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,4BAAkB,CAAA;IAClB,8BAAoB,CAAA;IACpB,4BAAkB,CAAA;IAClB,2BAAiB,CAAA;AACrB,CAAC,EATW,MAAM,sBAAN,MAAM,QASjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
3
|
import { AuthService } from '../auth';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class AccessGuard implements CanActivate {
|
|
5
5
|
private readonly authService;
|
|
6
6
|
private readonly reflector;
|
|
7
7
|
constructor(authService: AuthService, reflector: Reflector);
|
|
@@ -9,7 +9,7 @@ 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.AccessGuard = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const core_1 = require("@nestjs/core");
|
|
15
15
|
const app_decorator_1 = require("../../app.decorator");
|
|
@@ -17,7 +17,7 @@ const app_interface_1 = require("../../app.interface");
|
|
|
17
17
|
const util_1 = require("../../util");
|
|
18
18
|
const auth_1 = require("../auth");
|
|
19
19
|
const access_interface_1 = require("./access.interface");
|
|
20
|
-
let
|
|
20
|
+
let AccessGuard = class AccessGuard {
|
|
21
21
|
constructor(authService, reflector) {
|
|
22
22
|
this.authService = authService;
|
|
23
23
|
this.reflector = reflector;
|
|
@@ -36,15 +36,15 @@ let AuthGuard = class AuthGuard {
|
|
|
36
36
|
}
|
|
37
37
|
const token = (0, util_1.formatToken)(headers);
|
|
38
38
|
!token &&
|
|
39
|
-
(0, util_1.
|
|
39
|
+
(0, util_1.throwAPIError)({
|
|
40
40
|
code: 401004,
|
|
41
41
|
message: 'No required authentication token found; a token is essential for access authentication'
|
|
42
42
|
})(app_interface_1.APIError.UNAUTHORIZED);
|
|
43
|
-
return this.authService.authAccess(
|
|
43
|
+
return this.authService.authAccess(headers).then(payload => {
|
|
44
44
|
payload.sub === 'guest' &&
|
|
45
45
|
requiredAccesses &&
|
|
46
46
|
!requiredAccesses.includes(access_interface_1.Access.GUEST) &&
|
|
47
|
-
(0, util_1.
|
|
47
|
+
(0, util_1.throwAPIError)({
|
|
48
48
|
code: 401005,
|
|
49
49
|
message: 'The current resource is not accessible to guest users'
|
|
50
50
|
})(app_interface_1.APIError.UNAUTHORIZED);
|
|
@@ -53,10 +53,10 @@ let AuthGuard = class AuthGuard {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
exports.
|
|
57
|
-
exports.
|
|
56
|
+
exports.AccessGuard = AccessGuard;
|
|
57
|
+
exports.AccessGuard = AccessGuard = __decorate([
|
|
58
58
|
(0, common_1.Injectable)(),
|
|
59
59
|
__metadata("design:paramtypes", [auth_1.AuthService,
|
|
60
60
|
core_1.Reflector])
|
|
61
|
-
],
|
|
61
|
+
], AccessGuard);
|
|
62
62
|
//# sourceMappingURL=access.guard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.guard.js","sourceRoot":"","sources":["../../../src/authentication/access/access.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAsC;AACtC,uDAAiD;AACjD,uDAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"access.guard.js","sourceRoot":"","sources":["../../../src/authentication/access/access.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAsC;AACtC,uDAAiD;AACjD,uDAA4C;AAE5C,qCAAqD;AACrD,kCAAmC;AACnC,yDAAyC;AAGlC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACpB,YACqB,WAAwB,EACxB,SAAoB;QADpB,gBAAW,GAAX,WAAW,CAAa;QACxB,cAAS,GAAT,SAAS,CAAW;IACtC,CAAC;IAEJ,WAAW,CAAC,OAAyB;QACjC,MAAM,QAAQ,GAAG,CAAC,yBAAM,CAAC,KAAK,EAAE,yBAAM,CAAC,IAAI,CAAC,CAAA;QAC5C,MAAM,gBAAgB,GAAa,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,6BAAa,EAAE;YAC/E,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACrB,CAAC,CAAA;QAEF,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAc,CAAA;QAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC/B,MAAM,QAAQ,GAAG,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;QAE7E,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,QAAQ,EAAE,CAAC;YACpC,OAAO,IAAI,CAAA;QACf,CAAC;QAED,MAAM,KAAK,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,CAAA;QAElC,CAAC,KAAK;YACF,IAAA,oBAAa,EAAC;gBACV,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,wFAAwF;aACpG,CAAC,CAAC,wBAAQ,CAAC,YAAY,CAAC,CAAA;QAE7B,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YACvD,OAAO,CAAC,GAAG,KAAK,OAAO;gBACnB,gBAAgB;gBAChB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,yBAAM,CAAC,KAAK,CAAC;gBACxC,IAAA,oBAAa,EAAC;oBACV,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,uDAAuD;iBACnE,CAAC,CAAC,wBAAQ,CAAC,YAAY,CAAC,CAAA;YAE7B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAA;YAEzB,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;IACN,CAAC;CACJ,CAAA;AA3CY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAGyB,kBAAW;QACb,gBAAS;GAHhC,WAAW,CA2CvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AccessInterceptor = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let AccessInterceptor = class AccessInterceptor {
|
|
12
|
+
intercept(context, next) {
|
|
13
|
+
const request = context.switchToHttp().getRequest();
|
|
14
|
+
if (request.user) {
|
|
15
|
+
request.headers['x-authorization'] = request.user.sub;
|
|
16
|
+
}
|
|
17
|
+
return next.handle();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.AccessInterceptor = AccessInterceptor;
|
|
21
|
+
exports.AccessInterceptor = AccessInterceptor = __decorate([
|
|
22
|
+
(0, common_1.Injectable)()
|
|
23
|
+
], AccessInterceptor);
|
|
24
|
+
//# sourceMappingURL=access-interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-interceptor.js","sourceRoot":"","sources":["../../../src/authentication/access-interceptor/access-interceptor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAyF;AAGlF,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,SAAS,CAAC,OAAyB,EAAE,IAAiB;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAA;QAEnD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAA;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;IACxB,CAAC;CACJ,CAAA;AAVY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAU7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './access-interceptor';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./access-interceptor"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/access-interceptor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type AuthAccessOptions = AuthExternalAccessOptions;
|
|
1
|
+
import { AuthExternalPermissionOptions } from '../../external';
|
|
3
2
|
export type AuthPermissionOptions = AuthExternalPermissionOptions;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { APIHeaders } from '../../app.interface';
|
|
1
2
|
import { ExternalService } from '../../external';
|
|
2
|
-
import {
|
|
3
|
+
import { AuthPermissionOptions } from './auth.interface';
|
|
3
4
|
export declare class AuthService {
|
|
4
5
|
private readonly externalService;
|
|
5
6
|
constructor(externalService: ExternalService);
|
|
6
|
-
authAccess(
|
|
7
|
-
authPermission(options: AuthPermissionOptions)
|
|
7
|
+
authAccess(headers: APIHeaders): Promise<import("../../external").AuthenticatedToken>;
|
|
8
|
+
authPermission(headers: APIHeaders): (options: AuthPermissionOptions) => Promise<import("../../external").AuthenticatedPermission>;
|
|
8
9
|
}
|
|
@@ -16,11 +16,11 @@ let AuthService = class AuthService {
|
|
|
16
16
|
constructor(externalService) {
|
|
17
17
|
this.externalService = externalService;
|
|
18
18
|
}
|
|
19
|
-
async authAccess(
|
|
20
|
-
return this.externalService.authAccess(
|
|
19
|
+
async authAccess(headers) {
|
|
20
|
+
return this.externalService.authAccess(headers);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.externalService.authPermission(options);
|
|
22
|
+
authPermission(headers) {
|
|
23
|
+
return async (options) => this.externalService.authPermission(headers)(options);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
exports.AuthService = AuthService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/authentication/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/authentication/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AAEzC,6CAA8C;AAIvC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACpB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,KAAK,CAAC,UAAU,CAAC,OAAmB;QAChC,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,cAAc,CAAC,OAAmB;QAC9B,OAAO,KAAK,EAAE,OAA8B,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAA;IAC1G,CAAC;CACJ,CAAA;AAVY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEqC,0BAAe;GADpD,WAAW,CAUvB"}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./access"), exports);
|
|
18
|
+
__exportStar(require("./access-interceptor"), exports);
|
|
18
19
|
__exportStar(require("./auth"), exports);
|
|
19
20
|
__exportStar(require("./permission"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB;AACtB,+CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uDAAoC;AACpC,yCAAsB;AACtB,+CAA4B"}
|
|
@@ -33,7 +33,7 @@ let PermissionGuard = class PermissionGuard {
|
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
return this.authService
|
|
36
|
-
.authPermission({
|
|
36
|
+
.authPermission(headers)({ keys: requiredPermissions, userId: user.sub })
|
|
37
37
|
.then(({ result }) => result === 'successes');
|
|
38
38
|
}
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../src/authentication/permission/permission.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAsC;AACtC,uDAAwD;AAExD,kCAAmC;AAI5B,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,YACqB,WAAwB,EACxB,SAAoB;QADpB,gBAAW,GAAX,WAAW,CAAa;QACxB,cAAS,GAAT,SAAS,CAAW;IACtC,CAAC;IAEJ,WAAW,CAAC,OAAyB;QACjC,MAAM,mBAAmB,GAAiB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,oCAAoB,EAAE;YAC7F,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACrB,CAAC,CAAA;QAEF,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACf,CAAC;QAED,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAc,CAAA;QAC/E,MAAM,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,EAAE,CAAA;QAEtC,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,MAAM,EAAE,CAAC;YAClC,OAAO,IAAI,CAAA;QACf,CAAC;QAED,OAAO,IAAI,CAAC,WAAW;aAClB,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"permission.guard.js","sourceRoot":"","sources":["../../../src/authentication/permission/permission.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAsC;AACtC,uDAAwD;AAExD,kCAAmC;AAI5B,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,YACqB,WAAwB,EACxB,SAAoB;QADpB,gBAAW,GAAX,WAAW,CAAa;QACxB,cAAS,GAAT,SAAS,CAAW;IACtC,CAAC;IAEJ,WAAW,CAAC,OAAyB;QACjC,MAAM,mBAAmB,GAAiB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,oCAAoB,EAAE;YAC7F,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACrB,CAAC,CAAA;QAEF,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACf,CAAC;QAED,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAc,CAAA;QAC/E,MAAM,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,EAAE,CAAA;QAEtC,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,MAAM,EAAE,CAAC;YAClC,OAAO,IAAI,CAAA;QACf,CAAC;QAED,OAAO,IAAI,CAAC,WAAW;aAClB,cAAc,CAAC,OAAO,CAAC,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC;aACtE,IAAI,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,KAAK,WAAW,CAAC,CAAA;IACnD,CAAC;CACJ,CAAA;AA3BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAGyB,kBAAW;QACb,gBAAS;GAHhC,eAAe,CA2B3B"}
|
|
@@ -2,6 +2,7 @@ import { DeepPartial, EntityManager, FindManyOptions, FindOptionsWhere } from 't
|
|
|
2
2
|
import { ActionLogOptions } from '../action-log';
|
|
3
3
|
import { IndexDTO, NotIdDTO } from '../app.dto';
|
|
4
4
|
import { APIError, APIHeaders } from '../app.interface';
|
|
5
|
+
import { ThrowAPIErrorOptions } from '../util';
|
|
5
6
|
export interface BaseServiceOptions<T> extends Pick<ActionLogOptions, 'enableLogging'> {
|
|
6
7
|
entityManager?: EntityManager;
|
|
7
8
|
entityOptions: DeepPartial<T>;
|
|
@@ -17,9 +18,8 @@ export interface UpdateOptions<T> extends Omit<BaseServiceOptions<T>, 'preValida
|
|
|
17
18
|
validateKeys?: (keyof FindOptionsWhere<T>)[];
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
export interface
|
|
21
|
+
export interface UpdateAssociationOptions<T> extends Omit<BaseServiceOptions<T>, 'entityOptions'> {
|
|
21
22
|
entityIds: string[];
|
|
22
|
-
linkKey: string;
|
|
23
23
|
}
|
|
24
24
|
export interface FindOptions<T> {
|
|
25
25
|
findManyOptions?: FindManyOptions<T>;
|
|
@@ -35,8 +35,6 @@ export interface PreValidateOptions<T> {
|
|
|
35
35
|
validateKeys?: (keyof FindOptionsWhere<T>)[][] | (keyof FindOptionsWhere<T>)[];
|
|
36
36
|
validateMethod?: 'and' | 'or';
|
|
37
37
|
}
|
|
38
|
-
export interface ThrowErrorOptions {
|
|
39
|
-
code?: number;
|
|
38
|
+
export interface ThrowErrorOptions extends ThrowAPIErrorOptions {
|
|
40
39
|
errorType: APIError;
|
|
41
|
-
message: string;
|
|
42
40
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { ActionLogOptions, ActionLogService } from '../action-log';
|
|
3
3
|
import { AppEntity } from '../app.entity';
|
|
4
|
-
import { CreateOptions, DelOptions, FindOneOptions, FindOptions, PreValidateOptions, ThrowErrorOptions,
|
|
4
|
+
import { CreateOptions, DelOptions, FindOneOptions, FindOptions, PreValidateOptions, ThrowErrorOptions, UpdateAssociationOptions, UpdateOptions } from './base.interface';
|
|
5
5
|
export declare class BaseService {
|
|
6
6
|
private readonly actionLogService;
|
|
7
7
|
constructor(actionLogService: ActionLogService);
|
|
8
8
|
create<T extends AppEntity>({ enableLogging, entityManager, entityOptions, headers, preValidateOptions, serviceName }: CreateOptions<T>): (repository: Repository<T>) => Promise<T>;
|
|
9
9
|
del<T extends AppEntity>({ entityManager, findOptions, serviceName, headers, enableLogging }: DelOptions<T>): (repository: Repository<T>) => Promise<void>;
|
|
10
|
-
update<T extends AppEntity>({ enableLogging, entityManager, entityOptions, findOptions, headers, preValidateOptions, serviceName }: UpdateOptions<T>):
|
|
10
|
+
update<T extends AppEntity>({ enableLogging, entityManager, entityOptions, findOptions, headers, preValidateOptions, serviceName }: UpdateOptions<T>): (repository: Repository<T>) => Promise<T>;
|
|
11
11
|
find<T extends AppEntity>({ findOptions, findManyOptions }: FindOptions<T>): (repository: Repository<T>) => Promise<{
|
|
12
12
|
results: T[];
|
|
13
13
|
limit: number;
|
|
@@ -15,8 +15,8 @@ export declare class BaseService {
|
|
|
15
15
|
total: number;
|
|
16
16
|
}>;
|
|
17
17
|
findOne<T extends AppEntity>({ serviceName, findOptions, actionLogOptions }: FindOneOptions<T>): (repository: Repository<T>) => Promise<T>;
|
|
18
|
-
|
|
19
|
-
preValidate<T extends AppEntity>({ actionLogOptions, findOptions, serviceName, validateKeys, validateMethod }: PreValidateOptions<T>): (repository: Repository<T>) => Promise<void
|
|
18
|
+
updateAssociation<T extends AppEntity>({ enableLogging, entityIds: rawEntityIds, entityManager, findOptions, headers, serviceName }: UpdateAssociationOptions<T>): (associationKey: string) => (repository: Repository<T>) => Promise<T[]>;
|
|
19
|
+
preValidate<T extends AppEntity>({ actionLogOptions, findOptions, serviceName, validateKeys, validateMethod }: PreValidateOptions<T>): Promise<(repository: Repository<T>) => Promise<void>>;
|
|
20
20
|
checkProhibited<T extends AppEntity>(actionLogOptions?: ActionLogOptions): (entity: T & {
|
|
21
21
|
protected?: boolean;
|
|
22
22
|
}) => Promise<void>;
|