From d7b3fb972c55c935aee15760151ea27bb90eb400 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Wed, 31 Aug 2022 12:30:16 -0400 Subject: [PATCH] (core) upgrade typeorm so we can support newer postgres Summary: upgrade typeorm version, so Grist can run against newer versions of postgres. Dusted off some old benchmarking code to verify that important queries don't get slower. They don't appear to, unlike for some intermediate versions of typeorm I tried in the past. Most of the changes are because `findOne` changed how it interprets its arguments, and the value it returns when nothing is found. For the return value, I stuck with limiting its impact by emulating old behavior (returning undefined rather than null) rather than propagating the change out to parts of the code unrelated to the database. Test Plan: existing tests pass; manual testing with postgres 10 and 14 Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3613 --- app/gen-server/ApiServer.ts | 8 +- app/gen-server/entity/AclRule.ts | 2 +- app/gen-server/lib/Activations.ts | 2 +- app/gen-server/lib/HomeDBManager.ts | 55 +++---- app/server/companion.ts | 1 - app/server/lib/extractOrg.ts | 4 +- package.json | 2 +- test/gen-server/seed.ts | 15 +- test/nbrowser/gristUtils.ts | 2 +- yarn.lock | 217 +++++++++++++++++----------- 10 files changed, 178 insertions(+), 130 deletions(-) diff --git a/app/gen-server/ApiServer.ts b/app/gen-server/ApiServer.ts index ee3eee3a..aaf951d3 100644 --- a/app/gen-server/ApiServer.ts +++ b/app/gen-server/ApiServer.ts @@ -77,7 +77,7 @@ export function addOrg( } ): Promise { return dbManager.connection.transaction(async manager => { - const user = await manager.findOne(User, userId); + const user = await manager.findOne(User, {where: {id: userId}}); if (!user) { return handleDeletedUser(); } const query = await dbManager.addOrg(user, props, { ...options, @@ -411,7 +411,7 @@ export class ApiServer { // Get user's apiKey this._app.get('/api/profile/apikey', expressWrap(async (req, res) => { const userId = getUserId(req); - const user = await User.findOne(userId); + const user = await User.findOne({where: {id: userId}}); if (user) { // The null value is of no interest to the user, let's show empty string instead. res.send(user.apiKey || ''); @@ -426,7 +426,7 @@ export class ApiServer { const userId = getAuthorizedUserId(req); const force = req.body ? req.body.force : false; const manager = this._dbManager.connection.manager; - let user = await manager.findOne(User, userId); + let user = await manager.findOne(User, {where: {id: userId}}); if (!user) { return handleDeletedUser(); } if (!user.apiKey || force) { user = await updateApiKeyWithRetry(manager, user); @@ -441,7 +441,7 @@ export class ApiServer { this._app.delete('/api/profile/apikey', expressWrap(async (req, res) => { const userId = getAuthorizedUserId(req); await this._dbManager.connection.transaction(async manager => { - const user = await manager.findOne(User, userId); + const user = await manager.findOne(User, {where: {id: userId}}); if (!user) { return handleDeletedUser(); } user.apiKey = null; await manager.save(User, user); diff --git a/app/gen-server/entity/AclRule.ts b/app/gen-server/entity/AclRule.ts index 011ff458..6232b654 100644 --- a/app/gen-server/entity/AclRule.ts +++ b/app/gen-server/entity/AclRule.ts @@ -54,5 +54,5 @@ export class AclRuleDoc extends AclRule { public document: Document; @RelationId((aclRule: AclRuleDoc) => aclRule.document) - public docId: number; + public docId: string; } diff --git a/app/gen-server/lib/Activations.ts b/app/gen-server/lib/Activations.ts index 66e10d0a..47d67f2a 100644 --- a/app/gen-server/lib/Activations.ts +++ b/app/gen-server/lib/Activations.ts @@ -16,7 +16,7 @@ export class Activations { // filled in once an activation key is presented. public current(): Promise { return this._db.connection.manager.transaction(async manager => { - let activation = await manager.findOne(Activation); + let activation = await manager.findOne(Activation, {where: {}}); if (!activation) { activation = manager.create(Activation); activation.id = makeId(); diff --git a/app/gen-server/lib/HomeDBManager.ts b/app/gen-server/lib/HomeDBManager.ts index f5b5d2f5..b97cc422 100644 --- a/app/gen-server/lib/HomeDBManager.ts +++ b/app/gen-server/lib/HomeDBManager.ts @@ -406,15 +406,15 @@ export class HomeDBManager extends EventEmitter { * force, and returns the id of this first match it finds. */ public async testGetId(name: string): Promise { - const org = await Organization.findOne({name}); + const org = await Organization.findOne({where: {name}}); if (org) { return org.id; } - const ws = await Workspace.findOne({name}); + const ws = await Workspace.findOne({where: {name}}); if (ws) { return ws.id; } - const doc = await Document.findOne({name}); + const doc = await Document.findOne({where: {name}}); if (doc) { return doc.id; } - const user = await User.findOne({name}); + const user = await User.findOne({where: {name}}); if (user) { return user.id; } - const product = await Product.findOne({name}); + const product = await Product.findOne({where: {name}}); if (product) { return product.id; } throw new Error(`Cannot testGetId(${name})`); } @@ -434,17 +434,17 @@ export class HomeDBManager extends EventEmitter { }); } - public getUserByKey(apiKey: string): Promise { + public async getUserByKey(apiKey: string): Promise { // Include logins relation for Authorization convenience. - return User.findOne({apiKey}, {relations: ["logins"]}); + return await User.findOne({where: {apiKey}, relations: ["logins"]}) || undefined; } - public getUser(userId: number): Promise { - return User.findOne(userId, {relations: ["logins"]}); + public async getUser(userId: number): Promise { + return await User.findOne({where: {id: userId}, relations: ["logins"]}) || undefined; } public async getFullUser(userId: number): Promise { - const user = await User.findOne(userId, {relations: ["logins"]}); + const user = await User.findOne({where: {id: userId}, relations: ["logins"]}); if (!user) { throw new ApiError("unable to find user", 400); } return this.makeFullUser(user); } @@ -476,7 +476,10 @@ export class HomeDBManager extends EventEmitter { public async ensureExternalUser(profile: UserProfile) { await this._connection.transaction(async manager => { // First find user by the connectId from the profile - const existing = await manager.findOne(User, { connectId: profile.connectId}, {relations: ["logins"]}); + const existing = await manager.findOne(User, { + where: {connectId: profile.connectId || undefined}, + relations: ["logins"], + }); // If a user does not exist, create it with data from the external profile. if (!existing) { @@ -524,7 +527,7 @@ export class HomeDBManager extends EventEmitter { public async updateUser(userId: number, props: UserProfileChange): Promise { let isWelcomed: boolean = false; - let user: User|undefined; + let user: User|null = null; await this._connection.transaction(async manager => { user = await manager.findOne(User, {relations: ['logins'], where: {id: userId}}); @@ -552,14 +555,14 @@ export class HomeDBManager extends EventEmitter { } public async updateUserName(userId: number, name: string) { - const user = await User.findOne(userId); + const user = await User.findOne({where: {id: userId}}); if (!user) { throw new ApiError("unable to find user", 400); } user.name = name; await user.save(); } public async updateUserOptions(userId: number, props: Partial) { - const user = await User.findOne(userId); + const user = await User.findOne({where: {id: userId}}); if (!user) { throw new ApiError("unable to find user", 400); } const newOptions = {...(user.options ?? {}), ...props}; @@ -708,12 +711,12 @@ export class HomeDBManager extends EventEmitter { manager?: EntityManager ): Promise { const normalizedEmail = normalizeEmail(email); - return (manager || this._connection).createQueryBuilder() + return await (manager || this._connection).createQueryBuilder() .select('user') .from(User, 'user') .leftJoinAndSelect('user.logins', 'logins') .where('email = :email', {email: normalizedEmail}) - .getOne(); + .getOne() || undefined; } /** @@ -932,7 +935,7 @@ export class HomeDBManager extends EventEmitter { .leftJoinAndSelect('orgs.billingAccount', 'billing_accounts') .leftJoinAndSelect('billing_accounts.product', 'products') .where('external_id = :externalId', {externalId}); - return query.getOne(); + return await query.getOne() || undefined; } /** @@ -1226,7 +1229,7 @@ export class HomeDBManager extends EventEmitter { // TODO: make a more efficient implementation if needed. public async flushSingleDocAuthCache(scope: DocScope, docId: string) { // Get all aliases of this document. - const aliases = await this._connection.manager.find(Alias, { docId }); + const aliases = await this._connection.manager.find(Alias, {where: {docId}}); // Construct a set of possible prefixes for cache keys. const names = new Set(aliases.map(a => stringifyUrlIdOrg(a.urlId, scope.org))); names.add(stringifyUrlIdOrg(docId, scope.org)); @@ -1314,7 +1317,7 @@ export class HomeDBManager extends EventEmitter { } billingAccount = new BillingAccount(); billingAccount.individual = options.setUserAsOwner; - const dbProduct = await manager.findOne(Product, {name: productName}); + const dbProduct = await manager.findOne(Product, {where: {name: productName}}); if (!dbProduct) { throw new Error('Cannot find product for new organization'); } @@ -1533,8 +1536,10 @@ export class HomeDBManager extends EventEmitter { ...wsAcls, ...wsGroups, ...docs, ...docAcls, ...docGroups]); // Delete billing account if this was the last org using it. - const billingAccount = await manager.findOne(BillingAccount, org.billingAccountId, - {relations: ['orgs']}); + const billingAccount = await manager.findOne(BillingAccount, { + where: {id: org.billingAccountId}, + relations: ['orgs'], + }); if (billingAccount && billingAccount.orgs.length === 0) { await manager.remove([billingAccount]); } @@ -1714,7 +1719,7 @@ export class HomeDBManager extends EventEmitter { if (!doc.urlId) { for (let i = MIN_URLID_PREFIX_LENGTH; i <= doc.id.length; i++) { const candidate = doc.id.substr(0, i); - if (!await manager.findOne(Alias, { urlId: candidate })) { + if (!await manager.findOne(Alias, {where: {urlId: candidate}})) { doc.urlId = candidate; break; } @@ -2518,7 +2523,7 @@ export class HomeDBManager extends EventEmitter { .leftJoinAndSelect('org.workspaces', 'workspace') .leftJoinAndSelect('workspace.docs', 'doc') .where('doc.id = :docId', {docId}) - .getOne(); + .getOne() || undefined; } /** @@ -3584,8 +3589,8 @@ export class HomeDBManager extends EventEmitter { // Access fields are added to all entities giving the group name corresponding // with the access level of the user. // Returns the resource fetched by the queryBuilder. - private async _verifyAclPermissions( - queryBuilder: SelectQueryBuilder, + private async _verifyAclPermissions( + queryBuilder: SelectQueryBuilder, options: { rawQueryBuilder?: SelectQueryBuilder, emptyAllowed?: boolean, diff --git a/app/server/companion.ts b/app/server/companion.ts index 0e82ced1..7b527922 100644 --- a/app/server/companion.ts +++ b/app/server/companion.ts @@ -170,7 +170,6 @@ export async function dbCheck(connection: Connection) { const options = await getConnectionOptions(); log("database url:", getDatabaseUrl(options, false)); log("migration files:", options.migrations); - log("migration directory:", (options.cli && options.cli.migrationsDir) || 'unspecified'); log("migrations applied to db:", migrations.migrationsInDb); log("migrations listed in code:", migrations.migrationsInCode); let exitCode: number = 0; diff --git a/app/server/lib/extractOrg.ts b/app/server/lib/extractOrg.ts index 59d7e0e9..0d3454b6 100644 --- a/app/server/lib/extractOrg.ts +++ b/app/server/lib/extractOrg.ts @@ -101,7 +101,7 @@ export class Hosts { } else { // Otherwise check for a custom host. const org = await mapGetOrSet(this._host2org, hostname, async () => { - const o = await this._dbManager.connection.manager.findOne(Organization, {host: hostname}); + const o = await this._dbManager.connection.manager.findOne(Organization, {where: {host: hostname}}); return o && o.domain || undefined; }); if (!org) { throw new ApiError(`Domain not recognized: ${hostname}`, 404); } @@ -152,7 +152,7 @@ export class Hosts { if (org && this._getHostType(req.headers.host!) === 'native' && !this._dbManager.isMergedOrg(org)) { // Check if the org has a preferred host. const orgHost = await mapGetOrSet(this._org2host, org, async () => { - const o = await this._dbManager.connection.manager.findOne(Organization, {domain: org}); + const o = await this._dbManager.connection.manager.findOne(Organization, {where: {domain: org}}); return o && o.host || undefined; }); if (orgHost && orgHost !== req.hostname) { diff --git a/package.json b/package.json index b397ebbe..c0fd673d 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,7 @@ "short-uuid": "3.1.1", "tmp": "0.0.33", "ts-interface-checker": "1.0.2", - "typeorm": "0.2.18", + "typeorm": "0.3.9", "underscore": "1.9.1", "uuid": "3.3.2", "winston": "2.4.5", diff --git a/test/gen-server/seed.ts b/test/gen-server/seed.ts index 49f1024b..5ac9dc02 100644 --- a/test/gen-server/seed.ts +++ b/test/gen-server/seed.ts @@ -428,7 +428,7 @@ class Seed { const ba = new BillingAccount(); ba.individual = false; const productName = org.product || 'Free'; - ba.product = (await Product.findOne({name: productName}))!; + ba.product = (await Product.findOne({where: {name: productName}}))!; o.billingAccount = ba; if (org.domain) { o.domain = org.domain; } if (org.host) { o.host = org.host; } @@ -461,7 +461,7 @@ class Seed { } public async run() { - if (await this.userRepository.findOne()) { + if (await this.userRepository.findOne({where: {}})) { // we already have a user - skip seeding database return; } @@ -472,7 +472,7 @@ class Seed { // Creates benchmark data with 10 orgs, 50 workspaces per org and 20 docs per workspace. public async runBenchmark() { - if (await this.userRepository.findOne()) { + if (await this.userRepository.findOne({where: {}})) { // we already have a user - skip seeding database return; } @@ -501,7 +501,7 @@ class Seed { login.displayEmail = login.email = name.toLowerCase() + "@getgrist.com"; login.user = user; await login.save(); - const personal = await Organization.findOne({name: name + "land"}); + const personal = await Organization.findOne({where: {name: name + "land"}}); if (personal) { personal.owner = user; await personal.save(); @@ -521,8 +521,8 @@ export async function removeConnection() { throw new Error("unexpected number of connections"); } await getConnectionManager().connections[0].close(); - // There is no official way to delete connections that I've found. - (getConnectionManager().connections as any) = []; + // There is still no official way to delete connections that I've found. + (getConnectionManager() as any).connectionMap = new Map(); } } @@ -593,6 +593,9 @@ export async function createServer(port: number, initDb = createInitialDb): Prom flexServer.addJsonSupport(); await flexServer.start(); await flexServer.initHomeDBManager(); + flexServer.addDocWorkerMap(); + await flexServer.loadConfig(); + flexServer.addHosts(); flexServer.addAccessMiddleware(); flexServer.addApiMiddleware(); flexServer.addHomeApi(); diff --git a/test/nbrowser/gristUtils.ts b/test/nbrowser/gristUtils.ts index 82d1e619..5d34c02b 100644 --- a/test/nbrowser/gristUtils.ts +++ b/test/nbrowser/gristUtils.ts @@ -599,7 +599,7 @@ export async function updateOrgPlan(orgName: string, productName: string = 'team const dbOrg = await db.findOne(Organization, {where: {name: orgName}, relations: ['billingAccount', 'billingAccount.product']}); if (!dbOrg) { throw new Error(`cannot find org ${orgName}`); } - const product = await db.findOne(Product, {name: productName}); + const product = await db.findOne(Product, {where: {name: productName}}); if (!product) { throw new Error('cannot find product'); } dbOrg.billingAccount.product = product; await dbOrg.billingAccount.save(); diff --git a/yarn.lock b/yarn.lock index dca2093b..e26c0019 100644 --- a/yarn.lock +++ b/yarn.lock @@ -212,6 +212,11 @@ resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5" integrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ== +"@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.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -881,10 +886,10 @@ ansi-regex@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" @@ -931,10 +936,10 @@ app-module-path@2.2.0: resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" integrity sha1-ZBqlXft9am8KgUHEucCqULbCTdU= -app-root-path@^2.0.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.2.1.tgz#d0df4a682ee408273583d43f6f79e9892624bc9a" - integrity sha512-91IFKeKk7FjfmezPKkwtaRvSpnUc4gDwPAjA1YZ9Gn0q0PPeW+vbeUsZuyDwjI7+QTHhcLen2v25fi/AmhvbJA== +app-root-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.1.0.tgz#5971a2fc12ba170369a7a1ef018c71e6e47c2e86" + integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA== aproba@^1.0.3: version "1.2.0" @@ -990,6 +995,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" @@ -1465,7 +1475,7 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= -buffer@^5.0.2, buffer@^5.1.0, buffer@^5.5.0: +buffer@^5.0.2, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -1473,6 +1483,14 @@ buffer@^5.0.2, buffer@^5.1.0, 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" + buffers@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" @@ -1587,17 +1605,6 @@ chainsaw@~0.1.0: dependencies: traverse ">=0.3.0 <0.4" -chalk@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -1717,7 +1724,7 @@ cli-boxes@^2.2.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w== -cli-highlight@^2.0.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== @@ -2134,6 +2141,11 @@ data-urls@^1.0.1: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" +date-fns@^2.28.0: + version "2.29.2" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.2.tgz#0d4b3d0f3dff0f920820a070920f0d9662c51931" + integrity sha512-0VNbwmWJDS/G3ySwFSJA3ayhbURMTJLtwM2DTxf9CWondCnh6DTNlO9JgRSq6ibf4eD0lfMJNBxUdEAHHix+bA== + dayjs@^1.8.34: version "1.10.6" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63" @@ -2160,7 +2172,7 @@ debug@3.2.6, debug@^3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@4.3.1, debug@^4.1.1: +debug@4, debug@4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -2174,7 +2186,7 @@ debug@^3.0.0: dependencies: ms "^2.1.1" -debug@^4.0.1: +debug@^4.0.1, debug@^4.3.3: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -2353,10 +2365,10 @@ dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" -dotenv@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" - integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== +dotenv@^16.0.0: + version "16.0.2" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.2.tgz#0b0f8652c016a3858ef795024508cddc4bffc5bf" + integrity sha512-JvpYKUmzQhYoIFgK2MOnF3bciIZoItIIoryihy0rIA+H4Jy0FmgyKYAHCTN98P5ybGSJcIFbh6QKeJdtZd1qhA== double-ended-queue@2.1.0-0, double-ended-queue@^2.1.0-0: version "2.1.0-0" @@ -2698,7 +2710,7 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2909,11 +2921,6 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -figlet@^1.1.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.5.0.tgz#2db4d00a584e5155a96080632db919213c3e003c" - integrity sha512-ZQJM4aifMpz6H19AW1VqvZ7l4pOE9p7i/3LyxgO2kp+PO/VcDYNqIHEMtkccqIhTXMKci4kjueJr/iCQEaT/Ww== - file-type@14.1.4: version "14.1.4" resolved "https://registry.yarnpkg.com/file-type/-/file-type-14.1.4.tgz#3ac109f2ea9e8f5573d000ec0c6bcdff07fd46de" @@ -3167,7 +3174,7 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@*, glob@^7.0.3, glob@^7.1.0, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@*, glob@^7.0.3, glob@^7.1.0, glob@^7.1.3, glob@^7.1.4: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -3203,6 +3210,18 @@ glob@7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.2.0: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@~3.2.7: version "3.2.11" resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d" @@ -3378,13 +3397,6 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - dependencies: - ansi-regex "^2.0.0" - has-bigints@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" @@ -3969,13 +3981,12 @@ js-yaml@3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: - argparse "^1.0.7" - esprima "^4.0.0" + argparse "^2.0.1" jsbn@~0.1.0: version "0.1.1" @@ -4539,6 +4550,13 @@ minimatch@0.3: lru-cache "2" sigmund "~1.0.0" +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -4603,7 +4621,7 @@ mkdirp@0.5.5, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.4: dependencies: minimist "^1.2.5" -mkdirp@^1.0.3: +mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== @@ -5135,11 +5153,6 @@ pako@~1.0.2, pako@~1.0.5: resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== -parent-require@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parent-require/-/parent-require-1.0.0.tgz#746a167638083a860b0eef6732cb27ed46c32977" - integrity sha1-dGoWdjgIOoYLDu9nMssn7UbDKXc= - parents@^1.0.0, parents@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" @@ -6046,7 +6059,7 @@ setprototypeof@1.2.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: +sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8, sha.js@~2.4.4: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== @@ -6339,6 +6352,15 @@ string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string.prototype.trimend@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" @@ -6409,6 +6431,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -6451,11 +6480,6 @@ supports-color@6.0.0: dependencies: has-flag "^3.0.0" -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= - supports-color@^5.3.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -6727,6 +6751,11 @@ tslib@^2.0.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== +tslib@^2.3.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tty-browserify@~0.0.0: version "0.0.1" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" @@ -6781,25 +6810,28 @@ typedarray@^0.0.6, typedarray@~0.0.5: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typeorm@0.2.18: - version "0.2.18" - resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.18.tgz#8ae1d21104117724af41ddc11035c40a705e1de8" - integrity sha512-S553GwtG5ab268+VmaLCN7gKDqFPIzUw0eGMTobJ9yr0Np62Ojfx8j1Oa9bIeh5p7Pz1/kmGabAHoP1MYK05pA== +typeorm@0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.3.9.tgz#ad0f525d81c081fd11006f97030f47a55978ac81" + integrity sha512-xNcE44D4hn74n7pjuMog9hRgep+BiO3IBpjEaQZ8fb56zsDz7xHT1GAeWwmGuuU+4nDEELp2mIqgSCR+zxR7Jw== dependencies: - app-root-path "^2.0.1" - buffer "^5.1.0" - chalk "^2.4.2" - cli-highlight "^2.0.0" - debug "^4.1.1" - dotenv "^6.2.0" - glob "^7.1.2" - js-yaml "^3.13.1" - mkdirp "^0.5.1" + "@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" - tslib "^1.9.0" - xml2js "^0.4.17" - yargonaut "^1.1.2" - yargs "^13.2.1" + sha.js "^2.4.11" + tslib "^2.3.1" + uuid "^8.3.2" + xml2js "^0.4.23" + yargs "^17.3.1" typescript@4.7.4: version "4.7.4" @@ -6999,7 +7031,7 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.0.0, uuid@^8.3.0: +uuid@^8.0.0, uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== @@ -7312,7 +7344,7 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== -xml2js@^0.4.0, xml2js@^0.4.17: +xml2js@^0.4.0, xml2js@^0.4.17, xml2js@^0.4.23: version "0.4.23" resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== @@ -7389,15 +7421,6 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargonaut@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/yargonaut/-/yargonaut-1.1.4.tgz#c64f56432c7465271221f53f5cc517890c3d6e0c" - integrity sha512-rHgFmbgXAAzl+1nngqOcwEljqHGG9uUZoPjsdZEs1w5JW9RXYzrSvH/u70C1JE5qFi0qjsdhnUX/dJRpWqitSA== - dependencies: - chalk "^1.1.1" - figlet "^1.1.1" - parent-require "^1.0.0" - yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" @@ -7419,6 +7442,11 @@ yargs-parser@^20.2.2: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== +yargs-parser@^21.0.0: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + yargs-unparser@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.6.0.tgz#ef25c2c769ff6bd09e4b0f9d7c605fb27846ea9f" @@ -7428,7 +7456,7 @@ yargs-unparser@1.6.0: lodash "^4.17.15" yargs "^13.3.0" -yargs@13.3.2, yargs@^13.2.1, yargs@^13.3.0: +yargs@13.3.2, yargs@^13.3.0: version "13.3.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== @@ -7474,6 +7502,19 @@ yargs@^16.0.0: y18n "^5.0.5" yargs-parser "^20.2.2" +yargs@^17.3.1: + version "17.5.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e" + integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.0.0" + yauzl@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"