diff --git a/package.json b/package.json index ef3cf52..c881f6b 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@nestjs/platform-express": "^8.0.0", "@nestjs/platform-socket.io": "^8.4.4", "@nestjs/schedule": "^1.1.0", + "@nestjs/typeorm": "^8.1.4", "@nestjs/websockets": "^8.4.4", "config": "^3.3.7", "ioredis": "^5.0.5", @@ -38,9 +39,11 @@ "openid-client": "^5.1.6", "passport": "^0.5.2", "passport-jwt": "^4.0.0", + "pg": "^8.7.3", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.2.0", + "typeorm": "^0.3.7", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/src/app.module.ts b/src/app.module.ts index 9772634..d2b1593 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -15,7 +15,7 @@ import { } from './controllers'; import { jwtModuleOptions, redisModuleOptions } from './modules'; import { TimeSheetSocket } from './sockets'; -import { DingTalkSchedule, TimeSheetSchedule } from './schedules'; +import { TimeSheetSchedule } from './schedules'; import { AttendanceService, AuthService, @@ -25,13 +25,24 @@ import { InformService, } from './services'; import { JwtStrategy, WsGuard } from './strategys'; - +import { TypeOrmModule } from '@nestjs/typeorm'; +import { join } from 'path'; +import config from '@config/config'; +import { UserTimesheet } from './entities/timesheet.enetity'; @Module({ imports: [ PassportModule, JwtModule.register(jwtModuleOptions), RedisModule.forRoot(redisModuleOptions), ScheduleModule.forRoot(), + TypeOrmModule.forRoot({ + type: 'postgres', + ...config.postgresql, + entities: [join(__dirname, '**', '*.entity.{ts,js}')], + migrationsTableName: 'migration', + migrations: ['src/migration/*.ts'], + }), + TypeOrmModule.forFeature([UserTimesheet]), ], controllers: [ AppController, @@ -53,7 +64,6 @@ import { JwtStrategy, WsGuard } from './strategys'; UserService, InformService, TimeSheetSocket, - DingTalkSchedule, TimeSheetSchedule, ], exports: [AuthService], diff --git a/src/config/config.ts b/src/config/config.ts index af0612c..4564d83 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -1,7 +1,9 @@ +import { ServerEnvironment } from '@constants/server'; import * as config from 'config'; interface IConfig { server: { port: number; + environment: ServerEnvironment; }; dingTalk: { bossId: string; @@ -49,11 +51,22 @@ interface IConfig { secret: string; expiresIn: string; }; + postgresql: { + host: string; + port: number; + username: string; + password: string; + database: string; + autoLoadEntities: boolean; + synchronize: boolean; + logging: boolean; + }; } export default { server: { port: config.get('server.port'), + environment: config.get('server.environment'), }, dingTalk: { bossId: config.get('dingTalk.bossId'), @@ -100,4 +113,5 @@ export default { secret: config.get('jwt.secret'), expiresIn: config.get('jwt.expiresIn'), }, + postgresql: config.get('postgresql'), }; diff --git a/src/constants/index.ts b/src/constants/index.ts deleted file mode 100644 index 42c6ab8..0000000 --- a/src/constants/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dingTalk'; diff --git a/src/constants/server.ts b/src/constants/server.ts new file mode 100644 index 0000000..0836d4f --- /dev/null +++ b/src/constants/server.ts @@ -0,0 +1,4 @@ +export enum ServerEnvironment { + 'development', + 'production', +} diff --git a/src/controllers/dingTalk.controller.ts b/src/controllers/dingTalk.controller.ts index ef59802..90bd8cb 100644 --- a/src/controllers/dingTalk.controller.ts +++ b/src/controllers/dingTalk.controller.ts @@ -8,7 +8,7 @@ import { } from '@dtos/dingTlak'; import { ICreateReport } from '@interfaces/dingTalk'; import { NestRes } from '@interfaces/nestbase'; -import { ITimeSheetData } from '@interfaces/timesheet'; +import { ITimeSheet } from '@interfaces/timesheet'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; import { Body, @@ -215,7 +215,7 @@ export class DingTalkController { async getReportTemplateByName(@Request() req: NestRes) { const { dingTalkUserId } = req.user; const _timesheet = await this.redis.get('timesheets'); - const datas = JSON.parse(_timesheet || '[]'); + const datas = JSON.parse(_timesheet || '[]'); const userTimeSheet = datas.find((x) => x.userid === dingTalkUserId); const result = await this.dingTalkService.getReportTemplateByName({ diff --git a/src/controllers/timesheet.controller.ts b/src/controllers/timesheet.controller.ts index 433e72b..a2c4d06 100644 --- a/src/controllers/timesheet.controller.ts +++ b/src/controllers/timesheet.controller.ts @@ -1,6 +1,6 @@ import { Body, Controller, Get, Param, Put, UseGuards } from '@nestjs/common'; import FileData from '@core/files.data'; -import { ITimeSheetData } from '@interfaces/timesheet'; +import { ITimeSheet } from '@interfaces/timesheet'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; import { AuthGuard } from '@nestjs/passport'; import * as moment from 'moment'; @@ -16,25 +16,28 @@ export class TimeSheetController { ) { const templateData = await FileData.readTimeSheetTemplate(); const users = await FileData.readUsers(); - let datas = []; + let datas = []; if (date === moment().format('YYYY-MM-DD')) { const _timesheet = await this.redis.get('timesheets'); - datas = JSON.parse(_timesheet || '[]'); + datas = JSON.parse(_timesheet || '[]'); } else { try { const result = await FileData.readTimeSheet(date); - datas = JSON.parse(result).users; + datas = JSON.parse(result).users; } catch (err) {} } const timeSheetData = users .filter((x) => x.dept_name === dept_name) .map((x) => { + const _data = datas.find((d) => d.userid === x.id); return { userid: x.id, name: x.english_name, groupid: x.groupid, - value: datas.find((d) => d.userid === x.id)?.value || null, + value: _data?.value || '', + createTime: _data?.createTime || '', + updateTime: _data?.updateTime || '', }; }); diff --git a/src/entities/timesheet.enetity.ts b/src/entities/timesheet.enetity.ts new file mode 100644 index 0000000..2a67238 --- /dev/null +++ b/src/entities/timesheet.enetity.ts @@ -0,0 +1,27 @@ +import { Column, Entity } from 'typeorm'; + +@Entity({ name: 'user_timesheet' }) +export class UserTimesheet { + @Column({ primary: true, generated: 'uuid' }) + id: string; + @Column('jsonb', { array: false, default: () => "'[]'", nullable: true }) + timesheet?: ITimeSheet[]; + @Column('date') + createTime: string; +} + +export interface ITimeSheet { + userid: string; + name: string; + value?: string; + groupid: number; + updateTime: string; + createTime: string; +} + +export interface ISheetTemplate { + frontend: string; + backend: string; + test: string; + nodejs: string; +} diff --git a/src/interfaces/dingTalk/attendance.ts b/src/interfaces/dingTalk/attendance.ts index ed87f52..8bc9af4 100644 --- a/src/interfaces/dingTalk/attendance.ts +++ b/src/interfaces/dingTalk/attendance.ts @@ -2,7 +2,7 @@ import { AttendanceCheckType, AttendanceState, TimeResultType, -} from '../../constants'; +} from '../../constants/dingTalk'; import { IDingTalkBaseResult } from './base'; export interface IUserAttendances { diff --git a/src/interfaces/timesheet.ts b/src/interfaces/timesheet.ts index e6dc344..5537b9a 100644 --- a/src/interfaces/timesheet.ts +++ b/src/interfaces/timesheet.ts @@ -4,9 +4,11 @@ export interface ISheetTemplate { test: string; } -export interface ITimeSheetData { +export interface ITimeSheet { userid: string; name: string; value?: string; groupid: number; + updateTime: string; + createTime: string; } diff --git a/src/schedules/timesheet.schedule.ts b/src/schedules/timesheet.schedule.ts index 72b1e10..1ebe1fe 100644 --- a/src/schedules/timesheet.schedule.ts +++ b/src/schedules/timesheet.schedule.ts @@ -1,13 +1,21 @@ import config from '@config/config'; import FileData from '@core/files.data'; -import { ITimeSheetData } from '@interfaces/timesheet'; +import { ITimeSheet } from '@interfaces/timesheet'; import { Injectable } from '@nestjs/common'; import { Cron } from '@nestjs/schedule'; import * as moment from 'moment'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; +import { InjectRepository } from '@nestjs/typeorm'; +import { UserTimesheet } from 'src/entities/timesheet.enetity'; +import { Repository } from 'typeorm'; +import { now } from '@utils/utils'; @Injectable() export class TimeSheetSchedule { - constructor(@InjectRedis() private readonly redis: Redis) {} + constructor( + @InjectRedis() private readonly redis: Redis, + @InjectRepository(UserTimesheet) + private readonly timesheetRepository: Repository, + ) {} @Cron(config.job.saveTimeSheetRule, { name: 'SaveTimeSheetSchedule' }) async run() { @@ -19,12 +27,12 @@ export class TimeSheetSchedule { } console.log('Saving TimeSheet...'); const _timesheet = await this.redis.get('timesheets'); - const timesheets = JSON.parse(_timesheet || '[]'); - const result = await FileData.writeTimeSheet( - currentDate.format('YYYY-MM-DD'), - JSON.stringify({ users: timesheets }), - ); - if (result) { + const timesheets = JSON.parse(_timesheet || '[]'); + const result = await this.timesheetRepository.save({ + timesheet: timesheets, + createTime: now(), + }); + if (result.id) { await this.redis.set('timesheets', '[]'); console.log('Save TimeSheet successful!'); } else { diff --git a/src/services/attendance.service.ts b/src/services/attendance.service.ts index 6043f9d..c5918a2 100644 --- a/src/services/attendance.service.ts +++ b/src/services/attendance.service.ts @@ -8,7 +8,7 @@ import { AttendanceCheckType, AttendanceState, TimeResultType, -} from '../constants'; +} from '../constants/dingTalk'; interface ITimes { start: string; @@ -155,6 +155,9 @@ export class AttendanceService { if (await this.whetherLeaveOneDay()) { return; } + if (this.user.groupid >= 1 && this.user.groupid <= 4) { + return; + } const { date } = this.findNextNotHolodayDate( moment(this.tiems.start).format('YYYY-MM-DD'), ); diff --git a/src/services/user.service.ts b/src/services/user.service.ts index 51dfeb4..f1f1a15 100644 --- a/src/services/user.service.ts +++ b/src/services/user.service.ts @@ -1,7 +1,7 @@ import { AttendanceState } from '@constants/dingTalk'; import FileData from '@core/files.data'; import { IAttendances, IUserAttendances } from '@interfaces/dingTalk'; -import { ITimeSheetData } from '@interfaces/timesheet'; +import { ITimeSheet } from '@interfaces/timesheet'; import { Injectable } from '@nestjs/common'; import * as moment from 'moment'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; @@ -12,7 +12,7 @@ export class UserService { async getTodayTimeSheet(username: string) { const data = await this.redis.get('timesheets'); - const timesheet = JSON.parse(data || '[]'); + const timesheet = JSON.parse(data || '[]'); const users = await FileData.readUsers(); const user = users.find((x) => x.name === username); const todayTimeSheet = timesheet.find( diff --git a/src/sockets/timesheet.socket.ts b/src/sockets/timesheet.socket.ts index 62958ef..9aa3dfc 100644 --- a/src/sockets/timesheet.socket.ts +++ b/src/sockets/timesheet.socket.ts @@ -1,24 +1,29 @@ -import { ITimeSheetData } from '@interfaces/timesheet'; +import { ITimeSheet } from '@interfaces/timesheet'; import { UseGuards } from '@nestjs/common'; import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets'; import { InjectRedis, Redis } from '@nestjs-modules/ioredis'; import { Socket } from 'socket.io'; import { WsGuard } from '../strategys'; +import { now } from '@utils/utils'; @UseGuards(WsGuard) @WebSocketGateway({ namespace: 'timesheet', cors: '*' }) export class TimeSheetSocket { constructor(@InjectRedis() private readonly redis: Redis) {} @SubscribeMessage('sendMessage') - async onEvent(client: Socket, data: ITimeSheetData) { + async onEvent(client: Socket, data: ITimeSheet) { const _timesheet = await this.redis.get('timesheets'); - const timesheets = JSON.parse(_timesheet || '[]'); + const timesheets = JSON.parse(_timesheet || '[]'); const _data = timesheets.find((x) => x.userid === data.userid); + data.createTime = _data?.createTime || now(); + data.updateTime = now(); if (_data) { // 使用token中的userid=>每用户都只能编辑自己的timesheet不能修改其他用户的 // _data.userid = client.data.dingTalkUserId; _data.userid = data.userid; _data.value = data.value; + _data.createTime = data.createTime || now(); + _data.updateTime = now(); } else { timesheets.push(data); } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 9438601..9f03679 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,5 +1,5 @@ import * as moment from 'moment'; -import { AttendanceState } from '../constants'; +import { AttendanceState } from '../constants/dingTalk'; /** * 简单数组去重 eg: [1,2,2]=>[1,2] / ["1","2","2"]=>["1","2"] @@ -36,3 +36,7 @@ export function formatDate( } return date.format(format); } + +export function now(format = 'YYYY-MM-DD HH:mm:ss') { + return moment().format(format); +} diff --git a/yarn.lock b/yarn.lock index 18e86a3..8ef19dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -747,6 +747,13 @@ optional "0.1.4" tslib "2.4.0" +"@nestjs/typeorm@^8.1.4": + version "8.1.4" + resolved "https://registry.yarnpkg.com/@nestjs/typeorm/-/typeorm-8.1.4.tgz#ab2286b39b69d1ce74e039d1847708d56c2c3e60" + integrity sha512-hKv0Y9PG7YkHQfjsrNqM1s/VajlT7Mla8gaoblmuLzgMKsOQFsZXSHlXNxXZ8CA4aCPeDUiXtvqc4zocadGiIQ== + dependencies: + uuid "8.3.2" + "@nestjs/websockets@^8.4.4": version "8.4.5" resolved "https://registry.npmjs.org/@nestjs/websockets/-/websockets-8.4.5.tgz" @@ -810,6 +817,11 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@sqltools/formatter@^1.2.2": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.3.tgz#1185726610acc37317ddab11c3c7f9066966bd20" + integrity sha512-O3uyB/JbkAEMZaP3YqyHH7TMnex7tWyCbCI4EfJdOCoN6HIhqdJBWTM6aCCiWQ/5f5wxjgU735QAIpJbjDvmzg== + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz" @@ -1431,6 +1443,11 @@ ansi-styles@^5.0.0: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz" @@ -1439,6 +1456,11 @@ anymatch@^3.0.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +app-root-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.0.0.tgz#210b6f43873227e18a4b810a032283311555d5ad" + integrity sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw== + append-field@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz" @@ -1665,6 +1687,11 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer-writer@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" + integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== + buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" @@ -1673,6 +1700,14 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + busboy@^0.2.11: version "0.2.14" resolved "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz" @@ -1809,6 +1844,18 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" +cli-highlight@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" + integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== + dependencies: + chalk "^4.0.0" + highlight.js "^10.7.1" + mz "^2.4.0" + parse5 "^5.1.1" + parse5-htmlparser2-tree-adapter "^6.0.0" + yargs "^16.0.0" + cli-spinners@^2.5.0: version "2.6.1" resolved "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz" @@ -2038,6 +2085,11 @@ crypto-random-string@^2.0.0: resolved "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== +date-fns@^2.28.0: + version "2.28.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.28.0.tgz#9570d656f5fc13143e50c975a3b6bbeb46cd08b2" + integrity sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw== + debug@2.6.9: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" @@ -2052,7 +2104,7 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -2175,6 +2227,11 @@ dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" +dotenv@^16.0.0: + version "16.0.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" + integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== + duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz" @@ -2773,7 +2830,7 @@ glob-to-regexp@^0.4.1: resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^7.0.0, glob@^7.1.3, glob@^7.1.4: +glob@^7.0.0, glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -2870,6 +2927,11 @@ hexoid@1.0.0: resolved "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz" integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== +highlight.js@^10.7.1: + version "10.7.3" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" + integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" @@ -2916,7 +2978,7 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -2965,7 +3027,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3985,6 +4047,11 @@ mkdirp@^0.5.4: dependencies: minimist "^1.2.6" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + moment-timezone@^0.5.x: version "0.5.34" resolved "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz" @@ -4031,6 +4098,15 @@ mute-stream@0.0.8: resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mz@^2.4.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" @@ -4110,7 +4186,7 @@ npm-run-path@^4.0.0, npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -object-assign@^4, object-assign@^4.1.1: +object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -4245,6 +4321,11 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" +packet-reader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" + integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" @@ -4262,6 +4343,23 @@ parse-json@^5.0.0, parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse5-htmlparser2-tree-adapter@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + +parse5@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" + integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== + +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + parseurl@~1.3.3: version "1.3.3" resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" @@ -4328,6 +4426,57 @@ pause@0.0.1: resolved "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz" integrity sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10= +pg-connection-string@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" + integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== + +pg-int8@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" + integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== + +pg-pool@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.1.tgz#f499ce76f9bf5097488b3b83b19861f28e4ed905" + integrity sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ== + +pg-protocol@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" + integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== + +pg-types@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" + integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== + dependencies: + pg-int8 "1.0.1" + postgres-array "~2.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.4" + postgres-interval "^1.1.0" + +pg@^8.7.3: + version "8.7.3" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.3.tgz#8a5bdd664ca4fda4db7997ec634c6e5455b27c44" + integrity sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.5.0" + pg-pool "^3.5.1" + pg-protocol "^1.5.0" + pg-types "^2.1.0" + pgpass "1.x" + +pgpass@1.x: + version "1.0.5" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== + dependencies: + split2 "^4.1.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" @@ -4355,6 +4504,28 @@ pluralize@8.0.0: resolved "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz" integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== +postgres-array@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" + integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== + +postgres-date@~1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" + integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== + +postgres-interval@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" + integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== + dependencies: + xtend "^4.0.0" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" @@ -4771,6 +4942,14 @@ setprototypeof@1.2.0: resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== +sha.js@^2.4.11: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" @@ -4892,6 +5071,11 @@ sourcemap-codec@^1.4.4: resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== +split2@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" + integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" @@ -5099,6 +5283,20 @@ text-table@^0.2.0: resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + throat@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/throat/-/throat-6.0.1.tgz" @@ -5238,7 +5436,7 @@ tsconfig-paths@4.0.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2.4.0, tslib@^2.1.0: +tslib@2.4.0, tslib@^2.1.0, tslib@^2.3.1: version "2.4.0" resolved "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== @@ -5297,6 +5495,29 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typeorm@^0.3.7: + version "0.3.7" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.7.tgz#5776ed5058f0acb75d64723b39ff458d21de64c1" + integrity sha512-MsPJeP6Zuwfe64c++l80+VRqpGEGxf0CkztIEnehQ+CMmQPSHjOnFbFxwBuZ2jiLqZTjLk2ZqQdVF0RmvxNF3Q== + dependencies: + "@sqltools/formatter" "^1.2.2" + app-root-path "^3.0.0" + buffer "^6.0.3" + chalk "^4.1.0" + cli-highlight "^2.1.11" + date-fns "^2.28.0" + debug "^4.3.3" + dotenv "^16.0.0" + glob "^7.2.0" + js-yaml "^4.1.0" + mkdirp "^1.0.4" + reflect-metadata "^0.1.13" + sha.js "^2.4.11" + tslib "^2.3.1" + uuid "^8.3.2" + xml2js "^0.4.23" + yargs "^17.3.1" + typescript@4.6.4: version "4.6.4" resolved "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz" @@ -5559,7 +5780,7 @@ xdg-basedir@^4.0.0: resolved "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz" integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q== -xml2js@^0.4.17: +xml2js@^0.4.17, xml2js@^0.4.23: version "0.4.23" resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz" integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== @@ -5592,7 +5813,7 @@ yaml@^1.10.0: resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yargs-parser@^20.x: +yargs-parser@^20.2.2, yargs-parser@^20.x: version "20.2.9" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== @@ -5602,6 +5823,19 @@ yargs-parser@^21.0.0: resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz" integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== +yargs@^16.0.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + yargs@^17.3.1: version "17.5.1" resolved "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz"