@ubs-platform/users-common 1.0.6

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/.eslintrc.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": ["../../.eslintrc.base.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.json"],
19
+ "parser": "jsonc-eslint-parser",
20
+ "rules": {
21
+ "@nx/dependency-checks": "error"
22
+ }
23
+ }
24
+ ]
25
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 UBS Platform
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # users-common
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build users-common` to build the library.
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'nest-microservice-setup-util',
4
+ preset: '../../jest.preset.js',
5
+ testEnvironment: 'node',
6
+ transform: {
7
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
8
+ },
9
+ moduleFileExtensions: ['ts', 'js', 'html'],
10
+ coverageDirectory: '../../coverage/libs/nest-microservice-setup-util',
11
+ };
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@ubs-platform/users-common",
3
+ "version": "1.0.6",
4
+ "dependencies": {
5
+ "tslib": "^2.3.0"
6
+ },
7
+ "devDependencies": {
8
+ "typescript": "~5.3.2",
9
+ "@types/node": "~18.16.9"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "build-publish": "npm run build && npm publish"
17
+ },
18
+ "type": "commonjs",
19
+ "main": "./dist/index.js"
20
+ }
package/project.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "users-common",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/users-common/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/js:tsc",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/libs/users-common",
12
+ "main": "libs/users-common/src/index.ts",
13
+ "tsConfig": "libs/users-common/tsconfig.lib.json",
14
+ "assets": ["libs/users-common/*.md"]
15
+ }
16
+ },
17
+ "publish": {
18
+ "command": "node tools/scripts/publish.mjs users-common {args.ver} {args.tag}",
19
+ "dependsOn": ["build"]
20
+ }
21
+ },
22
+ "tags": []
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/dto';
@@ -0,0 +1,7 @@
1
+ export class UBSUsersErrorConsts {
2
+ static readonly EXIST_USERNAME = 'exist-username';
3
+ static readonly EXIST_PRIMARY_MAIL = 'exist-primary-mail';
4
+ static readonly EMPTY_DATA = 'empty-data';
5
+ static readonly AUTHENTICATION_FAIL = 'fail-authentication';
6
+ static readonly USER_NOTFOUND = 'notfound-user';
7
+ }
@@ -0,0 +1,3 @@
1
+ export class ErrorInformations {
2
+ constructor(public key: string, public message: string) {}
3
+ }
@@ -0,0 +1,12 @@
1
+ export * from './user-auth.model';
2
+ export * from './user-auth-status.model';
3
+ export * from './user-register.model';
4
+ export * from './error-consts';
5
+ export * from './user-general-info-dto';
6
+ export * from './user-dto';
7
+ export * from './user-admin-dto';
8
+ export * from './user-minimalized.dto';
9
+ export * from './user-create-dto';
10
+ export * from './password-change-dto';
11
+ export * from './user-full-dto';
12
+ export * from './error-informations';
@@ -0,0 +1,4 @@
1
+ export interface PasswordChangeDto {
2
+ currentPassword: string;
3
+ newPassword: string;
4
+ }
@@ -0,0 +1,11 @@
1
+ export interface UserAuthBackendDTO {
2
+ username: string;
3
+ primaryEmail: string;
4
+ name: string;
5
+ surname: string;
6
+ id: string;
7
+ suspended: boolean;
8
+ suspendReason: string;
9
+ roles: string[];
10
+ active: boolean;
11
+ }
@@ -0,0 +1,16 @@
1
+ export interface UserAuthStatus {
2
+ success: boolean;
3
+ message: string;
4
+ token?: string;
5
+ }
6
+
7
+ export class UserAuthSuccess implements UserAuthStatus {
8
+ constructor(public token?: string) {}
9
+ success = true;
10
+ message = 'User login is success';
11
+ }
12
+
13
+ export class UserAuthFail implements UserAuthStatus {
14
+ success = false;
15
+ message = 'Username or Password is wrong';
16
+ }
@@ -0,0 +1,4 @@
1
+ export interface UserAuth {
2
+ login: string;
3
+ password: string;
4
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ‼️‼️ do not use in frontend ‼️‼️
3
+ */
4
+ export interface UserCreateDTO {
5
+ username: string;
6
+ password: string;
7
+ primaryEmail: string;
8
+ name: string;
9
+ surname: string;
10
+ active: boolean;
11
+ // id: string;
12
+ roles: Array<string>;
13
+ }
@@ -0,0 +1,10 @@
1
+ export interface UserDTO {
2
+ username: string;
3
+ primaryEmail: string;
4
+ name: string;
5
+ surname: string;
6
+ id: string;
7
+ suspended: boolean;
8
+ suspendReason: string;
9
+ active: boolean;
10
+ }
@@ -0,0 +1,35 @@
1
+ export interface UserFullDto {
2
+ _id?: any;
3
+
4
+ username: string;
5
+
6
+ primaryEmail: string;
7
+
8
+ name: string;
9
+
10
+ surname: string;
11
+
12
+ country: string;
13
+
14
+ state: string;
15
+
16
+ city: string;
17
+
18
+ district: string;
19
+
20
+ gender: string;
21
+
22
+ pronounce: string;
23
+
24
+ roles: string[];
25
+
26
+ webSites: string[];
27
+
28
+ active: boolean;
29
+
30
+ suspended: boolean;
31
+
32
+ suspendReason: string;
33
+
34
+ password?: string;
35
+ }
@@ -0,0 +1,12 @@
1
+ export interface UserGeneralInfoDTO {
2
+ id?: string;
3
+ name: string;
4
+ surname: string;
5
+ gender: string;
6
+ pronounce: string;
7
+ webSites: string[];
8
+ country: string;
9
+ state: string;
10
+ city: string;
11
+ district: string;
12
+ }
@@ -0,0 +1,5 @@
1
+ export interface UserOnlyRequiredDTO {
2
+ name: string;
3
+ surname: string;
4
+ id: string;
5
+ }
@@ -0,0 +1,7 @@
1
+ export interface UserRegisterDTO {
2
+ username: string;
3
+ password: string;
4
+ primaryEmail: string;
5
+ name: string;
6
+ surname: string;
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compileOnSave": false,
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "sourceMap": true,
6
+ "moduleResolution": "node",
7
+ "emitDecoratorMetadata": true,
8
+ "experimentalDecorators": true,
9
+ "importHelpers": true,
10
+ "target": "es2015",
11
+ "module": "commonjs",
12
+ "outDir": "./dist",
13
+ "lib": ["es2020", "dom"],
14
+ "skipLibCheck": true,
15
+ "skipDefaultLibCheck": true,
16
+ "declaration": true,
17
+ },
18
+ "exclude": [
19
+ "node_modules",
20
+ "tmp",
21
+ "jest.config.ts",
22
+ "src/**/*.spec.ts",
23
+ "src/**/*.test.ts"
24
+ ],
25
+ "include": ["src/**/*.ts"]
26
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"]
7
+ },
8
+ "include": ["src/**/*.ts"],
9
+ "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
10
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "jest.config.ts",
10
+ "src/**/*.test.ts",
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }