modelence 0.18.0-dev.1 → 0.18.0-dev.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/dist/{chunk-KU4GANYW.js → chunk-4GRKA5XD.js} +3 -3
- package/dist/{chunk-KU4GANYW.js.map → chunk-4GRKA5XD.js.map} +1 -1
- package/dist/{chunk-S2E4OO6G.js → chunk-EPSYTDTF.js} +4 -4
- package/dist/{chunk-S2E4OO6G.js.map → chunk-EPSYTDTF.js.map} +1 -1
- package/dist/{package-XQQF6NGT.js → package-LHHQ7BNW.js} +2 -2
- package/dist/{package-XQQF6NGT.js.map → package-LHHQ7BNW.js.map} +1 -1
- package/dist/render-NUGKBTTZ.js +2 -0
- package/dist/render-NUGKBTTZ.js.map +1 -0
- package/dist/server-XAIFPVGX.js +2 -0
- package/dist/{server-JB4DTGBT.js.map → server-XAIFPVGX.js.map} +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/dist/render-57TPXKHI.js +0 -2
- package/dist/render-57TPXKHI.js.map +0 -1
- package/dist/server-JB4DTGBT.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{l as author,i as bin,n as bugs,s as default,q as dependencies,d as description,p as devDependencies,g as exports,h as files,o as homepage,m as license,e as main,b as name,r as peerDependencies,k as repository,j as scripts,a as type,f as types,c as version}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=package-
|
|
1
|
+
export{l as author,i as bin,n as bugs,s as default,q as dependencies,d as description,p as devDependencies,g as exports,h as files,o as homepage,m as license,e as main,b as name,r as peerDependencies,k as repository,j as scripts,a as type,f as types,c as version}from'./chunk-4GRKA5XD.js';//# sourceMappingURL=package-LHHQ7BNW.js.map
|
|
2
|
+
//# sourceMappingURL=package-LHHQ7BNW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"package-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"package-LHHQ7BNW.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b,c}from'./chunk-JBTEZOY2.js';import'./chunk-LDVLXJLS.js';import'./chunk-3SPXJEOR.js';import {a as a$1,m}from'./chunk-IJ5BS7PM.js';import {x,r,y}from'./chunk-VFOGVWJK.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';import {renderToPipeableStream}from'react-dom/server';import {Writable}from'stream';import {QueryClient,dehydrate}from'@tanstack/react-query';import {jsx}from'react/jsx-runtime';var W=()=>{let r=c();return r?y(r.session.user):null},D=r=>{let t=c();if(t)return t.session.configs[r]?.value};function A(){x(W),r(D);}async function Y(r){let{callContext:t,loadingElement:m$1,routesElement:n,router:o,location:s}=r;A();let l=await a("_system.session.init",{},t),e=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),d=o?o({children:n,location:s}):n,i=jsx(a$1,{loadingElement:m$1,children:jsx(m,{client:e,children:d})}),p=await b({callContext:t,queryClient:e,session:{user:l.user,configs:l.configs??{}}},()=>H(i,s)),y=dehydrate(e);return e.clear(),{html:p,sessionState:JSON.stringify({session:l}),queryState:JSON.stringify(y)}}async function Z(r){let{callContext:t,loadingElement:m$1,routesElement:n,router:o,location:s,onShellReady:l,onError:e}=r;A();let d=await a("_system.session.init",{},t),i=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),p=o?o({children:n,location:s}):n,y=jsx(a$1,{loadingElement:m$1,children:jsx(m,{client:i,children:p})}),f=null;await new Promise((u,R)=>{b({callContext:t,queryClient:i,session:{user:d.user,configs:d.configs??{}}},()=>{let a=renderToPipeableStream(y,{onShellReady(){f=a,l?.(),u(a);},onShellError(c){R(c);},onError(c){e?.(c);}});return a});});let g=null,I=u=>new Promise((R,a)=>{if(!f){a(new Error("SSR stream was not initialized"));return}let c=new Writable({write(h,x,J){u.write(h,M=>J(M??void 0));},final(h){try{let x=dehydrate(i);g=JSON.stringify(x);}finally{i.clear();}h(),R();}});c.on("error",a),u.on("error",a),f.pipe(c);});return {sessionState:JSON.stringify({session:d}),pipe:I,getQueryState:()=>{if(g===null)throw new Error("getQueryState() called before stream finished");return g}}}function H(r,t){return new Promise((m,n)=>{let o="",s=new Writable({write(e,d,i){o+=e.toString(),i();}}),{pipe:l}=renderToPipeableStream(r,{onAllReady(){s.on("finish",()=>m(o)),s.on("error",n),l(s);},onShellError(e){n(e);},onError(e){console.error("SSR onError (non-fatal):",{location:t,error:e});}});})}export{Y as renderSsrTree,Z as renderSsrTreeStream};//# sourceMappingURL=render-NUGKBTTZ.js.map
|
|
2
|
+
//# sourceMappingURL=render-NUGKBTTZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ssr/render.tsx"],"names":["sessionResolver","ctx","getSsrContext","_parseSessionUser","configResolver","key","ensureSsrResolversInstalled","_setSsrSessionResolver","_setSsrConfigResolver","renderSsrTree","options","callContext","loadingElement","routesElement","router","location","sessionPayload","callInProcessMethod","queryClient","QueryClient","routedTree","tree","jsx","AppProvider","ModelenceQueryProvider","html","runWithSsrContext","renderToString","dehydratedState","dehydrate","renderSsrTreeStream","onShellReady","onError","streamRef","resolve","reject","stream","renderToPipeableStream","error","queryStateJson","pipe","destination","passthrough","Writable","chunk","_encoding","callback","err","buffer","writable"],"mappings":"+ZAkBA,IAAMA,CAAAA,CAAkB,IAAM,CAC5B,IAAMC,CAAAA,CAAMC,CAAAA,EAAc,CAC1B,OAAKD,CAAAA,CAGEE,CAAAA,CAAkBF,CAAAA,CAAI,QAAQ,IAAI,CAAA,CAFhC,IAGX,CAAA,CAEMG,CAAAA,CAAkBC,CAAAA,EAAmB,CACzC,IAAMJ,CAAAA,CAAMC,CAAAA,EAAc,CAC1B,GAAKD,CAAAA,CAGL,OAAOA,CAAAA,CAAI,OAAA,CAAQ,OAAA,CAAQI,CAAG,CAAA,EAAG,KACnC,CAAA,CAEA,SAASC,CAAAA,EAA8B,CAGrCC,CAAAA,CAAuBP,CAA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OAAO,CACL,YAAA,CAAc,IAAA,CAAK,SAAA,CAAU,CAAE,OAAA,CAAS1B,CAAe,CAAC,CAAA,CACxD,IAAA,CAAAwB,EACA,aAAA,CAAe,IAAM,CACnB,GAAID,CAAAA,GAAmB,IAAA,CACrB,MAAM,IAAI,KAAA,CAAM,+CAA+C,CAAA,CAEjE,OAAOA,CACT,CACF,CACF,CAEA,SAASZ,CAAAA,CAAeN,CAAAA,CAA0BN,CAAAA,CAA+C,CAC/F,OAAO,IAAI,OAAA,CAAQ,CAACmB,CAAAA,CAASC,CAAAA,GAAW,CACtC,IAAIa,CAAAA,CAAS,EAAA,CACPC,CAAAA,CAAW,IAAIN,QAAAA,CAAS,CAC5B,KAAA,CAAMC,CAAAA,CAAOC,CAAAA,CAAWC,CAAAA,CAAU,CAChCE,CAAAA,EAAUJ,CAAAA,CAAM,QAAA,EAAS,CACzBE,CAAAA,GACF,CACF,CAAC,CAAA,CAEK,CAAE,IAAA,CAAAN,CAAK,CAAA,CAAIH,sBAAAA,CAAuBhB,CAAAA,CAAM,CAC5C,UAAA,EAAa,CACX4B,CAAAA,CAAS,EAAA,CAAG,QAAA,CAAU,IAAMf,CAAAA,CAAQc,CAAM,CAAC,EAC3CC,CAAAA,CAAS,EAAA,CAAG,OAAA,CAASd,CAAM,CAAA,CAC3BK,CAAAA,CAAKS,CAAQ,EACf,CAAA,CACA,YAAA,CAAaX,CAAAA,CAAO,CAClBH,CAAAA,CAAOG,CAAK,EACd,CAAA,CACA,OAAA,CAAQA,CAAAA,CAAO,CAIb,OAAA,CAAQ,KAAA,CAAM,0BAAA,CAA4B,CAAE,QAAA,CAAAvB,CAAAA,CAAU,KAAA,CAAAuB,CAAM,CAAC,EAC/D,CACF,CAAC,EACH,CAAC,CACH","file":"render-NUGKBTTZ.js","sourcesContent":["import React from 'react';\nimport { renderToPipeableStream, type PipeableStream } from 'react-dom/server';\nimport { Writable } from 'node:stream';\nimport { QueryClient, dehydrate, type DehydratedState } from '@tanstack/react-query';\nimport { AppProvider } from '../client/AppProvider';\nimport { ModelenceQueryProvider } from '../client/queryProvider';\nimport { getSsrContext, runWithSsrContext } from './context';\nimport { callInProcessMethod } from './callInProcess';\nimport type { Context } from '../methods/types';\nimport {\n _parseSessionUser,\n _setSsrSessionResolver,\n type SessionInitPayload,\n} from '../client/session';\nimport { _setSsrConfigResolver } from '../config/client';\nimport type { ConfigKey, Configs } from '../config/types';\nimport type { SsrRouter } from '../client/renderApp';\n\nconst sessionResolver = () => {\n const ctx = getSsrContext();\n if (!ctx) {\n return null;\n }\n return _parseSessionUser(ctx.session.user);\n};\n\nconst configResolver = (key: ConfigKey) => {\n const ctx = getSsrContext();\n if (!ctx) {\n return undefined;\n }\n return ctx.session.configs[key]?.value;\n};\n\nfunction ensureSsrResolversInstalled() {\n // Idempotent — safe to call repeatedly. Re-installs the framework's own\n // resolvers if they were swapped out (tests, future reload code).\n _setSsrSessionResolver(sessionResolver);\n _setSsrConfigResolver(configResolver);\n}\n\nexport type SsrRenderResult = {\n html: string;\n /** Inline as <script id=\"__MODELENCE_STATE__\">…</script> */\n sessionState: string;\n /** Inline as <script id=\"__MODELENCE_QUERY_STATE__\">…</script> */\n queryState: string;\n};\n\nexport type SsrRenderOptions = {\n callContext: Context;\n loadingElement: React.ReactNode;\n routesElement: React.ReactNode;\n router?: SsrRouter;\n location?: string;\n};\n\nexport type SsrStreamHandle = {\n /** Session bootstrap payload — safe to inline before the React shell flushes. */\n sessionState: string;\n /**\n * Pipe React's HTML stream into the response. Resolves once every Suspense\n * boundary has settled and the stream has finished writing.\n */\n pipe: (destination: Writable) => Promise<void>;\n /**\n * Read the dehydrated query state. Only call AFTER `pipe()` resolves —\n * queries that resolve mid-stream populate the cache during render.\n */\n getQueryState: () => string;\n};\n\nexport type SsrStreamOptions = SsrRenderOptions & {\n /**\n * Called once React has flushed the shell (head + above-fallback content)\n * and the stream is ready to pipe. The framework uses this hook to write\n * the opening template + state scripts before piping React's HTML.\n */\n onShellReady?: () => void;\n /** Non-fatal SSR errors (Suspense fallbacks, etc.). */\n onError?: (error: unknown) => void;\n};\n\nexport async function renderSsrTree(options: SsrRenderOptions): Promise<SsrRenderResult> {\n const { callContext, loadingElement, routesElement, router, location } = options;\n\n ensureSsrResolversInstalled();\n\n const sessionPayload = await callInProcessMethod<SessionInitPayload>(\n '_system.session.init',\n {},\n callContext\n );\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: false,\n // Per-request client; release cache + timers immediately after dehydrate.\n gcTime: 0,\n },\n },\n });\n\n const routedTree = router ? router({ children: routesElement, location }) : routesElement;\n\n const tree = (\n <AppProvider loadingElement={loadingElement}>\n <ModelenceQueryProvider client={queryClient}>{routedTree}</ModelenceQueryProvider>\n </AppProvider>\n );\n\n const html = await runWithSsrContext(\n {\n callContext,\n queryClient,\n session: {\n user: sessionPayload.user,\n configs: (sessionPayload.configs as Configs) ?? {},\n },\n },\n () => renderToString(tree, location)\n );\n\n // Safe to dehydrate + clear here: `onAllReady` waits for every Suspense\n // boundary to settle before resolving, so all in-flight queries have\n // populated the cache by this point.\n const dehydratedState: DehydratedState = dehydrate(queryClient);\n queryClient.clear();\n\n return {\n html,\n sessionState: JSON.stringify({ session: sessionPayload }),\n queryState: JSON.stringify(dehydratedState),\n };\n}\n\n/**\n * Streaming variant of {@link renderSsrTree}. Returns a handle that lets the\n * caller flush a template prelude (head + opening shell) as soon as the\n * React shell is ready, pipe the React HTML stream into the response, then\n * append the dehydrated query state once streaming completes.\n *\n * This is what enables fast First Contentful Paint: the browser receives the\n * <head> (with CSS <link> tags) immediately, starts the stylesheet fetch in\n * parallel with the HTML stream, and paints the streamed shell with styles\n * applied — instead of the dev-mode FOUC caused by JS-injected CSS.\n */\nexport async function renderSsrTreeStream(options: SsrStreamOptions): Promise<SsrStreamHandle> {\n const { callContext, loadingElement, routesElement, router, location, onShellReady, onError } =\n options;\n\n ensureSsrResolversInstalled();\n\n const sessionPayload = await callInProcessMethod<SessionInitPayload>(\n '_system.session.init',\n {},\n callContext\n );\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: false,\n gcTime: 0,\n },\n },\n });\n\n const routedTree = router ? router({ children: routesElement, location }) : routesElement;\n const tree = (\n <AppProvider loadingElement={loadingElement}>\n <ModelenceQueryProvider client={queryClient}>{routedTree}</ModelenceQueryProvider>\n </AppProvider>\n );\n\n let streamRef: PipeableStream | null = null;\n // The shell-ready promise resolves with the PipeableStream as soon as React\n // has rendered above-fallback content. Errors during the shell render\n // reject it so the caller can fall back to a static response.\n const shellReady = new Promise<PipeableStream>((resolve, reject) => {\n // Run the render inside the SSR context so server-rendered components\n // can resolve session/config/query state from the per-request scope.\n runWithSsrContext(\n {\n callContext,\n queryClient,\n session: {\n user: sessionPayload.user,\n configs: (sessionPayload.configs as Configs) ?? {},\n },\n },\n () => {\n const stream = renderToPipeableStream(tree, {\n onShellReady() {\n streamRef = stream;\n onShellReady?.();\n resolve(stream);\n },\n onShellError(error) {\n reject(error);\n },\n onError(error) {\n onError?.(error);\n },\n });\n return stream;\n }\n );\n });\n\n // Surface shell errors synchronously by awaiting before returning the handle.\n await shellReady;\n\n let queryStateJson: string | null = null;\n\n const pipe = (destination: Writable): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (!streamRef) {\n reject(new Error('SSR stream was not initialized'));\n return;\n }\n\n // react-dom calls `.end()` on the destination it pipes into. We need to\n // keep writing AFTER React is done (epilogue + query state script), so\n // we wrap the real destination in a pass-through Writable whose `end()`\n // flushes pending data but does NOT close the underlying response.\n const passthrough = new Writable({\n write(chunk, _encoding, callback) {\n destination.write(chunk, (err) => callback(err ?? undefined));\n },\n final(callback) {\n // Triggered by react-dom's `destination.end()`. Resolve the pipe\n // promise so the caller can write the epilogue, but leave the real\n // response open.\n try {\n const dehydratedState: DehydratedState = dehydrate(queryClient);\n queryStateJson = JSON.stringify(dehydratedState);\n } finally {\n queryClient.clear();\n }\n callback();\n resolve();\n },\n });\n\n passthrough.on('error', reject);\n destination.on('error', reject);\n\n streamRef.pipe(passthrough);\n });\n };\n\n return {\n sessionState: JSON.stringify({ session: sessionPayload }),\n pipe,\n getQueryState: () => {\n if (queryStateJson === null) {\n throw new Error('getQueryState() called before stream finished');\n }\n return queryStateJson;\n },\n };\n}\n\nfunction renderToString(tree: React.ReactElement, location: string | undefined): Promise<string> {\n return new Promise((resolve, reject) => {\n let buffer = '';\n const writable = new Writable({\n write(chunk, _encoding, callback) {\n buffer += chunk.toString();\n callback();\n },\n });\n\n const { pipe } = renderToPipeableStream(tree, {\n onAllReady() {\n writable.on('finish', () => resolve(buffer));\n writable.on('error', reject);\n pipe(writable);\n },\n onShellError(error) {\n reject(error);\n },\n onError(error) {\n // Non-fatal recoverable errors (Suspense fallbacks, etc.). React still\n // ships HTML, but repeated occurrences can mask real bugs — log with\n // request URL for telemetry follow-up.\n console.error('SSR onError (non-fatal):', { location, error });\n },\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{g as getCallContext,f as startServer}from'./chunk-EPSYTDTF.js';import'./chunk-4GRKA5XD.js';import'./chunk-LDVLXJLS.js';import'./chunk-C3UESBRX.js';import'./chunk-3SPXJEOR.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server-XAIFPVGX.js.map
|
|
2
|
+
//# sourceMappingURL=server-XAIFPVGX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"server-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"server-XAIFPVGX.js"}
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{m as ObjectId,k as ServerChannel,a as consumeRateLimit,c as deleteFile,j as deleteUser,i as disableUser,d as downloadFile,e as getFileUrl,b as getUploadUrl,l as sendEmail,h as startApp}from'./chunk-
|
|
1
|
+
export{m as ObjectId,k as ServerChannel,a as consumeRateLimit,c as deleteFile,j as deleteUser,i as disableUser,d as downloadFile,e as getFileUrl,b as getUploadUrl,l as sendEmail,h as startApp}from'./chunk-EPSYTDTF.js';import'./chunk-4GRKA5XD.js';export{r as LiveData,a as Module,b as Store,q as authenticate,t as createQuery,k as dbUsers,c as schema}from'./chunk-LDVLXJLS.js';import'./chunk-C3UESBRX.js';export{a as getConfig}from'./chunk-3SPXJEOR.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server.js.map
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/package.json
CHANGED
package/dist/render-57TPXKHI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a,b,c}from'./chunk-JBTEZOY2.js';import'./chunk-LDVLXJLS.js';import'./chunk-3SPXJEOR.js';import {a as a$1,m}from'./chunk-IJ5BS7PM.js';import {x,r,y}from'./chunk-VFOGVWJK.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';import {renderToPipeableStream}from'react-dom/server';import {Writable}from'stream';import {QueryClient,dehydrate}from'@tanstack/react-query';import {jsx}from'react/jsx-runtime';var A=()=>{let r=c();return r?y(r.session.user):null},I=r=>{let t=c();if(t)return t.session.configs[r]?.value};function Q(){x(A),r(I);}async function G(r){let{callContext:t,loadingElement:c,routesElement:o,router:n,location:s}=r;Q();let l=await a("_system.session.init",{},t),e=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),a$2=n?n({children:o,location:s}):o,i=jsx(a$1,{loadingElement:c,children:jsx(m,{client:e,children:a$2})}),p=await b({callContext:t,queryClient:e,session:{user:l.user,configs:l.configs??{}}},()=>J(i,s)),y=dehydrate(e);return e.clear(),{html:p,sessionState:JSON.stringify({session:l}),queryState:JSON.stringify(y)}}async function L(r){let{callContext:t,loadingElement:c,routesElement:o,router:n,location:s,onShellReady:l,onError:e}=r;Q();let a$2=await a("_system.session.init",{},t),i=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),p=n?n({children:o,location:s}):o,y=jsx(a$1,{loadingElement:c,children:jsx(m,{client:i,children:p})}),f=null;await new Promise((m,R)=>{b({callContext:t,queryClient:i,session:{user:a$2.user,configs:a$2.configs??{}}},()=>{let d=renderToPipeableStream(y,{onShellReady(){f=d,l?.(),m(d);},onShellError(S){R(S);},onError(S){e?.(S);}});return d});});let g=null,N=m=>new Promise((R,d)=>{if(!f){d(new Error("SSR stream was not initialized"));return}m.on("finish",()=>{try{let S=dehydrate(i);g=JSON.stringify(S);}finally{i.clear();}R();}),m.on("error",d),f.pipe(m);});return {sessionState:JSON.stringify({session:a$2}),pipe:N,getQueryState:()=>{if(g===null)throw new Error("getQueryState() called before stream finished");return g}}}function J(r,t){return new Promise((c,o)=>{let n="",s=new Writable({write(e,a,i){n+=e.toString(),i();}}),{pipe:l}=renderToPipeableStream(r,{onAllReady(){s.on("finish",()=>c(n)),s.on("error",o),l(s);},onShellError(e){o(e);},onError(e){console.error("SSR onError (non-fatal):",{location:t,error:e});}});})}export{G as renderSsrTree,L as renderSsrTreeStream};//# sourceMappingURL=render-57TPXKHI.js.map
|
|
2
|
-
//# sourceMappingURL=render-57TPXKHI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ssr/render.tsx"],"names":["sessionResolver","ctx","getSsrContext","_parseSessionUser","configResolver","key","ensureSsrResolversInstalled","_setSsrSessionResolver","_setSsrConfigResolver","renderSsrTree","options","callContext","loadingElement","routesElement","router","location","sessionPayload","callInProcessMethod","queryClient","QueryClient","routedTree","tree","jsx","AppProvider","ModelenceQueryProvider","html","runWithSsrContext","renderToString","dehydratedState","dehydrate","renderSsrTreeStream","onShellReady","onError","streamRef","resolve","reject","stream","renderToPipeableStream","error","queryStateJson","pipe","destination","buffer","writable","Writable","chunk","_encoding","callback"],"mappings":"+ZAkBA,IAAMA,CAAAA,CAAkB,IAAM,CAC5B,IAAMC,CAAAA,CAAMC,CAAAA,EAAc,CAC1B,OAAKD,CAAAA,CAGEE,CAAAA,CAAkBF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AW,EAC5B,CAAC,CAAA,CAGH,OAAO,CACL,YAAA,CAAc,IAAA,CAAK,SAAA,CAAU,CAAE,OAAA,CAASzB,GAAe,CAAC,CAAA,CACxD,IAAA,CAAAwB,CAAAA,CACA,aAAA,CAAe,IAAM,CACnB,GAAID,CAAAA,GAAmB,IAAA,CACrB,MAAM,IAAI,KAAA,CAAM,+CAA+C,CAAA,CAEjE,OAAOA,CACT,CACF,CACF,CAEA,SAASZ,CAAAA,CAAeN,CAAAA,CAA0BN,CAAAA,CAA+C,CAC/F,OAAO,IAAI,OAAA,CAAQ,CAACmB,CAAAA,CAASC,CAAAA,GAAW,CACtC,IAAIO,CAAAA,CAAS,EAAA,CACPC,CAAAA,CAAW,IAAIC,QAAAA,CAAS,CAC5B,KAAA,CAAMC,CAAAA,CAAOC,CAAAA,CAAWC,EAAU,CAChCL,CAAAA,EAAUG,CAAAA,CAAM,QAAA,EAAS,CACzBE,CAAAA,GACF,CACF,CAAC,CAAA,CAEK,CAAE,IAAA,CAAAP,CAAK,CAAA,CAAIH,sBAAAA,CAAuBhB,CAAAA,CAAM,CAC5C,UAAA,EAAa,CACXsB,CAAAA,CAAS,EAAA,CAAG,QAAA,CAAU,IAAMT,CAAAA,CAAQQ,CAAM,CAAC,CAAA,CAC3CC,CAAAA,CAAS,EAAA,CAAG,OAAA,CAASR,CAAM,CAAA,CAC3BK,CAAAA,CAAKG,CAAQ,EACf,CAAA,CACA,YAAA,CAAaL,CAAAA,CAAO,CAClBH,CAAAA,CAAOG,CAAK,EACd,CAAA,CACA,OAAA,CAAQA,CAAAA,CAAO,CAIb,OAAA,CAAQ,KAAA,CAAM,0BAAA,CAA4B,CAAE,QAAA,CAAAvB,CAAAA,CAAU,KAAA,CAAAuB,CAAM,CAAC,EAC/D,CACF,CAAC,EACH,CAAC,CACH","file":"render-57TPXKHI.js","sourcesContent":["import React from 'react';\nimport { renderToPipeableStream, type PipeableStream } from 'react-dom/server';\nimport { Writable } from 'node:stream';\nimport { QueryClient, dehydrate, type DehydratedState } from '@tanstack/react-query';\nimport { AppProvider } from '../client/AppProvider';\nimport { ModelenceQueryProvider } from '../client/queryProvider';\nimport { getSsrContext, runWithSsrContext } from './context';\nimport { callInProcessMethod } from './callInProcess';\nimport type { Context } from '../methods/types';\nimport {\n _parseSessionUser,\n _setSsrSessionResolver,\n type SessionInitPayload,\n} from '../client/session';\nimport { _setSsrConfigResolver } from '../config/client';\nimport type { ConfigKey, Configs } from '../config/types';\nimport type { SsrRouter } from '../client/renderApp';\n\nconst sessionResolver = () => {\n const ctx = getSsrContext();\n if (!ctx) {\n return null;\n }\n return _parseSessionUser(ctx.session.user);\n};\n\nconst configResolver = (key: ConfigKey) => {\n const ctx = getSsrContext();\n if (!ctx) {\n return undefined;\n }\n return ctx.session.configs[key]?.value;\n};\n\nfunction ensureSsrResolversInstalled() {\n // Idempotent — safe to call repeatedly. Re-installs the framework's own\n // resolvers if they were swapped out (tests, future reload code).\n _setSsrSessionResolver(sessionResolver);\n _setSsrConfigResolver(configResolver);\n}\n\nexport type SsrRenderResult = {\n html: string;\n /** Inline as <script id=\"__MODELENCE_STATE__\">…</script> */\n sessionState: string;\n /** Inline as <script id=\"__MODELENCE_QUERY_STATE__\">…</script> */\n queryState: string;\n};\n\nexport type SsrRenderOptions = {\n callContext: Context;\n loadingElement: React.ReactNode;\n routesElement: React.ReactNode;\n router?: SsrRouter;\n location?: string;\n};\n\nexport type SsrStreamHandle = {\n /** Session bootstrap payload — safe to inline before the React shell flushes. */\n sessionState: string;\n /**\n * Pipe React's HTML stream into the response. Resolves once every Suspense\n * boundary has settled and the stream has finished writing.\n */\n pipe: (destination: Writable) => Promise<void>;\n /**\n * Read the dehydrated query state. Only call AFTER `pipe()` resolves —\n * queries that resolve mid-stream populate the cache during render.\n */\n getQueryState: () => string;\n};\n\nexport type SsrStreamOptions = SsrRenderOptions & {\n /**\n * Called once React has flushed the shell (head + above-fallback content)\n * and the stream is ready to pipe. The framework uses this hook to write\n * the opening template + state scripts before piping React's HTML.\n */\n onShellReady?: () => void;\n /** Non-fatal SSR errors (Suspense fallbacks, etc.). */\n onError?: (error: unknown) => void;\n};\n\nexport async function renderSsrTree(options: SsrRenderOptions): Promise<SsrRenderResult> {\n const { callContext, loadingElement, routesElement, router, location } = options;\n\n ensureSsrResolversInstalled();\n\n const sessionPayload = await callInProcessMethod<SessionInitPayload>(\n '_system.session.init',\n {},\n callContext\n );\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: false,\n // Per-request client; release cache + timers immediately after dehydrate.\n gcTime: 0,\n },\n },\n });\n\n const routedTree = router ? router({ children: routesElement, location }) : routesElement;\n\n const tree = (\n <AppProvider loadingElement={loadingElement}>\n <ModelenceQueryProvider client={queryClient}>{routedTree}</ModelenceQueryProvider>\n </AppProvider>\n );\n\n const html = await runWithSsrContext(\n {\n callContext,\n queryClient,\n session: {\n user: sessionPayload.user,\n configs: (sessionPayload.configs as Configs) ?? {},\n },\n },\n () => renderToString(tree, location)\n );\n\n // Safe to dehydrate + clear here: `onAllReady` waits for every Suspense\n // boundary to settle before resolving, so all in-flight queries have\n // populated the cache by this point.\n const dehydratedState: DehydratedState = dehydrate(queryClient);\n queryClient.clear();\n\n return {\n html,\n sessionState: JSON.stringify({ session: sessionPayload }),\n queryState: JSON.stringify(dehydratedState),\n };\n}\n\n/**\n * Streaming variant of {@link renderSsrTree}. Returns a handle that lets the\n * caller flush a template prelude (head + opening shell) as soon as the\n * React shell is ready, pipe the React HTML stream into the response, then\n * append the dehydrated query state once streaming completes.\n *\n * This is what enables fast First Contentful Paint: the browser receives the\n * <head> (with CSS <link> tags) immediately, starts the stylesheet fetch in\n * parallel with the HTML stream, and paints the streamed shell with styles\n * applied — instead of the dev-mode FOUC caused by JS-injected CSS.\n */\nexport async function renderSsrTreeStream(options: SsrStreamOptions): Promise<SsrStreamHandle> {\n const { callContext, loadingElement, routesElement, router, location, onShellReady, onError } =\n options;\n\n ensureSsrResolversInstalled();\n\n const sessionPayload = await callInProcessMethod<SessionInitPayload>(\n '_system.session.init',\n {},\n callContext\n );\n\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: false,\n gcTime: 0,\n },\n },\n });\n\n const routedTree = router ? router({ children: routesElement, location }) : routesElement;\n const tree = (\n <AppProvider loadingElement={loadingElement}>\n <ModelenceQueryProvider client={queryClient}>{routedTree}</ModelenceQueryProvider>\n </AppProvider>\n );\n\n let streamRef: PipeableStream | null = null;\n // The shell-ready promise resolves with the PipeableStream as soon as React\n // has rendered above-fallback content. Errors during the shell render\n // reject it so the caller can fall back to a static response.\n const shellReady = new Promise<PipeableStream>((resolve, reject) => {\n // Run the render inside the SSR context so server-rendered components\n // can resolve session/config/query state from the per-request scope.\n runWithSsrContext(\n {\n callContext,\n queryClient,\n session: {\n user: sessionPayload.user,\n configs: (sessionPayload.configs as Configs) ?? {},\n },\n },\n () => {\n const stream = renderToPipeableStream(tree, {\n onShellReady() {\n streamRef = stream;\n onShellReady?.();\n resolve(stream);\n },\n onShellError(error) {\n reject(error);\n },\n onError(error) {\n onError?.(error);\n },\n });\n return stream;\n }\n );\n });\n\n // Surface shell errors synchronously by awaiting before returning the handle.\n await shellReady;\n\n let queryStateJson: string | null = null;\n\n const pipe = (destination: Writable): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (!streamRef) {\n reject(new Error('SSR stream was not initialized'));\n return;\n }\n\n destination.on('finish', () => {\n // React has finished streaming; dehydrate now so every query that\n // resolved during the stream is captured.\n try {\n const dehydratedState: DehydratedState = dehydrate(queryClient);\n queryStateJson = JSON.stringify(dehydratedState);\n } finally {\n queryClient.clear();\n }\n resolve();\n });\n destination.on('error', reject);\n\n streamRef.pipe(destination);\n });\n };\n\n return {\n sessionState: JSON.stringify({ session: sessionPayload }),\n pipe,\n getQueryState: () => {\n if (queryStateJson === null) {\n throw new Error('getQueryState() called before stream finished');\n }\n return queryStateJson;\n },\n };\n}\n\nfunction renderToString(tree: React.ReactElement, location: string | undefined): Promise<string> {\n return new Promise((resolve, reject) => {\n let buffer = '';\n const writable = new Writable({\n write(chunk, _encoding, callback) {\n buffer += chunk.toString();\n callback();\n },\n });\n\n const { pipe } = renderToPipeableStream(tree, {\n onAllReady() {\n writable.on('finish', () => resolve(buffer));\n writable.on('error', reject);\n pipe(writable);\n },\n onShellError(error) {\n reject(error);\n },\n onError(error) {\n // Non-fatal recoverable errors (Suspense fallbacks, etc.). React still\n // ships HTML, but repeated occurrences can mask real bugs — log with\n // request URL for telemetry follow-up.\n console.error('SSR onError (non-fatal):', { location, error });\n },\n });\n });\n}\n"]}
|
package/dist/server-JB4DTGBT.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{g as getCallContext,f as startServer}from'./chunk-S2E4OO6G.js';import'./chunk-KU4GANYW.js';import'./chunk-LDVLXJLS.js';import'./chunk-C3UESBRX.js';import'./chunk-3SPXJEOR.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server-JB4DTGBT.js.map
|
|
2
|
-
//# sourceMappingURL=server-JB4DTGBT.js.map
|