@rxbenefits/server-utils 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/package.json +6 -7
- package/src/api-client.ts +1 -0
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-lint.log +0 -5
- package/CHANGELOG.md +0 -7
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @admin-portal/server-utils
|
|
2
2
|
|
|
3
3
|
Shared server-side utilities for Next.js API routes across all microfrontends.
|
|
4
4
|
|
|
@@ -30,12 +30,12 @@ Choose the implementation pattern that matches your app architecture:
|
|
|
30
30
|
|
|
31
31
|
#### Step 1: Add Dependency
|
|
32
32
|
|
|
33
|
-
Ensure `@
|
|
33
|
+
Ensure `@admin-portal/server-utils` is in your `package.json`:
|
|
34
34
|
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
38
|
+
"@admin-portal/server-utils": "workspace:*"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
```
|
|
@@ -44,7 +44,7 @@ Ensure `@rxbenefits/server-utils` is in your `package.json`:
|
|
|
44
44
|
|
|
45
45
|
```typescript
|
|
46
46
|
//************************DO NOT EDIT WITHOUT NOTIFYING Sam or Ken **********************************
|
|
47
|
-
import { createCallJavaHandler } from '@
|
|
47
|
+
import { createCallJavaHandler } from '@admin-portal/server-utils';
|
|
48
48
|
|
|
49
49
|
import { getAccessToken, withApiAuthRequired, getWafBypassToken } from '../../lib/auth0';
|
|
50
50
|
|
|
@@ -73,7 +73,7 @@ export const config = {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* CallJava API route handler
|
|
76
|
-
* Uses centralized handler from @
|
|
76
|
+
* Uses centralized handler from @admin-portal/server-utils with automatic:
|
|
77
77
|
* - WAF bypass header injection
|
|
78
78
|
* - Authentication header injection
|
|
79
79
|
* - Tracing header injection
|
|
@@ -117,12 +117,12 @@ export function getWafBypassToken(): string | undefined {
|
|
|
117
117
|
|
|
118
118
|
#### Step 1: Add Dependency
|
|
119
119
|
|
|
120
|
-
Ensure `@
|
|
120
|
+
Ensure `@admin-portal/server-utils` is in your `package.json`:
|
|
121
121
|
|
|
122
122
|
```json
|
|
123
123
|
{
|
|
124
124
|
"dependencies": {
|
|
125
|
-
"@
|
|
125
|
+
"@admin-portal/server-utils": "workspace:*"
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
```
|
|
@@ -144,7 +144,7 @@ const headers: Record<string, string> = {
|
|
|
144
144
|
**After**:
|
|
145
145
|
|
|
146
146
|
```typescript
|
|
147
|
-
import { createBackendHeaders } from '@
|
|
147
|
+
import { createBackendHeaders } from '@admin-portal/server-utils';
|
|
148
148
|
import { getWafBypassToken } from '@/lib/auth0';
|
|
149
149
|
|
|
150
150
|
const headers: Record<string, string> = createBackendHeaders({
|
|
@@ -158,7 +158,7 @@ const headers: Record<string, string> = createBackendHeaders({
|
|
|
158
158
|
#### Step 3: Example - apiHandler.ts
|
|
159
159
|
|
|
160
160
|
```typescript
|
|
161
|
-
import { createBackendHeaders } from '@
|
|
161
|
+
import { createBackendHeaders } from '@admin-portal/server-utils';
|
|
162
162
|
import { NextRequest, NextResponse } from 'next/server';
|
|
163
163
|
|
|
164
164
|
import { apiConfig } from './apiMaps';
|
|
@@ -199,7 +199,7 @@ const fetchData = async (
|
|
|
199
199
|
#### Step 4: Example - GraphQL Route
|
|
200
200
|
|
|
201
201
|
```typescript
|
|
202
|
-
import { createBackendHeaders } from '@
|
|
202
|
+
import { createBackendHeaders } from '@admin-portal/server-utils';
|
|
203
203
|
|
|
204
204
|
import { getAccessToken, withApiAuthRequired, getWafBypassToken } from '@/lib/auth0';
|
|
205
205
|
import { NextRequest, NextResponse } from 'next/server';
|
|
@@ -380,5 +380,5 @@ All utilities in this package automatically add:
|
|
|
380
380
|
This package uses source files directly (no build step required):
|
|
381
381
|
|
|
382
382
|
```bash
|
|
383
|
-
pnpm --filter @
|
|
383
|
+
pnpm --filter @admin-portal/server-utils lint
|
|
384
384
|
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxbenefits/server-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "echo 'Server utils uses source files directly'",
|
|
9
|
+
"lint": "eslint . --ext .ts,.tsx"
|
|
10
|
+
},
|
|
7
11
|
"dependencies": {
|
|
8
12
|
"@opentelemetry/api": "^1.9.0",
|
|
9
13
|
"axios": "^1.7.9",
|
|
@@ -14,10 +18,5 @@
|
|
|
14
18
|
"devDependencies": {
|
|
15
19
|
"@types/formidable": "^3.4.5",
|
|
16
20
|
"@types/node": "^20"
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "echo 'Server utils uses source files directly'",
|
|
21
|
-
"lint": "eslint . --ext .ts,.tsx"
|
|
22
21
|
}
|
|
23
|
-
}
|
|
22
|
+
}
|
package/src/api-client.ts
CHANGED
package/.turbo/turbo-build.log
DELETED
package/.turbo/turbo-lint.log
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @admin-portal/server-utils@0.0.0 lint /Users/dmalone/Documents/GitHub/admin-portal/packages/server-utils
|
|
3
|
-
> eslint . --ext .ts,.tsx
|
|
4
|
-
|
|
5
|
-
Pages directory cannot be found at /Users/dmalone/Documents/GitHub/admin-portal/packages/server-utils/pages or /Users/dmalone/Documents/GitHub/admin-portal/packages/server-utils/src/pages. If using a custom path, please configure with the `no-html-link-for-pages` rule in your eslint config file.
|