@bearei/server-common 0.0.8 → 0.0.10
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/{authentication/access → access}/access.guard.d.ts +3 -3
- package/dist/{authentication/access → access}/access.guard.js +9 -9
- package/dist/access/access.guard.js.map +1 -0
- package/dist/{authentication/access-interceptor/access-interceptor.js → access/access.interceptor.js} +1 -1
- package/dist/access/access.interceptor.js.map +1 -0
- package/dist/access/access.interface.js.map +1 -0
- package/dist/{authentication/access → access}/index.d.ts +1 -0
- package/dist/{authentication/access → access}/index.js +1 -0
- package/dist/access/index.js.map +1 -0
- package/dist/app.decorator.d.ts +5 -4
- package/dist/app.decorator.js +7 -6
- package/dist/app.decorator.js.map +1 -1
- package/dist/app.dto.d.ts +1 -4
- package/dist/app.dto.js +5 -16
- package/dist/app.dto.js.map +1 -1
- package/dist/app.entity.js +7 -30
- package/dist/app.entity.js.map +1 -1
- package/dist/app.interface.d.ts +7 -0
- package/dist/app.interface.js.map +1 -1
- package/dist/authentication/authentication.interface.d.ts +2 -0
- package/dist/authentication/{auth/auth.interface.js → authentication.interface.js} +1 -1
- package/dist/authentication/authentication.interface.js.map +1 -0
- package/dist/authentication/authentication.module.d.ts +2 -0
- package/dist/authentication/{auth/auth.module.js → authentication.module.js} +10 -10
- package/dist/authentication/authentication.module.js.map +1 -0
- package/dist/authentication/authentication.service.d.ts +9 -0
- package/dist/authentication/{auth/auth.service.js → authentication.service.js} +11 -11
- package/dist/authentication/authentication.service.js.map +1 -0
- package/dist/authentication/index.d.ts +3 -4
- package/dist/authentication/index.js +3 -4
- package/dist/authentication/index.js.map +1 -1
- package/dist/base/base.interface.d.ts +5 -2
- package/dist/base/base.service.d.ts +8 -8
- package/dist/base/base.service.js +22 -19
- package/dist/base/base.service.js.map +1 -1
- package/dist/database/database.module.js +6 -6
- package/dist/database/database.module.js.map +1 -1
- package/dist/external/external.interface.d.ts +2 -2
- package/dist/external/external.service.d.ts +3 -3
- package/dist/external/external.service.js +12 -6
- package/dist/external/external.service.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/permission/index.js.map +1 -0
- package/dist/{authentication/permission → permission}/permission.guard.d.ts +3 -3
- package/dist/{authentication/permission → permission}/permission.guard.js +9 -9
- package/dist/permission/permission.guard.js.map +1 -0
- package/dist/permission/permission.interface.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/authentication/access/access.guard.js.map +0 -1
- package/dist/authentication/access/access.interface.js.map +0 -1
- package/dist/authentication/access/index.js.map +0 -1
- package/dist/authentication/access-interceptor/access-interceptor.js.map +0 -1
- package/dist/authentication/access-interceptor/index.d.ts +0 -1
- package/dist/authentication/access-interceptor/index.js +0 -18
- package/dist/authentication/access-interceptor/index.js.map +0 -1
- package/dist/authentication/auth/auth.interface.d.ts +0 -2
- package/dist/authentication/auth/auth.interface.js.map +0 -1
- package/dist/authentication/auth/auth.module.d.ts +0 -2
- package/dist/authentication/auth/auth.module.js.map +0 -1
- package/dist/authentication/auth/auth.service.d.ts +0 -9
- package/dist/authentication/auth/auth.service.js.map +0 -1
- package/dist/authentication/auth/index.d.ts +0 -3
- package/dist/authentication/auth/index.js +0 -20
- package/dist/authentication/auth/index.js.map +0 -1
- package/dist/authentication/permission/index.js.map +0 -1
- package/dist/authentication/permission/permission.guard.js.map +0 -1
- package/dist/authentication/permission/permission.interface.js.map +0 -1
- /package/dist/{authentication/access-interceptor/access-interceptor.d.ts → access/access.interceptor.d.ts} +0 -0
- /package/dist/{authentication/access → access}/access.interface.d.ts +0 -0
- /package/dist/{authentication/access → access}/access.interface.js +0 -0
- /package/dist/{authentication/permission → permission}/index.d.ts +0 -0
- /package/dist/{authentication/permission → permission}/index.js +0 -0
- /package/dist/{authentication/permission → permission}/permission.interface.d.ts +0 -0
- /package/dist/{authentication/permission → permission}/permission.interface.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import {
|
|
3
|
+
import { AuthenticationService } from '../authentication';
|
|
4
4
|
export declare class AccessGuard implements CanActivate {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly authenticationService;
|
|
6
6
|
private readonly reflector;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(authenticationService: AuthenticationService, reflector: Reflector);
|
|
8
8
|
canActivate(context: ExecutionContext): true | Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -12,16 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AccessGuard = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const core_1 = require("@nestjs/core");
|
|
15
|
-
const app_decorator_1 = require("
|
|
16
|
-
const app_interface_1 = require("
|
|
17
|
-
const
|
|
18
|
-
const
|
|
15
|
+
const app_decorator_1 = require("../app.decorator");
|
|
16
|
+
const app_interface_1 = require("../app.interface");
|
|
17
|
+
const authentication_1 = require("../authentication");
|
|
18
|
+
const util_1 = require("../util");
|
|
19
19
|
const access_interface_1 = require("./access.interface");
|
|
20
20
|
let AccessGuard = class AccessGuard {
|
|
21
|
-
|
|
21
|
+
authenticationService;
|
|
22
22
|
reflector;
|
|
23
|
-
constructor(
|
|
24
|
-
this.
|
|
23
|
+
constructor(authenticationService, reflector) {
|
|
24
|
+
this.authenticationService = authenticationService;
|
|
25
25
|
this.reflector = reflector;
|
|
26
26
|
}
|
|
27
27
|
canActivate(context) {
|
|
@@ -42,7 +42,7 @@ let AccessGuard = class AccessGuard {
|
|
|
42
42
|
code: 401004,
|
|
43
43
|
message: 'No required authentication token found; a token is essential for access authentication'
|
|
44
44
|
})(app_interface_1.APIError.UNAUTHORIZED);
|
|
45
|
-
return this.
|
|
45
|
+
return this.authenticationService.authenticationAccess(headers).then(payload => {
|
|
46
46
|
payload.sub === 'guest' &&
|
|
47
47
|
requiredAccesses &&
|
|
48
48
|
!requiredAccesses.includes(access_interface_1.Access.GUEST) &&
|
|
@@ -58,7 +58,7 @@ let AccessGuard = class AccessGuard {
|
|
|
58
58
|
exports.AccessGuard = AccessGuard;
|
|
59
59
|
exports.AccessGuard = AccessGuard = __decorate([
|
|
60
60
|
(0, common_1.Injectable)(),
|
|
61
|
-
__metadata("design:paramtypes", [
|
|
61
|
+
__metadata("design:paramtypes", [authentication_1.AuthenticationService,
|
|
62
62
|
core_1.Reflector])
|
|
63
63
|
], AccessGuard);
|
|
64
64
|
//# sourceMappingURL=access.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.guard.js","sourceRoot":"","sources":["../../src/access/access.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwE;AACxE,uCAAsC;AACtC,oDAA8C;AAC9C,oDAAyC;AACzC,sDAAuD;AAEvD,kCAAkD;AAClD,yDAAyC;AAGlC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEC;IACA;IAFrB,YACqB,qBAA4C,EAC5C,SAAoB;QADpB,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,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,C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AA;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
|
+
{"version":3,"file":"access.interface.js","sourceRoot":"","sources":["../../src/access/access.interface.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IACd,uBAAa,CAAA;IACb,yBAAe,CAAA;AACnB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
|
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./access.guard"), exports);
|
|
18
|
+
__exportStar(require("./access.interceptor"), exports);
|
|
18
19
|
__exportStar(require("./access.interface"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/access/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,uDAAoC;AACpC,qDAAkC"}
|
package/dist/app.decorator.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import common from '@nestjs/common';
|
|
2
2
|
import { ValidationOptions } from 'class-validator';
|
|
3
|
-
import { Access
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
3
|
+
import { Access } from './access';
|
|
4
|
+
import { Permission } from './permission';
|
|
5
|
+
export declare const AUTHENTICATION_PERMISSIONS_KEY = "AuthenticationPermission";
|
|
6
|
+
export declare const IS_PUBLIC_KEY = "Public";
|
|
7
|
+
export declare const AuthenticationPermission: (permissions: Permission[]) => common.CustomDecorator<string>;
|
|
7
8
|
export declare const Public: (accesses: Access[]) => common.CustomDecorator<string>;
|
|
8
9
|
export declare const IsNanoid: (validationOptions?: ValidationOptions) => (object: Record<string, any>, propertyName: string) => void;
|
|
9
10
|
export declare const IsPassword: (validationOptions?: ValidationOptions) => (object: Record<string, any>, propertyName: string) => void;
|
package/dist/app.decorator.js
CHANGED
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IsVersion = exports.IsPassword = exports.IsNanoid = exports.Public = exports.
|
|
6
|
+
exports.IsVersion = exports.IsPassword = exports.IsNanoid = exports.Public = exports.AuthenticationPermission = exports.IS_PUBLIC_KEY = exports.AUTHENTICATION_PERMISSIONS_KEY = void 0;
|
|
7
7
|
const common_1 = __importDefault(require("@nestjs/common"));
|
|
8
8
|
const class_validator_1 = require("class-validator");
|
|
9
|
-
exports.
|
|
10
|
-
exports.IS_PUBLIC_KEY = '
|
|
11
|
-
const
|
|
12
|
-
exports.
|
|
9
|
+
exports.AUTHENTICATION_PERMISSIONS_KEY = 'AuthenticationPermission';
|
|
10
|
+
exports.IS_PUBLIC_KEY = 'Public';
|
|
11
|
+
const AuthenticationPermission = (permissions) => common_1.default.SetMetadata(exports.AUTHENTICATION_PERMISSIONS_KEY, permissions);
|
|
12
|
+
exports.AuthenticationPermission = AuthenticationPermission;
|
|
13
13
|
const Public = (accesses) => common_1.default.SetMetadata(exports.IS_PUBLIC_KEY, accesses);
|
|
14
14
|
exports.Public = Public;
|
|
15
15
|
const IsNanoid = (validationOptions) => (object, propertyName) => {
|
|
@@ -37,7 +37,8 @@ const IsPassword = (validationOptions) => (object, propertyName) => {
|
|
|
37
37
|
target: object.constructor,
|
|
38
38
|
options: {
|
|
39
39
|
...validationOptions,
|
|
40
|
-
message: `${propertyName} is not a valid password. Passwords should follow the pattern:
|
|
40
|
+
message: `${propertyName} is not a valid password. Passwords should follow the pattern:
|
|
41
|
+
/^(?=.[A-Z])(?=.[\\W_])(?!.*\\s).{8,32}$/`
|
|
41
42
|
},
|
|
42
43
|
validator: {
|
|
43
44
|
validate(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.decorator.js","sourceRoot":"","sources":["../src/app.decorator.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AACnC,qDAAoE;
|
|
1
|
+
{"version":3,"file":"app.decorator.js","sourceRoot":"","sources":["../src/app.decorator.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AACnC,qDAAoE;AAIvD,QAAA,8BAA8B,GAAG,0BAA0B,CAAA;AAC3D,QAAA,aAAa,GAAG,QAAQ,CAAA;AAE9B,MAAM,wBAAwB,GAAG,CAAC,WAAyB,EAAE,EAAE,CAClE,gBAAM,CAAC,WAAW,CAAC,sCAA8B,EAAE,WAAW,CAAC,CAAA;AADtD,QAAA,wBAAwB,4BAC8B;AAE5D,MAAM,MAAM,GAAG,CAAC,QAAkB,EAAE,EAAE,CAAC,gBAAM,CAAC,WAAW,CAAC,qBAAa,EAAE,QAAQ,CAAC,CAAA;AAA5E,QAAA,MAAM,UAAsE;AAElF,MAAM,QAAQ,GACjB,CAAC,iBAAqC,EAAE,EAAE,CAAC,CAAC,MAA2B,EAAE,YAAoB,EAAE,EAAE;IAC7F,IAAA,mCAAiB,EAAC;QACd,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,MAAM,CAAC,WAAW;QAC1B,OAAO,EAAE;YACL,GAAG,iBAAiB;YACpB,OAAO,EAAE,GAAG,YAAY,yBAAyB;SACpD;QACD,SAAS,EAAE;YACP,QAAQ,CAAC,KAAK;gBACV,MAAM,WAAW,GAAG,iB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;AAlBQ,QAAA,SAAS,aAkBjB"}
|
package/dist/app.dto.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Order } from './app.interface';
|
|
2
2
|
export declare class IndexDTO {
|
|
3
|
+
id?: string;
|
|
3
4
|
projectId?: string;
|
|
4
5
|
scopeId?: string;
|
|
5
|
-
id?: string;
|
|
6
6
|
page?: number;
|
|
7
7
|
size?: number;
|
|
8
8
|
count?: boolean;
|
|
@@ -13,9 +13,6 @@ export declare class IndexDTO {
|
|
|
13
13
|
export declare class ByIdDTO {
|
|
14
14
|
id?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare class ByIdsDTO {
|
|
17
|
-
ids?: string;
|
|
18
|
-
}
|
|
19
16
|
export declare class NotIdDTO {
|
|
20
17
|
notId?: string;
|
|
21
18
|
}
|
package/dist/app.dto.js
CHANGED
|
@@ -9,15 +9,15 @@ 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.NotIdDTO = exports.
|
|
12
|
+
exports.NotIdDTO = exports.ByIdDTO = exports.IndexDTO = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const app_decorator_1 = require("./app.decorator");
|
|
16
16
|
const common_1 = require("./common");
|
|
17
17
|
class IndexDTO {
|
|
18
|
+
id;
|
|
18
19
|
projectId;
|
|
19
20
|
scopeId;
|
|
20
|
-
id;
|
|
21
21
|
page;
|
|
22
22
|
size;
|
|
23
23
|
count;
|
|
@@ -29,15 +29,15 @@ exports.IndexDTO = IndexDTO;
|
|
|
29
29
|
__decorate([
|
|
30
30
|
(0, app_decorator_1.IsNanoid)(),
|
|
31
31
|
__metadata("design:type", String)
|
|
32
|
-
], IndexDTO.prototype, "
|
|
32
|
+
], IndexDTO.prototype, "id", void 0);
|
|
33
33
|
__decorate([
|
|
34
34
|
(0, app_decorator_1.IsNanoid)(),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
|
-
], IndexDTO.prototype, "
|
|
36
|
+
], IndexDTO.prototype, "projectId", void 0);
|
|
37
37
|
__decorate([
|
|
38
38
|
(0, app_decorator_1.IsNanoid)(),
|
|
39
39
|
__metadata("design:type", String)
|
|
40
|
-
], IndexDTO.prototype, "
|
|
40
|
+
], IndexDTO.prototype, "scopeId", void 0);
|
|
41
41
|
__decorate([
|
|
42
42
|
(0, class_validator_1.IsNumber)({ allowNaN: false }),
|
|
43
43
|
(0, class_validator_1.Min)(1),
|
|
@@ -82,17 +82,6 @@ __decorate([
|
|
|
82
82
|
(0, app_decorator_1.IsNanoid)(),
|
|
83
83
|
__metadata("design:type", String)
|
|
84
84
|
], ByIdDTO.prototype, "id", void 0);
|
|
85
|
-
class ByIdsDTO {
|
|
86
|
-
ids;
|
|
87
|
-
}
|
|
88
|
-
exports.ByIdsDTO = ByIdsDTO;
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, class_validator_1.ArrayMaxSize)(1024),
|
|
91
|
-
(0, class_validator_1.ArrayMinSize)(0),
|
|
92
|
-
(0, app_decorator_1.IsNanoid)({ each: true }),
|
|
93
|
-
(0, class_transformer_1.Transform)(({ value }) => (typeof value === 'string' ? value.split(',') : value)),
|
|
94
|
-
__metadata("design:type", String)
|
|
95
|
-
], ByIdsDTO.prototype, "ids", void 0);
|
|
96
85
|
class NotIdDTO {
|
|
97
86
|
notId;
|
|
98
87
|
}
|
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,qDAAiG;AACjG,mDAAwC;AAExC,qCAA8B;AAE9B,MAAa,QAAQ;IAEjB,
|
|
1
|
+
{"version":3,"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,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IACtB,IAAA,6BAAS,EAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;;qCACjE;AAMd;IAJC,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IACtB,IAAA,6BAAS,EAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;;gDACtD;AAG7B,MAAa,OAAO;IAEhB,EAAE,CAAS;CACd;AAHD,0BAGC;AADG;IADC,IAAA,wBAAQ,GAAE;;mCACA;AAGf,MAAa,QAAQ;IAEjB,KAAK,CAAS;CACjB;AAHD,4BAGC;AADG;IADC,IAAA,wBAAQ,GAAE;;uCACG"}
|
package/dist/app.entity.js
CHANGED
|
@@ -26,54 +26,31 @@ let AppEntity = class AppEntity extends typeorm_1.BaseEntity {
|
|
|
26
26
|
};
|
|
27
27
|
exports.AppEntity = AppEntity;
|
|
28
28
|
__decorate([
|
|
29
|
-
(0, typeorm_1.PrimaryColumn)({
|
|
30
|
-
length: 32,
|
|
31
|
-
nullable: false,
|
|
32
|
-
type: 'varchar'
|
|
33
|
-
}),
|
|
29
|
+
(0, typeorm_1.PrimaryColumn)({ length: 32, nullable: false, type: 'varchar' }),
|
|
34
30
|
__metadata("design:type", String)
|
|
35
31
|
], AppEntity.prototype, "id", void 0);
|
|
36
32
|
__decorate([
|
|
37
|
-
(0, typeorm_1.Column)({
|
|
38
|
-
length: 32,
|
|
39
|
-
nullable: false,
|
|
40
|
-
type: 'varchar'
|
|
41
|
-
}),
|
|
33
|
+
(0, typeorm_1.Column)({ length: 32, nullable: false, type: 'varchar' }),
|
|
42
34
|
__metadata("design:type", String)
|
|
43
35
|
], AppEntity.prototype, "projectId", void 0);
|
|
44
36
|
__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({
|
|
46
|
-
default: 'ei',
|
|
47
|
-
length: 32,
|
|
48
|
-
nullable: false,
|
|
49
|
-
type: 'varchar'
|
|
50
|
-
}),
|
|
37
|
+
(0, typeorm_1.Column)({ default: 'ei', length: 32, nullable: false, type: 'varchar' }),
|
|
51
38
|
__metadata("design:type", String)
|
|
52
39
|
], AppEntity.prototype, "scopeId", void 0);
|
|
53
40
|
__decorate([
|
|
54
|
-
(0, typeorm_1.Column)({
|
|
55
|
-
nullable: false,
|
|
56
|
-
type: 'date'
|
|
57
|
-
}),
|
|
41
|
+
(0, typeorm_1.Column)({ nullable: false, type: 'date' }),
|
|
58
42
|
__metadata("design:type", Date)
|
|
59
43
|
], AppEntity.prototype, "createdAt", void 0);
|
|
60
44
|
__decorate([
|
|
61
|
-
(0, typeorm_1.Column)({
|
|
62
|
-
nullable: false,
|
|
63
|
-
type: 'date'
|
|
64
|
-
}),
|
|
45
|
+
(0, typeorm_1.Column)({ nullable: false, type: 'date' }),
|
|
65
46
|
__metadata("design:type", Date)
|
|
66
47
|
], AppEntity.prototype, "updatedAt", void 0);
|
|
67
48
|
__decorate([
|
|
68
|
-
(0, typeorm_1.Column)({
|
|
69
|
-
type: 'date'
|
|
70
|
-
}),
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'date' }),
|
|
71
50
|
__metadata("design:type", Date)
|
|
72
51
|
], AppEntity.prototype, "deletedAt", void 0);
|
|
73
52
|
__decorate([
|
|
74
|
-
(0, typeorm_1.VersionColumn)({
|
|
75
|
-
nullable: false
|
|
76
|
-
}),
|
|
53
|
+
(0, typeorm_1.VersionColumn)({ nullable: false }),
|
|
77
54
|
__metadata("design:type", String)
|
|
78
55
|
], AppEntity.prototype, "version", void 0);
|
|
79
56
|
__decorate([
|
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;IAErC,EAAE,CAAQ;IAGV,SAAS,CAAQ;IAGjB,OAAO,CAAQ;IAGf,SAAS,CAAM;IAGf,SAAS,CAAM;IAGf,SAAS,CAAM;IAGf,OAAO,CAAQ;IAGf,YAAY;QACR,IAAI,CAAC,EAAE,GAAG,IAAA,eAAM,GAAE,CAAA;IACtB,CAAC;CACJ,CAAA;AA1BY,8BAAS;AAElB;IADC,IAAA,uBAAa,EAAC,EAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;;qCACpD;AAGV;IADC,IAAA,gBAAM,EAAC,EAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;;4CACtC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;;0CACvD;AAGf;IADC,IAAA,gBAAM,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;8BAC7B,IAAI;4CAAA;AAGf;IADC,IAAA,gBAAM,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;8BAC7B,IAAI;4CAAA;AAGf;IADC,IAAA,gBAAM,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8BACZ,IAAI;4CAAA;AAGf;IADC,IAAA,uBAAa,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;0CAClB;AAGf;IADC,IAAA,sBAAY,GAAE;;;;6CAGd;oBAzBQ,SAAS;IADrB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;GACR,SAAS,CA0BrB"}
|
package/dist/app.interface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AppEntity } from './app.entity';
|
|
2
3
|
export declare enum Language {
|
|
3
4
|
EN_US = "enUS",
|
|
4
5
|
ZH_CN = "zhCN"
|
|
@@ -31,3 +32,9 @@ export declare enum Action {
|
|
|
31
32
|
SIGN_UP = "signUp",
|
|
32
33
|
UPDATE = "update"
|
|
33
34
|
}
|
|
35
|
+
export interface FindResult<T extends AppEntity> {
|
|
36
|
+
limit: string;
|
|
37
|
+
offset: string;
|
|
38
|
+
results: T[];
|
|
39
|
+
total: string;
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;AAGA,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.interface.js","sourceRoot":"","sources":["../../src/authentication/authentication.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.AuthenticationModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const external_1 = require("
|
|
12
|
-
const
|
|
13
|
-
let
|
|
11
|
+
const external_1 = require("../external");
|
|
12
|
+
const authentication_service_1 = require("./authentication.service");
|
|
13
|
+
let AuthenticationModule = class AuthenticationModule {
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
15
|
+
exports.AuthenticationModule = AuthenticationModule;
|
|
16
|
+
exports.AuthenticationModule = AuthenticationModule = __decorate([
|
|
17
17
|
(0, common_1.Module)({
|
|
18
|
-
exports: [
|
|
18
|
+
exports: [authentication_service_1.AuthenticationService],
|
|
19
19
|
imports: [external_1.ExternalModule],
|
|
20
|
-
providers: [
|
|
20
|
+
providers: [authentication_service_1.AuthenticationService]
|
|
21
21
|
})
|
|
22
|
-
],
|
|
23
|
-
//# sourceMappingURL=
|
|
22
|
+
], AuthenticationModule);
|
|
23
|
+
//# sourceMappingURL=authentication.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.module.js","sourceRoot":"","sources":["../../src/authentication/authentication.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAqC;AACrC,0CAA0C;AAC1C,qEAA8D;AAOvD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,CAAC,8CAAqB,CAAC;QAChC,OAAO,EAAE,CAAC,yBAAc,CAAC;QACzB,SAAS,EAAE,CAAC,8CAAqB,CAAC;KACrC,CAAC;GACW,oBAAoB,CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { APIHeaders } from '../app.interface';
|
|
2
|
+
import { ExternalService } from '../external';
|
|
3
|
+
import { AuthenticationPermissionOptions } from './authentication.interface';
|
|
4
|
+
export declare class AuthenticationService {
|
|
5
|
+
private readonly externalService;
|
|
6
|
+
constructor(externalService: ExternalService);
|
|
7
|
+
authenticationAccess(headers: APIHeaders): Promise<import("../external").AuthenticatedToken>;
|
|
8
|
+
authenticationPermission(headers: APIHeaders): (options: AuthenticationPermissionOptions) => Promise<import("../external").AuthenticatedPermission>;
|
|
9
|
+
}
|
|
@@ -9,24 +9,24 @@ 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.AuthenticationService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const external_1 = require("
|
|
15
|
-
let
|
|
14
|
+
const external_1 = require("../external");
|
|
15
|
+
let AuthenticationService = class AuthenticationService {
|
|
16
16
|
externalService;
|
|
17
17
|
constructor(externalService) {
|
|
18
18
|
this.externalService = externalService;
|
|
19
19
|
}
|
|
20
|
-
async
|
|
21
|
-
return this.externalService.
|
|
20
|
+
async authenticationAccess(headers) {
|
|
21
|
+
return this.externalService.authenticationUserAccess(headers);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
return async (options) => this.externalService.
|
|
23
|
+
authenticationPermission(headers) {
|
|
24
|
+
return async (options) => this.externalService.authenticationUserPermission(headers)(options);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
27
|
+
exports.AuthenticationService = AuthenticationService;
|
|
28
|
+
exports.AuthenticationService = AuthenticationService = __decorate([
|
|
29
29
|
(0, common_1.Injectable)(),
|
|
30
30
|
__metadata("design:paramtypes", [external_1.ExternalService])
|
|
31
|
-
],
|
|
32
|
-
//# sourceMappingURL=
|
|
31
|
+
], AuthenticationService);
|
|
32
|
+
//# sourceMappingURL=authentication.service.js.map
|
|
@@ -0,0 +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;IACD;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,KAAK,CAAC,oBAAoB,CAAC,OAAmB;QAC1C,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAA;IACjE,CAAC;IAED,wBAAwB,CAAC,OAAmB;QACxC,OAAO,KAAK,EAAE,OAAwC,EAAE,EAAE,CACtD,IAAI,CAAC,eAAe,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAA;IAC3E,CAAC;CACJ,CAAA;AAXY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAEqC,0BAAe;GADpD,qBAAqB,CAWjC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './permission';
|
|
1
|
+
export * from './authentication.interface';
|
|
2
|
+
export * from './authentication.module';
|
|
3
|
+
export * from './authentication.service';
|
|
@@ -14,8 +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("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./permission"), exports);
|
|
17
|
+
__exportStar(require("./authentication.interface"), exports);
|
|
18
|
+
__exportStar(require("./authentication.module"), exports);
|
|
19
|
+
__exportStar(require("./authentication.service"), exports);
|
|
21
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA0C;AAC1C,0DAAuC;AACvC,2DAAwC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { DeepPartial,
|
|
1
|
+
import { DeepPartial, FindManyOptions, FindOptionsWhere } from 'typeorm';
|
|
2
2
|
import { ActionLogOptions } from '../action-log';
|
|
3
3
|
import { IndexDTO, NotIdDTO } from '../app.dto';
|
|
4
4
|
import { APIError, APIHeaders } from '../app.interface';
|
|
5
5
|
import { ThrowAPIErrorOptions } from '../util';
|
|
6
6
|
export interface BaseServiceOptions<T> extends Pick<ActionLogOptions, 'enableLogging'> {
|
|
7
|
-
entityManager?: EntityManager;
|
|
8
7
|
entityOptions: DeepPartial<T>;
|
|
9
8
|
findOptions: FindOptionsWhere<T>;
|
|
10
9
|
headers: APIHeaders;
|
|
@@ -38,3 +37,7 @@ export interface PreValidateOptions<T> {
|
|
|
38
37
|
export interface ThrowErrorOptions extends ThrowAPIErrorOptions {
|
|
39
38
|
errorType: APIError;
|
|
40
39
|
}
|
|
40
|
+
export interface ProcessOrValidateWhereResult<T> {
|
|
41
|
+
findOrOptions?: FindOptionsWhere<T>[];
|
|
42
|
+
where?: FindOptionsWhere<T>[];
|
|
43
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
2
2
|
import { ActionLogOptions, ActionLogService } from '../action-log';
|
|
3
3
|
import { AppEntity } from '../app.entity';
|
|
4
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
|
-
create<T extends AppEntity>({ enableLogging,
|
|
9
|
-
del<T extends AppEntity>({
|
|
10
|
-
update<T extends AppEntity>({ enableLogging,
|
|
8
|
+
create<T extends AppEntity>({ enableLogging, entityOptions, headers, preValidateOptions, serviceName }: CreateOptions<T>): (repository: Repository<T>) => (entityManager?: EntityManager) => Promise<T>;
|
|
9
|
+
del<T extends AppEntity>({ findOptions, serviceName, headers, enableLogging }: DelOptions<T>): (repository: Repository<T>) => (entityManager?: EntityManager) => Promise<void>;
|
|
10
|
+
update<T extends AppEntity>({ enableLogging, entityOptions, findOptions, headers, preValidateOptions, serviceName }: UpdateOptions<T>): (repository: Repository<T>) => (entityManager?: EntityManager) => Promise<T>;
|
|
11
11
|
find<T extends AppEntity>({ findOptions, findManyOptions }: FindOptions<T>): (repository: Repository<T>) => Promise<{
|
|
12
12
|
results: T[];
|
|
13
|
-
limit:
|
|
14
|
-
offset:
|
|
15
|
-
total:
|
|
13
|
+
limit: string;
|
|
14
|
+
offset: string;
|
|
15
|
+
total: string;
|
|
16
16
|
}>;
|
|
17
17
|
findOne<T extends AppEntity>({ serviceName, findOptions, actionLogOptions }: FindOneOptions<T>): (repository: Repository<T>) => Promise<T>;
|
|
18
|
-
updateAssociation<T extends AppEntity>({ enableLogging, entityIds: rawEntityIds,
|
|
18
|
+
updateAssociation<T extends AppEntity>({ enableLogging, entityIds: rawEntityIds, findOptions, headers, serviceName }: UpdateAssociationOptions<T>): (associationKey: string) => (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<T[]>>;
|
|
19
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;
|