@hellocoop/nextjs 2.9.0 → 2.9.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/handlers/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/handlers/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAgCtD,QAAA,MAAM,cAAc,QAAe,cAAc,OAAO,eAAe,yCA6HtE,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -8,6 +8,7 @@ const config_1 = __importDefault(require("../lib/config"));
|
|
|
8
8
|
const oidc_1 = require("../lib/oidc");
|
|
9
9
|
const core_1 = require("@hellocoop/core");
|
|
10
10
|
const auth_1 = require("../lib/auth");
|
|
11
|
+
const constants_1 = require("@hellocoop/constants");
|
|
11
12
|
const sendErrorPage = (error, target_uri, req, res) => {
|
|
12
13
|
if (config_1.default.routes.error) {
|
|
13
14
|
const url = new URL(config_1.default.routes.error);
|
|
@@ -89,7 +90,7 @@ const handleCallback = async (req, res) => {
|
|
|
89
90
|
const cb = await config_1.default.callbacks.loggedIn({ token, payload, req, res });
|
|
90
91
|
if (cb === null || cb === void 0 ? void 0 : cb.accessDenied) {
|
|
91
92
|
// TODO? set target_uri to not logged in setting?
|
|
92
|
-
auth =
|
|
93
|
+
auth = constants_1.NotLoggedIn;
|
|
93
94
|
}
|
|
94
95
|
else if (cb === null || cb === void 0 ? void 0 : cb.updatedAuth) {
|
|
95
96
|
auth = {
|
package/dist/handlers/router.js
CHANGED
|
@@ -9,7 +9,7 @@ const login_1 = __importDefault(require("./login"));
|
|
|
9
9
|
const logout_1 = __importDefault(require("./logout"));
|
|
10
10
|
const wildcard_1 = __importDefault(require("./wildcard"));
|
|
11
11
|
const auth_1 = require("./auth");
|
|
12
|
-
const
|
|
12
|
+
const constants_1 = require("@hellocoop/constants");
|
|
13
13
|
const translateHandlerErrors = (handler) => async (req, res) => {
|
|
14
14
|
try {
|
|
15
15
|
await handler(req, res);
|
|
@@ -25,7 +25,7 @@ const router = translateHandlerErrors((req, res) => {
|
|
|
25
25
|
// console.log({query})
|
|
26
26
|
if (query.auth || query.getAuth) { // get auth object
|
|
27
27
|
if (config_1.default.error) // don't blow up buttons if not configured
|
|
28
|
-
return res.end(
|
|
28
|
+
return res.end(constants_1.NotLoggedIn);
|
|
29
29
|
else
|
|
30
30
|
return (0, auth_1.handleAuth)(req, res);
|
|
31
31
|
}
|
package/dist/lib/auth.d.ts
CHANGED
|
@@ -5,5 +5,4 @@ export declare const clearAuthCookie: (res: NextApiResponse) => Promise<void>;
|
|
|
5
5
|
export declare const getAuthfromCookies: (res: NextApiResponse, cookies: Partial<{
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
}>) => Promise<Auth>;
|
|
8
|
-
export declare const NotLoggedIn: Auth;
|
|
9
8
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAQtC,eAAO,MAAM,cAAc,QAAgB,eAAe,QAAQ,IAAI,KAAG,QAAQ,OAAO,CAgBvF,CAAA;AAED,eAAO,MAAM,eAAe,QAAgB,eAAe,kBAK1D,CAAA;AAGD,eAAO,MAAM,kBAAkB,QAChB,eAAe;;OACpB,QAAQ,IAAI,CAkBrB,CAAA"}
|
package/dist/lib/auth.js
CHANGED
|
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getAuthfromCookies = exports.clearAuthCookie = exports.saveAuthCookie = void 0;
|
|
7
7
|
const core_1 = require("@hellocoop/core");
|
|
8
|
+
const constants_1 = require("@hellocoop/constants");
|
|
8
9
|
const config_1 = __importDefault(require("./config"));
|
|
9
10
|
const cookie_1 = require("cookie");
|
|
10
11
|
const oidc_1 = require("./oidc");
|
|
@@ -40,7 +41,7 @@ const getAuthfromCookies = async function (res, cookies) {
|
|
|
40
41
|
(0, oidc_1.clearOidcCookie)(res);
|
|
41
42
|
const authCookie = cookies[authName];
|
|
42
43
|
if (!authCookie)
|
|
43
|
-
return
|
|
44
|
+
return constants_1.NotLoggedIn;
|
|
44
45
|
try {
|
|
45
46
|
const auth = await (0, core_1.decryptObj)(authCookie, config_1.default.secret);
|
|
46
47
|
if (auth) {
|
|
@@ -51,7 +52,6 @@ const getAuthfromCookies = async function (res, cookies) {
|
|
|
51
52
|
await (0, exports.clearAuthCookie)(res);
|
|
52
53
|
console.error(e);
|
|
53
54
|
}
|
|
54
|
-
return
|
|
55
|
+
return constants_1.NotLoggedIn;
|
|
55
56
|
};
|
|
56
57
|
exports.getAuthfromCookies = getAuthfromCookies;
|
|
57
|
-
exports.NotLoggedIn = { isLoggedIn: false };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellocoop/nextjs",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Next.js SDK for Hellō https://hello.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"react-dom": ">=17"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@hellocoop/types": "*",
|
|
49
50
|
"@tsconfig/node18": "^18.2.2",
|
|
50
51
|
"@types/cookie": "^0.5.2",
|
|
51
52
|
"@types/cors": "^2.8.14",
|
|
@@ -61,9 +62,8 @@
|
|
|
61
62
|
"node": ">=18"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@hellocoop/core": "
|
|
65
|
-
"@hellocoop/react": "
|
|
66
|
-
"@hellocoop/types": "latest",
|
|
65
|
+
"@hellocoop/core": "*",
|
|
66
|
+
"@hellocoop/react": "*",
|
|
67
67
|
"cookie": "^0.5.0",
|
|
68
68
|
"cors": "^2.8.5",
|
|
69
69
|
"swr": "^2.2.2"
|