@qelos/integrator-nuxt 4.2.0 → 4.2.2
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 +9 -4
- package/dist/module.d.ts +2 -2
- package/dist/module.js +9 -2
- package/dist/module.js.map +1 -1
- package/dist/runtime/api-proxy.js +1 -2
- package/dist/runtime/api-proxy.js.map +1 -1
- package/package.json +17 -7
- package/src/module.ts +10 -2
- package/src/runtime/api-proxy.ts +1 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @qelos/integrator-nuxt
|
|
2
2
|
|
|
3
|
-
Nuxt 3 integrator for [Qelos](https://qelos.io). It plugs into a Nuxt app's
|
|
3
|
+
Nuxt 3+ integrator for [Qelos](https://qelos.io). It plugs into a Nuxt app's
|
|
4
4
|
Nitro server to make the Nuxt host act as a same-origin BFF for a managed
|
|
5
5
|
Qelos app: requests under `/api/**` are proxied to Qelos, and every other
|
|
6
6
|
request resolves the current user up front so your route handlers and Vue
|
|
@@ -12,9 +12,14 @@ components can use them directly.
|
|
|
12
12
|
pnpm add @qelos/integrator-nuxt
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
## Version requirements
|
|
16
|
+
|
|
17
|
+
- **Nuxt** ≥3.0.0 (includes Nuxt 4.x). Nuxt 2 and below are **not** supported.
|
|
18
|
+
- **Node.js** ≥18 — the middleware uses
|
|
19
|
+
[`Response.headers.getSetCookie()`](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
|
|
20
|
+
to pipe individual upstream `Set-Cookie` headers back to the client.
|
|
21
|
+
- **Forward compatibility:** the integrator accepts any Nuxt release that
|
|
22
|
+
satisfies the `>=3.0.0` peer dependency range.
|
|
18
23
|
|
|
19
24
|
## Configure
|
|
20
25
|
|
package/dist/module.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export interface QelosNuxtModuleOptions extends QelosNuxtRuntimeConfig {
|
|
|
11
11
|
*/
|
|
12
12
|
disableProxy?: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
15
|
-
export default
|
|
14
|
+
declare const qelosNuxtModule: any;
|
|
15
|
+
export default qelosNuxtModule;
|
|
16
16
|
export { createQelosMiddleware } from './middleware';
|
|
17
17
|
export { createRequestSdk } from './sdk-factory';
|
|
18
18
|
export { defineQelosEventHandler } from './event-handler';
|
package/dist/module.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { defineNuxtModule, addServerHandler, addImportsDir, createResolver, addTypeTemplate, } from '@nuxt/kit';
|
|
2
|
-
|
|
2
|
+
// The workspace resolves two @nuxt/schema copies (3.21.4 and 4.5.2 - this package
|
|
3
|
+
// supports both Nuxt versions, and other workspace packages pin different ones), which
|
|
4
|
+
// makes tsc's declaration-portability check for the exported module non-deterministic
|
|
5
|
+
// across runs. `any` sidesteps needing to name a cross-package type for the export;
|
|
6
|
+
// runtime behavior is unaffected and is verified against real Nuxt 3 and 4 projects by
|
|
7
|
+
// test/module-smoke.test.ts.
|
|
8
|
+
const qelosNuxtModule = defineNuxtModule({
|
|
3
9
|
meta: {
|
|
4
10
|
name: '@qelos/integrator-nuxt',
|
|
5
11
|
configKey: 'qelos',
|
|
6
12
|
compatibility: {
|
|
7
|
-
nuxt: '^3.0.0',
|
|
13
|
+
nuxt: '^3.0.0 || ^4.0.0',
|
|
8
14
|
},
|
|
9
15
|
},
|
|
10
16
|
defaults: {
|
|
@@ -63,6 +69,7 @@ export {};
|
|
|
63
69
|
});
|
|
64
70
|
},
|
|
65
71
|
});
|
|
72
|
+
export default qelosNuxtModule;
|
|
66
73
|
export { createQelosMiddleware } from './middleware';
|
|
67
74
|
export { createRequestSdk } from './sdk-factory';
|
|
68
75
|
export { defineQelosEventHandler } from './event-handler';
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC;AAgBnB,eAAe,gBAAgB,CAAyB;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC;AAgBnB,kFAAkF;AAClF,uFAAuF;AACvF,sFAAsF;AACtF,oFAAoF;AACpF,uFAAuF;AACvF,6BAA6B;AAC7B,MAAM,eAAe,GAAQ,gBAAgB,CAAyB;IACpE,IAAI,EAAE;QACJ,IAAI,EAAE,wBAAwB;QAC9B,SAAS,EAAE,OAAO;QAClB,aAAa,EAAE;YACb,IAAI,EAAE,kBAAkB;SACzB;KACF;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE;KACX;IACD,KAAK,CAAC,OAAO,EAAE,IAAI;QACjB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEpD,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;QAEtE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,qEAAqE;YACrE,qEAAqE;YACrE,gEAAgE;YAChE,gEAAgE;YAChE,kEAAkE;YAClE,gEAAgE;YAChE,gEAAgE;YAChE,MAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC;YACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACtF,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,aAAa,CAAC,SAAS,GAAG,CAAC,OAAO,EAAE,GAAG,iBAAiB,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG;YACjC,GAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAA6C;YAC5E,GAAG,aAAa;SACjB,CAAC;QAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,gBAAgB,CAAC;gBACf,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC;gBAC5C,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,gBAAgB,CAAC;gBACf,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC;aACxC,CAAC,CAAC;QACL,CAAC;QAED,aAAa,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAEhD,eAAe,CAAC;YACd,QAAQ,EAAE,uBAAuB;YACjC,WAAW,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;CAUxB;SACI,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -17,8 +17,7 @@ export default defineEventHandler((event) => {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
const originalHost = getRequestHeader(event, 'host');
|
|
20
|
-
const
|
|
21
|
-
const target = joinURL(base, path);
|
|
20
|
+
const target = joinURL(base, event.path);
|
|
22
21
|
return proxyRequest(event, target, {
|
|
23
22
|
fetch: globalThis.fetch,
|
|
24
23
|
cookieDomainRewrite: { '*': originalHost ?? '' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-proxy.js","sourceRoot":"","sources":["../../src/runtime/api-proxy.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,uCAAuC;AACvC,iCAAiC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,IAAI,CAAC;AACZ,0DAA0D;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,eAAe,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC,KAAK,IAAI,EAAE,CAA2B,CAAC;IAC1E,MAAM,IAAI,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,WAAW,CAAC;YAChB,UAAU,EAAE,GAAG;YACf,aAAa,EACX,qJAAqJ;SACxJ,CAAC,CAAC;IACL,CAAC;IAED,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,
|
|
1
|
+
{"version":3,"file":"api-proxy.js","sourceRoot":"","sources":["../../src/runtime/api-proxy.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,uCAAuC;AACvC,iCAAiC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,IAAI,CAAC;AACZ,0DAA0D;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,eAAe,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC,KAAK,IAAI,EAAE,CAA2B,CAAC;IAC1E,MAAM,IAAI,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,WAAW,CAAC;YAChB,UAAU,EAAE,GAAG;YACf,aAAa,EACX,qJAAqJ;SACxJ,CAAC,CAAC;IACL,CAAC;IAED,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE;QACjC,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,mBAAmB,EAAE,EAAE,GAAG,EAAE,YAAY,IAAI,EAAE,EAAE;KACjD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qelos/integrator-nuxt",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Nuxt integrator for Qelos: server middleware/module that identifies the user and workspace from the Qelos SDK before your handlers run.",
|
|
6
6
|
"main": "./dist/module.js",
|
|
@@ -49,27 +49,37 @@
|
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18"
|
|
54
|
+
},
|
|
52
55
|
"peerDependencies": {
|
|
53
56
|
"h3": "^1.0.0",
|
|
54
|
-
"nuxt": "^3.0.0"
|
|
57
|
+
"nuxt": "^3.0.0 || ^4.0.0"
|
|
55
58
|
},
|
|
56
59
|
"peerDependenciesMeta": {
|
|
57
60
|
"nuxt": {
|
|
58
|
-
"optional":
|
|
61
|
+
"optional": false
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
"dependencies": {
|
|
62
|
-
"@qelos/sdk": "4.2.
|
|
65
|
+
"@qelos/sdk": "4.2.2"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
|
65
|
-
"@nuxt/kit": "^3.13.0",
|
|
66
|
-
"@nuxt/schema": "^3.13.0",
|
|
68
|
+
"@nuxt/kit": "^3.13.0 || ^4.0.0",
|
|
69
|
+
"@nuxt/schema": "^3.13.0 || ^4.0.0",
|
|
67
70
|
"h3": "^1.13.0",
|
|
71
|
+
"nuxt": "^4.0.0",
|
|
72
|
+
"tsx": "^4.21.0",
|
|
68
73
|
"typescript": "^5.4.5"
|
|
69
74
|
},
|
|
70
75
|
"scripts": {
|
|
71
76
|
"type-check": "tsc --noEmit",
|
|
72
77
|
"build": "npm run type-check && tsc",
|
|
73
|
-
"pre-build": "pnpm run type-check && tsc"
|
|
78
|
+
"pre-build": "pnpm run type-check && tsc",
|
|
79
|
+
"test": "node --import tsx --test \"src/**/*.test.ts\"",
|
|
80
|
+
"pretest:smoke": "pnpm run build",
|
|
81
|
+
"test:smoke": "node --import tsx --test test/module-smoke.test.ts",
|
|
82
|
+
"test:smoke:nuxt3": "node --import tsx --test test/module-smoke.test.ts --test-name-pattern \"Nuxt 3\"",
|
|
83
|
+
"test:smoke:nuxt4": "node --import tsx --test test/module-smoke.test.ts --test-name-pattern \"Nuxt 4\""
|
|
74
84
|
}
|
|
75
85
|
}
|
package/src/module.ts
CHANGED
|
@@ -20,12 +20,18 @@ export interface QelosNuxtModuleOptions extends QelosNuxtRuntimeConfig {
|
|
|
20
20
|
disableProxy?: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
// The workspace resolves two @nuxt/schema copies (3.21.4 and 4.5.2 - this package
|
|
24
|
+
// supports both Nuxt versions, and other workspace packages pin different ones), which
|
|
25
|
+
// makes tsc's declaration-portability check for the exported module non-deterministic
|
|
26
|
+
// across runs. `any` sidesteps needing to name a cross-package type for the export;
|
|
27
|
+
// runtime behavior is unaffected and is verified against real Nuxt 3 and 4 projects by
|
|
28
|
+
// test/module-smoke.test.ts.
|
|
29
|
+
const qelosNuxtModule: any = defineNuxtModule<QelosNuxtModuleOptions>({
|
|
24
30
|
meta: {
|
|
25
31
|
name: '@qelos/integrator-nuxt',
|
|
26
32
|
configKey: 'qelos',
|
|
27
33
|
compatibility: {
|
|
28
|
-
nuxt: '^3.0.0',
|
|
34
|
+
nuxt: '^3.0.0 || ^4.0.0',
|
|
29
35
|
},
|
|
30
36
|
},
|
|
31
37
|
defaults: {
|
|
@@ -93,6 +99,8 @@ export {};
|
|
|
93
99
|
},
|
|
94
100
|
});
|
|
95
101
|
|
|
102
|
+
export default qelosNuxtModule;
|
|
103
|
+
|
|
96
104
|
export { createQelosMiddleware } from './middleware';
|
|
97
105
|
export { createRequestSdk } from './sdk-factory';
|
|
98
106
|
export { defineQelosEventHandler } from './event-handler';
|
package/src/runtime/api-proxy.ts
CHANGED
|
@@ -26,8 +26,7 @@ export default defineEventHandler((event) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const originalHost = getRequestHeader(event, 'host');
|
|
29
|
-
const
|
|
30
|
-
const target = joinURL(base, path);
|
|
29
|
+
const target = joinURL(base, event.path);
|
|
31
30
|
|
|
32
31
|
return proxyRequest(event, target, {
|
|
33
32
|
fetch: globalThis.fetch,
|