From 0be903990eec75cf072a44c56162a14977114f2e Mon Sep 17 00:00:00 2001 From: glo11372 Date: Thu, 7 Mar 2024 14:47:39 +0530 Subject: [PATCH 1/4] PWA-3154:GraphQL cacheable requests always have Authorization Bearer header --- .../links/__tests__/__snapshots__/index.spec.js.snap | 1 - .../peregrine/lib/Apollo/links/__tests__/index.spec.js | 8 ++++---- packages/peregrine/lib/Apollo/links/index.js | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap index 1b3428cfe5..e9eb130057 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap @@ -4,7 +4,6 @@ exports[`returns a map with expected keys and values 1`] = ` Map { "MUTATION_QUEUE" => "mutationQueue", "RETRY" => "retry", - "AUTH" => "auth", "GQL_CACHE" => "gqlCache", "STORE" => "store", "ERROR" => "error", diff --git a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js index 7185d08491..a538dfd4e0 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js +++ b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js @@ -7,10 +7,10 @@ jest.mock('@apollo/client', () => ({ __esModule: true, createHttpLink: jest.fn(() => 'http') })); -jest.mock('@magento/peregrine/lib/Apollo/links/authLink', () => ({ - __esModule: true, - default: jest.fn(() => 'auth') -})); +// jest.mock('@magento/peregrine/lib/Apollo/links/authLink', () => ({ +// __esModule: true, +// default: jest.fn(() => 'auth') +// })); jest.mock('@magento/peregrine/lib/Apollo/links/errorLink', () => ({ __esModule: true, default: jest.fn(() => 'error') diff --git a/packages/peregrine/lib/Apollo/links/index.js b/packages/peregrine/lib/Apollo/links/index.js index 1a6bf48b1e..5d867985c8 100644 --- a/packages/peregrine/lib/Apollo/links/index.js +++ b/packages/peregrine/lib/Apollo/links/index.js @@ -1,6 +1,6 @@ import { createHttpLink } from '@apollo/client'; -import createAuthLink from '@magento/peregrine/lib/Apollo/links/authLink'; +// import createAuthLink from '@magento/peregrine/lib/Apollo/links/authLink'; import createErrorLink from '@magento/peregrine/lib/Apollo/links/errorLink'; import createGqlCacheLink from '@magento/peregrine/lib/Apollo/links/gqlCacheLink'; import createMutationQueueLink from '@magento/peregrine/lib/Apollo/links/mutationQueueLink'; @@ -32,7 +32,7 @@ export const customFetchToShrinkQuery = (uri, options) => { }; const getLinks = apiBase => { - const authLink = createAuthLink(); + // const authLink = createAuthLink(); const storeLink = createStoreLink(); const errorLink = createErrorLink(); const retryLink = createRetryLink(); @@ -54,7 +54,7 @@ const getLinks = apiBase => { const links = new Map() .set('MUTATION_QUEUE', mutationQueueLink) .set('RETRY', retryLink) - .set('AUTH', authLink) + // .set('AUTH', authLink) .set('GQL_CACHE', gqlCacheLink) .set('STORE', storeLink) .set('ERROR', errorLink) From e85ff1e07e24d4e683f3d518cf5c1848dd32da53 Mon Sep 17 00:00:00 2001 From: glo11372 Date: Mon, 18 Mar 2024 12:36:31 +0530 Subject: [PATCH 2/4] PWA-3154:Removing Commented lines --- packages/peregrine/lib/Apollo/links/__tests__/index.spec.js | 4 ---- packages/peregrine/lib/Apollo/links/index.js | 3 --- 2 files changed, 7 deletions(-) diff --git a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js index a538dfd4e0..bf287a6277 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js +++ b/packages/peregrine/lib/Apollo/links/__tests__/index.spec.js @@ -7,10 +7,6 @@ jest.mock('@apollo/client', () => ({ __esModule: true, createHttpLink: jest.fn(() => 'http') })); -// jest.mock('@magento/peregrine/lib/Apollo/links/authLink', () => ({ -// __esModule: true, -// default: jest.fn(() => 'auth') -// })); jest.mock('@magento/peregrine/lib/Apollo/links/errorLink', () => ({ __esModule: true, default: jest.fn(() => 'error') diff --git a/packages/peregrine/lib/Apollo/links/index.js b/packages/peregrine/lib/Apollo/links/index.js index 5d867985c8..3519d594d3 100644 --- a/packages/peregrine/lib/Apollo/links/index.js +++ b/packages/peregrine/lib/Apollo/links/index.js @@ -1,6 +1,5 @@ import { createHttpLink } from '@apollo/client'; -// import createAuthLink from '@magento/peregrine/lib/Apollo/links/authLink'; import createErrorLink from '@magento/peregrine/lib/Apollo/links/errorLink'; import createGqlCacheLink from '@magento/peregrine/lib/Apollo/links/gqlCacheLink'; import createMutationQueueLink from '@magento/peregrine/lib/Apollo/links/mutationQueueLink'; @@ -32,7 +31,6 @@ export const customFetchToShrinkQuery = (uri, options) => { }; const getLinks = apiBase => { - // const authLink = createAuthLink(); const storeLink = createStoreLink(); const errorLink = createErrorLink(); const retryLink = createRetryLink(); @@ -54,7 +52,6 @@ const getLinks = apiBase => { const links = new Map() .set('MUTATION_QUEUE', mutationQueueLink) .set('RETRY', retryLink) - // .set('AUTH', authLink) .set('GQL_CACHE', gqlCacheLink) .set('STORE', storeLink) .set('ERROR', errorLink) From 707e32112eed6f18d5c5d526d4d63fcf7feae2de Mon Sep 17 00:00:00 2001 From: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:16:39 +0530 Subject: [PATCH 3/4] Update index.spec.js.snap --- .../lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap index e9eb130057..643c854632 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap @@ -8,5 +8,5 @@ Map { "STORE" => "store", "ERROR" => "error", "HTTP" => "http", -} +} `; From cc928d5efbc893f2e949e0b3dd9a4616186d93de Mon Sep 17 00:00:00 2001 From: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:27:00 +0530 Subject: [PATCH 4/4] Update index.spec.js.snap --- .../lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap index 643c854632..e9eb130057 100644 --- a/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/peregrine/lib/Apollo/links/__tests__/__snapshots__/index.spec.js.snap @@ -8,5 +8,5 @@ Map { "STORE" => "store", "ERROR" => "error", "HTTP" => "http", -} +} `;