beer-network 1.2.6 → 1.2.8
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/api.d.ts +0 -1
- package/api.js +17 -14
- package/package.json +3 -4
package/api.d.ts
CHANGED
package/api.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Session } from './session';
|
|
|
2
2
|
export default class Fetch {
|
|
3
3
|
constructor(pathPrefix) {
|
|
4
4
|
this.isNextJS = undefined;
|
|
5
|
-
this.nodeHeaders = undefined;
|
|
6
5
|
this.pathPrefix = pathPrefix || '';
|
|
7
6
|
this.isNode = typeof process !== 'undefined' && !!process.versions?.node;
|
|
8
7
|
}
|
|
@@ -293,21 +292,25 @@ export default class Fetch {
|
|
|
293
292
|
if (index > 2) {
|
|
294
293
|
return undefined;
|
|
295
294
|
}
|
|
296
|
-
if (this.isNextJS
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
??
|
|
295
|
+
if (this.isNextJS === true) {
|
|
296
|
+
// eslint-disable-next-line global-require
|
|
297
|
+
const nextModule = require('next/headers');
|
|
298
|
+
const nodeHeaders = await nextModule.headers();
|
|
299
|
+
return nodeHeaders.get('x-access-token')
|
|
300
|
+
?? nodeHeaders.get('access-token')
|
|
301
|
+
?? nodeHeaders.get('authorization')
|
|
302
|
+
?? nodeHeaders.get('AccessToken')
|
|
303
|
+
?? nodeHeaders.get('Authorization')
|
|
302
304
|
?? '';
|
|
303
305
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
if (this.isNextJS === undefined) {
|
|
307
|
+
try {
|
|
308
|
+
await import('next/headers');
|
|
309
|
+
this.isNextJS = true;
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
this.isNextJS = false;
|
|
313
|
+
}
|
|
311
314
|
}
|
|
312
315
|
return this.tryAuthorization(index + 1);
|
|
313
316
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beer-network",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.8",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
|
|
7
7
|
"pub-m": "tsc && cp package.json ./dist/package.json && npm publish ./dist"
|
|
8
8
|
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
},
|
|
11
9
|
"peerDependencies": {
|
|
12
10
|
"next": "*"
|
|
13
11
|
},
|
|
@@ -17,8 +15,8 @@
|
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"devDependencies": {
|
|
20
|
-
"next": "^16.1.3",
|
|
21
18
|
"@babel/eslint-parser": "^7.22.15",
|
|
19
|
+
"@types/node": "^25.0.10",
|
|
22
20
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
23
21
|
"@typescript-eslint/parser": "^6.0.0",
|
|
24
22
|
"eslint": "^8.45.0",
|
|
@@ -28,6 +26,7 @@
|
|
|
28
26
|
"eslint-plugin-react": "^7.33.2",
|
|
29
27
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
30
28
|
"eslint-plugin-react-refresh": "^0.4.3",
|
|
29
|
+
"next": "^16.1.3",
|
|
31
30
|
"typescript": "^5.0.2"
|
|
32
31
|
}
|
|
33
32
|
}
|