@qelos/integrator-next 4.0.0 → 4.1.0
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 +109 -164
- package/dist/context.d.ts +5 -11
- package/dist/context.js +63 -43
- package/dist/context.js.map +1 -1
- package/dist/cookies.d.ts +19 -0
- package/dist/cookies.js +39 -0
- package/dist/cookies.js.map +1 -0
- package/dist/env-config.d.ts +3 -3
- package/dist/env-config.js +6 -7
- package/dist/env-config.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/me-client.d.ts +15 -0
- package/dist/me-client.js +35 -0
- package/dist/me-client.js.map +1 -0
- package/dist/middleware.d.ts +10 -34
- package/dist/middleware.js +75 -80
- package/dist/middleware.js.map +1 -1
- package/dist/pages.d.ts +5 -9
- package/dist/pages.js +61 -98
- package/dist/pages.js.map +1 -1
- package/dist/proxy-target.d.ts +17 -0
- package/dist/proxy-target.js +26 -0
- package/dist/proxy-target.js.map +1 -0
- package/dist/runtime/api-proxy.d.ts +16 -0
- package/dist/runtime/api-proxy.js +90 -0
- package/dist/runtime/api-proxy.js.map +1 -0
- package/dist/sdk-factory.d.ts +13 -16
- package/dist/sdk-factory.js +29 -79
- package/dist/sdk-factory.js.map +1 -1
- package/dist/types.d.ts +28 -16
- package/dist/types.js.map +1 -1
- package/package.json +8 -3
package/dist/types.d.ts
CHANGED
|
@@ -2,30 +2,42 @@ import type QelosSDK from '@qelos/sdk';
|
|
|
2
2
|
import type { IUser } from '@qelos/sdk/dist/authentication';
|
|
3
3
|
import type { IWorkspace } from '@qelos/sdk/workspaces';
|
|
4
4
|
import type { QelosSDKOptions } from '@qelos/sdk/types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export interface QelosNextConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Base URL of the Qelos backend (e.g. https://yourdomain.com).
|
|
8
|
+
*/
|
|
9
|
+
appUrl: string;
|
|
10
|
+
/**
|
|
11
|
+
* Static API token used for service-to-service calls. When provided, no
|
|
12
|
+
* cookie-based `/api/me` identification is required for anonymous access.
|
|
13
|
+
*/
|
|
14
|
+
apiToken?: string;
|
|
15
|
+
/**
|
|
16
|
+
* If true, the request is rejected (401) when the user cannot be resolved.
|
|
17
|
+
* Defaults to `false` — anonymous requests pass through with `user = null`.
|
|
18
|
+
*/
|
|
19
|
+
requireAuth?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Skip the middleware / resolver entirely for requests matching any of these
|
|
22
|
+
* path prefixes. Useful for `/_next`, `/favicon.ico`, `/health`, etc.
|
|
23
|
+
*/
|
|
24
|
+
skipPaths?: string[];
|
|
8
25
|
/**
|
|
9
26
|
* Optional extra options merged into the per-request SDK instance.
|
|
10
27
|
*/
|
|
11
28
|
sdkOptions?: Partial<QelosSDKOptions>;
|
|
12
|
-
}
|
|
13
|
-
export interface TokenRefreshContext<TRefreshTarget = unknown> {
|
|
14
29
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* routes it is the `NextApiResponse`; for `getServerSideProps` it is the
|
|
18
|
-
* raw `ServerResponse`. App Router server components / route handlers do
|
|
19
|
-
* not call this hook because cookies cannot be set after the response has
|
|
20
|
-
* started — the refreshed tokens are only mutated on the in-memory pair.
|
|
30
|
+
* When `false` (default), Edge middleware prepends `/api/` to `skipPaths` so
|
|
31
|
+
* the catch-all BFF proxy route is not shadowed by the `/api/me` probe.
|
|
21
32
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
33
|
+
disableProxy?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface QelosRequestContext {
|
|
36
|
+
user: IUser | null;
|
|
37
|
+
workspace: IWorkspace | null;
|
|
38
|
+
workspaces: IWorkspace[];
|
|
25
39
|
sdk: QelosSDK;
|
|
26
40
|
}
|
|
27
|
-
export type TokenRefreshHook<TRefreshTarget = unknown> = (ctx: TokenRefreshContext<TRefreshTarget>) => void | Promise<void>;
|
|
28
|
-
export type QelosRequestContext = QelosContext<QelosSDK, IUser, IWorkspace>;
|
|
29
41
|
/**
|
|
30
42
|
* Header name used to forward the resolved user id from edge middleware to
|
|
31
43
|
* downstream App Router handlers. Handlers that want the full user object
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2CA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qelos/integrator-next",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Qelos integrator middleware for Next.js (App Router and Pages Router): identifies the user and workspace via the Qelos SDK before the application's own handler runs.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
"require": "./dist/route.js",
|
|
43
43
|
"default": "./dist/route.js"
|
|
44
44
|
},
|
|
45
|
+
"./runtime/api-proxy": {
|
|
46
|
+
"types": "./dist/runtime/api-proxy.d.ts",
|
|
47
|
+
"import": "./dist/runtime/api-proxy.js",
|
|
48
|
+
"require": "./dist/runtime/api-proxy.js",
|
|
49
|
+
"default": "./dist/runtime/api-proxy.js"
|
|
50
|
+
},
|
|
45
51
|
"./types": {
|
|
46
52
|
"types": "./dist/types.d.ts",
|
|
47
53
|
"import": "./dist/types.js",
|
|
@@ -64,8 +70,7 @@
|
|
|
64
70
|
}
|
|
65
71
|
},
|
|
66
72
|
"dependencies": {
|
|
67
|
-
"@qelos/
|
|
68
|
-
"@qelos/sdk": "^4.0.0"
|
|
73
|
+
"@qelos/sdk": "4.1.0"
|
|
69
74
|
},
|
|
70
75
|
"devDependencies": {
|
|
71
76
|
"@types/node": "^22.5.4",
|