Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @baseapp-frontend/components

## 0.0.35

### Patch Changes

- Updated dependencies
- @baseapp-frontend/graphql@1.1.14

## 0.0.34

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/components",
"description": "BaseApp components modules such as comments, notifications, messages, and more.",
"version": "0.0.34",
"version": "0.0.35",
"main": "./index.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
Expand Down
6 changes: 6 additions & 0 deletions packages/graphql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @baseapp-frontend/graphql

## 1.1.14

### Patch Changes

- Add graphql support to Expo/Mobile environment

## 1.1.13

### Patch Changes
Expand Down
6 changes: 4 additions & 2 deletions packages/graphql/config/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export async function httpFetch(
): Promise<GraphQLResponse> {
const fetchOptions = getFetchOptions({ request, variables, uploadables })
const response = await baseAppFetch('', {
baseUrl: process.env.NEXT_PUBLIC_RELAY_ENDPOINT,
baseUrl: (process.env.NEXT_PUBLIC_RELAY_ENDPOINT ||
process.env.EXPO_PUBLIC_RELAY_ENDPOINT) as string,
Comment on lines +68 to +69
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add validation for required environment variables

The current implementation silently casts potentially undefined environment variables to string. This could lead to runtime errors if neither NEXT_PUBLIC_RELAY_ENDPOINT nor EXPO_PUBLIC_RELAY_ENDPOINT is defined.

Consider adding validation:

-    baseUrl: (process.env.NEXT_PUBLIC_RELAY_ENDPOINT ||
-      process.env.EXPO_PUBLIC_RELAY_ENDPOINT) as string,
+    baseUrl: (() => {
+      const endpoint = process.env.NEXT_PUBLIC_RELAY_ENDPOINT || process.env.EXPO_PUBLIC_RELAY_ENDPOINT;
+      if (!endpoint) {
+        throw new Error('Missing required environment variable: NEXT_PUBLIC_RELAY_ENDPOINT or EXPO_PUBLIC_RELAY_ENDPOINT');
+      }
+      return endpoint;
+    })(),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
baseUrl: (process.env.NEXT_PUBLIC_RELAY_ENDPOINT ||
process.env.EXPO_PUBLIC_RELAY_ENDPOINT) as string,
baseUrl: (() => {
const endpoint = process.env.NEXT_PUBLIC_RELAY_ENDPOINT || process.env.EXPO_PUBLIC_RELAY_ENDPOINT;
if (!endpoint) {
throw new Error('Missing required environment variable: NEXT_PUBLIC_RELAY_ENDPOINT or EXPO_PUBLIC_RELAY_ENDPOINT');
}
return endpoint;
})(),

decamelizeRequestBodyKeys: false,
decamelizeRequestParamsKeys: false,
camelizeResponseDataKeys: false,
Expand All @@ -89,7 +90,8 @@ export async function httpFetch(
}

const wsClient = createClient({
url: process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT as string,
url: (process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT ||
process.env.EXPO_PUBLIC_WS_RELAY_ENDPOINT) as string,
Comment on lines +93 to +94
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add validation for WebSocket endpoint

Similar to the HTTP endpoint, the WebSocket endpoint should validate that at least one environment variable is defined.

Consider adding validation:

-  url: (process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT ||
-    process.env.EXPO_PUBLIC_WS_RELAY_ENDPOINT) as string,
+  url: (() => {
+    const wsEndpoint = process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT || process.env.EXPO_PUBLIC_WS_RELAY_ENDPOINT;
+    if (!wsEndpoint) {
+      throw new Error('Missing required environment variable: NEXT_PUBLIC_WS_RELAY_ENDPOINT or EXPO_PUBLIC_WS_RELAY_ENDPOINT');
+    }
+    return wsEndpoint;
+  })(),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
url: (process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT ||
process.env.EXPO_PUBLIC_WS_RELAY_ENDPOINT) as string,
url: (() => {
const wsEndpoint = process.env.NEXT_PUBLIC_WS_RELAY_ENDPOINT || process.env.EXPO_PUBLIC_WS_RELAY_ENDPOINT;
if (!wsEndpoint) {
throw new Error('Missing required environment variable: NEXT_PUBLIC_WS_RELAY_ENDPOINT or EXPO_PUBLIC_WS_RELAY_ENDPOINT');
}
return wsEndpoint;
})(),

connectionParams: () => {
const Authorization = getToken()
if (!Authorization) return {}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/graphql",
"description": "GraphQL configurations and utilities",
"version": "1.1.13",
"version": "1.1.14",
"main": "./index.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
Expand Down
7 changes: 7 additions & 0 deletions packages/wagtail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @baseapp-frontend/wagtail

## 1.0.9

### Patch Changes

- Updated dependencies
- @baseapp-frontend/graphql@1.1.14

## 1.0.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/wagtail/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/wagtail",
"description": "BaseApp Wagtail",
"version": "1.0.8",
"version": "1.0.9",
"main": "./index.ts",
"types": "dist/index.d.ts",
"sideEffects": false,
Expand Down
Loading