Browse Source

chore(core): Update graphql, typeorm

Pinned the sql.js version to 1.1.0 due to this TypeORM compatibility issue: https://github.com/typeorm/typeorm/issues/5720
Michael Bromley 5 years ago
parent
commit
0a0526db87

+ 3 - 3
packages/core/package.json

@@ -56,7 +56,7 @@
     "csv-parse": "^4.6.5",
     "express": "^4.16.4",
     "fs-extra": "^8.0.1",
-    "graphql": "^14.5.8",
+    "graphql": "14.6.0",
     "graphql-iso-date": "^3.6.1",
     "graphql-tag": "^2.10.0",
     "graphql-tools": "^4.0.6",
@@ -73,7 +73,7 @@
     "progress": "^2.0.3",
     "reflect-metadata": "^0.1.12",
     "rxjs": "^6.3.3",
-    "typeorm": "0.2.21"
+    "typeorm": "0.2.24"
   },
   "devDependencies": {
     "@types/bcrypt": "^3.0.0",
@@ -96,7 +96,7 @@
     "mysql": "^2.16.0",
     "pg": "^7.8.0",
     "rimraf": "^3.0.0",
-    "sql.js": "^1.0.0",
+    "sql.js": "1.1.0",
     "sqlite3": "^4.0.6",
     "typescript": "~3.6.2"
   }

+ 5 - 61
packages/core/src/testing/connection.mock.ts

@@ -1,68 +1,8 @@
-import { AbstractRepository, EntityManager, Repository } from 'typeorm';
-
 import { Type } from '@vendure/common/lib/shared-types';
+import { AbstractRepository, EntityManager, Repository } from 'typeorm';
 
 import { MockClass } from './testing-types';
 
-/**
- * A mock of the TypeORM Connection class for use in testing.
- */
-export class MockConnection {
-    manager: MockEntityManager;
-
-    private repositoryMap = new Map<Type<any>, any>();
-
-    constructor() {
-        this.manager = new MockEntityManager();
-        this.manager.connection = this;
-    }
-
-    registerMockRepository<T extends Type<any>>(entity: T): MockRepository<T> {
-        const repository = new MockRepository();
-        this.repositoryMap.set(entity, repository);
-        return repository;
-    }
-
-    getRepository<T extends Type<any>>(entity: T): MockRepository<T> {
-        const repository = this.repositoryMap.get(entity);
-        if (repository) {
-            return repository;
-        } else {
-            throw new Error(
-                `No mock repository registered for "${entity.name}". Use registerRepository() first.`,
-            );
-        }
-    }
-}
-
-export class MockRepository<T> implements MockClass<Repository<T>> {
-    manager: any;
-    metadata: any;
-    queryRunner: any;
-    target: any;
-    createQueryBuilder = jest.fn();
-    hasId = jest.fn();
-    getId = jest.fn();
-    create = jest.fn();
-    merge = jest.fn();
-    preload = jest.fn();
-    save = jest.fn();
-    remove = jest.fn();
-    insert = jest.fn();
-    update = jest.fn();
-    delete = jest.fn();
-    count = jest.fn();
-    find = jest.fn();
-    findAndCount = jest.fn();
-    findByIds = jest.fn();
-    findOne = jest.fn();
-    findOneOrFail = jest.fn();
-    query = jest.fn();
-    clear = jest.fn();
-    increment = jest.fn();
-    decrement = jest.fn();
-}
-
 export class MockEntityManager implements MockClass<EntityManager> {
     connection: any = {};
     queryRunner: any = {};
@@ -79,6 +19,10 @@ export class MockEntityManager implements MockClass<EntityManager> {
     insert = jest.fn();
     update = jest.fn();
     delete = jest.fn();
+    softDelete = jest.fn();
+    softRemove = jest.fn();
+    restore = jest.fn();
+    recover = jest.fn();
     count = jest.fn();
     find = jest.fn();
     findAndCount = jest.fn();

+ 1 - 1
packages/testing/package.json

@@ -39,7 +39,7 @@
     "graphql-tag": "^2.10.1",
     "node-fetch": "^2.6.0",
     "node-libcurl": "^2.0.2",
-    "sql.js": "^1.0.0"
+    "sql.js": "1.1.0"
   },
   "devDependencies": {
     "@types/mysql": "^2.15.8",

+ 5 - 4
yarn.lock

@@ -17668,10 +17668,10 @@ typedarray@^0.0.6:
   resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
   integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
 
-typeorm@0.2.21:
-  version "0.2.21"
-  resolved "https://registry.npmjs.org/typeorm/-/typeorm-0.2.21.tgz#d8d63bec783c128913b140b52f65e9fd76e44510"
-  integrity sha512-4abj5aFjwt4Y+Gs3VmykcjURUZwIezwPWYVMNl2swRk8/iluGZZ9Lbwd4tdzJ7ZdsgKyHsT8zf8zPZPL5jH+EQ==
+typeorm@0.2.24:
+  version "0.2.24"
+  resolved "https://registry.npmjs.org/typeorm/-/typeorm-0.2.24.tgz#cd0fbd907326873a96c98e290fca49c589f0ffa8"
+  integrity sha512-L9tQv6nNLRyh+gex/qc8/CyLs8u0kXKqk1OjYGF13k/KOg6N2oibwkuGgv0FuoTGYx2ta2NmqvuMUAMrHIY5ew==
   dependencies:
     app-root-path "^3.0.0"
     buffer "^5.1.0"
@@ -17683,6 +17683,7 @@ typeorm@0.2.21:
     js-yaml "^3.13.1"
     mkdirp "^0.5.1"
     reflect-metadata "^0.1.13"
+    sha.js "^2.4.11"
     tslib "^1.9.0"
     xml2js "^0.4.17"
     yargonaut "^1.1.2"