modelence 0.18.0-dev.5 → 0.18.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/bin/modelence.js +2 -2
- package/dist/bin/modelence.js.map +1 -1
- package/dist/chunk-ANRYTF2N.js +3 -0
- package/dist/chunk-ANRYTF2N.js.map +1 -0
- package/dist/client.d.ts +5 -67
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/{index-pPrHYnzB.d.ts → index-CLpVWWuj.d.ts} +1 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{package-U4D5AOYA.js → package-YHSF5RBN.js} +2 -2
- package/dist/{package-U4D5AOYA.js.map → package-YHSF5RBN.js.map} +1 -1
- package/dist/server.d.ts +5 -5
- package/dist/server.js +20 -1
- package/dist/server.js.map +1 -1
- package/dist/{types-BmVlYelB.d.ts → types-Ba-XOoJD.d.ts} +6 -14
- package/dist/{types-V74rNt-g.d.ts → types-BrUcinD0.d.ts} +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +1 -3
- package/dist/chunk-3XTC4WGD.js +0 -19
- package/dist/chunk-3XTC4WGD.js.map +0 -1
- package/dist/chunk-DRDY7GOT.js +0 -2
- package/dist/chunk-DRDY7GOT.js.map +0 -1
- package/dist/chunk-FL573BOT.js +0 -2
- package/dist/chunk-FL573BOT.js.map +0 -1
- package/dist/chunk-GZI4X3CV.js +0 -3
- package/dist/chunk-GZI4X3CV.js.map +0 -1
- package/dist/chunk-R6OOTUGO.js +0 -2
- package/dist/chunk-R6OOTUGO.js.map +0 -1
- package/dist/chunk-SABBG2XG.js +0 -2
- package/dist/chunk-SABBG2XG.js.map +0 -1
- package/dist/chunk-TQI5WDPR.js +0 -2
- package/dist/chunk-TQI5WDPR.js.map +0 -1
- package/dist/chunk-X22U5KA3.js +0 -3
- package/dist/chunk-X22U5KA3.js.map +0 -1
- package/dist/collectCss-4V7I3QV3.js +0 -2
- package/dist/collectCss-4V7I3QV3.js.map +0 -1
- package/dist/render-DLVPZOA6.js +0 -2
- package/dist/render-DLVPZOA6.js.map +0 -1
- package/dist/renderApp-ZQEZU2MT.js +0 -2
- package/dist/renderApp-ZQEZU2MT.js.map +0 -1
- package/dist/server-Z77W2F6P.js +0 -2
- package/dist/server-Z77W2F6P.js.map +0 -1
- package/dist/transport-ZSBKZIXH.js +0 -2
- package/dist/transport-ZSBKZIXH.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/module.ts","../src/system/client.ts","../src/websocket/clientChannel.ts","../src/files/client.ts","../src/client.ts","../src/client/renderApp.tsx"],"names":["createClientModule","moduleName","key","getConfig","name","rest","args","callMethod","getArgs","pageParam","systemConfig","ClientChannel","category","onMessage","getWebsocketClientProvider","id","uploadFile","file","filePath","contentType","visibility","url","fields","resolvedFilePath","formData","value","uploadResponse","deleteFile","downloadFile","getFileUrl","AppProvider","React","SSR_STATE_SCRIPT_ID","hasSsrMarker","readSsrState","node","e","SNAPSHOT_KEY","setSnapshot","snapshot","_getSsrSnapshot","renderApp","options","loadingElement","routesElement","favicon","errorHandler","router","setErrorHandler","isHydrating","ssrState","hydrateSession","startSessionHeartbeat","container","routedTree","tree","jsx","ModelenceQueryProvider","ReactDOM","link","newLink"],"mappings":"oLAuFO,SAASA,CAAAA,CAA8CC,CAAAA,CAAoB,CAChF,OAAO,CACL,SAAA,CACEC,CAAAA,CACqD,CAErD,OAAOC,CAAAA,CAAiB,CAAA,EAAGF,CAAU,CAAA,CAAA,EAAIC,CAAG,CAAA,CAAE,CAChD,CAAA,CAEA,KAAA,CACEE,CAAAA,CAAAA,GACGC,EAGH,CACA,IAAMC,CAAAA,CAAQD,CAAAA,CAAK,CAAC,CAAA,EAAK,EAAC,CAC1B,OAAO,CACL,QAAA,CAAU,CAACJ,CAAAA,CAAYG,CAAAA,CAAME,CAAI,CAAA,CACjC,OAAA,CAAS,IACPC,CAAAA,CACE,CAAA,EAAG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U,IAAM,CAExC,CAAC,CAAA,CAUD,IAAMG,CAAAA,CAAchB,CAAAA,EAAa,CAC3BiB,CAAAA,CAAWhB,CAAAA,EAAa,CAC1BgB,CAAAA,EAAU,OAAA,GACZC,CAAAA,CAAeD,CAAAA,CAAS,OAAO,CAAA,CAC/BE,GAAAA,EAAsB,CAAA,CAGxB,IAAMC,CAAAA,CAAY,QAAA,CAAS,cAAA,CAAe,MAAM,CAAA,CAC1CC,CAAAA,CAAaP,CAAAA,CAASA,CAAAA,CAAO,CAAE,QAAA,CAAUH,CAAc,CAAC,EAAIA,CAAAA,CAC5DW,CAAAA,CACJC,GAAAA,CAACzB,CAAAA,CAAM,UAAA,CAAN,CACC,QAAA,CAAAyB,GAAAA,CAAC1B,CAAAA,CAAA,CAAY,cAAA,CAAgBa,GAAAA,CAC3B,QAAA,CAAAa,GAAAA,CAACC,CAAAA,CAAA,CAAwB,QAAA,CAAAH,CAAAA,CAAW,CAAA,CACtC,CAAA,CACF,CAAA,CASF,GANIL,CAAAA,CACFS,CAAAA,CAAS,WAAA,CAAYL,CAAAA,CAAWE,CAAI,CAAA,CAEpCG,CAAAA,CAAS,UAAA,CAAWL,CAAS,CAAA,CAAE,OAAOE,CAAI,CAAA,CAGxCV,CAAAA,CAAS,CACX,IAAMc,CAAAA,CAAO,QAAA,CAAS,aAAA,CAAc,mBAAmB,CAAA,CACvD,GAAKA,CAAAA,CAMHA,CAAAA,CAAK,IAAA,CAAOd,CAAAA,CAAAA,KANH,CACT,IAAMe,CAAAA,CAAU,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA,CAC7CA,CAAAA,CAAQ,GAAA,CAAM,MAAA,CACdA,CAAAA,CAAQ,IAAA,CAAOf,CAAAA,CACf,QAAA,CAAS,IAAA,CAAK,WAAA,CAAYe,CAAO,EACnC,CAGF,CACF","file":"chunk-TQI5WDPR.js","sourcesContent":["'use client';\n\nimport type { ObjectId } from 'mongodb';\nimport type { ConfigParams, ConfigType, ValueType } from '../config/types';\nimport { callMethod, type MethodArgs } from './method';\nimport type { AnyMethodShape } from '../methods/types';\n\n// Pulls the config store value without importing server-side code\nimport { getConfig as _getClientConfig } from '../config/client';\n\n// ── type helpers ─────────────────────────────────────────────────────────────\n\n/**\n * Recursively maps ObjectId → string to match the sanitized runtime values\n * sent over the wire. Dates are preserved (revived via typeMap on the client).\n */\ntype Sanitized<T> = T extends ObjectId\n ? string\n : T extends Date\n ? Date\n : T extends (infer U)[]\n ? Sanitized<U>[]\n : T extends object\n ? { [K in keyof T]: Sanitized<T[K]> }\n : T;\n\ntype ExtractArgs<M> = M extends (args: infer A, ...rest: any[]) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n ? A\n : M extends { handler: (args: infer A, ...rest: any[]) => any } // eslint-disable-line @typescript-eslint/no-explicit-any\n ? A\n : MethodArgs;\n\ntype ExtractResult<M> = M extends (...args: any[]) => Promise<infer R> // eslint-disable-line @typescript-eslint/no-explicit-any\n ? Sanitized<R>\n : M extends { handler: (...args: any[]) => Promise<infer R> } // eslint-disable-line @typescript-eslint/no-explicit-any\n ? Sanitized<R>\n : unknown;\n\ntype PublicKeyOf<TSchema extends Record<string, ConfigParams>> = {\n [K in keyof TSchema as TSchema[K] extends ConfigParams<ConfigType, true>\n ? string & K\n : never]: ValueType<TSchema[K]['type']>;\n};\n\ntype AnyModule = {\n name: string;\n configSchema: Record<string, ConfigParams>;\n queries: Record<string, AnyMethodShape>;\n mutations: Record<string, AnyMethodShape>;\n};\n\n// ── createClientModule ────────────────────────────────────────────────────────\n\n/**\n * Creates a typed client accessor for a module's public configs, queries, and mutations.\n *\n * Use `import type` to reference the module so no server code is bundled on the client.\n * Arg and return types for queries and mutations are inferred automatically from the\n * server-side handler signatures.\n *\n * @param moduleName - The module's name as passed to `new Module(name, ...)`.\n *\n * @example\n * ```ts\n * // src/client/payments.ts\n * import type paymentsModule from '../server/payments';\n * import { createClientModule } from 'modelence/client';\n *\n * export const payments = createClientModule<typeof paymentsModule>('payments');\n * ```\n *\n * ```ts\n * // src/components/Checkout.tsx\n * import { useQuery, useMutation } from '@tanstack/react-query';\n * import { payments } from '../client/payments';\n *\n * // Typed config — public keys only, private and secret keys excluded:\n * const currency = payments.getConfig('currency'); // string | undefined\n *\n * // Typed query — pass directly to useQuery:\n * const { data: products } = useQuery(payments.query('getProducts', { page: 1 }));\n *\n * // Typed mutation — pass directly to useMutation:\n * const { mutate: charge } = useMutation(payments.mutation('charge'));\n * charge({ amount: 100 }); // args typed from handler signature\n * ```\n */\nexport function createClientModule<TModule extends AnyModule>(moduleName: string) {\n return {\n getConfig<K extends keyof PublicKeyOf<TModule['configSchema']> & string>(\n key: K\n ): PublicKeyOf<TModule['configSchema']>[K] | undefined {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return _getClientConfig(`${moduleName}.${key}`) as any;\n },\n\n query<K extends keyof TModule['queries'] & string>(\n name: K,\n ...rest: {} extends ExtractArgs<TModule['queries'][K]>\n ? [args?: ExtractArgs<TModule['queries'][K]>]\n : [args: ExtractArgs<TModule['queries'][K]>]\n ) {\n const args = (rest[0] ?? {}) as ExtractArgs<TModule['queries'][K]>;\n return {\n queryKey: [moduleName, name, args] as const,\n queryFn: (): Promise<ExtractResult<TModule['queries'][K]>> =>\n callMethod<ExtractResult<TModule['queries'][K]>>(\n `${moduleName}.${name}`,\n args as MethodArgs\n ),\n };\n },\n\n mutation<K extends keyof TModule['mutations'] & string>(name: K) {\n return {\n mutationFn: (\n args: ExtractArgs<TModule['mutations'][K]>\n ): Promise<ExtractResult<TModule['mutations'][K]>> =>\n callMethod<ExtractResult<TModule['mutations'][K]>>(\n `${moduleName}.${name}`,\n args as MethodArgs\n ),\n };\n },\n\n /**\n * Returns options for `useInfiniteQuery`. The `getArgs` callback receives the\n * current `pageParam` and returns the args to pass to the query handler.\n * Spread the result into `useInfiniteQuery` alongside `getNextPageParam`.\n *\n * Annotate the `pageParam` type in the callback so TypeScript can infer the\n * page param type — no manual generic needed on `useInfiniteQuery`.\n */\n infiniteQuery<K extends keyof TModule['queries'] & string, TPageParam = unknown>(\n name: K,\n getArgs: (pageParam: TPageParam | undefined) => ExtractArgs<TModule['queries'][K]>\n ) {\n return {\n queryKey: [moduleName, name, 'infinite', getArgs(undefined)] as const,\n // Included so TanStack infers TPageParam from the callback type, not from a bare `undefined`.\n initialPageParam: undefined as TPageParam | undefined,\n queryFn: ({\n pageParam,\n }: {\n pageParam: TPageParam | undefined;\n }): Promise<ExtractResult<TModule['queries'][K]>> =>\n callMethod<ExtractResult<TModule['queries'][K]>>(\n `${moduleName}.${name}`,\n getArgs(pageParam) as MethodArgs\n ),\n };\n },\n };\n}\n","import type systemModule from './index';\nimport { createClientModule } from '../client/module';\n\nexport const systemConfig = createClientModule<typeof systemModule>('_system');\n","import { getWebsocketClientProvider } from './client';\n\nexport class ClientChannel<T = unknown> {\n public readonly category: string;\n private readonly onMessage: (data: T) => void;\n\n constructor(category: string, onMessage: (data: T) => void) {\n this.category = category;\n this.onMessage = onMessage;\n }\n\n init() {\n getWebsocketClientProvider()?.on({\n category: this.category,\n listener: this.onMessage,\n });\n }\n\n joinChannel(id: string) {\n getWebsocketClientProvider()?.joinChannel({\n category: this.category,\n id,\n });\n }\n\n leaveChannel(id: string) {\n getWebsocketClientProvider()?.leaveChannel({\n category: this.category,\n id,\n });\n }\n}\n","import { callMethod } from '../client/method';\nimport type { FileVisibility, GetUploadUrlResult } from './types';\n\ntype UploadFileParams = {\n filePath: string;\n contentType: string;\n visibility: FileVisibility;\n};\n\ntype UploadFileResult = {\n filePath: string;\n};\n\nexport async function uploadFile(\n file: File | Blob,\n { filePath, contentType, visibility }: UploadFileParams\n): Promise<UploadFileResult> {\n const {\n url,\n fields,\n filePath: resolvedFilePath,\n } = await callMethod<GetUploadUrlResult>('_system.files.getUploadUrl', {\n filePath,\n contentType,\n visibility,\n });\n\n const formData = new FormData();\n for (const [key, value] of Object.entries(fields)) {\n formData.append(key, value);\n }\n formData.append('file', file);\n\n const uploadResponse = await fetch(url, {\n method: 'POST',\n body: formData,\n });\n\n if (!uploadResponse.ok) {\n throw new Error(`Failed to upload file: HTTP status: ${uploadResponse.status}`);\n }\n\n return { filePath: resolvedFilePath };\n}\n\nexport async function deleteFile(filePath: string): Promise<void> {\n await callMethod('_system.files.deleteFile', { filePath });\n}\n\nexport async function downloadFile(filePath: string): Promise<{ downloadUrl: string }> {\n return callMethod('_system.files.downloadFile', { filePath });\n}\n\nexport async function getFileUrl(filePath: string): Promise<{ url: string }> {\n return callMethod('_system.files.getFileUrl', { filePath });\n}\n","import React from 'react';\n\nimport { AppProvider as OriginalAppProvider } from './client/AppProvider';\n\nexport { getConfig } from './config/client';\nexport { createClientModule } from './client/module';\nexport type { ValueType } from './config/types';\nexport { systemConfig } from './system/client';\n\nexport const AppProvider =\n 'useClient' in React\n ? // @ts-ignore: React.useClient only exists in Next.js\n React.useClient(OriginalAppProvider)\n : OriginalAppProvider;\n\nexport { renderApp } from './client/renderApp';\nexport { ModelenceQueryProvider } from './client/queryProvider';\nexport {\n modelenceQuery,\n modelenceLiveQuery,\n modelenceMutation,\n createQueryKey,\n connectModelenceQueryClient,\n disconnectModelenceQueryClient,\n ModelenceQueryClient,\n type ModelenceQueryKey,\n} from './client/query';\nexport { callMethod, MethodError, type MethodArgs, type CallMethodOptions } from './client/method';\nexport { useSession } from './client/session';\nexport {\n signupWithPassword,\n loginWithPassword,\n verifyEmail,\n updateProfile,\n resendEmailVerification,\n logout,\n sendResetPasswordToken,\n resetPassword,\n linkOAuthProvider,\n unlinkOAuthProvider,\n type UserInfo,\n} from './auth/client';\nexport {\n getWebsocketClientProvider,\n setWebsocketClientProvider,\n startWebsockets,\n subscribeLiveQuery,\n} from './websocket/client';\nexport { ClientChannel } from './websocket/clientChannel';\nexport { getLocalStorageSession } from './client/localStorage';\nexport { uploadFile, deleteFile, downloadFile, getFileUrl } from './files/client';\n","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { AppProvider } from '../client';\nimport { setErrorHandler, ErrorHandler } from './errorHandler';\nimport { hydrateSession, startSessionHeartbeat, type SessionInitPayload } from './session';\nimport { ModelenceQueryProvider } from './queryProvider';\n\nconst SSR_STATE_SCRIPT_ID = '__MODELENCE_STATE__';\n\ntype SsrState = {\n session?: SessionInitPayload;\n};\n\nfunction hasSsrMarker(): boolean {\n if (typeof document === 'undefined') {\n return false;\n }\n return document.getElementById(SSR_STATE_SCRIPT_ID) !== null;\n}\n\nfunction readSsrState(): SsrState | null {\n if (typeof document === 'undefined') {\n return null;\n }\n\n const node = document.getElementById(SSR_STATE_SCRIPT_ID);\n if (!node) {\n return null;\n }\n\n try {\n return JSON.parse(node.textContent ?? '') as SsrState;\n } catch (e) {\n // The script tag still signals that SSR ran — the caller must hydrate,\n // not createRoot, even if the payload is unreadable. Session bootstrap\n // is the only thing we lose here.\n console.error('Modelence: failed to parse SSR state', e);\n return null;\n }\n}\n\nexport type SsrRouter = (props: {\n children: React.ReactNode;\n location?: string;\n}) => React.ReactElement;\n\nexport interface RenderAppOptions {\n loadingElement: React.ReactNode;\n routesElement: React.ReactNode;\n favicon?: string;\n errorHandler?: ErrorHandler;\n router?: SsrRouter;\n}\n\n// Shared on globalThis because Vite's ssrLoadModule loads the user's entry\n// in a separate module graph from the framework runtime.\nconst SNAPSHOT_KEY = '__modelence_ssr_snapshot__';\n\ntype GlobalWithSnapshot = typeof globalThis & {\n [SNAPSHOT_KEY]?: RenderAppOptions | null;\n};\n\nfunction setSnapshot(snapshot: RenderAppOptions | null) {\n (globalThis as GlobalWithSnapshot)[SNAPSHOT_KEY] = snapshot;\n}\n\n/** @internal Used by the SSR runtime after evaluating the user's entry. */\nexport function _getSsrSnapshot(): RenderAppOptions | null {\n return (globalThis as GlobalWithSnapshot)[SNAPSHOT_KEY] ?? null;\n}\n\nexport function renderApp(options: RenderAppOptions) {\n if (typeof window === 'undefined') {\n setSnapshot(options);\n return;\n }\n\n const { loadingElement, routesElement, favicon, errorHandler, router } = options;\n\n if (errorHandler) {\n setErrorHandler(errorHandler);\n }\n\n window.addEventListener('unload', () => {\n // Empty 'unload' handler prevents bfcache in most browsers.\n });\n\n // ORDER MATTERS: hydrate session BEFORE building the React tree / calling\n // hydrateRoot, so `isSessionInitialized()` is true on the first render and\n // AppProvider's initial `isLoading` matches the server-rendered output.\n //\n // Hydration mode is keyed off the SSR marker script's *presence*, not off\n // the parsed payload — a parse failure would still leave server-rendered\n // markup in the DOM, and calling createRoot on it would wipe it out and\n // trigger a flash plus hydration mismatch warnings.\n const isHydrating = hasSsrMarker();\n const ssrState = readSsrState();\n if (ssrState?.session) {\n hydrateSession(ssrState.session);\n startSessionHeartbeat();\n }\n\n const container = document.getElementById('root')!;\n const routedTree = router ? router({ children: routesElement }) : routesElement;\n const tree = (\n <React.StrictMode>\n <AppProvider loadingElement={loadingElement}>\n <ModelenceQueryProvider>{routedTree}</ModelenceQueryProvider>\n </AppProvider>\n </React.StrictMode>\n );\n\n if (isHydrating) {\n ReactDOM.hydrateRoot(container, tree);\n } else {\n ReactDOM.createRoot(container).render(tree);\n }\n\n if (favicon) {\n const link = document.querySelector(\"link[rel~='icon']\") as HTMLLinkElement;\n if (!link) {\n const newLink = document.createElement('link');\n newLink.rel = 'icon';\n newLink.href = favicon;\n document.head.appendChild(newLink);\n } else {\n link.href = favicon;\n }\n }\n}\n"]}
|
package/dist/chunk-X22U5KA3.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var s="module",i="modelence",r="0.18.0-dev.5",c="The Node.js Framework for Real-Time MongoDB Apps",n="dist/index.js",o="dist/global.d.ts",p={".":"./dist/index.js","./client":"./dist/client.js","./server":"./dist/server.js","./telemetry":"./dist/telemetry.js","./mongodb":"./dist/mongo.js","./types":{types:"./dist/types.d.ts",default:"./dist/types.js"}},d=["dist","dist/bin"],a={modelence:"./dist/bin/modelence.js"},l={build:"tsup",dev:"tsup --watch",format:'prettier --write "src/**/*.{ts,tsx,js,jsx,json,css,md}"',"format:check":'prettier --check "src/**/*.{ts,tsx,js,jsx,json,css,md}"',lint:"eslint src --ext .ts,.tsx --fix","lint:check":"eslint src --ext .ts,.tsx",prepublishOnly:"npm run build",bench:"tsx src/bench/index.ts",test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage",postversion:"git push && git push --tags",prepare:"cd ../.. && git config core.hooksPath .husky"},m={type:"git",url:"git+https://github.com/modelence/modelence.git"},y="Modelence",u="SEE LICENSE IN LICENSE",g={url:"https://github.com/modelence/modelence/issues"},h="https://modelence.com",v={"@tanstack/react-query":"^5.100.7","@types/archiver":"^6.0.3","@types/bcrypt":"^6.0.0","@types/cookie-parser":"^1.4.9","@types/express":"^5.0.0","@types/fs-extra":"^11.0.4","@types/node":"^22.5.1","@types/react":"^19.0.0","@types/react-dom":"^19.0.1","@types/socket.io":"^3.0.1","@typescript-eslint/eslint-plugin":"^8.17.0","@typescript-eslint/parser":"^8.17.0",eslint:"^9.37.0",husky:"^9.1.7","lint-staged":"^16.2.7",prettier:"^3.6.2",react:"^19.0.0","react-dom":"^19.0.0","ts-node":"^10.9.2",vitest:"^2.1.8","@vitest/coverage-v8":"^2.1.8","vite-tsconfig-paths":"^5.1.4"},x={"@socket.io/mongo-adapter":"^0.4.0","@vitejs/plugin-react":"^4.3.4",archiver:"^7.0.1",bcrypt:"^6.0.0",commander:"^12.0.0","cookie-parser":"^1.4.7",dotenv:"^16.4.5","elastic-apm-node":"^4.15.0",express:"^4.21.0","fs-extra":"^11.2.0",jiti:"^2.4.2",mongodb:"^6.8.1",open:"^10.1.0","socket.io":"^4.8.1","socket.io-client":"^4.8.1",tsup:"^8.3.6",tsx:"^4.19.3",typescript:"^5.7.2",vite:"^6.0.3","vite-plugin-eslint":"^1.8.1",winston:"^3.15.0","winston-elasticsearch":"^0.19.0",zod:"^3.23.8",zustand:"^5.0.2"},j={"@tanstack/react-query":">=5.0.0",react:">=18.0.0","react-dom":">=18.0.0"},b={type:s,name:i,version:r,description:c,main:n,types:o,exports:p,files:d,bin:a,scripts:l,"lint-staged":{"src/**/*.{ts,tsx,js,jsx,json,css,md}":"prettier --write"},repository:m,author:y,license:u,bugs:g,homepage:h,devDependencies:v,dependencies:x,peerDependencies:j};
|
|
2
|
-
export{s as a,i as b,r as c,c as d,n as e,o as f,p as g,d as h,a as i,l as j,m as k,y as l,u as m,g as n,h as o,v as p,x as q,j as r,b as s};//# sourceMappingURL=chunk-X22U5KA3.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-X22U5KA3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"names":["type","name","version","description","main","types","exports","files","bin","scripts","repository","author","license","bugs","homepage","devDependencies","dependencies","peerDependencies","package_default"],"mappings":"AACE,IAAAA,CAAAA,CAAQ,QAAA,CACRC,CAAAA,CAAQ,WAAA,CACRC,CAAAA,CAAW,cAAA,CACXC,CAAAA,CAAe,kDAAA,CACfC,CAAAA,CAAQ,eAAA,CACRC,CAAAA,CAAS,kBAAA,CACTC,CAAAA,CAAW,CACT,GAAA,CAAK,iBAAA,CACL,UAAA,CAAY,kBAAA,CACZ,UAAA,CAAY,kBAAA,CACZ,aAAA,CAAe,qBAAA,CACf,WAAA,CAAa,iBAAA,CACb,SAAA,CAAW,CACT,KAAA,CAAS,mBAAA,CACT,QAAW,iBACb,CACF,CAAA,CACAC,CAAAA,CAAS,CACP,MAAA,CACA,UACF,CAAA,CACAC,CAAAA,CAAO,CACL,SAAA,CAAa,yBACf,CAAA,CACAC,CAAAA,CAAW,CACT,KAAA,CAAS,MAAA,CACT,GAAA,CAAO,cAAA,CACP,MAAA,CAAU,yDAAA,CACV,cAAA,CAAgB,yDAAA,CAChB,IAAA,CAAQ,iCAAA,CACR,YAAA,CAAc,2BAAA,CACd,cAAA,CAAkB,eAAA,CAClB,MAAS,wBAAA,CACT,IAAA,CAAQ,YAAA,CACR,YAAA,CAAc,QAAA,CACd,eAAA,CAAiB,uBAAA,CACjB,WAAA,CAAe,6BAAA,CACf,OAAA,CAAW,8CACb,CAAA,CAI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AAA,CAAsB,QAAA,CACtB,OAAA,CAAW,UACX,uBAAA,CAAyB,SAAA,CACzB,GAAA,CAAO,SAAA,CACP,OAAA,CAAW,QACb,CAAA,CACAC,CAAAA,CAAoB,CAClB,uBAAA,CAAyB,SAAA,CACzB,KAAA,CAAS,UAAA,CACT,WAAA,CAAa,UACf,CAAA,CA3GFC,CAAAA,CAAA,CACE,IAAA,CAAAlB,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CAWA,KAAA,CAAAC,CAAAA,CAIA,GAAA,CAAAC,CAAAA,CAGA,OAAA,CAAAC,CAAAA,CAeA,aAAA,CAAe,CACb,sCAAA,CAAwC,kBAC1C,CAAA,CACA,UAAA,CAAAC,CAAAA,CAIA,MAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CAGA,QAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CAwBA,YAAA,CAAAC,CAAAA,CA0BA,gBAAA,CAAAC,CAKF","file":"chunk-X22U5KA3.js","sourcesContent":["{\n \"type\": \"module\",\n \"name\": \"modelence\",\n \"version\": \"0.18.0-dev.5\",\n \"description\": \"The Node.js Framework for Real-Time MongoDB Apps\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/global.d.ts\",\n \"exports\": {\n \".\": \"./dist/index.js\",\n \"./client\": \"./dist/client.js\",\n \"./server\": \"./dist/server.js\",\n \"./telemetry\": \"./dist/telemetry.js\",\n \"./mongodb\": \"./dist/mongo.js\",\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"default\": \"./dist/types.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"dist/bin\"\n ],\n \"bin\": {\n \"modelence\": \"./dist/bin/modelence.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"format\": \"prettier --write \\\"src/**/*.{ts,tsx,js,jsx,json,css,md}\\\"\",\n \"format:check\": \"prettier --check \\\"src/**/*.{ts,tsx,js,jsx,json,css,md}\\\"\",\n \"lint\": \"eslint src --ext .ts,.tsx --fix\",\n \"lint:check\": \"eslint src --ext .ts,.tsx\",\n \"prepublishOnly\": \"npm run build\",\n \"bench\": \"tsx src/bench/index.ts\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"postversion\": \"git push && git push --tags\",\n \"prepare\": \"cd ../.. && git config core.hooksPath .husky\"\n },\n \"lint-staged\": {\n \"src/**/*.{ts,tsx,js,jsx,json,css,md}\": \"prettier --write\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/modelence/modelence.git\"\n },\n \"author\": \"Modelence\",\n \"license\": \"SEE LICENSE IN LICENSE\",\n \"bugs\": {\n \"url\": \"https://github.com/modelence/modelence/issues\"\n },\n \"homepage\": \"https://modelence.com\",\n \"devDependencies\": {\n \"@tanstack/react-query\": \"^5.100.7\",\n \"@types/archiver\": \"^6.0.3\",\n \"@types/bcrypt\": \"^6.0.0\",\n \"@types/cookie-parser\": \"^1.4.9\",\n \"@types/express\": \"^5.0.0\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/node\": \"^22.5.1\",\n \"@types/react\": \"^19.0.0\",\n \"@types/react-dom\": \"^19.0.1\",\n \"@types/socket.io\": \"^3.0.1\",\n \"@typescript-eslint/eslint-plugin\": \"^8.17.0\",\n \"@typescript-eslint/parser\": \"^8.17.0\",\n \"eslint\": \"^9.37.0\",\n \"husky\": \"^9.1.7\",\n \"lint-staged\": \"^16.2.7\",\n \"prettier\": \"^3.6.2\",\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"ts-node\": \"^10.9.2\",\n \"vitest\": \"^2.1.8\",\n \"@vitest/coverage-v8\": \"^2.1.8\",\n \"vite-tsconfig-paths\": \"^5.1.4\"\n },\n \"dependencies\": {\n \"@socket.io/mongo-adapter\": \"^0.4.0\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"archiver\": \"^7.0.1\",\n \"bcrypt\": \"^6.0.0\",\n \"commander\": \"^12.0.0\",\n \"cookie-parser\": \"^1.4.7\",\n \"dotenv\": \"^16.4.5\",\n \"elastic-apm-node\": \"^4.15.0\",\n \"express\": \"^4.21.0\",\n \"fs-extra\": \"^11.2.0\",\n \"jiti\": \"^2.4.2\",\n \"mongodb\": \"^6.8.1\",\n \"open\": \"^10.1.0\",\n \"socket.io\": \"^4.8.1\",\n \"socket.io-client\": \"^4.8.1\",\n \"tsup\": \"^8.3.6\",\n \"tsx\": \"^4.19.3\",\n \"typescript\": \"^5.7.2\",\n \"vite\": \"^6.0.3\",\n \"vite-plugin-eslint\": \"^1.8.1\",\n \"winston\": \"^3.15.0\",\n \"winston-elasticsearch\": \"^0.19.0\",\n \"zod\": \"^3.23.8\",\n \"zustand\": \"^5.0.2\"\n },\n \"peerDependencies\": {\n \"@tanstack/react-query\": \">=5.0.0\",\n \"react\": \">=18.0.0\",\n \"react-dom\": \">=18.0.0\"\n }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import a from'path';import u from'fs';var l=/\.(css|scss|sass|less|styl|stylus|pcss|postcss)(\?|$)/,p=Object.freeze({hrefs:[],source:"dev"});function y(s,e){let t=s.moduleGraph.getModuleById(d(s,e));if(!t)return p;let n=new Set,o=[],i=new Set,c=r=>{if(!n.has(r)){n.add(r),r.url&&l.test(r.url)&&!i.has(r.url)&&(i.add(r.url),o.push(r.url));for(let f of r.importedModules)c(f);for(let f of r.ssrImportedModules)c(f);}};return c(t),{hrefs:o,source:"dev"}}function d(s,e){let t=s.config.root;return a.join(t,e).replace(/\\/g,"/")}function A(s){let e=a.resolve(process.cwd(),s,".vite","ssr-manifest.json");if(!u.existsSync(e))return {hrefs:[],source:"prod"};let t;try{t=JSON.parse(u.readFileSync(e,"utf-8"));}catch(o){return console.warn("Modelence SSR: failed to parse ssr-manifest.json",o),{hrefs:[],source:"prod"}}let n=new Set;for(let o of Object.values(t))if(Array.isArray(o))for(let i of o)typeof i=="string"&&l.test(i)&&n.add(i);return {hrefs:Array.from(n),source:"prod"}}function v(s){return s.hrefs.length===0?"":s.hrefs.map(e=>`<link rel="stylesheet" href="${h(e)}">`).join("")}function C(s){return s.hrefs.map(e=>`<${e}>; rel=preload; as=style`)}function h(s){return s.replace(/&/g,"&").replace(/"/g,""")}export{C as buildEarlyHintsLink,y as collectDevCssAssets,A as loadProdCssAssets,v as renderStylesheetLinks};//# sourceMappingURL=collectCss-4V7I3QV3.js.map
|
|
2
|
-
//# sourceMappingURL=collectCss-4V7I3QV3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ssr/collectCss.ts"],"names":["CSS_EXTENSION_REGEX","EMPTY_ASSETS","collectDevCssAssets","viteServer","entryVirtualPath","ssrModule","resolveEntryId","seen","hrefs","hrefSet","walk","mod","imported","root","path","loadProdCssAssets","clientBuildDir","manifestPath","fs","manifest","error","assets","asset","renderStylesheetLinks","href","escapeAttribute","buildEarlyHintsLink","value"],"mappings":"sCAIA,IAAMA,CAAAA,CAAsB,uDAAA,CAatBC,CAAAA,CAA0B,MAAA,CAAO,MAAA,CAAO,CAAE,MAAO,EAAC,CAAG,MAAA,CAAQ,KAAM,CAAC,CAAA,CAQnE,SAASC,CAAAA,CACdC,EACAC,CAAAA,CACW,CACX,IAAMC,CAAAA,CAAYF,CAAAA,CAAW,WAAA,CAAY,aAAA,CACvCG,CAAAA,CAAeH,EAAYC,CAAgB,CAC7C,CAAA,CACA,GAAI,CAACC,CAAAA,CACH,OAAOJ,CAAAA,CAGT,IAAMM,CAAAA,CAAO,IAAI,GAAA,CACXC,CAAAA,CAAkB,EAAC,CACnBC,CAAAA,CAAU,IAAI,IAEdC,CAAAA,CAAQC,CAAAA,EAAoB,CAChC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\nimport type { ViteDevServer, ModuleNode } from 'vite';\n\nconst CSS_EXTENSION_REGEX = /\\.(css|scss|sass|less|styl|stylus|pcss|postcss)(\\?|$)/;\n\nexport type CssAssetSource = 'dev' | 'prod';\n\nexport interface CssAssets {\n /**\n * Public URLs suitable for emitting as <link rel=\"stylesheet\">. In dev these\n * point at Vite's transform endpoint; in prod they point at the built asset.\n */\n hrefs: string[];\n source: CssAssetSource;\n}\n\nconst EMPTY_ASSETS: CssAssets = Object.freeze({ hrefs: [], source: 'dev' }) as CssAssets;\n\n/**\n * Walk the Vite dev module graph from the SSR entry, collecting every CSS\n * module pulled in by the rendered tree. Returns URLs that the browser can\n * request directly so the dev HTML can ship <link rel=\"stylesheet\"> tags\n * before the client JS runs (kills FOUC in dev).\n */\nexport function collectDevCssAssets(\n viteServer: ViteDevServer,\n entryVirtualPath: string\n): CssAssets {\n const ssrModule = viteServer.moduleGraph.getModuleById(\n resolveEntryId(viteServer, entryVirtualPath)\n );\n if (!ssrModule) {\n return EMPTY_ASSETS;\n }\n\n const seen = new Set<ModuleNode>();\n const hrefs: string[] = [];\n const hrefSet = new Set<string>();\n\n const walk = (mod: ModuleNode) => {\n if (seen.has(mod)) {\n return;\n }\n seen.add(mod);\n\n if (mod.url && CSS_EXTENSION_REGEX.test(mod.url) && !hrefSet.has(mod.url)) {\n hrefSet.add(mod.url);\n hrefs.push(mod.url);\n }\n\n for (const imported of mod.importedModules) {\n walk(imported);\n }\n for (const imported of mod.ssrImportedModules) {\n walk(imported);\n }\n };\n\n walk(ssrModule);\n\n return { hrefs, source: 'dev' };\n}\n\nfunction resolveEntryId(viteServer: ViteDevServer, entryVirtualPath: string): string {\n const root = viteServer.config.root;\n // `entryVirtualPath` is rooted at Vite's `root` (e.g. '/index.tsx' under\n // 'src/client'). The module graph keys modules by absolute file id.\n const absolutePath = path.join(root, entryVirtualPath).replace(/\\\\/g, '/');\n return absolutePath;\n}\n\ntype SsrManifest = Record<string, string[]>;\n\n/**\n * Read the production SSR manifest produced by `vite build --ssr`. The manifest\n * maps every JS module id to the CSS/asset URLs the client must load to render\n * its output. We flatten the unique CSS entries — the SSR render only touched a\n * subset of routes per request, but at framework boot we don't yet have a\n * per-request module list, so we emit the full set. This matches the behavior\n * of a non-streaming build.\n */\nexport function loadProdCssAssets(clientBuildDir: string): CssAssets {\n const manifestPath = path.resolve(process.cwd(), clientBuildDir, '.vite', 'ssr-manifest.json');\n\n if (!fs.existsSync(manifestPath)) {\n return { hrefs: [], source: 'prod' };\n }\n\n let manifest: SsrManifest;\n try {\n manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) as SsrManifest;\n } catch (error) {\n console.warn('Modelence SSR: failed to parse ssr-manifest.json', error);\n return { hrefs: [], source: 'prod' };\n }\n\n const hrefSet = new Set<string>();\n for (const assets of Object.values(manifest)) {\n if (!Array.isArray(assets)) {\n continue;\n }\n for (const asset of assets) {\n if (typeof asset === 'string' && CSS_EXTENSION_REGEX.test(asset)) {\n hrefSet.add(asset);\n }\n }\n }\n\n return { hrefs: Array.from(hrefSet), source: 'prod' };\n}\n\n/**\n * Render the CSS asset URLs as HTML <link rel=\"stylesheet\"> tags. React 19\n * users who render <link precedence=...> inside components get React Float's\n * dedup + ordering automatically; this helper exists for the framework-level\n * tags injected into the template <head> before the React shell.\n */\nexport function renderStylesheetLinks(assets: CssAssets): string {\n if (assets.hrefs.length === 0) {\n return '';\n }\n return assets.hrefs\n .map((href) => `<link rel=\"stylesheet\" href=\"${escapeAttribute(href)}\">`)\n .join('');\n}\n\n/**\n * Build a Link header value for HTTP 103 Early Hints. The browser starts the\n * stylesheet fetch as soon as it sees this response, before the SSR render\n * has even begun.\n */\nexport function buildEarlyHintsLink(assets: CssAssets): string[] {\n return assets.hrefs.map((href) => `<${href}>; rel=preload; as=style`);\n}\n\nfunction escapeAttribute(value: string): string {\n return value.replace(/&/g, '&').replace(/\"/g, '"');\n}\n"]}
|
package/dist/render-DLVPZOA6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a,b,c}from'./chunk-DRDY7GOT.js';import'./chunk-GZI4X3CV.js';import'./chunk-3SPXJEOR.js';import {a as a$1,m}from'./chunk-SABBG2XG.js';import {x,r,y}from'./chunk-R6OOTUGO.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 J=()=>{let r=c();return r?y(r.session.user):null},M=r=>{let o=c();if(o)return o.session.configs[r]?.value};function D(){x(J),r(M);}async function X(r){let{callContext:o,loadingElement:C,routesElement:S,router:u,location:x,onShellReady:E,onError:b$1}=r;D();let i=await a("_system.session.init",{},o),n=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),O=u?u({children:S,location:x}):S,Q=jsx(a$1,{loadingElement:C,children:jsx(m,{client:n,children:O})}),l=null;await new Promise((s,d)=>{b({callContext:o,queryClient:n,session:{user:i.user,configs:i.configs??{}}},()=>{let e=renderToPipeableStream(Q,{onShellReady(){l=e,E?.(),s(e);},onShellError(t){d(t);},onError(t){b$1?.(t);}});return e});});let a$2=null,_=s=>new Promise((d,e)=>{if(!l){e(new Error("SSR stream was not initialized"));return}let t=new Writable({write(m,c,I){s.write(m,N=>I(N??void 0));},final(m){try{let c=dehydrate(n);a$2=JSON.stringify(c);}finally{n.clear();}m(),d();}});t.on("error",e),s.on("error",e),l.pipe(t);});return {sessionState:JSON.stringify({session:i}),pipe:_,getQueryState:()=>{if(a$2===null)throw new Error("getQueryState() called before stream finished");return a$2}}}export{X as renderSsrTreeStream};//# sourceMappingURL=render-DLVPZOA6.js.map
|
|
2
|
-
//# sourceMappingURL=render-DLVPZOA6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ssr/render.tsx"],"names":["sessionResolver","ctx","getSsrContext","_parseSessionUser","configResolver","key","ensureSsrResolversInstalled","_setSsrSessionResolver","_setSsrConfigResolver","renderSsrTreeStream","options","callContext","loadingElement","routesElement","router","location","onShellReady","onError","sessionPayload","callInProcessMethod","queryClient","QueryClient","routedTree","tree","jsx","AppProvider","ModelenceQueryProvider","streamRef","resolve","reject","runWithSsrContext","stream","renderToPipeableStream","error","queryStateJson","pipe","destination","passthrough","Writable","chunk","_encoding","callback","err","dehydratedState","dehydrate"],"mappings":"+ZAkBA,IAAMA,CAAAA,CAAkB,IAAM,CAC5B,IAAMC,CAAAA,CAAMC,CAAAA,EAAc,CAC1B,OAAKD,CAAAA,CAGEE,CAAAA,CAAkBF,CAAAA,CAAI,OAAA,CAAQ,IAAI,CAAA,CAFhC,IAGX,CAAA,CAEMG,CAAAA,CAAkBC,GAAmB,CACzC,IAAMJ,CAAAA,CAAMC,CAAAA,GACZ,GAAKD,CAAAA,CAGL,OAAOA,CAAAA,CAAI,QAAQ,OAAA,CAAQI,CAAG,CAAA,EAAG,KACnC,EAEA,SAASC,CAAAA,EAA8B,CAGrCC,CAAAA,CAAuBP,CAAe,CAAA,CACtCQ,CAAAA,CAAsBJ,CAAc,EACtC,CA+CA,eAAsBK,CAAAA,CAAoBC,CAAAA,CAAqD,CAC7F,GAAM,CAAE,WAAA,CAAAC,CAAAA,CAAa,cAAA,CAAAC,EAAgB,aAAA,CAAAC,CAAAA,CAAe,MAAA,CAAAC,CAAAA,CAAQ,SAAAC,CAAAA,CAAU,YAAA,CAAAC,CAAAA,CAAc,OAAA,CAAAC,GAAQ,CAAA,CAC1FP,CAAAA,CAEFJ,CAAAA,EAA4B,CAE5B,IAAMY,CAAAA,CAAiB,MAAMC,CAAAA,CAC3B,sBAAA,CACA,EAAC,CACDR,CACF,CAAA,CAEMS,CAAAA,CAAc,IAAIC,WAAAA,CAAY,CAClC,cAAA,CAAgB,CACd,QAAS,CACP,KAAA,CAAO,KAAA,CACP,MAAA,CAAQ,CACV,CACF,CACF,CAAC,CAAA,CAEKC,EAAaR,CAAAA,CAASA,CAAAA,CAAO,CAAE,Q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QG,CAAAA,EAAQD,EAASC,CAAAA,EAAO,MAAS,CAAC,EAC9D,EACA,KAAA,CAAMD,CAAAA,CAAU,CAId,GAAI,CACF,IAAME,CAAAA,CAAmCC,SAAAA,CAAUxB,CAAW,EAC9Dc,GAAAA,CAAiB,IAAA,CAAK,SAAA,CAAUS,CAAe,EACjD,CAAA,OAAE,CACAvB,CAAAA,CAAY,KAAA,GACd,CACAqB,CAAAA,EAAS,CACTb,CAAAA,GACF,CACF,CAAC,CAAA,CAEDS,CAAAA,CAAY,GAAG,OAAA,CAASR,CAAM,CAAA,CAC9BO,CAAAA,CAAY,GAAG,OAAA,CAASP,CAAM,CAAA,CAE9BF,CAAAA,CAAU,KAAKU,CAAW,EAC5B,CAAC,CAAA,CAGH,OAAO,CACL,YAAA,CAAc,IAAA,CAAK,SAAA,CAAU,CAAE,OAAA,CAASnB,CAAe,CAAC,CAAA,CACxD,KAAAiB,CAAAA,CACA,aAAA,CAAe,IAAM,CACnB,GAAID,GAAAA,GAAmB,IAAA,CACrB,MAAM,IAAI,MAAM,+CAA+C,CAAA,CAEjE,OAAOA,GACT,CACF,CACF","file":"render-DLVPZOA6.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 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\n/**\n * Renders the SSR tree as a stream. Returns a handle that lets the caller\n * flush a template prelude (head + opening shell) as soon as the React shell\n * is ready, pipe the React HTML stream into the response, then append the\n * 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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"renderApp-ZQEZU2MT.js"}
|
package/dist/server-Z77W2F6P.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{g as getCallContext,f as startServer}from'./chunk-3XTC4WGD.js';import'./chunk-X22U5KA3.js';import'./chunk-GZI4X3CV.js';import'./chunk-C3UESBRX.js';import'./chunk-3SPXJEOR.js';import'./chunk-FL573BOT.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server-Z77W2F6P.js.map
|
|
2
|
-
//# sourceMappingURL=server-Z77W2F6P.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"server-Z77W2F6P.js"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {c as c$1,a}from'./chunk-DRDY7GOT.js';import'./chunk-GZI4X3CV.js';import'./chunk-3SPXJEOR.js';import {p}from'./chunk-R6OOTUGO.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';function c(){return p(async(t,s)=>{let r=c$1();if(!r)throw new Error(`callMethod('${t}') was invoked during SSR but no request context is active. Wrap the render in runWithSsrContext().`);return a(t,s,r.callContext)})}export{c as installSsrCallMethodTransport};//# sourceMappingURL=transport-ZSBKZIXH.js.map
|
|
2
|
-
//# sourceMappingURL=transport-ZSBKZIXH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ssr/transport.ts"],"names":["installSsrCallMethodTransport","_setCallMethodTransport","methodName","args","ssrCtx","getSsrContext","callInProcessMethod"],"mappings":"iMAKO,SAASA,CAAAA,EAA4C,CAC1D,OAAOC,CAAAA,CAAwB,MAAUC,CAAAA,CAAoBC,CAAAA,GAAqB,CAChF,IAAMC,CAAAA,CAASC,GAAAA,EAAc,CAC7B,GAAI,CAACD,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,CAAA,YAAA,EAAeF,CAAU,CAAA,mGAAA,CAE3B,CAAA,CAGF,OAAOI,CAAAA,CAAuBJ,CAAAA,CAAYC,CAAAA,CAAMC,CAAAA,CAAO,WAAW,CACpE,CAAC,CACH","file":"transport-ZSBKZIXH.js","sourcesContent":["import { _setCallMethodTransport, type MethodArgs } from '../client/method';\nimport { callInProcessMethod } from './callInProcess';\nimport { getSsrContext } from './context';\n\n/** Routes `callMethod` through `runMethod` in-process during SSR. */\nexport function installSsrCallMethodTransport(): () => void {\n return _setCallMethodTransport(async <T>(methodName: string, args: MethodArgs) => {\n const ssrCtx = getSsrContext();\n if (!ssrCtx) {\n throw new Error(\n `callMethod('${methodName}') was invoked during SSR but no request context is active. ` +\n `Wrap the render in runWithSsrContext().`\n );\n }\n\n return callInProcessMethod<T>(methodName, args, ssrCtx.callContext);\n });\n}\n"]}
|