Skip to content

Commit

Permalink
feat(product): update to support @apollo/client 3 and apollo-angular 2 (
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored and damienwebdev committed Jan 20, 2021
1 parent 204fe6f commit 714f63c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
11 changes: 3 additions & 8 deletions libs/product/src/drivers/magento/product.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import {InMemoryCache} from '@apollo/client/core';
import {addTypenameToDocument} from '@apollo/client/utilities';
import { TestBed } from '@angular/core/testing';
import {
ApolloTestingModule,
ApolloTestingController,
APOLLO_TESTING_CACHE,
} from 'apollo-angular/testing';
import {
InMemoryCache,
IntrospectionFragmentMatcher,
} from 'apollo-cache-inmemory';
import { addTypenameToDocument } from 'apollo-utilities';

import { GetProductQuery, MagentoSimpleProduct } from '@daffodil/product';
import {
Expand All @@ -33,9 +30,7 @@ describe('Product | Magento | ProductService', () => {
provide: APOLLO_TESTING_CACHE,
useValue: new InMemoryCache({
addTypename: true,
fragmentMatcher: new IntrospectionFragmentMatcher({
introspectionQueryResultData: schema,
}),
possibleTypes: schema.possibleTypes,
}),
},
],
Expand Down
5 changes: 2 additions & 3 deletions libs/product/src/drivers/magento/product.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {Apollo} from 'apollo-angular';
import { Injectable } from '@angular/core';

import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';

import { Apollo } from 'apollo-angular';

import { DaffProductServiceInterface } from '../interfaces/product-service.interface';
import { GetAllProductsQuery } from './queries/get-all-products';
import { GetProductQuery } from './queries/get-product';
Expand All @@ -17,7 +16,7 @@ import { DaffProduct } from '../../models/product';
@Injectable({
providedIn: 'root'
})
export class DaffMagentoProductService implements DaffProductServiceInterface {
export class DaffMagentoProductService implements DaffProductServiceInterface {
constructor(private apollo: Apollo) {}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';


export const magentoBundledProductFragment = gql`
fragment magentoBundledProduct on BundleProduct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';


export const magentoConfigurableProductFragment = gql`
fragment magentoConfigurableProduct on ConfigurableProduct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';

import { magentoBundledProductFragment } from './bundled-product';
import { magentoSimpleProductFragment } from './simple-product';
import { magentoConfigurableProductFragment } from './configurable-product';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';


export const magentoSimpleProductFragment = gql`
fragment magentoSimpleProduct on SimpleProduct {
Expand Down
3 changes: 2 additions & 1 deletion libs/product/src/drivers/magento/queries/get-all-products.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';

import { magentoProductFragment } from './fragments/product';

export const GetAllProductsQuery = gql`
Expand Down
3 changes: 2 additions & 1 deletion libs/product/src/drivers/magento/queries/get-product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import {gql} from 'apollo-angular';

import { magentoProductFragment } from './fragments/product';

export const GetProductQuery = gql`
Expand Down
4 changes: 1 addition & 3 deletions libs/product/src/drivers/shopify/product.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {Apollo, gql} from 'apollo-angular';
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { Apollo } from 'apollo-angular';
import gql from 'graphql-tag';

import { DaffProduct } from '../../models/product';
import { DaffProductServiceInterface } from '../interfaces/product-service.interface';

Expand Down

0 comments on commit 714f63c

Please sign in to comment.