@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/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
- import type { QelosConfig, QelosContext, QelosTokenPair, ResolvedTokens } from '@qelos/global-types';
6
- export type { QelosTokenPair, ResolvedTokens } from '@qelos/global-types';
7
- export interface QelosNextConfig extends QelosConfig {
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
- * The transport-specific carrier for the refresh hook. For App Router edge
16
- * middleware this is the outbound `NextResponse`; for Pages Router API
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
- target: TRefreshTarget;
23
- oldTokens: QelosTokenPair;
24
- newTokens: ResolvedTokens;
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":"AAyCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC"}
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.0.0",
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/global-types": "^4.0.0",
68
- "@qelos/sdk": "^4.0.0"
73
+ "@qelos/sdk": "4.1.0"
69
74
  },
70
75
  "devDependencies": {
71
76
  "@types/node": "^22.5.4",