modelence 0.24.0 → 0.24.1

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.
Files changed (40) hide show
  1. package/dist/{chunk-V3EQDOEU.js → chunk-3RGPZ5RE.js} +3 -3
  2. package/dist/{chunk-V3EQDOEU.js.map → chunk-3RGPZ5RE.js.map} +1 -1
  3. package/dist/chunk-BQ4WG67Z.js +2 -0
  4. package/dist/chunk-BQ4WG67Z.js.map +1 -0
  5. package/dist/chunk-BVJJCQ6Y.js +4 -0
  6. package/dist/chunk-BVJJCQ6Y.js.map +1 -0
  7. package/dist/{chunk-NPBIRXLC.js → chunk-CAN2CWEI.js} +2 -2
  8. package/dist/{chunk-NPBIRXLC.js.map → chunk-CAN2CWEI.js.map} +1 -1
  9. package/dist/chunk-NMG65UCR.js +3 -0
  10. package/dist/chunk-NMG65UCR.js.map +1 -0
  11. package/dist/chunk-VKGZ35WJ.js +2 -0
  12. package/dist/chunk-VKGZ35WJ.js.map +1 -0
  13. package/dist/{chunk-6FAEWW7A.js → chunk-VVJ5HBG5.js} +5 -5
  14. package/dist/{chunk-6FAEWW7A.js.map → chunk-VVJ5HBG5.js.map} +1 -1
  15. package/dist/client.d.ts +48 -8
  16. package/dist/client.js +1 -1
  17. package/dist/{package-PLJALKWH.js → package-FRHPJWXY.js} +2 -2
  18. package/dist/{package-PLJALKWH.js.map → package-FRHPJWXY.js.map} +1 -1
  19. package/dist/render-7S2MBT7R.js +2 -0
  20. package/dist/{render-RQCPSN7B.js.map → render-7S2MBT7R.js.map} +1 -1
  21. package/dist/renderApp-RWQKYP54.js +2 -0
  22. package/dist/{renderApp-UF5FLZHD.js.map → renderApp-RWQKYP54.js.map} +1 -1
  23. package/dist/server-BR352GUJ.js +2 -0
  24. package/dist/{server-GF7ON6QY.js.map → server-BR352GUJ.js.map} +1 -1
  25. package/dist/server.js +1 -1
  26. package/dist/transport-QMFZ67HR.js +2 -0
  27. package/dist/{transport-3V4KGAAU.js.map → transport-QMFZ67HR.js.map} +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-63RBLFRJ.js +0 -4
  30. package/dist/chunk-63RBLFRJ.js.map +0 -1
  31. package/dist/chunk-DKK3TACA.js +0 -3
  32. package/dist/chunk-DKK3TACA.js.map +0 -1
  33. package/dist/chunk-LR6IBZVP.js +0 -2
  34. package/dist/chunk-LR6IBZVP.js.map +0 -1
  35. package/dist/chunk-WD5PEREO.js +0 -2
  36. package/dist/chunk-WD5PEREO.js.map +0 -1
  37. package/dist/render-RQCPSN7B.js +0 -2
  38. package/dist/renderApp-UF5FLZHD.js +0 -2
  39. package/dist/server-GF7ON6QY.js +0 -2
  40. package/dist/transport-3V4KGAAU.js +0 -2
package/dist/client.d.ts CHANGED
@@ -16,8 +16,16 @@ interface ClientConfig {
16
16
  * Opens a URL for OAuth redirects. React Native must use
17
17
  * `(url) => Linking.openURL(url)` — WebView is not supported.
18
18
  * Defaults to `window.location.href` when not provided.
19
+ *
20
+ * A web client that opens the flow in a popup should return the window
21
+ * `window.open` gave it: `(url) => window.open(url)`. With that reference the
22
+ * callback page in the popup can hand the sign-in code back to this page,
23
+ * which then completes the login in its own context — what makes OAuth work
24
+ * when the app runs inside a cross-origin iframe and the popup's storage is
25
+ * partitioned away from it. Any other return value (including the `Promise`
26
+ * from `Linking.openURL`) is ignored.
19
27
  */
20
- openUrl?: (url: string) => void;
28
+ openUrl?: (url: string) => unknown;
21
29
  /**
22
30
  * Credentials mode for method-call requests. Defaults to `'include'`, which
23
31
  * browser apps need for the cookie-based flows (password reset, magic link).
@@ -649,17 +657,28 @@ declare function signInWithOAuth(options: {
649
657
  * Pairs with `signInWithOAuth({ provider, redirectUri })` — the flow that hands
650
658
  * a code back to your app. It works on native and under Expo Web, where the
651
659
  * verifier is kept in `sessionStorage` so it survives the navigation to the
652
- * provider. A plain web app that calls `signInWithOAuth({ provider })` with no
653
- * `redirectUri` is signed in by a session cookie and never needs this.
660
+ * provider.
661
+ *
662
+ * When this page is an OAuth popup opened by a page that is still listening —
663
+ * the embedded-iframe case, where `openUrl` returned the window from
664
+ * `window.open` — the code is handed to that opening page instead, and the
665
+ * sign-in completes *there*, in the context the app actually runs in. This call
666
+ * then resolves to `null`: there is no user to return here, and this page is
667
+ * closed for you. A plain web app that calls `signInWithOAuth({ provider })`
668
+ * with no `redirectUri` is signed in by a session cookie and never needs this.
654
669
  *
655
- * The verifier minted by `signInWithOAuth` is replayed here, which is what
656
- * makes a code usable only by the client that started the flow. Calling this
657
- * without a preceding `signInWithOAuth` — as a crafted deep link would — fails
658
- * before the code is ever sent.
670
+ * The verifier minted by `signInWithOAuth` is replayed by whichever context
671
+ * redeems the code, which is what makes a code usable only by the client that
672
+ * started the flow. Calling this without a preceding `signInWithOAuth` — as a
673
+ * crafted deep link would — fails before the code is ever sent.
659
674
  *
660
675
  * @example
661
676
  * ```ts
662
677
  * const user = await loginWithOAuth({ code });
678
+ * if (user) {
679
+ * // Signed in here. In an embedded popup, user is null and the opening
680
+ * // page has completed the sign-in instead.
681
+ * }
663
682
  * ```
664
683
  * @param options.code - The `code` query parameter from the deep link.
665
684
  */
@@ -675,6 +694,27 @@ declare function loginWithOAuth(options: {
675
694
  lastName?: string;
676
695
  avatarUrl?: string;
677
696
  } | null>;
697
+ /**
698
+ * Resume a popup sign-in after the opening page reloaded mid-flow.
699
+ *
700
+ * An embedded preview that refreshes while the popup is at the provider loses
701
+ * the in-memory listener that would receive the code. The verifier survives in
702
+ * `sessionStorage`, so pass the popup window back in on load to keep the flow
703
+ * alive.
704
+ *
705
+ * @example
706
+ * ```ts
707
+ * const popup = window.open('', 'modelence-oauth');
708
+ * if (popup) resumeOAuthPopup({ popup });
709
+ * ```
710
+ * @param options.popup - The popup window that is still completing the flow.
711
+ * @returns Whether a sign-in was pending and the handoff was re-armed.
712
+ */
713
+ declare function resumeOAuthPopup(options: {
714
+ popup: unknown;
715
+ }): boolean;
716
+ /** Abandons a popup sign-in this page was waiting on. */
717
+ declare function cancelOAuthPopup(): void;
678
718
  /**
679
719
  * Link an OAuth provider to the currently signed-in user's account.
680
720
  * Redirects the browser to the OAuth provider's authorization page.
@@ -745,4 +785,4 @@ declare function getLocalStorageSession(): any;
745
785
 
746
786
  declare const AppProvider: any;
747
787
 
748
- export { AppProvider, type CallMethodOptions, ClientChannel, type ClientConfig, type MethodArgs, MethodError, ModelenceQueryClient, type ModelenceQueryKey, ModelenceQueryProvider, type UserInfo, ValueType, callMethod, configureClient, connectModelenceQueryClient, createClientModule, createQueryKey, disconnectModelenceQueryClient, getConfig, getLocalStorageSession, getWebsocketClientProvider, linkOAuthProvider, loginWithMagicLink, loginWithOAuth, loginWithOneTimeCode, loginWithPassword, logout, modelenceLiveQuery, modelenceMutation, modelenceQuery, parseDeepLinkParams, renderApp, resendEmailVerification, resetPassword, sendMagicLink, sendResetPasswordToken, setWebsocketClientProvider, signInWithOAuth, signupWithPassword, startWebsockets, subscribeLiveQuery, systemConfig, unlinkOAuthProvider, updateProfile, useSession, verifyEmail };
788
+ export { AppProvider, type CallMethodOptions, ClientChannel, type ClientConfig, type MethodArgs, MethodError, ModelenceQueryClient, type ModelenceQueryKey, ModelenceQueryProvider, type UserInfo, ValueType, callMethod, cancelOAuthPopup, configureClient, connectModelenceQueryClient, createClientModule, createQueryKey, disconnectModelenceQueryClient, getConfig, getLocalStorageSession, getWebsocketClientProvider, linkOAuthProvider, loginWithMagicLink, loginWithOAuth, loginWithOneTimeCode, loginWithPassword, logout, modelenceLiveQuery, modelenceMutation, modelenceQuery, parseDeepLinkParams, renderApp, resendEmailVerification, resetPassword, resumeOAuthPopup, sendMagicLink, sendResetPasswordToken, setWebsocketClientProvider, signInWithOAuth, signupWithPassword, startWebsockets, subscribeLiveQuery, systemConfig, unlinkOAuthProvider, updateProfile, useSession, verifyEmail };
package/dist/client.js CHANGED
@@ -1,2 +1,2 @@
1
- export{g as AppProvider,f as ClientChannel,a as createClientModule,e as parseDeepLinkParams,d as renderApp,b as systemConfig}from'./chunk-LR6IBZVP.js';export{i as ModelenceQueryClient,n as ModelenceQueryProvider,f as connectModelenceQueryClient,m as createQueryKey,h as disconnectModelenceQueryClient,d as getWebsocketClientProvider,k as modelenceLiveQuery,l as modelenceMutation,j as modelenceQuery,c as setWebsocketClientProvider,e as startWebsockets,b as subscribeLiveQuery}from'./chunk-DKK3TACA.js';export{H as MethodError,K as callMethod,d as configureClient,b as getConfig,c as getLocalStorageSession,C as linkOAuthProvider,x as loginWithMagicLink,B as loginWithOAuth,y as loginWithOneTimeCode,q as loginWithPassword,u as logout,t as resendEmailVerification,z as resetPassword,w as sendMagicLink,v as sendResetPasswordToken,A as signInWithOAuth,p as signupWithPassword,D as unlinkOAuthProvider,r as updateProfile,o as useSession,s as verifyEmail}from'./chunk-WD5PEREO.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=client.js.map
1
+ export{g as AppProvider,f as ClientChannel,a as createClientModule,e as parseDeepLinkParams,d as renderApp,b as systemConfig}from'./chunk-BQ4WG67Z.js';export{b as ModelenceQueryProvider}from'./chunk-NMG65UCR.js';export{T as MethodError,l as ModelenceQueryClient,W as callMethod,P as cancelOAuthPopup,d as configureClient,i as connectModelenceQueryClient,p as createQueryKey,k as disconnectModelenceQueryClient,b as getConfig,c as getLocalStorageSession,g as getWebsocketClientProvider,Q as linkOAuthProvider,J as loginWithMagicLink,N as loginWithOAuth,K as loginWithOneTimeCode,C as loginWithPassword,G as logout,n as modelenceLiveQuery,o as modelenceMutation,m as modelenceQuery,F as resendEmailVerification,L as resetPassword,O as resumeOAuthPopup,I as sendMagicLink,H as sendResetPasswordToken,f as setWebsocketClientProvider,M as signInWithOAuth,B as signupWithPassword,h as startWebsockets,e as subscribeLiveQuery,R as unlinkOAuthProvider,D as updateProfile,A as useSession,E as verifyEmail}from'./chunk-VKGZ35WJ.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=client.js.map
2
2
  //# sourceMappingURL=client.js.map
@@ -1,2 +1,2 @@
1
- export{m as author,i as bin,o as bugs,t as default,r as dependencies,d as description,q as devDependencies,j as engines,g as exports,h as files,p as homepage,n as license,e as main,b as name,s as peerDependencies,l as repository,k as scripts,a as type,f as types,c as version}from'./chunk-V3EQDOEU.js';//# sourceMappingURL=package-PLJALKWH.js.map
2
- //# sourceMappingURL=package-PLJALKWH.js.map
1
+ export{m as author,i as bin,o as bugs,t as default,r as dependencies,d as description,q as devDependencies,j as engines,g as exports,h as files,p as homepage,n as license,e as main,b as name,s as peerDependencies,l as repository,k as scripts,a as type,f as types,c as version}from'./chunk-3RGPZ5RE.js';//# sourceMappingURL=package-FRHPJWXY.js.map
2
+ //# sourceMappingURL=package-FRHPJWXY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"package-PLJALKWH.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"package-FRHPJWXY.js"}
@@ -0,0 +1,2 @@
1
+ import {a,b as b$1,c}from'./chunk-CAN2CWEI.js';import'./chunk-BVJJCQ6Y.js';import'./chunk-UW37F3GV.js';import {a as a$1,b}from'./chunk-NMG65UCR.js';import {y,a as a$2,z}from'./chunk-VKGZ35WJ.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?z(r.session.user):null},M=r=>{let n=c();if(n)return n.session.configs[r]?.value};function D(){y(J),a$2(M);}async function X(r){let{callContext:n,loadingElement:C,routesElement:S,router:u,location:x,onShellReady:E,onError:b$2}=r;D();let l=await a("_system.session.init",{},n),i=new QueryClient({defaultOptions:{queries:{retry:false,gcTime:0}}}),O=u?u({children:S,location:x}):S,Q=jsx(a$1,{loadingElement:C,children:jsx(b,{client:i,children:O})}),a$2=null;await new Promise((s,m)=>{b$1({callContext:n,queryClient:i,session:{user:l.user,configs:l.configs??{}}},()=>{let e=renderToPipeableStream(Q,{onShellReady(){a$2=e,E?.(),s(e);},onShellError(t){m(t);},onError(t){b$2?.(t);}});return e});});let d=null,_=s=>new Promise((m,e)=>{if(!a$2){e(new Error("SSR stream was not initialized"));return}let t=new Writable({write(o,c,I){s.write(o,N=>I(N??void 0));},final(o){try{let c=dehydrate(i);d=JSON.stringify(c);}finally{i.clear();}o(),m();}});t.on("error",o=>{s.destroy(o),e(o);}),s.on("error",e),a$2.pipe(t);});return {sessionState:JSON.stringify({session:l}),pipe:_,getQueryState:()=>{if(d===null)throw new Error("getQueryState() called before stream finished");return d}}}export{X as renderSsrTreeStream};//# sourceMappingURL=render-7S2MBT7R.js.map
2
+ //# sourceMappingURL=render-7S2MBT7R.js.map
@@ -1 +1 @@
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":"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","file":"render-RQCPSN7B.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 _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 — inline before the shell flushes. */\n sessionState: string;\n /** Pipe React's HTML into `destination`. Resolves when streaming finishes. */\n pipe: (destination: Writable) => Promise<void>;\n /** Dehydrated query state. Only call after `pipe()` resolves. */\n getQueryState: () => string;\n};\n\nexport type SsrStreamOptions = SsrRenderOptions & {\n /** Fires when the shell is flushed; caller writes prelude + state here. */\n onShellReady?: () => void;\n /** Non-fatal SSR errors (Suspense fallbacks, etc.). */\n onError?: (error: unknown) => void;\n};\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 // Resolves with the stream once React renders above-fallback content;\n // rejects on shell errors 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 components can resolve\n // 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 // Await so shell errors surface before the caller starts piping.\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 `destination.end()` when done. The caller still needs\n // to write the epilogue + query state, so wrap with a passthrough whose\n // `final()` resolves the pipe promise without closing the response.\n const passthrough = new Writable({\n write(chunk, _encoding, callback) {\n destination.write(chunk, (err) => callback(err ?? undefined));\n },\n final(callback) {\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', (err) => {\n destination.destroy(err);\n reject(err);\n });\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
+ {"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":"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","file":"render-7S2MBT7R.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 _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 — inline before the shell flushes. */\n sessionState: string;\n /** Pipe React's HTML into `destination`. Resolves when streaming finishes. */\n pipe: (destination: Writable) => Promise<void>;\n /** Dehydrated query state. Only call after `pipe()` resolves. */\n getQueryState: () => string;\n};\n\nexport type SsrStreamOptions = SsrRenderOptions & {\n /** Fires when the shell is flushed; caller writes prelude + state here. */\n onShellReady?: () => void;\n /** Non-fatal SSR errors (Suspense fallbacks, etc.). */\n onError?: (error: unknown) => void;\n};\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 // Resolves with the stream once React renders above-fallback content;\n // rejects on shell errors 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 components can resolve\n // 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 // Await so shell errors surface before the caller starts piping.\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 `destination.end()` when done. The caller still needs\n // to write the epilogue + query state, so wrap with a passthrough whose\n // `final()` resolves the pipe promise without closing the response.\n const passthrough = new Writable({\n write(chunk, _encoding, callback) {\n destination.write(chunk, (err) => callback(err ?? undefined));\n },\n final(callback) {\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', (err) => {\n destination.destroy(err);\n reject(err);\n });\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"]}
@@ -0,0 +1,2 @@
1
+ export{c as _getSsrSnapshot,d as renderApp}from'./chunk-BQ4WG67Z.js';import'./chunk-NMG65UCR.js';import'./chunk-VKGZ35WJ.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=renderApp-RWQKYP54.js.map
2
+ //# sourceMappingURL=renderApp-RWQKYP54.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"renderApp-UF5FLZHD.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"renderApp-RWQKYP54.js"}
@@ -0,0 +1,2 @@
1
+ export{g as getCallContext,f as startServer}from'./chunk-VVJ5HBG5.js';import'./chunk-3RGPZ5RE.js';import'./chunk-BVJJCQ6Y.js';import'./chunk-VYR7VQMQ.js';import'./chunk-UW37F3GV.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server-BR352GUJ.js.map
2
+ //# sourceMappingURL=server-BR352GUJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"server-GF7ON6QY.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"server-BR352GUJ.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-6FAEWW7A.js';import'./chunk-V3EQDOEU.js';export{A as LiveData,a as Module,c as Store,z as authenticate,m as clearSessionUser,C as createQuery,o as createSession,j as dbSessions,s as dbUsers,n as invalidateAllUserSessions,k as obtainSession,d as schema,p as setAuthTokenCookie,l as setSessionUser}from'./chunk-63RBLFRJ.js';import'./chunk-VYR7VQMQ.js';export{a as getConfig,h as getEnvironmentId}from'./chunk-UW37F3GV.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server.js.map
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-VVJ5HBG5.js';import'./chunk-3RGPZ5RE.js';export{A as LiveData,a as Module,c as Store,z as authenticate,m as clearSessionUser,C as createQuery,o as createSession,j as dbSessions,s as dbUsers,n as invalidateAllUserSessions,k as obtainSession,d as schema,p as setAuthTokenCookie,l as setSessionUser}from'./chunk-BVJJCQ6Y.js';import'./chunk-VYR7VQMQ.js';export{a as getConfig,h as getEnvironmentId}from'./chunk-UW37F3GV.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';//# sourceMappingURL=server.js.map
2
2
  //# sourceMappingURL=server.js.map
@@ -0,0 +1,2 @@
1
+ import {c,a}from'./chunk-CAN2CWEI.js';import'./chunk-BVJJCQ6Y.js';import'./chunk-UW37F3GV.js';import {V,U}from'./chunk-VKGZ35WJ.js';import'./chunk-5M6FUMUK.js';import'./chunk-DO5TZLF5.js';function d(){return V(async(t,r)=>{let o=c();return o?a(t,r,o.callContext):U(t,r)})}export{d as installSsrCallMethodTransport};//# sourceMappingURL=transport-QMFZ67HR.js.map
2
+ //# sourceMappingURL=transport-QMFZ67HR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ssr/transport.ts"],"names":["installSsrCallMethodTransport","setCallMethodTransport","methodName","args","ssrCtx","getSsrContext","callInProcessMethod","defaultCallMethodTransport"],"mappings":"4LAcO,SAASA,CAAAA,EAA4C,CAC1D,OAAOC,CAAAA,CAAuB,MAAUC,EAAoBC,CAAAA,GAAqB,CAC/E,IAAMC,CAAAA,CAASC,CAAAA,EAAc,CAC7B,OAAKD,CAAAA,CAIEE,CAAAA,CAAuBJ,CAAAA,CAAYC,CAAAA,CAAMC,CAAAA,CAAO,WAAW,CAAA,CAHzDG,CAAAA,CAA8BL,CAAAA,CAAYC,CAAI,CAIzD,CAAC,CACH","file":"transport-3V4KGAAU.js","sourcesContent":["import {\n setCallMethodTransport,\n defaultCallMethodTransport,\n type MethodArgs,\n} from '../client/method';\nimport { callInProcessMethod } from './callInProcess';\nimport { getSsrContext } from './context';\n\n/**\n * Routes `callMethod` through `runMethod` in-process during an active SSR\n * render. Outside a render (e.g. server-side `callMethod` from jobs or other\n * non-render code) there is no request context, so it falls back to the\n * default HTTP transport — installing SSR must not break those call sites.\n */\nexport function installSsrCallMethodTransport(): () => void {\n return setCallMethodTransport(async <T>(methodName: string, args: MethodArgs) => {\n const ssrCtx = getSsrContext();\n if (!ssrCtx) {\n return defaultCallMethodTransport<T>(methodName, args);\n }\n\n return callInProcessMethod<T>(methodName, args, ssrCtx.callContext);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/ssr/transport.ts"],"names":["installSsrCallMethodTransport","setCallMethodTransport","methodName","args","ssrCtx","getSsrContext","callInProcessMethod","defaultCallMethodTransport"],"mappings":"4LAcO,SAASA,CAAAA,EAA4C,CAC1D,OAAOC,CAAAA,CAAuB,MAAUC,EAAoBC,CAAAA,GAAqB,CAC/E,IAAMC,CAAAA,CAASC,CAAAA,EAAc,CAC7B,OAAKD,CAAAA,CAIEE,CAAAA,CAAuBJ,CAAAA,CAAYC,CAAAA,CAAMC,CAAAA,CAAO,WAAW,CAAA,CAHzDG,CAAAA,CAA8BL,CAAAA,CAAYC,CAAI,CAIzD,CAAC,CACH","file":"transport-QMFZ67HR.js","sourcesContent":["import {\n setCallMethodTransport,\n defaultCallMethodTransport,\n type MethodArgs,\n} from '../client/method';\nimport { callInProcessMethod } from './callInProcess';\nimport { getSsrContext } from './context';\n\n/**\n * Routes `callMethod` through `runMethod` in-process during an active SSR\n * render. Outside a render (e.g. server-side `callMethod` from jobs or other\n * non-render code) there is no request context, so it falls back to the\n * default HTTP transport — installing SSR must not break those call sites.\n */\nexport function installSsrCallMethodTransport(): () => void {\n return setCallMethodTransport(async <T>(methodName: string, args: MethodArgs) => {\n const ssrCtx = getSsrContext();\n if (!ssrCtx) {\n return defaultCallMethodTransport<T>(methodName, args);\n }\n\n return callInProcessMethod<T>(methodName, args, ssrCtx.callContext);\n });\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "modelence",
4
- "version": "0.24.0",
4
+ "version": "0.24.1",
5
5
  "description": "The Node.js Framework for Real-Time MongoDB Apps",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/global.d.ts",
@@ -1,4 +0,0 @@
1
- import {a,b,n,j as j$1}from'./chunk-UW37F3GV.js';import {a as a$2,b as b$1}from'./chunk-5M6FUMUK.js';import {a as a$1}from'./chunk-DO5TZLF5.js';import {isDeepStrictEqual}from'util';import {MongoError,ObjectId,MongoServerError}from'mongodb';import {z as z$1}from'zod';import {createHash,randomBytes,timingSafeEqual}from'crypto';var Z=class{constructor(e,{stores:t=[],queries:r={},mutations:i={},routes:a=[],cronJobs:c={},configSchema:d={},rateLimits:m=[],channels:T=[]}={}){this.name=e,this.stores=t,this.queries=r,this.mutations=i,this.routes=a,this.cronJobs=c,this.configSchema=d,this.rateLimits=m,this.channels=T;}getConfig(e){return a(`${this.name}.${e}`)}};function oe(){return process.env.NODE_ENV==="development"&&!process.env.MODELENCE_SERVICE_ENDPOINT&&!a("_system.mongodbUri")}function I(n){let e=n._def;if(e.typeName==="ZodString")return {type:"string"};if(e.typeName==="ZodNumber")return {type:"number"};if(e.typeName==="ZodBoolean")return {type:"boolean"};if(e.typeName==="ZodDate")return {type:"date"};if(e.typeName==="ZodArray")return {type:"array",items:I(e.type)};if(e.typeName==="ZodObject"){let r=e.shape(),i={};for(let[a,c]of Object.entries(r))i[a]=I(c);return {type:"object",items:i}}if(e.typeName==="ZodOptional")return {...I(e.innerType),optional:true};if(e.typeName==="ZodNullable")return {...I(e.innerType),optional:true};if(e.typeName==="ZodEnum")return {type:"enum",items:e.values};if(e.typeName==="ZodUnion")return {type:"union",items:e.options.map(I)};if(e.typeName==="ZodEffects"){let t=e;return t.description?{type:"custom",typeName:t.description}:I(t.schema)}return {type:"custom",typeName:e.typeName}}function N(n){let e={};for(let[t,r]of Object.entries(n))Array.isArray(r)?e[t]=r.map(i=>typeof i=="object"&&"_def"in i?I(i):N(i)):typeof r=="object"&&"_def"in r?e[t]=I(r):e[t]=N(r);return e}var j=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),se=n=>j(n)&&"_def"in n,K=n=>n._def,ae=n=>{let e=K(n);if(e.typeName==="ZodOptional"||e.typeName==="ZodNullable"||e.typeName==="ZodDefault"||e.typeName==="ZodCatch"||e.typeName==="ZodReadonly")return e.innerType;if(e.typeName==="ZodEffects")return e.schema;if(e.typeName==="ZodBranded")return e.type;if(e.typeName==="ZodPipeline")return e.out},ce=n=>{let e=K(n);if(e.typeName==="ZodDefault")return {hasDefault:true,value:e.defaultValue()};let t=ae(n);return t?ce(t):{hasDefault:false}},Q=(n,e)=>{let t=K(n);if(t.typeName==="ZodObject"&&j(e))return $(t.shape(),e);if(t.typeName==="ZodArray"&&Array.isArray(e))return e.map(i=>Q(t.type,i));let r=ae(n);return r?Q(r,e):e},F=(n,e)=>se(n)?Q(n,e):Array.isArray(n)&&Array.isArray(e)?n.length===1?e.map(t=>F(n[0],t)):e.map((t,r)=>F(n[r],t)):j(n)&&j(e)?$(n,e):e,$=(n,e)=>{let t={...e};for(let[r,i]of Object.entries(n)){let a=t[r];if(a===void 0){if(se(i)){let c=ce(i);c.hasDefault&&(t[r]=F(i,c.value));}continue}t[r]=F(i,a);}return t};var we="[modelence:index-error]";function de(n){return n instanceof MongoServerError?n.code===11e3||n.message.includes("E11000"):false}function le(n,e,t){let r={problem:"unique-index-violation",collection:n,index:{name:e.name??null,key:e.key,collation:e.collation??null,partialFilterExpression:e.partialFilterExpression??null},duplicateKey:t.keyValue??null,serverError:t.errmsg??t.message},i=e.collation?{collation:e.collation}:void 0,a=`db.getCollection(${JSON.stringify(n)}).aggregate(${JSON.stringify(Ie(e))}`+(i?`, ${JSON.stringify(i)}`:"")+")";return [`${we} Unique index '${e.name??JSON.stringify(e.key)}' on collection '${n}' could not be created because existing documents already violate it. Until this is resolved the constraint is NOT enforced, so new duplicates can still be written.`,`Details: ${JSON.stringify(r)}`,"Find the conflicting documents with:",` ${a}`,"Fix: merge, delete, or update the conflicting documents so each indexed value is unique, then restart the app \u2014 the index build is retried on startup."].join(`
2
- `)}function Ie(n){let e=Object.keys(n.key),t=e.flatMap(i=>Oe(i).map(a=>({$unwind:{path:`$${a}`,preserveNullAndEmptyArrays:true}}))),r=Object.fromEntries(e.map(i=>[i.replace(/\./g,"_"),`$${i}`]));return [...n.partialFilterExpression?[{$match:n.partialFilterExpression}]:[],...t,{$group:{_id:r,ids:{$addToSet:"$_id"}}},{$match:{$expr:{$gt:[{$size:"$ids"},1]}}},{$limit:100}]}function Oe(n){let e=n.split(".");return e.map((t,r)=>e.slice(0,r+1).join("."))}var Ce=["background","bits","bucketSize","collation","default_language","expireAfterSeconds","hidden","language_override","max","min","partialFilterExpression","sparse","storageEngine","textIndexVersion","unique","weights","wildcardProjection","2dsphereIndexVersion"],J=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),Ae=n=>n.startsWith("_modelence_"),H=n=>{let e={};for(let t of Ce){let r=n[t];r!==void 0&&(e[t]=r);}return e},_e=(n,e)=>{if(!J(n)||!J(e))return false;let t=Object.entries(n),r=Object.entries(e);return t.length!==r.length?false:t.every(([i,a],c)=>{let[d,m]=r[c]||[];return i===d&&isDeepStrictEqual(a,m)})},ue=(n,e)=>_e(n.key,e.key)?isDeepStrictEqual(H(n),H(e)):false,V=n=>J(n)?Object.entries(n).map(([e,t])=>`${e}:${JSON.stringify(t)}`).join("|"):null,ke=async n=>{try{return await n.listIndexes().toArray()}catch(e){if(e instanceof MongoError&&e.code===26)return [];throw e}},ve=n=>Object.entries(n).map(([e,t])=>`${e}_${t}`).join("_"),Me=n=>{if(n.name){let t=n.name.startsWith("_modelence_")?n.name:`_modelence_${n.name}`;return {...n,name:t}}let e=ve(n.key);return {...n,name:`_modelence_${e}`}},f=class n{constructor(e,t){this._chainParent=null;this._chainChild=null;this.name=e,this.schema=t.schema,this.methods=t.methods,this.indexes=t.indexes.map(Me),this.searchIndexes=t.searchIndexes||[],this.indexCreationMode=t.indexCreationMode??"background";}getName(){return this.name}getIndexCreationMode(){return this.indexCreationMode}getSchema(){return this.schema}getSerializedSchema(){return N(this.schema)}getIndexes(){return this.indexes}getSearchIndexes(){return this.searchIndexes}getChainTail(){let e=this;for(;e._chainChild;)e=e._chainChild;return e}getChainRoot(){let e=this;for(;e._chainParent;)e=e._chainParent;return e}extend(e){let t=this.getChainTail();if(this.client||t.client)throw new Error(`Store.extend() must be called before startApp(). Store '${this.name}' has already been initialized and cannot be extended.`);let r={...t.schema,...e.schema||{}},i=[...t.indexes,...e.indexes||[]],a=[...t.searchIndexes,...e.searchIndexes||[]],c={...t.methods||{},...e.methods||{}},d=new n(this.name,{schema:r,methods:c,indexes:i,searchIndexes:a,indexCreationMode:e.indexCreationMode??t.indexCreationMode});return t._chainChild=d,d._chainParent=t,d}init(e){if(this.collection)throw new Error(`Collection ${this.name} is already initialized`);this.client=e,this.collection=this.client.db().collection(this.name);}async createIndexes(e="full"){let t=this.requireCollection(),r=e!=="create-only",i=e!=="drop-only",a=await ke(t),c=new Map,d=new Map,m=new Set,T=s=>{c.set(s.name,s);let l=V(s.key);if(!l)return;let u=d.get(l);u?u.add(s.name):d.set(l,new Set([s.name]));},w=s=>{let l=c.get(s);if(!l)return;c.delete(s);let u=V(l.key);if(!u)return;let x=d.get(u);x&&(x.delete(s),x.size===0&&d.delete(u));};for(let s of a)typeof s.name=="string"&&T({...s,name:s.name});let y=async s=>{if(!(s==="_id_"||m.has(s))){try{await t.dropIndex(s);}catch(l){if(!(l instanceof MongoError&&l.code===27))throw l}m.add(s),w(s);}};if(r){let s=new Set(this.indexes.map(u=>u.name).filter(u=>typeof u=="string")),l=[...c.values()].filter(u=>Ae(u.name)&&!s.has(u.name));for(let u of l)await y(u.name);}if(this.indexes.length>0)for(let s of this.indexes){if(!s.name)continue;let l=false,u=c.get(s.name);u&&!ue(u,s)&&(r?await y(u.name):l=true);let x=V(s.key);if(x){let S=[...d.get(x)||[]];for(let C of S)C!==s.name&&(r?await y(C):l=true);}let M=c.get(s.name);if(!(!!M&&ue(M,s))&&i&&!l){try{await t.createIndexes([s]);}catch(S){throw s.unique&&de(S)&&console.error(le(this.name,s,S)),S}T({name:s.name,key:s.key,...H(s)});}}if(i&&this.searchIndexes.length>0)for(let s of this.searchIndexes)try{await t.createSearchIndexes([s]);}catch(l){if(l instanceof MongoError&&l.code===68&&s.name)await t.dropSearchIndex(s.name),await t.createSearchIndexes([s]);else throw l}}wrapDocument(e){return this.methods?Object.create(null,Object.getOwnPropertyDescriptors({...e,...this.methods})):e}getSelector(e){return typeof e=="string"?{_id:new ObjectId(e)}:e instanceof ObjectId?{_id:e}:e}requireCollection(){if(!this.collection)throw new Error(`Collection ${this.name} is not provisioned`);return this.collection}requireClient(){if(!this.client)throw new Error("Database is not connected");return this.client}async findOne(e,t){let r=await this.requireCollection().findOne(e,t);return r?this.wrapDocument(r):null}async requireOne(e,t,r){let i=await this.findOne(e,t);if(!i)throw r?r():new Error(`Record not found in ${this.name}`);return i}find(e,t){let r=this.requireCollection().find(e,t?.projection?{projection:t.projection}:void 0);return t?.sort&&r.sort(t.sort),t?.limit&&r.limit(t.limit),t?.skip&&r.skip(t.skip),r}async findById(e){let t=typeof e=="string"?{_id:new ObjectId(e)}:{_id:e};return await this.findOne(t)}async requireById(e,t){let r=await this.findById(e);if(!r)throw t?t():new Error(`Record with id ${e} not found in ${this.name}`);return r}countDocuments(e){return this.requireCollection().countDocuments(e)}async fetch(e,t){return (await this.find(e,t).toArray()).map(this.wrapDocument.bind(this))}async insertOne(e,t){return await this.requireCollection().insertOne(e,t)}async create(e,t){let r=$(this.schema,{_id:new ObjectId,...e});return await this.requireCollection().insertOne(r,t),this.wrapDocument(r)}async insertMany(e,t){return await this.requireCollection().insertMany(e,t)}async updateOne(e,t,r){return await this.requireCollection().updateOne(this.getSelector(e),t,r)}async upsertOne(e,t,r){return await this.requireCollection().updateOne(this.getSelector(e),t,{upsert:true,...r})}async updateMany(e,t,r){return await this.requireCollection().updateMany(e,t,r)}async upsertMany(e,t,r){return await this.requireCollection().updateMany(e,t,{upsert:true,...r})}async deleteOne(e,t){return await this.requireCollection().deleteOne(this.getSelector(e),t)}async deleteMany(e,t){return await this.requireCollection().deleteMany(e,t)}async findOneAndUpdate(e,t,r){let i=await this.requireCollection().findOneAndUpdate(this.getSelector(e),t,r??{});return i?this.wrapDocument(i):null}async findOneAndUpsert(e,t,r){let i=await this.requireCollection().findOneAndUpdate(this.getSelector(e),t,{upsert:true,...r,returnDocument:"after",includeResultMetadata:true});return {doc:i.value?this.wrapDocument(i.value):null,isNew:!!i.lastErrorObject?.upserted}}async findOneAndDelete(e,t){let r=await this.requireCollection().findOneAndDelete(this.getSelector(e),t??{});return r?this.wrapDocument(r):null}async findOneAndReplace(e,t,r){let i=await this.requireCollection().findOneAndReplace(this.getSelector(e),t,r??{});return i?this.wrapDocument(i):null}async replaceOne(e,t,r){return await this.requireCollection().replaceOne(this.getSelector(e),t,r)}async distinct(e,t,r){let i=t??{};return r!==void 0?await this.requireCollection().distinct(e,i,r):await this.requireCollection().distinct(e,i)}watch(e,t){return this.requireCollection().watch(e,t)}aggregate(e,t){return this.requireCollection().aggregate(e,t)}bulkWrite(e){return this.requireCollection().bulkWrite(e)}getDatabase(){return this.requireClient().db()}rawCollection(){return this.requireCollection()}async renameFrom(e,t){let r=this.getDatabase();if(!this.collection||!r)throw new Error(`Store ${this.name} is not provisioned`);if((await r.listCollections({name:e}).toArray()).length===0)throw new Error(`Collection ${e} not found`);if((await r.listCollections({name:this.name}).toArray()).length>0)throw new Error(`Collection ${this.name} already exists`);await r.collection(e).rename(this.name,t);}async vectorSearch({field:e,embedding:t,numCandidates:r,limit:i,projection:a,indexName:c}){return this.aggregate([{$vectorSearch:{index:c||e+"VectorSearch",path:e,queryVector:t,numCandidates:r||100,limit:i||10}},{$project:{_id:1,score:{$meta:"vectorSearchScore"},...a}}])}static vectorIndex({field:e,dimensions:t,similarity:r="cosine",indexName:i}){return {type:"vectorSearch",name:i||e+"VectorSearch",definition:{fields:[{type:"vector",path:e,numDimensions:t,similarity:r}]}}}};var Ee=z$1.string.bind(z$1),Re=z$1.number.bind(z$1),Ze=z$1.date.bind(z$1),Ne=z$1.boolean.bind(z$1),je=z$1.array.bind(z$1),Fe=z$1.object.bind(z$1),$e=z$1.enum.bind(z$1),o={string:Ee,number:Re,date:Ze,boolean:Ne,array:je,object:Fe,enum:$e,embedding(){return z$1.array(z$1.number())},objectId(){return z$1.instanceof(ObjectId).describe("ObjectId")},userId(){return z$1.instanceof(ObjectId).describe("UserId")},ref(n){return z$1.instanceof(ObjectId).describe("Ref")},union:z$1.union.bind(z$1),infer(n){return {}}};function g(n){return createHash("sha256").update(n).digest("hex")}var Y=new f("_modelenceLinkNonces",{schema:{nonce:o.string(),userId:o.string(),expiresAt:o.date()},indexes:[{key:{nonce:1},unique:true},{key:{expiresAt:1},expireAfterSeconds:0}]});async function an(n){let e=randomBytes(32).toString("hex");return await Y.insertOne({nonce:e,userId:n,expiresAt:new Date(Date.now()+a$1.minutes(10))}),e}async function cn(n){let e=await Y.findOneAndDelete({nonce:n});return e?e.userId:null}var ee=new f("_modelenceOAuthExchangeCodes",{schema:{code:o.string(),userId:o.string(),provider:o.string(),codeChallenge:o.string().optional(),expiresAt:o.date()},indexes:[{key:{code:1},unique:true},{key:{expiresAt:1},expireAfterSeconds:0}]}),ze=1;async function dn(n,e,t){let r=randomBytes(32).toString("hex");return await ee.insertOne({code:g(r),userId:n,provider:e,codeChallenge:g(t),expiresAt:new Date(Date.now()+a$1.minutes(ze))}),r}async function ln(n,e){let t=await ee.findOneAndDelete({code:g(n)});return !t||t.expiresAt<new Date||!t.codeChallenge||!e||!Ue(g(e),t.codeChallenge)?null:{userId:t.userId,provider:t.provider}}function Ue(n,e){return n.length!==e.length?false:timingSafeEqual(Buffer.from(n,"utf8"),Buffer.from(e,"utf8"))}var D=new f("_modelenceSessions",{schema:{authToken:o.string(),createdAt:o.date(),expiresAt:o.date(),userId:o.userId().nullable()},indexes:[{key:{authToken:1},unique:true},{key:{expiresAt:1},expireAfterSeconds:0},{key:{userId:1}}]});async function he(n){if(n){let e=g(n),t=await D.findOne({authToken:e}),r=/^[0-9a-f]{64}$/i.test(n);if(!t&&!r&&(t=await D.findOne({authToken:n}),t&&await D.updateOne({_id:t._id},{$set:{authToken:e}})),t)return {authToken:n,expiresAt:new Date(t.expiresAt),userId:t.userId??null}}return await Le()}async function un(n,e){await D.updateOne({authToken:g(n)},{$set:{userId:e}});}async function pn(n){await D.updateOne({authToken:g(n)},{$set:{userId:null}});}async function hn(n){await D.deleteMany({userId:n});}async function Le(n=null){let e=randomBytes(32).toString("base64url"),t=Date.now(),r=new Date(t+a$1.days(7));return await D.insertOne({authToken:g(e),createdAt:new Date(t),expiresAt:r,userId:n}),{authToken:e,expiresAt:r,userId:n}}async function We(n){let e=Date.now(),t=new Date(e+a$1.days(7));await D.updateOne({authToken:g(n.authToken)},{$set:{lastActiveDate:new Date(e),expiresAt:t}});}function Qe(n,e){n.cookie("authToken",e,{httpOnly:true,secure:process.env.NODE_ENV==="production",sameSite:"lax",path:"/",maxAge:a$1.days(7)});}function mn(n){n.clearCookie("authToken",{httpOnly:true,secure:process.env.NODE_ENV==="production",sameSite:"lax",path:"/"});}var yn=new Z("_system.session",{stores:[D,Y,ee],mutations:{init:async function(n,{session:e,user:t,res:r}){return r&&e?.userId&&Qe(r,e.authToken),{session:e,user:t,configs:b(),...oe()?{setupRequired:true}:{}}},heartbeat:async function(n,{session:e}){e&&await We(e);}}});var me=new f("_modelenceUsers",{schema:{handle:o.string(),emails:o.array(o.object({address:o.string(),verified:o.boolean()})).optional(),status:o.enum(["active","disabled","deleted"]).optional(),firstName:o.string().optional(),lastName:o.string().optional(),avatarUrl:o.string().optional(),createdAt:o.date(),disabledAt:o.date().optional(),deletedAt:o.date().optional(),roles:o.array(o.string()).optional(),authMethods:o.object({password:o.object({hash:o.string()}).optional(),google:o.object({id:o.string()}).optional(),github:o.object({id:o.string()}).optional()})},indexes:[{key:{handle:1},unique:true,collation:{locale:"en",strength:2}},{key:{"emails.address":1,status:1}},{key:{"emails.address":1},unique:true,collation:{locale:"en",strength:2},partialFilterExpression:{"emails.address":{$exists:true}}},{key:{"authMethods.google.id":1},sparse:true,unique:true},{key:{"authMethods.github.id":1},sparse:true,unique:true}]}),xn=new f("_modelenceDisposableEmailDomains",{schema:{domain:o.string(),addedAt:o.date()},indexes:[{key:{domain:1},unique:true}]}),Sn=new f("_modelenceEmailVerificationTokens",{schema:{userId:o.objectId(),email:o.string().optional(),token:o.string(),createdAt:o.date(),expiresAt:o.date()},indexes:[{key:{token:1},unique:true},{key:{expiresAt:1},expireAfterSeconds:0}]}),bn=new f("_modelenceResetPasswordTokens",{schema:{userId:o.objectId(),email:o.string().optional(),token:o.string(),createdAt:o.date(),expiresAt:o.date()},indexes:[{key:{token:1},unique:true},{key:{expiresAt:1},expireAfterSeconds:0}]}),Dn=new f("_modelenceMagicLinkTokens",{schema:{email:o.string(),token:o.string(),code:o.string(),attempts:o.number(),createdAt:o.date(),expiresAt:o.date()},indexes:[{key:{token:1},unique:true},{key:{email:1}},{key:{expiresAt:1},expireAfterSeconds:0}]});var ye=new Map,_={authenticated:null,unauthenticated:null};function In(n,e){_.authenticated=e.authenticated,_.unauthenticated=e.unauthenticated;for(let[t,r]of Object.entries(n))ye.set(t,r);}function fe(){return _.unauthenticated?[_.unauthenticated]:[]}function ge(){return _.authenticated?[_.authenticated]:[]}function te(n,e){let t=e.find(r=>!Ke(n,r));if(t)throw new Error(`Access denied - missing permission: '${t}'`)}function Ke(n,e){for(let t of n)if(ye.get(t)?.permissions?.includes(e))return true;return false}async function Te(n){let e=await he(n),t=e.userId?await me.findOne({_id:new ObjectId(e.userId),status:{$nin:["deleted","disabled"]}}):null,r=t?{id:t._id.toString(),handle:t.handle,roles:t.roles||[],hasRole:a=>(t.roles||[]).includes(a),requireRole:a=>{if(!(t.roles||[]).includes(a))throw new Error(`Access denied - role '${a}' required`)},firstName:t.firstName??void 0,lastName:t.lastName??void 0,avatarUrl:t.avatarUrl??void 0}:null,i=r?ge():fe();return {user:r,session:e,roles:i}}var k=class{constructor(e){this.fetch=e.fetch,this.watch=e.watch;}};function Be(){return typeof window!="object"}function O(){if(!Be())throw new Error("This function can only be called on the server")}function En(n){return n.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim()}var v=new Map;function Je(n){let e=v.get(n.id);return e||(e=new Map,v.set(n.id,e)),e}async function He(n,e){let t=z$1.object({subscriptionId:z$1.string().min(1),method:z$1.string().min(1),args:z$1.record(z$1.unknown()).default({}),authToken:z$1.string().nullish(),clientInfo:z$1.object({screenWidth:z$1.number(),screenHeight:z$1.number(),windowWidth:z$1.number(),windowHeight:z$1.number(),pixelRatio:z$1.number(),orientation:z$1.string().nullable()}).optional()}).safeParse(e);if(!t.success){n.emit("liveQueryError",{subscriptionId:null,error:`Invalid payload: ${t.error.message}`});return}let{subscriptionId:r,method:i,args:a,authToken:c,clientInfo:d}=t.data,m=Je(n),T=m.get(r);if(T)if(T.cleanup)try{T.cleanup();}catch(y){console.error("[LiveQuery] Error cleaning up existing subscription:",y);}else T.aborted=true;let w={cleanup:null};m.set(r,w);try{let{session:y,user:s,roles:l}=await Te(c??null),u={session:y,user:s,roles:l,clientInfo:d??{screenWidth:0,screenHeight:0,windowWidth:0,windowHeight:0,pixelRatio:1,orientation:null},connectionInfo:{ip:n.handshake.address,userAgent:n.handshake.headers["user-agent"]},req:null,res:null},x=await xe(i,a,u),M=async()=>{let b=a$2(await x.fetch());w.aborted||n.emit("liveQueryData",{subscriptionId:r,data:b,typeMap:b$1(b)});},E=!0,S=!1,C=()=>{w.aborted||!E||S||(E=!1,S=!0,M().catch(b=>{w.aborted||(console.error(`[LiveQuery] Error fetching data for ${i}:`,b),n.emit("liveQueryError",{subscriptionId:r,error:b instanceof Error?b.message:String(b)}));}).finally(()=>{S=!1,C();}));},U=x.watch({publish:()=>{E=!0,C();}});if(w.aborted){if(U)try{U();}catch(b){console.error("[LiveQuery] Error cleaning up after disconnect during setup:",b);}return}w.cleanup=U||null,C();}catch(y){m.delete(r),console.error(`[LiveQuery] Error in ${i}:`,y),n.emit("liveQueryError",{subscriptionId:r,error:y instanceof Error?y.message:String(y)});}}function Xe(n,e){let t=z$1.object({subscriptionId:z$1.string().min(1)}).safeParse(e);if(!t.success){console.warn(`[LiveQuery] Invalid unsubscribe payload: ${t.error.message}`);return}let{subscriptionId:r}=t.data,i=v.get(n.id);if(!i)return;let a=i.get(r);if(a){if(a.cleanup)try{a.cleanup();}catch(c){console.error("[LiveQuery] Error in cleanup:",c);}else a.aborted=true;i.delete(r);}}function Ge(n){let e=v.get(n.id);if(e){for(let t of e.values())if(t.cleanup)try{t.cleanup();}catch(r){console.error("[LiveQuery] Error in cleanup on disconnect:",r);}else t.aborted=true;v.delete(n.id);}}var q={};function Kn(n,e){return O(),Se(n),z("query",n,e)}function Vn(n,e){return O(),Se(n),z("mutation",n,e)}function Bn(n,e){return O(),be(n),z("query",n,e)}function Jn(n,e){return O(),be(n),z("mutation",n,e)}function Se(n){if(n.toLowerCase().startsWith("_system."))throw new Error(`Method name cannot start with a reserved prefix: '_system.' (${n})`)}function be(n){if(!n.toLowerCase().startsWith("_system."))throw new Error(`System method name must start with a prefix: '_system.' (${n})`)}function z(n,e,t){if(O(),q[e])throw new Error(`Method with name '${e}' is already defined.`);let r=typeof t=="function"?t:t.handler,i=typeof t=="function"?[]:t.permissions??[];q[e]={type:n,name:e,handler:r,permissions:i};}async function Hn(n$1,e,t){O();let r=q[n$1];if(!r)throw new Error(`Method with name '${n$1}' is not defined.`);let{type:i,handler:a}=r,c=n("method",`method:${n$1}`,{type:i,args:j$1(e)}),d;try{te(t.roles,r.permissions),d=await a(e,t);}catch(m){throw c.end("error"),m}return c.end(),d}async function xe(n$1,e,t){O();let r=q[n$1];if(!r)throw new Error(`Method with name '${n$1}' is not defined.`);let{type:i,handler:a}=r;if(i!=="query")throw new Error("Live methods are only supported for queries");let c=n("method",`method:${n$1}:live`,{type:i,args:j$1(e)}),d;try{if(te(t.roles,r.permissions),d=await a(e,t),!(d instanceof k))throw new Error(`Live query handler for '${n$1}' must return a LiveData object with fetch and watch functions. See https://docs.modelence.com/live-queries`)}catch(m){throw c.end("error"),m}return c.end(),d}
3
- export{k as A,En as B,Kn as C,Vn as D,Bn as E,Jn as F,Hn as G,He as H,Xe as I,Ge as J,Z as a,oe as b,f as c,o as d,g as e,an as f,cn as g,dn as h,ln as i,D as j,he as k,un as l,pn as m,hn as n,Le as o,Qe as p,mn as q,yn as r,me as s,xn as t,Sn as u,bn as v,Dn as w,In as x,fe as y,Te as z};//# sourceMappingURL=chunk-63RBLFRJ.js.map
4
- //# sourceMappingURL=chunk-63RBLFRJ.js.map