@tomei/sso 0.11.7 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.commitlintrc.json +22 -22
- package/.eslintrc +16 -16
- package/.eslintrc.js +35 -35
- package/.husky/commit-msg +15 -15
- package/.husky/pre-commit +7 -7
- package/.prettierrc +4 -4
- package/Jenkinsfile +57 -57
- package/README.md +23 -23
- package/__tests__/unit/components/login-user/login-user.spec.ts +742 -742
- package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
- package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
- package/__tests__/unit/session/session.service.spec.ts +47 -47
- package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
- package/create-sso-user.sql +39 -39
- package/dist/src/components/login-user/login-user.d.ts +1 -0
- package/dist/src/components/login-user/login-user.js +16 -0
- package/dist/src/components/login-user/login-user.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +13 -13
- package/migrations/01-alter-system-privilege-table.js +13 -13
- package/migrations/02-alter-user-group-table.js +78 -78
- package/migrations/03-alter-user-system-privilege-table.js +38 -38
- package/migrations/04-create-user-user-group-table.js +55 -55
- package/migrations/05-create-login-history-table.js +49 -49
- package/package.json +1 -1
- package/sampledotenv +7 -7
- package/src/components/login-user/login-user.ts +18 -0
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +23 -23
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/login-user/user.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/login-user/user.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/login-user/user.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/system/system.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/system/system.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/system/system.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js.map +0 -1
- package/dist/src/prisma-client/__mocks__/prisma.d.ts +0 -3
- package/dist/src/prisma-client/__mocks__/prisma.js +0 -14
- package/dist/src/prisma-client/__mocks__/prisma.js.map +0 -1
- package/dist/src/prisma-client/client.d.ts +0 -3
- package/dist/src/prisma-client/client.js +0 -6
- package/dist/src/prisma-client/client.js.map +0 -1
- package/dist/src/prisma-client/index.d.ts +0 -1
- package/dist/src/prisma-client/index.js +0 -18
- package/dist/src/prisma-client/index.js.map +0 -1
    
        package/jest.config.js
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 | 
            -
            /** @type {import('ts-jest').JestConfigWithTsJest} */
         | 
| 2 | 
            -
            module.exports = {
         | 
| 3 | 
            -
              clearMocks: true,
         | 
| 4 | 
            -
              preset: 'ts-jest',
         | 
| 5 | 
            -
              testTimeout: 20000,
         | 
| 6 | 
            -
              coverageDirectory: "coverage",
         | 
| 7 | 
            -
              testEnvironment: 'node',
         | 
| 8 | 
            -
              "modulePathIgnorePatterns": [
         | 
| 9 | 
            -
                "<rootDir>/dist"
         | 
| 10 | 
            -
              ],
         | 
| 11 | 
            -
              setupFilesAfterEnv: [
         | 
| 12 | 
            -
                '<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
         | 
| 13 | 
            -
              ]   
         | 
| 1 | 
            +
            /** @type {import('ts-jest').JestConfigWithTsJest} */
         | 
| 2 | 
            +
            module.exports = {
         | 
| 3 | 
            +
              clearMocks: true,
         | 
| 4 | 
            +
              preset: 'ts-jest',
         | 
| 5 | 
            +
              testTimeout: 20000,
         | 
| 6 | 
            +
              coverageDirectory: "coverage",
         | 
| 7 | 
            +
              testEnvironment: 'node',
         | 
| 8 | 
            +
              "modulePathIgnorePatterns": [
         | 
| 9 | 
            +
                "<rootDir>/dist"
         | 
| 10 | 
            +
              ],
         | 
| 11 | 
            +
              setupFilesAfterEnv: [
         | 
| 12 | 
            +
                '<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
         | 
| 13 | 
            +
              ]   
         | 
| 14 14 | 
             
            };
         | 
| @@ -1,13 +1,13 @@ | |
| 1 | 
            -
            'use strict';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module.exports = {
         | 
| 4 | 
            -
              async up(queryInterface, Sequelize) {
         | 
| 5 | 
            -
                await queryInterface.addColumn('sso_systemPrivilege','Module', {
         | 
| 6 | 
            -
                    type: Sequelize.STRING(200),
         | 
| 7 | 
            -
                })
         | 
| 8 | 
            -
              },
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              async down(queryInterface) {
         | 
| 11 | 
            -
                queryInterface.removeColumn('sso_systemPrivilege','Module')
         | 
| 12 | 
            -
              },
         | 
| 13 | 
            -
            };
         | 
| 1 | 
            +
            'use strict';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module.exports = {
         | 
| 4 | 
            +
              async up(queryInterface, Sequelize) {
         | 
| 5 | 
            +
                await queryInterface.addColumn('sso_systemPrivilege','Module', {
         | 
| 6 | 
            +
                    type: Sequelize.STRING(200),
         | 
| 7 | 
            +
                })
         | 
| 8 | 
            +
              },
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              async down(queryInterface) {
         | 
| 11 | 
            +
                queryInterface.removeColumn('sso_systemPrivilege','Module')
         | 
| 12 | 
            +
              },
         | 
| 13 | 
            +
            };
         | 
| @@ -1,78 +1,78 @@ | |
| 1 | 
            -
            'use strict';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module.exports = {
         | 
| 4 | 
            -
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            -
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 6 | 
            -
                  return await Promise.all([
         | 
| 7 | 
            -
                    queryInterface.addColumn(
         | 
| 8 | 
            -
                      'sso_usergroup',
         | 
| 9 | 
            -
                      'AllowInheritFromParentYN',
         | 
| 10 | 
            -
                      {
         | 
| 11 | 
            -
                        type: Sequelize.ENUM(['Y', 'N']),
         | 
| 12 | 
            -
                        defaultValue: 'N',
         | 
| 13 | 
            -
                      },
         | 
| 14 | 
            -
                      { transaction: t },
         | 
| 15 | 
            -
                    ),
         | 
| 16 | 
            -
                    queryInterface.addColumn(
         | 
| 17 | 
            -
                        'sso_usergroup',
         | 
| 18 | 
            -
                        'FullPath',
         | 
| 19 | 
            -
                        {
         | 
| 20 | 
            -
                            type: Sequelize.STRING(1000),
         | 
| 21 | 
            -
                            allowNull: true,
         | 
| 22 | 
            -
                        },
         | 
| 23 | 
            -
                        { transaction: t },
         | 
| 24 | 
            -
                    ),
         | 
| 25 | 
            -
                    queryInterface.addColumn(
         | 
| 26 | 
            -
                        'sso_usergroup',
         | 
| 27 | 
            -
                        'GroupLevel',
         | 
| 28 | 
            -
                        {
         | 
| 29 | 
            -
                            type: Sequelize.INTEGER,
         | 
| 30 | 
            -
                            allowNull: false,
         | 
| 31 | 
            -
                            defaultValue: 0,
         | 
| 32 | 
            -
                        },
         | 
| 33 | 
            -
                        { transaction: t },
         | 
| 34 | 
            -
                    ),
         | 
| 35 | 
            -
                    queryInterface.addColumn(
         | 
| 36 | 
            -
                        'sso_usergroup',
         | 
| 37 | 
            -
                        'GroupType',
         | 
| 38 | 
            -
                        {
         | 
| 39 | 
            -
                            type: Sequelize.STRING(10),
         | 
| 40 | 
            -
                            allowNull: true,
         | 
| 41 | 
            -
                        },
         | 
| 42 | 
            -
                        { transaction: t },
         | 
| 43 | 
            -
                    ),
         | 
| 44 | 
            -
                    queryInterface.addColumn(
         | 
| 45 | 
            -
                        'sso_usergroup',
         | 
| 46 | 
            -
                        'ParentGroupCode',
         | 
| 47 | 
            -
                        {
         | 
| 48 | 
            -
                            type: Sequelize.STRING(10),
         | 
| 49 | 
            -
                            allowNull: true,
         | 
| 50 | 
            -
                        },
         | 
| 51 | 
            -
                        { transaction: t },
         | 
| 52 | 
            -
                    ),
         | 
| 53 | 
            -
                    queryInterface.addColumn(
         | 
| 54 | 
            -
                        'sso_usergroup',
         | 
| 55 | 
            -
                        'PersonInCharge',
         | 
| 56 | 
            -
                        {
         | 
| 57 | 
            -
                            type: Sequelize.STRING(100),
         | 
| 58 | 
            -
                            allowNull: true,
         | 
| 59 | 
            -
                        },
         | 
| 60 | 
            -
                        { transaction: t },
         | 
| 61 | 
            -
                    ),
         | 
| 62 | 
            -
                  ]);
         | 
| 63 | 
            -
                });
         | 
| 64 | 
            -
              },
         | 
| 65 | 
            -
             | 
| 66 | 
            -
              down: async (queryInterface) => {
         | 
| 67 | 
            -
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 68 | 
            -
                  return await Promise.all([
         | 
| 69 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'AllowInheritFromParentYN', { transaction: t }),
         | 
| 70 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'FullPath', { transaction: t }),
         | 
| 71 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'GroupLevel', { transaction: t }),
         | 
| 72 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'GroupType', { transaction: t }),
         | 
| 73 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'ParentGroupCode', { transaction: t }),
         | 
| 74 | 
            -
                    queryInterface.removeColumn('sso_usergroup', 'PersonInCharge', { transaction: t }),
         | 
| 75 | 
            -
                  ]);
         | 
| 76 | 
            -
                });
         | 
| 77 | 
            -
              },
         | 
| 78 | 
            -
            };
         | 
| 1 | 
            +
            'use strict';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module.exports = {
         | 
| 4 | 
            +
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            +
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 6 | 
            +
                  return await Promise.all([
         | 
| 7 | 
            +
                    queryInterface.addColumn(
         | 
| 8 | 
            +
                      'sso_usergroup',
         | 
| 9 | 
            +
                      'AllowInheritFromParentYN',
         | 
| 10 | 
            +
                      {
         | 
| 11 | 
            +
                        type: Sequelize.ENUM(['Y', 'N']),
         | 
| 12 | 
            +
                        defaultValue: 'N',
         | 
| 13 | 
            +
                      },
         | 
| 14 | 
            +
                      { transaction: t },
         | 
| 15 | 
            +
                    ),
         | 
| 16 | 
            +
                    queryInterface.addColumn(
         | 
| 17 | 
            +
                        'sso_usergroup',
         | 
| 18 | 
            +
                        'FullPath',
         | 
| 19 | 
            +
                        {
         | 
| 20 | 
            +
                            type: Sequelize.STRING(1000),
         | 
| 21 | 
            +
                            allowNull: true,
         | 
| 22 | 
            +
                        },
         | 
| 23 | 
            +
                        { transaction: t },
         | 
| 24 | 
            +
                    ),
         | 
| 25 | 
            +
                    queryInterface.addColumn(
         | 
| 26 | 
            +
                        'sso_usergroup',
         | 
| 27 | 
            +
                        'GroupLevel',
         | 
| 28 | 
            +
                        {
         | 
| 29 | 
            +
                            type: Sequelize.INTEGER,
         | 
| 30 | 
            +
                            allowNull: false,
         | 
| 31 | 
            +
                            defaultValue: 0,
         | 
| 32 | 
            +
                        },
         | 
| 33 | 
            +
                        { transaction: t },
         | 
| 34 | 
            +
                    ),
         | 
| 35 | 
            +
                    queryInterface.addColumn(
         | 
| 36 | 
            +
                        'sso_usergroup',
         | 
| 37 | 
            +
                        'GroupType',
         | 
| 38 | 
            +
                        {
         | 
| 39 | 
            +
                            type: Sequelize.STRING(10),
         | 
| 40 | 
            +
                            allowNull: true,
         | 
| 41 | 
            +
                        },
         | 
| 42 | 
            +
                        { transaction: t },
         | 
| 43 | 
            +
                    ),
         | 
| 44 | 
            +
                    queryInterface.addColumn(
         | 
| 45 | 
            +
                        'sso_usergroup',
         | 
| 46 | 
            +
                        'ParentGroupCode',
         | 
| 47 | 
            +
                        {
         | 
| 48 | 
            +
                            type: Sequelize.STRING(10),
         | 
| 49 | 
            +
                            allowNull: true,
         | 
| 50 | 
            +
                        },
         | 
| 51 | 
            +
                        { transaction: t },
         | 
| 52 | 
            +
                    ),
         | 
| 53 | 
            +
                    queryInterface.addColumn(
         | 
| 54 | 
            +
                        'sso_usergroup',
         | 
| 55 | 
            +
                        'PersonInCharge',
         | 
| 56 | 
            +
                        {
         | 
| 57 | 
            +
                            type: Sequelize.STRING(100),
         | 
| 58 | 
            +
                            allowNull: true,
         | 
| 59 | 
            +
                        },
         | 
| 60 | 
            +
                        { transaction: t },
         | 
| 61 | 
            +
                    ),
         | 
| 62 | 
            +
                  ]);
         | 
| 63 | 
            +
                });
         | 
| 64 | 
            +
              },
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              down: async (queryInterface) => {
         | 
| 67 | 
            +
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 68 | 
            +
                  return await Promise.all([
         | 
| 69 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'AllowInheritFromParentYN', { transaction: t }),
         | 
| 70 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'FullPath', { transaction: t }),
         | 
| 71 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'GroupLevel', { transaction: t }),
         | 
| 72 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'GroupType', { transaction: t }),
         | 
| 73 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'ParentGroupCode', { transaction: t }),
         | 
| 74 | 
            +
                    queryInterface.removeColumn('sso_usergroup', 'PersonInCharge', { transaction: t }),
         | 
| 75 | 
            +
                  ]);
         | 
| 76 | 
            +
                });
         | 
| 77 | 
            +
              },
         | 
| 78 | 
            +
            };
         | 
| @@ -1,38 +1,38 @@ | |
| 1 | 
            -
            'use strict';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module.exports = {
         | 
| 4 | 
            -
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            -
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 6 | 
            -
                  return await Promise.all([
         | 
| 7 | 
            -
                    queryInterface.addColumn(
         | 
| 8 | 
            -
                        'sso_usersystemprivilege',
         | 
| 9 | 
            -
                        'IsInheritedYN',
         | 
| 10 | 
            -
                        {
         | 
| 11 | 
            -
                            type: Sequelize.ENUM(['Y', 'N']),
         | 
| 12 | 
            -
                            defaultValue: 'N',
         | 
| 13 | 
            -
                        },
         | 
| 14 | 
            -
                        { transaction: t },
         | 
| 15 | 
            -
                    ),
         | 
| 16 | 
            -
                    queryInterface.addColumn(
         | 
| 17 | 
            -
                        'sso_usersystemprivilege',
         | 
| 18 | 
            -
                        'IsRevokedYN',
         | 
| 19 | 
            -
                        {
         | 
| 20 | 
            -
                            type: Sequelize.ENUM(['Y', 'N']),
         | 
| 21 | 
            -
                            defaultValue: 'N',
         | 
| 22 | 
            -
                        },
         | 
| 23 | 
            -
                        { transaction: t },
         | 
| 24 | 
            -
                    ),
         | 
| 25 | 
            -
                  ]);
         | 
| 26 | 
            -
                });
         | 
| 27 | 
            -
              },
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              down: async (queryInterface) => {
         | 
| 30 | 
            -
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 31 | 
            -
                  return await Promise.all([
         | 
| 32 | 
            -
                    queryInterface.removeColumn('sso_usersystemprivilege', 'IsInheritedYN', { transaction: t }),
         | 
| 33 | 
            -
                    queryInterface.removeColumn('sso_usersystemprivilege', 'IsRevokedYN', { transaction: t }),
         | 
| 34 | 
            -
                  ]);
         | 
| 35 | 
            -
                });
         | 
| 36 | 
            -
              },
         | 
| 37 | 
            -
            };
         | 
| 38 | 
            -
            'use strict';
         | 
| 1 | 
            +
            'use strict';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module.exports = {
         | 
| 4 | 
            +
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            +
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 6 | 
            +
                  return await Promise.all([
         | 
| 7 | 
            +
                    queryInterface.addColumn(
         | 
| 8 | 
            +
                        'sso_usersystemprivilege',
         | 
| 9 | 
            +
                        'IsInheritedYN',
         | 
| 10 | 
            +
                        {
         | 
| 11 | 
            +
                            type: Sequelize.ENUM(['Y', 'N']),
         | 
| 12 | 
            +
                            defaultValue: 'N',
         | 
| 13 | 
            +
                        },
         | 
| 14 | 
            +
                        { transaction: t },
         | 
| 15 | 
            +
                    ),
         | 
| 16 | 
            +
                    queryInterface.addColumn(
         | 
| 17 | 
            +
                        'sso_usersystemprivilege',
         | 
| 18 | 
            +
                        'IsRevokedYN',
         | 
| 19 | 
            +
                        {
         | 
| 20 | 
            +
                            type: Sequelize.ENUM(['Y', 'N']),
         | 
| 21 | 
            +
                            defaultValue: 'N',
         | 
| 22 | 
            +
                        },
         | 
| 23 | 
            +
                        { transaction: t },
         | 
| 24 | 
            +
                    ),
         | 
| 25 | 
            +
                  ]);
         | 
| 26 | 
            +
                });
         | 
| 27 | 
            +
              },
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              down: async (queryInterface) => {
         | 
| 30 | 
            +
                return queryInterface.sequelize.transaction(async (t) => {
         | 
| 31 | 
            +
                  return await Promise.all([
         | 
| 32 | 
            +
                    queryInterface.removeColumn('sso_usersystemprivilege', 'IsInheritedYN', { transaction: t }),
         | 
| 33 | 
            +
                    queryInterface.removeColumn('sso_usersystemprivilege', 'IsRevokedYN', { transaction: t }),
         | 
| 34 | 
            +
                  ]);
         | 
| 35 | 
            +
                });
         | 
| 36 | 
            +
              },
         | 
| 37 | 
            +
            };
         | 
| 38 | 
            +
            'use strict';
         | 
| @@ -1,55 +1,55 @@ | |
| 1 | 
            -
            'use strict';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module.exports = {
         | 
| 4 | 
            -
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            -
                queryInterface.createTable('sso_UserUserGroup', {
         | 
| 6 | 
            -
                    UserId: {
         | 
| 7 | 
            -
                        primaryKey: true,
         | 
| 8 | 
            -
                        type: Sequelize.INTEGER,
         | 
| 9 | 
            -
                        allowNull: false,
         | 
| 10 | 
            -
                        references: {
         | 
| 11 | 
            -
                            model: 'sso_users',
         | 
| 12 | 
            -
                            key: 'id',
         | 
| 13 | 
            -
                        },
         | 
| 14 | 
            -
                        onDelete: 'CASCADE',
         | 
| 15 | 
            -
                        onUpdate: 'CASCADE',
         | 
| 16 | 
            -
                    },
         | 
| 17 | 
            -
                    GroupCode: {
         | 
| 18 | 
            -
                        primaryKey: true,
         | 
| 19 | 
            -
                        type: Sequelize.STRING(191),
         | 
| 20 | 
            -
                        allowNull: false,
         | 
| 21 | 
            -
                        references: {
         | 
| 22 | 
            -
                            model: 'sso_usergroup',
         | 
| 23 | 
            -
                            key: 'GroupCode',
         | 
| 24 | 
            -
                        },
         | 
| 25 | 
            -
                        onDelete: 'CASCADE',
         | 
| 26 | 
            -
                        onUpdate: 'CASCADE',
         | 
| 27 | 
            -
                    },
         | 
| 28 | 
            -
                    SystemId: {
         | 
| 29 | 
            -
                        type: Sequelize.INTEGER,
         | 
| 30 | 
            -
                        allowNull: true,
         | 
| 31 | 
            -
                        references: {
         | 
| 32 | 
            -
                            model: 'sso_systems',
         | 
| 33 | 
            -
                            key: 'id',
         | 
| 34 | 
            -
                        },
         | 
| 35 | 
            -
                        onDelete: 'CASCADE',
         | 
| 36 | 
            -
                        onUpdate: 'CASCADE',
         | 
| 37 | 
            -
                    },
         | 
| 38 | 
            -
                    CreatedAt: {
         | 
| 39 | 
            -
                        allowNull: false,
         | 
| 40 | 
            -
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 41 | 
            -
                        type: Sequelize.DATE,
         | 
| 42 | 
            -
                    },
         | 
| 43 | 
            -
                    UpdatedAt: {
         | 
| 44 | 
            -
                        allowNull: false,
         | 
| 45 | 
            -
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 46 | 
            -
                        type: Sequelize.DATE,
         | 
| 47 | 
            -
                    },
         | 
| 48 | 
            -
                });
         | 
| 49 | 
            -
             | 
| 50 | 
            -
              },
         | 
| 51 | 
            -
             | 
| 52 | 
            -
              down: async (queryInterface) => {
         | 
| 53 | 
            -
                await queryInterface.dropTable('sso_UserUserGroup');
         | 
| 54 | 
            -
              },
         | 
| 55 | 
            -
            };
         | 
| 1 | 
            +
            'use strict';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module.exports = {
         | 
| 4 | 
            +
              up: async (queryInterface, Sequelize) => {
         | 
| 5 | 
            +
                queryInterface.createTable('sso_UserUserGroup', {
         | 
| 6 | 
            +
                    UserId: {
         | 
| 7 | 
            +
                        primaryKey: true,
         | 
| 8 | 
            +
                        type: Sequelize.INTEGER,
         | 
| 9 | 
            +
                        allowNull: false,
         | 
| 10 | 
            +
                        references: {
         | 
| 11 | 
            +
                            model: 'sso_users',
         | 
| 12 | 
            +
                            key: 'id',
         | 
| 13 | 
            +
                        },
         | 
| 14 | 
            +
                        onDelete: 'CASCADE',
         | 
| 15 | 
            +
                        onUpdate: 'CASCADE',
         | 
| 16 | 
            +
                    },
         | 
| 17 | 
            +
                    GroupCode: {
         | 
| 18 | 
            +
                        primaryKey: true,
         | 
| 19 | 
            +
                        type: Sequelize.STRING(191),
         | 
| 20 | 
            +
                        allowNull: false,
         | 
| 21 | 
            +
                        references: {
         | 
| 22 | 
            +
                            model: 'sso_usergroup',
         | 
| 23 | 
            +
                            key: 'GroupCode',
         | 
| 24 | 
            +
                        },
         | 
| 25 | 
            +
                        onDelete: 'CASCADE',
         | 
| 26 | 
            +
                        onUpdate: 'CASCADE',
         | 
| 27 | 
            +
                    },
         | 
| 28 | 
            +
                    SystemId: {
         | 
| 29 | 
            +
                        type: Sequelize.INTEGER,
         | 
| 30 | 
            +
                        allowNull: true,
         | 
| 31 | 
            +
                        references: {
         | 
| 32 | 
            +
                            model: 'sso_systems',
         | 
| 33 | 
            +
                            key: 'id',
         | 
| 34 | 
            +
                        },
         | 
| 35 | 
            +
                        onDelete: 'CASCADE',
         | 
| 36 | 
            +
                        onUpdate: 'CASCADE',
         | 
| 37 | 
            +
                    },
         | 
| 38 | 
            +
                    CreatedAt: {
         | 
| 39 | 
            +
                        allowNull: false,
         | 
| 40 | 
            +
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 41 | 
            +
                        type: Sequelize.DATE,
         | 
| 42 | 
            +
                    },
         | 
| 43 | 
            +
                    UpdatedAt: {
         | 
| 44 | 
            +
                        allowNull: false,
         | 
| 45 | 
            +
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 46 | 
            +
                        type: Sequelize.DATE,
         | 
| 47 | 
            +
                    },
         | 
| 48 | 
            +
                });
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              },
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              down: async (queryInterface) => {
         | 
| 53 | 
            +
                await queryInterface.dropTable('sso_UserUserGroup');
         | 
| 54 | 
            +
              },
         | 
| 55 | 
            +
            };
         | 
| @@ -1,49 +1,49 @@ | |
| 1 | 
            -
            'use strict';
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
            module.exports = {
         | 
| 5 | 
            -
              up: async (queryInterface, Sequelize) => {
         | 
| 6 | 
            -
                queryInterface.createTable('sso_LoginHistories', {
         | 
| 7 | 
            -
                    Id: {
         | 
| 8 | 
            -
                        primaryKey: true,
         | 
| 9 | 
            -
                        autoIncrement: true,
         | 
| 10 | 
            -
                        type: Sequelize.INTEGER,
         | 
| 11 | 
            -
                        allowNull: false,
         | 
| 12 | 
            -
                    },
         | 
| 13 | 
            -
                    UserId: {
         | 
| 14 | 
            -
                        type: Sequelize.INTEGER,
         | 
| 15 | 
            -
                        allowNull: false,
         | 
| 16 | 
            -
                        references: {
         | 
| 17 | 
            -
                            model: 'sso_users',
         | 
| 18 | 
            -
                            key: 'id',
         | 
| 19 | 
            -
                        },
         | 
| 20 | 
            -
                        onDelete: 'CASCADE',
         | 
| 21 | 
            -
                        onUpdate: 'CASCADE',
         | 
| 22 | 
            -
                    },
         | 
| 23 | 
            -
                    SystemId: {
         | 
| 24 | 
            -
                        type: Sequelize.INTEGER,
         | 
| 25 | 
            -
                        allowNull: false,
         | 
| 26 | 
            -
                        references: {
         | 
| 27 | 
            -
                            model: 'sso_systems',
         | 
| 28 | 
            -
                            key: 'id',
         | 
| 29 | 
            -
                        },
         | 
| 30 | 
            -
                        onDelete: 'CASCADE',
         | 
| 31 | 
            -
                        onUpdate: 'CASCADE',
         | 
| 32 | 
            -
                    },
         | 
| 33 | 
            -
                    OriginIP: {
         | 
| 34 | 
            -
                        type: Sequelize.STRING(191),
         | 
| 35 | 
            -
                        allowNull: false,
         | 
| 36 | 
            -
                    },
         | 
| 37 | 
            -
                    CreatedAt: {
         | 
| 38 | 
            -
                        type: Sequelize.DATE(3),
         | 
| 39 | 
            -
                        allowNull: false,
         | 
| 40 | 
            -
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 41 | 
            -
                    },
         | 
| 42 | 
            -
                });
         | 
| 43 | 
            -
             | 
| 44 | 
            -
              },
         | 
| 45 | 
            -
             | 
| 46 | 
            -
              down: async (queryInterface) => {
         | 
| 47 | 
            -
                await queryInterface.dropTable('sso_LoginHistories');
         | 
| 48 | 
            -
              },
         | 
| 49 | 
            -
            };
         | 
| 1 | 
            +
            'use strict';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
             | 
| 4 | 
            +
            module.exports = {
         | 
| 5 | 
            +
              up: async (queryInterface, Sequelize) => {
         | 
| 6 | 
            +
                queryInterface.createTable('sso_LoginHistories', {
         | 
| 7 | 
            +
                    Id: {
         | 
| 8 | 
            +
                        primaryKey: true,
         | 
| 9 | 
            +
                        autoIncrement: true,
         | 
| 10 | 
            +
                        type: Sequelize.INTEGER,
         | 
| 11 | 
            +
                        allowNull: false,
         | 
| 12 | 
            +
                    },
         | 
| 13 | 
            +
                    UserId: {
         | 
| 14 | 
            +
                        type: Sequelize.INTEGER,
         | 
| 15 | 
            +
                        allowNull: false,
         | 
| 16 | 
            +
                        references: {
         | 
| 17 | 
            +
                            model: 'sso_users',
         | 
| 18 | 
            +
                            key: 'id',
         | 
| 19 | 
            +
                        },
         | 
| 20 | 
            +
                        onDelete: 'CASCADE',
         | 
| 21 | 
            +
                        onUpdate: 'CASCADE',
         | 
| 22 | 
            +
                    },
         | 
| 23 | 
            +
                    SystemId: {
         | 
| 24 | 
            +
                        type: Sequelize.INTEGER,
         | 
| 25 | 
            +
                        allowNull: false,
         | 
| 26 | 
            +
                        references: {
         | 
| 27 | 
            +
                            model: 'sso_systems',
         | 
| 28 | 
            +
                            key: 'id',
         | 
| 29 | 
            +
                        },
         | 
| 30 | 
            +
                        onDelete: 'CASCADE',
         | 
| 31 | 
            +
                        onUpdate: 'CASCADE',
         | 
| 32 | 
            +
                    },
         | 
| 33 | 
            +
                    OriginIP: {
         | 
| 34 | 
            +
                        type: Sequelize.STRING(191),
         | 
| 35 | 
            +
                        allowNull: false,
         | 
| 36 | 
            +
                    },
         | 
| 37 | 
            +
                    CreatedAt: {
         | 
| 38 | 
            +
                        type: Sequelize.DATE(3),
         | 
| 39 | 
            +
                        allowNull: false,
         | 
| 40 | 
            +
                        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
         | 
| 41 | 
            +
                    },
         | 
| 42 | 
            +
                });
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              },
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              down: async (queryInterface) => {
         | 
| 47 | 
            +
                await queryInterface.dropTable('sso_LoginHistories');
         | 
| 48 | 
            +
              },
         | 
| 49 | 
            +
            };
         | 
    
        package/package.json
    CHANGED
    
    
    
        package/sampledotenv
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 | 
            -
            DATABASE_URL=
         | 
| 2 | 
            -
            SHADOW_DATABASE_URL=
         | 
| 3 | 
            -
            REDIS_URL=
         | 
| 4 | 
            -
            REDIS_PASSWORD=
         | 
| 5 | 
            -
            SMTP_HOST=
         | 
| 6 | 
            -
            SMTP_PORT=
         | 
| 7 | 
            -
            EMAIL_SENDER=
         | 
| 1 | 
            +
            DATABASE_URL=
         | 
| 2 | 
            +
            SHADOW_DATABASE_URL=
         | 
| 3 | 
            +
            REDIS_URL=
         | 
| 4 | 
            +
            REDIS_PASSWORD=
         | 
| 5 | 
            +
            SMTP_HOST=
         | 
| 6 | 
            +
            SMTP_PORT=
         | 
| 7 | 
            +
            EMAIL_SENDER=
         | 
| 8 8 | 
             
            EMAIL_PASSWORD=
         | 
| @@ -535,4 +535,22 @@ export class LoginUser extends LoginUserBase { | |
| 535 535 | 
             
                  throw error;
         | 
| 536 536 | 
             
                }
         | 
| 537 537 | 
             
              }
         | 
| 538 | 
            +
             | 
| 539 | 
            +
              async logout(systemCode: string) {
         | 
| 540 | 
            +
                try {
         | 
| 541 | 
            +
                  if (!this.ObjectId) {
         | 
| 542 | 
            +
                    throw new Error('ObjectId(UserId) is not set');
         | 
| 543 | 
            +
                  }
         | 
| 544 | 
            +
                  const userSession = await this._SessionService.retrieveUserSession(
         | 
| 545 | 
            +
                    this.ObjectId,
         | 
| 546 | 
            +
                  );
         | 
| 547 | 
            +
                  const index = userSession.systemLogins.findIndex(
         | 
| 548 | 
            +
                    (system) => system.code === systemCode,
         | 
| 549 | 
            +
                  );
         | 
| 550 | 
            +
                  userSession.systemLogins.splice(index, 1);
         | 
| 551 | 
            +
                  this._SessionService.setUserSession(this.ObjectId, userSession);
         | 
| 552 | 
            +
                } catch (error) {
         | 
| 553 | 
            +
                  throw error;
         | 
| 554 | 
            +
                }
         | 
| 555 | 
            +
              }
         | 
| 538 556 | 
             
            }
         | 
    
        package/tsconfig.build.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            {
         | 
| 2 | 
            -
                "extends": "./tsconfig.json",
         | 
| 3 | 
            -
                "include": ["**/*.ts"],
         | 
| 4 | 
            -
                "exclude": ["node_modules", "__test__", "dist", "**/*spec.ts"]
         | 
| 5 | 
            -
              }
         | 
| 1 | 
            +
            {
         | 
| 2 | 
            +
                "extends": "./tsconfig.json",
         | 
| 3 | 
            +
                "include": ["**/*.ts"],
         | 
| 4 | 
            +
                "exclude": ["node_modules", "__test__", "dist", "**/*spec.ts"]
         | 
| 5 | 
            +
              }
         | 
| 6 6 |  | 
    
        package/tsconfig.json
    CHANGED
    
    | @@ -1,23 +1,23 @@ | |
| 1 | 
            -
            {
         | 
| 2 | 
            -
              "compilerOptions": {
         | 
| 3 | 
            -
                "module": "commonjs",
         | 
| 4 | 
            -
                "declaration": true,
         | 
| 5 | 
            -
                "removeComments": true,
         | 
| 6 | 
            -
                "emitDecoratorMetadata": true,
         | 
| 7 | 
            -
                "experimentalDecorators": true,
         | 
| 8 | 
            -
                "allowSyntheticDefaultImports": true,
         | 
| 9 | 
            -
                "moduleResolution": "node",
         | 
| 10 | 
            -
                "target": "es6",
         | 
| 11 | 
            -
                "sourceMap": true,
         | 
| 12 | 
            -
                "outDir": "./dist",
         | 
| 13 | 
            -
                "baseUrl": "./src",
         | 
| 14 | 
            -
                "rootDir": "./",
         | 
| 15 | 
            -
                "incremental": true,
         | 
| 16 | 
            -
                "skipLibCheck": true,
         | 
| 17 | 
            -
                "noImplicitAny": false,
         | 
| 18 | 
            -
                "strictBindCallApply": false,
         | 
| 19 | 
            -
                "forceConsistentCasingInFileNames": false,
         | 
| 20 | 
            -
                "noFallthroughCasesInSwitch": false,
         | 
| 21 | 
            -
                "strictNullChecks": true,
         | 
| 22 | 
            -
              },
         | 
| 23 | 
            -
            }
         | 
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "compilerOptions": {
         | 
| 3 | 
            +
                "module": "commonjs",
         | 
| 4 | 
            +
                "declaration": true,
         | 
| 5 | 
            +
                "removeComments": true,
         | 
| 6 | 
            +
                "emitDecoratorMetadata": true,
         | 
| 7 | 
            +
                "experimentalDecorators": true,
         | 
| 8 | 
            +
                "allowSyntheticDefaultImports": true,
         | 
| 9 | 
            +
                "moduleResolution": "node",
         | 
| 10 | 
            +
                "target": "es6",
         | 
| 11 | 
            +
                "sourceMap": true,
         | 
| 12 | 
            +
                "outDir": "./dist",
         | 
| 13 | 
            +
                "baseUrl": "./src",
         | 
| 14 | 
            +
                "rootDir": "./",
         | 
| 15 | 
            +
                "incremental": true,
         | 
| 16 | 
            +
                "skipLibCheck": true,
         | 
| 17 | 
            +
                "noImplicitAny": false,
         | 
| 18 | 
            +
                "strictBindCallApply": false,
         | 
| 19 | 
            +
                "forceConsistentCasingInFileNames": false,
         | 
| 20 | 
            +
                "noFallthroughCasesInSwitch": false,
         | 
| 21 | 
            +
                "strictNullChecks": true,
         | 
| 22 | 
            +
              },
         | 
| 23 | 
            +
            }
         | 
| 
            File without changes
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            //# sourceMappingURL=login-history.repository.spec.js.map
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"login-history.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/login-history/login-history.repository.spec.ts"],"names":[],"mappings":""}
         | 
| 
            File without changes
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            //# sourceMappingURL=user.repository.spec.js.map
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"user.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/login-user/user.repository.spec.ts"],"names":[],"mappings":""}
         | 
| 
            File without changes
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            //# sourceMappingURL=system.repository.spec.js.map
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"system.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/system/system.repository.spec.ts"],"names":[],"mappings":""}
         | 
| 
            File without changes
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            //# sourceMappingURL=system-access.repository.spec.js.map
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"system-access.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/system-access/system-access.repository.spec.ts"],"names":[],"mappings":""}
         | 
| @@ -1,3 +0,0 @@ | |
| 1 | 
            -
            import { PrismaClient } from '@prisma/client';
         | 
| 2 | 
            -
            import { DeepMockProxy } from 'jest-mock-extended';
         | 
| 3 | 
            -
            export declare const prismaMock: DeepMockProxy<PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import(".prisma/client").Prisma.RejectOnNotFound | import(".prisma/client").Prisma.RejectPerOperation | undefined>>;
         |