@poly-x/next 0.1.0-alpha.18 → 0.1.0-alpha.19
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/dist/server.cjs +13 -0
- package/dist/server.d.cts +8 -0
- package/dist/server.d.mts +8 -0
- package/dist/server.mjs +13 -0
- package/package.json +3 -3
package/dist/server.cjs
CHANGED
|
@@ -357,6 +357,19 @@ function createAuthHandlers(handlersConfig = {}) {
|
|
|
357
357
|
},
|
|
358
358
|
async session() {
|
|
359
359
|
return Response.json(await auth(handlersConfig));
|
|
360
|
+
},
|
|
361
|
+
async subscriptionCredential() {
|
|
362
|
+
const config = resolveNextConfig(handlersConfig);
|
|
363
|
+
const current = await new require_server_session.ServerSession({
|
|
364
|
+
authClient: buildServerAuthClient(config),
|
|
365
|
+
secret: config.secret,
|
|
366
|
+
cookies: await requestCookies()
|
|
367
|
+
}).read();
|
|
368
|
+
if (!current) return Response.json({ status: "signed_out" }, { status: 401 });
|
|
369
|
+
return Response.json({
|
|
370
|
+
token: current.tokens.accessToken,
|
|
371
|
+
organizationId: current.session.claims.organizationId
|
|
372
|
+
});
|
|
360
373
|
}
|
|
361
374
|
};
|
|
362
375
|
}
|
package/dist/server.d.cts
CHANGED
|
@@ -127,6 +127,14 @@ interface AuthHandlers {
|
|
|
127
127
|
* server truth instead. Never carries a token.
|
|
128
128
|
*/
|
|
129
129
|
session(request: Request): Promise<Response>;
|
|
130
|
+
/**
|
|
131
|
+
* v2 (ADR-0008): a session-derived credential for the real-time `authz:changed` channel. Returns
|
|
132
|
+
* `{ token, organizationId }` read from the sealed session server-side — the token is for the
|
|
133
|
+
* socket handshake only (in-memory; never persisted), per the pragmatic custody decision. A
|
|
134
|
+
* signed-out caller gets `401` with no token. This is the one place a token leaves the BFF, and
|
|
135
|
+
* only to open the live-authz subscription.
|
|
136
|
+
*/
|
|
137
|
+
subscriptionCredential(request: Request): Promise<Response>;
|
|
130
138
|
}
|
|
131
139
|
/** The JSON the `forgotPassword` handler returns — always uniform (no enumeration). */
|
|
132
140
|
type ForgotPasswordResult = {
|
package/dist/server.d.mts
CHANGED
|
@@ -127,6 +127,14 @@ interface AuthHandlers {
|
|
|
127
127
|
* server truth instead. Never carries a token.
|
|
128
128
|
*/
|
|
129
129
|
session(request: Request): Promise<Response>;
|
|
130
|
+
/**
|
|
131
|
+
* v2 (ADR-0008): a session-derived credential for the real-time `authz:changed` channel. Returns
|
|
132
|
+
* `{ token, organizationId }` read from the sealed session server-side — the token is for the
|
|
133
|
+
* socket handshake only (in-memory; never persisted), per the pragmatic custody decision. A
|
|
134
|
+
* signed-out caller gets `401` with no token. This is the one place a token leaves the BFF, and
|
|
135
|
+
* only to open the live-authz subscription.
|
|
136
|
+
*/
|
|
137
|
+
subscriptionCredential(request: Request): Promise<Response>;
|
|
130
138
|
}
|
|
131
139
|
/** The JSON the `forgotPassword` handler returns — always uniform (no enumeration). */
|
|
132
140
|
type ForgotPasswordResult = {
|
package/dist/server.mjs
CHANGED
|
@@ -356,6 +356,19 @@ function createAuthHandlers(handlersConfig = {}) {
|
|
|
356
356
|
},
|
|
357
357
|
async session() {
|
|
358
358
|
return Response.json(await auth(handlersConfig));
|
|
359
|
+
},
|
|
360
|
+
async subscriptionCredential() {
|
|
361
|
+
const config = resolveNextConfig(handlersConfig);
|
|
362
|
+
const current = await new ServerSession({
|
|
363
|
+
authClient: buildServerAuthClient(config),
|
|
364
|
+
secret: config.secret,
|
|
365
|
+
cookies: await requestCookies()
|
|
366
|
+
}).read();
|
|
367
|
+
if (!current) return Response.json({ status: "signed_out" }, { status: 401 });
|
|
368
|
+
return Response.json({
|
|
369
|
+
token: current.tokens.accessToken,
|
|
370
|
+
organizationId: current.session.claims.organizationId
|
|
371
|
+
});
|
|
359
372
|
}
|
|
360
373
|
};
|
|
361
374
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poly-x/next",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.19",
|
|
4
4
|
"description": "PolyX SDK for Next.js App Router - components plus server helpers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"module": "./dist/index.mjs",
|
|
48
48
|
"types": "./dist/index.d.cts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@poly-x/core": "0.1.0-alpha.
|
|
51
|
-
"@poly-x/react": "0.1.0-alpha.
|
|
50
|
+
"@poly-x/core": "0.1.0-alpha.19",
|
|
51
|
+
"@poly-x/react": "0.1.0-alpha.19"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"next": ">=14",
|