From 86d6320cb41f2892c710438e6ef9bf1927b385f2 Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Thu, 17 Jul 2025 15:33:23 -0300 Subject: [PATCH 1/5] graphql/environment: send Current-Profile on subscription/websocket connections --- packages/graphql/CHANGELOG.md | 6 ++++++ packages/graphql/config/environment.ts | 10 ++++++++-- packages/graphql/package.json | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/graphql/CHANGELOG.md b/packages/graphql/CHANGELOG.md index fcad5c09..b5d2b97a 100644 --- a/packages/graphql/CHANGELOG.md +++ b/packages/graphql/CHANGELOG.md @@ -1,5 +1,11 @@ # @baseapp-frontend/graphql +## 1.3.2 + +### Patch Changes + +- Send Current-Profile param on subscription/websocket connection + ## 1.3.1 ### Patch Changes diff --git a/packages/graphql/config/environment.ts b/packages/graphql/config/environment.ts index c714fe42..0365f629 100644 --- a/packages/graphql/config/environment.ts +++ b/packages/graphql/config/environment.ts @@ -1,4 +1,5 @@ -import { ACCESS_KEY_NAME, getExpoConstant } from '@baseapp-frontend/utils' +import { CURRENT_PROFILE_KEY_NAME, MinimalProfile } from '@baseapp-frontend/authentication' +import { ACCESS_KEY_NAME, getExpoConstant, parseString } from '@baseapp-frontend/utils' import { baseAppFetch } from '@baseapp-frontend/utils/functions/fetch/baseAppFetch' import { getToken } from '@baseapp-frontend/utils/functions/token/getToken' @@ -100,8 +101,13 @@ const wsClient = createClient({ url: (process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT ?? EXPO_PUBLIC_WS_RELAY_ENDPOINT) as string, connectionParams: () => { const Authorization = getToken(ACCESS_KEY_NAME) + const CurrentProfileStr = getToken(CURRENT_PROFILE_KEY_NAME) || undefined + const CurrentProfile = parseString(CurrentProfileStr) if (!Authorization) return {} - return { Authorization } + return { + Authorization, + 'Current-Profile': CurrentProfile ? CurrentProfile.id : undefined, + } }, retryAttempts: Infinity, webSocketImpl: WebSocket, diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 34d308ef..353750f6 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/graphql", "description": "GraphQL configurations and utilities", - "version": "1.3.1", + "version": "1.3.2", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false, From 114fef6e1f6174a12c5df18e5e61a8ad40435d32 Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Thu, 17 Jul 2025 15:39:08 -0300 Subject: [PATCH 2/5] add @baseapp-frontend/authentication as dependency --- packages/graphql/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 353750f6..8db9e9d1 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -28,6 +28,7 @@ "react": "catalog:react19" }, "devDependencies": { + "@baseapp-frontend/authentication": "workspace:*", "@baseapp-frontend/config": "workspace:*", "@baseapp-frontend/tsconfig": "workspace:*", "@types/js-cookie": "catalog:", From 2e822c168c4561c32554253307409ac52d8c277c Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Thu, 17 Jul 2025 15:42:34 -0300 Subject: [PATCH 3/5] add @baseapp-frontend/authentication to pnpm-lock.yaml --- pnpm-lock.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a8e93b1d..abfd02b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1235,6 +1235,9 @@ importers: specifier: catalog:graphql version: 19.0.0 devDependencies: + '@baseapp-frontend/authentication': + specifier: workspace:* + version: link:../authentication '@baseapp-frontend/config': specifier: workspace:* version: link:../config From cf27e98c5937da5c1635fb858142049ed5076677 Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Thu, 17 Jul 2025 15:49:51 -0300 Subject: [PATCH 4/5] move @baseapp-frontend/authentication from devDependencies to dependencies --- packages/graphql/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 8db9e9d1..29f976a3 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -13,6 +13,7 @@ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist" }, "dependencies": { + "@baseapp-frontend/authentication": "workspace:*", "graphql": "catalog:graphql", "graphql-ws": "catalog:graphql", "isomorphic-ws": "catalog:graphql", @@ -28,7 +29,6 @@ "react": "catalog:react19" }, "devDependencies": { - "@baseapp-frontend/authentication": "workspace:*", "@baseapp-frontend/config": "workspace:*", "@baseapp-frontend/tsconfig": "workspace:*", "@types/js-cookie": "catalog:", From e073737185218e67f94959a709f4b5b8957382ea Mon Sep 17 00:00:00 2001 From: Alisson Patricio Date: Thu, 17 Jul 2025 15:58:32 -0300 Subject: [PATCH 5/5] update lock file --- pnpm-lock.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index abfd02b7..4f9e27ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1201,6 +1201,9 @@ importers: packages/graphql: dependencies: + '@baseapp-frontend/authentication': + specifier: workspace:* + version: link:../authentication '@baseapp-frontend/utils': specifier: workspace:* version: link:../utils @@ -1235,9 +1238,6 @@ importers: specifier: catalog:graphql version: 19.0.0 devDependencies: - '@baseapp-frontend/authentication': - specifier: workspace:* - version: link:../authentication '@baseapp-frontend/config': specifier: workspace:* version: link:../config