@niledatabase/nextjs 5.0.0-alpha.5 → 5.0.0-alpha.6
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.6](https://github.com/niledatabase/nile-js/compare/v5.0.0-alpha.5...v5.0.0-alpha.6) (2025-06-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **server:** move logging to the config object ([6e3e380](https://github.com/niledatabase/nile-js/commit/6e3e38014f5b9795552af0a7b97e2d3fe6cd1a88))
|
|
11
|
+
|
|
6
12
|
# [5.0.0-alpha.5](https://github.com/niledatabase/nile-js/compare/v5.0.0-alpha.4...v5.0.0-alpha.5) (2025-06-10)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import * as next_dist_server_web_spec_extension_adapters_headers from 'next/dist/server/web/spec-extension/adapters/headers';
|
|
1
2
|
import { Server } from '@niledatabase/server';
|
|
2
3
|
|
|
3
4
|
declare function nextJs(instance: Server): {
|
|
4
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
onRequest: () => Promise<next_dist_server_web_spec_extension_adapters_headers.ReadonlyHeaders | undefined>;
|
|
5
7
|
};
|
|
6
8
|
|
|
7
9
|
export { nextJs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import * as next_dist_server_web_spec_extension_adapters_headers from 'next/dist/server/web/spec-extension/adapters/headers';
|
|
1
2
|
import { Server } from '@niledatabase/server';
|
|
2
3
|
|
|
3
4
|
declare function nextJs(instance: Server): {
|
|
4
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
onRequest: () => Promise<next_dist_server_web_spec_extension_adapters_headers.ReadonlyHeaders | undefined>;
|
|
5
7
|
};
|
|
6
8
|
|
|
7
9
|
export { nextJs };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},i=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!C.call(t,n)&&n!==o&&s(t,n,{get:()=>e[n],enumerable:!(r=x(e,n))||r.enumerable});return t};var p=(t,e,o)=>(o=t!=null?u(k(t)):{},i(e||!t||!t.__esModule?s(o,"default",{value:t,enumerable:!0}):o,t)),m=t=>i(s({},"__esModule",{value:!0}),t);var w={};f(w,{nextJs:()=>v});module.exports=m(w);var c=require("@niledatabase/server");function v(t){return{id:"next-js-cookies",onRequest:async()=>{let{cookies:e,headers:o}=await import("next/headers"),r=await o();if(t.setContext(r),!t.getContext().tenantId){let a=(await e()).get(c.TENANT_COOKIE);return a&&t.setContext({tenantId:a.value}),r}}}}0&&(module.exports={nextJs});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n id: 'next-js-cookies',\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n const headersHelper = await headers();\n instance.setContext(headersHelper);\n if (!instance.getContext().tenantId) {\n const cooks = await cookies();\n const tenantCookie = cooks.get(TENANT_COOKIE);\n if (tenantCookie) {\n instance.setContext({ tenantId: tenantCookie.value });\n }\n // return this so that the initial request can still partake\n return headersHelper;\n }\n return;\n },\n };\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsC,gCAE/B,SAASF,EAAOG,EAAkB,CACvC,MAAO,CACL,GAAI,kBACJ,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAClDC,EAAgB,MAAMD,EAAQ,EAEpC,GADAF,EAAS,WAAWG,CAAa,EAC7B,CAACH,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMI,GADQ,MAAMH,EAAQ,GACD,IAAI,eAAa,EAC5C,OAAIG,GACFJ,EAAS,WAAW,CAAE,SAAUI,EAAa,KAAM,CAAC,EAG/CD,CACT,CAEF,CACF,CACF","names":["index_exports","__export","nextJs","__toCommonJS","import_server","instance","cookies","headers","headersHelper","tenantCookie"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TENANT_COOKIE as
|
|
1
|
+
import{TENANT_COOKIE as s}from"@niledatabase/server";function u(t){return{id:"next-js-cookies",onRequest:async()=>{let{cookies:n,headers:r}=await import("next/headers"),e=await r();if(t.setContext(e),!t.getContext().tenantId){let o=(await n()).get(s);return o&&t.setContext({tenantId:o.value}),e}}}}export{u as nextJs};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n id: 'next-js-cookies',\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n const headersHelper = await headers();\n instance.setContext(headersHelper);\n if (!instance.getContext().tenantId) {\n const cooks = await cookies();\n const tenantCookie = cooks.get(TENANT_COOKIE);\n if (tenantCookie) {\n instance.setContext({ tenantId: tenantCookie.value });\n }\n // return this so that the initial request can still partake\n return headersHelper;\n }\n return;\n },\n };\n}\n"],"mappings":"AAAA,OAAiB,iBAAAA,MAAqB,uBAE/B,SAASC,EAAOC,EAAkB,CACvC,MAAO,CACL,GAAI,kBACJ,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAClDC,EAAgB,MAAMD,EAAQ,EAEpC,GADAF,EAAS,WAAWG,CAAa,EAC7B,CAACH,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMI,GADQ,MAAMH,EAAQ,GACD,IAAIH,CAAa,EAC5C,OAAIM,GACFJ,EAAS,WAAW,CAAE,SAAUI,EAAa,KAAM,CAAC,EAG/CD,CACT,CAEF,CACF,CACF","names":["TENANT_COOKIE","nextJs","instance","cookies","headers","headersHelper","tenantCookie"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niledatabase/nextjs",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"next": "^15.3.3",
|
|
39
39
|
"tsup": "^8.5.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "33b4751621db9c1f92fd559e8b6def081f0c3cd4"
|
|
42
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,16 +2,21 @@ import { Server, TENANT_COOKIE } from '@niledatabase/server';
|
|
|
2
2
|
|
|
3
3
|
export function nextJs(instance: Server) {
|
|
4
4
|
return {
|
|
5
|
+
id: 'next-js-cookies',
|
|
5
6
|
onRequest: async () => {
|
|
6
7
|
const { cookies, headers } = await import('next/headers');
|
|
7
|
-
|
|
8
|
+
const headersHelper = await headers();
|
|
9
|
+
instance.setContext(headersHelper);
|
|
8
10
|
if (!instance.getContext().tenantId) {
|
|
9
11
|
const cooks = await cookies();
|
|
10
12
|
const tenantCookie = cooks.get(TENANT_COOKIE);
|
|
11
13
|
if (tenantCookie) {
|
|
12
14
|
instance.setContext({ tenantId: tenantCookie.value });
|
|
13
15
|
}
|
|
16
|
+
// return this so that the initial request can still partake
|
|
17
|
+
return headersHelper;
|
|
14
18
|
}
|
|
19
|
+
return;
|
|
15
20
|
},
|
|
16
21
|
};
|
|
17
22
|
}
|