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..29f976a3 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, @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a8e93b1d..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