ソースを参照

chore(core): Remove deprecated Injector.getConnection() method

Michael Bromley 4 年 前
コミット
20400868ef

+ 7 - 2
packages/core/e2e/fulfillment-process.e2e-spec.ts

@@ -1,5 +1,10 @@
 /* tslint:disable:no-non-null-assertion */
-import { CustomFulfillmentProcess, manualFulfillmentHandler, mergeConfig } from '@vendure/core';
+import {
+    CustomFulfillmentProcess,
+    manualFulfillmentHandler,
+    mergeConfig,
+    TransactionalConnection,
+} from '@vendure/core';
 import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing';
 import path from 'path';
 
@@ -38,7 +43,7 @@ describe('Fulfillment process', () => {
     const VALIDATION_ERROR_MESSAGE = 'Fulfillment must have a tracking code';
     const customOrderProcess: CustomFulfillmentProcess<'AwaitingPickup'> = {
         init(injector) {
-            initSpy(injector.getConnection().name);
+            initSpy(injector.get(TransactionalConnection).rawConnection.name);
         },
         transitions: {
             Pending: {

+ 2 - 2
packages/core/e2e/order-process.e2e-spec.ts

@@ -1,5 +1,5 @@
 /* tslint:disable:no-non-null-assertion */
-import { CustomOrderProcess, mergeConfig, OrderState } from '@vendure/core';
+import { CustomOrderProcess, mergeConfig, OrderState, TransactionalConnection } from '@vendure/core';
 import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing';
 import path from 'path';
 
@@ -42,7 +42,7 @@ describe('Order process', () => {
     const VALIDATION_ERROR_MESSAGE = 'Customer must have a company email address';
     const customOrderProcess: CustomOrderProcess<'ValidatingCustomer'> = {
         init(injector) {
-            initSpy(injector.getConnection().name);
+            initSpy(injector.get(TransactionalConnection).rawConnection.name);
         },
         transitions: {
             AddingItems: {

+ 2 - 1
packages/core/e2e/payment-process.e2e-spec.ts

@@ -10,6 +10,7 @@ import {
     OrderState,
     PaymentMethodHandler,
     RequestContext,
+    TransactionalConnection,
 } from '@vendure/core';
 import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing';
 import gql from 'graphql-tag';
@@ -51,7 +52,7 @@ describe('Payment process', () => {
     const PAYMENT_ERROR_MESSAGE = 'Payment is not valid';
     const customPaymentProcess: CustomPaymentProcess<'Validating'> = {
         init(injector) {
-            initSpy(injector.getConnection().name);
+            initSpy(injector.get(TransactionalConnection).rawConnection.name);
         },
         transitions: {
             Created: {

+ 0 - 10
packages/core/src/common/injector.ts

@@ -24,16 +24,6 @@ export class Injector {
         return this.moduleRef.get(typeOrToken, { strict: false });
     }
 
-    /**
-     * @description
-     * (deprecated) Retrieve the TypeORM `Connection` instance.
-     *
-     * @deprecated Use `.get(TransactionalConnection)` instead.
-     */
-    getConnection(): Connection {
-        return this.moduleRef.get(getConnectionToken() as any, { strict: false });
-    }
-
     /**
      * @description
      * Retrieve an instance of the given scoped provider (transient or request-scoped) from the