@instantdb/react 0.22.93-experimental.drewh-ssr.20383114333.1 → 0.22.93-experimental.drewh-ssr.20384561223.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.
- package/dist/commonjs/next-ssr/HydrationStreamProvider.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js +2 -0
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/commonjs/next-ssr/{getUserOnServer.d.ts → getUserFromInstantCookie.d.ts} +1 -1
- package/dist/commonjs/next-ssr/getUserFromInstantCookie.d.ts.map +1 -0
- package/dist/commonjs/next-ssr/{getUserOnServer.js → getUserFromInstantCookie.js} +1 -1
- package/dist/commonjs/next-ssr/getUserFromInstantCookie.js.map +1 -0
- package/dist/commonjs/next-ssr/index.d.ts +1 -1
- package/dist/commonjs/next-ssr/index.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/index.js +2 -2
- package/dist/commonjs/next-ssr/index.js.map +1 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.d.ts.map +1 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.js +2 -0
- package/dist/esm/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/esm/next-ssr/{getUserOnServer.d.ts → getUserFromInstantCookie.d.ts} +1 -1
- package/dist/esm/next-ssr/getUserFromInstantCookie.d.ts.map +1 -0
- package/dist/esm/next-ssr/{getUserOnServer.js → getUserFromInstantCookie.js} +1 -1
- package/dist/esm/next-ssr/getUserFromInstantCookie.js.map +1 -0
- package/dist/esm/next-ssr/index.d.ts +1 -1
- package/dist/esm/next-ssr/index.d.ts.map +1 -1
- package/dist/esm/next-ssr/index.js +1 -1
- package/dist/esm/next-ssr/index.js.map +1 -1
- package/dist/standalone/index.js +121 -121
- package/dist/standalone/index.umd.cjs +12 -12
- package/package.json +4 -4
- package/src/next-ssr/HydrationStreamProvider.tsx +2 -0
- package/src/next-ssr/index.tsx +1 -1
- package/dist/commonjs/next-ssr/getUserOnServer.d.ts.map +0 -1
- package/dist/commonjs/next-ssr/getUserOnServer.js.map +0 -1
- package/dist/esm/next-ssr/getUserOnServer.d.ts.map +0 -1
- package/dist/esm/next-ssr/getUserOnServer.js.map +0 -1
- /package/src/next-ssr/{getUserOnServer.ts → getUserFromInstantCookie.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydrationStreamProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HydrationStreamProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,SAAwD,CAAC;AAI9E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,eAAe;IACvB,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAChC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;CACnC;AAWD,UAAU,sBAAsB,CAAC,MAAM;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QACN;;;;WAIG;QACH,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;KACzC,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B,CAAC,MAAM;IAClD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,6BAA6B,CAAC,MAAM;sBAaD;QAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B;;;WAGG;QACH,WAAW,CAAC,EAAE,eAAe,CAAC;QAC9B;;;WAGG;QACH,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;QAC5C;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;;EAmGF"}
|
|
@@ -40,6 +40,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
40
40
|
// This allows us to send serialized json from the server to the client using 'useServerInsertedHTML'
|
|
41
41
|
// We are allowed to send whatever json we want, however it must be triggered at the same time as the client is recieving new html to display
|
|
42
42
|
// after a suspsense boundary resolves
|
|
43
|
+
// We do this to send a list of triples and attrs for each query that the server made so they can be pre-filled on the client render.
|
|
44
|
+
// useServerInsertedHTML is called whenever a suspense boundary resolves, resulting in new html being streamed down to the client.
|
|
43
45
|
exports.isServer = typeof window === 'undefined' || 'Deno' in globalThis;
|
|
44
46
|
const navigation_js_1 = require("next/navigation.js");
|
|
45
47
|
const React = __importStar(require("react"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydrationStreamProvider.js","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"HydrationStreamProvider.js","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEb,sEAqIC;;AArMD,qGAAqG;AACrG,6IAA6I;AAC7I,sCAAsC;AACtC,qIAAqI;AACrI,kIA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AC,WAAW,CAAC,UAAU,CAAC,CACpC,CAAC;oBACF,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC3B,CAAC,CAAC;gBAEF,MAAM,SAAS,GAA8B,MAAA,GAAG,CAAC,EAAE,CAAC,mCAAI,EAAE,CAAC;gBAE3D,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;gBAExB,oDAAoD;gBACpD,GAAG,CAAC,EAAE,CAAC,GAAG;oBACR,WAAW,EAAE,IAAI;oBACjB,IAAI,EAAE,SAAS;iBAChB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,kBAAkB;QAElB,OAAO,CACL,uBAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YACpC,KAAK,CAAC,QAAQ,GACE,CACpB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,gCAAgC;QAC1C,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\n// This allows us to send serialized json from the server to the client using 'useServerInsertedHTML'\n// We are allowed to send whatever json we want, however it must be triggered at the same time as the client is recieving new html to display\n// after a suspsense boundary resolves\n// We do this to send a list of triples and attrs for each query that the server made so they can be pre-filled on the client render.\n// useServerInsertedHTML is called whenever a suspense boundary resolves, resulting in new html being streamed down to the client.\n\nexport const isServer = typeof window === 'undefined' || 'Deno' in globalThis;\n\nimport { useServerInsertedHTML } from 'next/navigation.js';\n\nimport * as React from 'react';\nimport { htmlEscapeJsonString } from './htmlescape.js';\n\nconst serializedSymbol = Symbol('serialized');\n\ninterface DataTransformer {\n serialize: (object: any) => any;\n deserialize: (object: any) => any;\n}\n\ntype Serialized<TData> = unknown & {\n [serializedSymbol]: TData;\n};\n\ninterface TypedDataTransformer<TData> {\n serialize: (obj: TData) => Serialized<TData>;\n deserialize: (obj: Serialized<TData>) => TData;\n}\n\ninterface HydrationStreamContext<TShape> {\n id: string;\n stream: {\n /**\n * **Server method**\n * Push a new entry to the stream\n * Will be ignored on the client\n */\n push: (...shape: Array<TShape>) => void;\n };\n}\n\nexport interface HydrationStreamProviderProps<TShape> {\n children: React.ReactNode;\n /**\n * Optional transformer to serialize/deserialize the data\n * Example devalue, superjson et al\n */\n transformer?: DataTransformer;\n /**\n * **Client method**\n * Called in the browser when new entries are received\n */\n onEntries: (entries: Array<TShape>) => void;\n /**\n * **Server method**\n * onFlush is called on the server when the cache is flushed\n */\n onFlush?: () => Array<TShape>;\n /**\n * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced\n */\n nonce?: string;\n}\n\nexport function createHydrationStreamProvider<TShape>() {\n const context = React.createContext<HydrationStreamContext<TShape>>(\n null as any,\n );\n /**\n\n * 1. (Happens on server): `useServerInsertedHTML()` is called **on the server** whenever a `Suspense`-boundary completes\n * - This means that we might have some new entries in the cache that needs to be flushed\n * - We pass these to the client by inserting a `<script>`-tag where we do `window[id].push(serializedVersionOfCache)`\n * 2. (Happens in browser) In `useEffect()`:\n * - We check if `window[id]` is set to an array and call `push()` on all the entries which will call `onEntries()` with the new entries\n * - We replace `window[id]` with a `push()`-method that will be called whenever new entries are received\n **/\n function UseClientHydrationStreamProvider(props: {\n children: React.ReactNode;\n /**\n * Optional transformer to serialize/deserialize the data\n * Example devalue, superjson et al\n */\n transformer?: DataTransformer;\n /**\n * **Client method**\n * Called in the browser when new entries are received\n */\n onEntries: (entries: Array<TShape>) => void;\n /**\n * **Server method**\n * onFlush is called on the server when the cache is flushed\n */\n onFlush?: () => Array<TShape>;\n /**\n * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced\n */\n nonce?: string;\n }) {\n // unique id for the cache provider\n const id = `__RQ${React.useId()}`;\n const idJSON = htmlEscapeJsonString(JSON.stringify(id));\n\n const [transformer] = React.useState(\n () =>\n (props.transformer ?? {\n // noop\n serialize: (obj: any) => obj,\n deserialize: (obj: any) => obj,\n }) as unknown as TypedDataTransformer<TShape>,\n );\n\n // <server stuff>\n const [stream] = React.useState<Array<TShape>>(() => {\n if (!isServer) {\n return {\n push() {\n // no-op on the client\n },\n } as unknown as Array<TShape>;\n }\n return [];\n });\n const count = React.useRef(0);\n useServerInsertedHTML(() => {\n // This only happens on the server\n stream.push(...(props.onFlush?.() ?? []));\n\n if (!stream.length) {\n return null;\n }\n // console.log(`pushing ${stream.length} entries`)\n const serializedCacheArgs = stream\n .map((entry) => transformer.serialize(entry))\n .map((entry) => JSON.stringify(entry))\n .join(',');\n\n // Flush stream\n // eslint-disable-next-line react-hooks/immutability\n stream.length = 0;\n\n const html: Array<string> = [\n `window[${idJSON}] = window[${idJSON}] || [];`,\n `window[${idJSON}].push(${htmlEscapeJsonString(serializedCacheArgs)});`,\n ];\n return (\n <script\n key={count.current++}\n nonce={props.nonce}\n dangerouslySetInnerHTML={{\n __html: html.join(''),\n }}\n />\n );\n });\n // </server stuff>\n\n // <client stuff>\n // Setup and run the onEntries handler on the client only, but do it during\n // the initial render so children have access to the data immediately\n // This is important to avoid the client suspending during the initial render\n // if the data has not yet been hydrated.\n if (!isServer) {\n const win = window as any;\n if (!win[id]?.initialized) {\n // Client: consume cache:\n const onEntries = (...serializedEntries: Array<Serialized<TShape>>) => {\n const entries = serializedEntries.map((serialized) =>\n transformer.deserialize(serialized),\n );\n props.onEntries(entries);\n };\n\n const winStream: Array<Serialized<TShape>> = win[id] ?? [];\n\n onEntries(...winStream);\n\n // eslint-disable-next-line react-hooks/immutability\n win[id] = {\n initialized: true,\n push: onEntries,\n };\n }\n }\n // </client stuff>\n\n return (\n <context.Provider value={{ stream, id }}>\n {props.children}\n </context.Provider>\n );\n }\n\n return {\n Provider: UseClientHydrationStreamProvider,\n context,\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserFromInstantCookie.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/getUserFromInstantCookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,KACZ,OAAO,CAAC,IAAI,GAAG,IAAI,CAKrB,CAAC"}
|
|
@@ -18,4 +18,4 @@ const getUserFromInstantCookie = (appId) => __awaiter(void 0, void 0, void 0, fu
|
|
|
18
18
|
return user;
|
|
19
19
|
});
|
|
20
20
|
exports.getUserFromInstantCookie = getUserFromInstantCookie;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=getUserFromInstantCookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserFromInstantCookie.js","sourceRoot":"","sources":["../../../src/next-ssr/getUserFromInstantCookie.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gDAA0C;AAEnC,MAAM,wBAAwB,GAAG,CACtC,KAAa,EACS,EAAE;IACxB,MAAM,WAAW,GAAG,MAAM,IAAA,oBAAO,GAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAPW,QAAA,wBAAwB,4BAOnC","sourcesContent":["import { User } from '@instantdb/core';\nimport { cookies } from 'next/headers.js';\n\nexport const getUserFromInstantCookie = async (\n appId: string,\n): Promise<User | null> => {\n const cookieStore = await cookies();\n const userJSON = cookieStore.get('instant_user_' + appId);\n const user = userJSON ? JSON.parse(userJSON.value) : null;\n return user;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InstantConfig, InstantSchemaDef, InstantUnknownSchema } from '@instantdb/core';
|
|
2
2
|
import { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
3
|
-
export { getUserFromInstantCookie } from './
|
|
3
|
+
export { getUserFromInstantCookie } from './getUserFromInstantCookie.ts';
|
|
4
4
|
export { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
5
5
|
export { InstantSuspenseProvider } from './InstantSuspenseProvider.tsx';
|
|
6
6
|
export { createInstantRouteHandler } from '@instantdb/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,GACtC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAIvC"}
|
|
@@ -7,8 +7,8 @@ exports.createInstantRouteHandler = exports.InstantSuspenseProvider = exports.In
|
|
|
7
7
|
exports.init = init;
|
|
8
8
|
const version_ts_1 = __importDefault(require("../version.js"));
|
|
9
9
|
const InstantNextDatabase_tsx_1 = require("./InstantNextDatabase.js");
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "getUserFromInstantCookie", { enumerable: true, get: function () { return
|
|
10
|
+
var getUserFromInstantCookie_ts_1 = require("./getUserFromInstantCookie.js");
|
|
11
|
+
Object.defineProperty(exports, "getUserFromInstantCookie", { enumerable: true, get: function () { return getUserFromInstantCookie_ts_1.getUserFromInstantCookie; } });
|
|
12
12
|
var InstantNextDatabase_tsx_2 = require("./InstantNextDatabase.js");
|
|
13
13
|
Object.defineProperty(exports, "InstantNextDatabase", { enumerable: true, get: function () { return InstantNextDatabase_tsx_2.InstantNextDatabase; } });
|
|
14
14
|
var InstantSuspenseProvider_tsx_1 = require("./InstantSuspenseProvider.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":";;;;;;AAqCA,oBASC;AAxCD,+DAAoC;AAEpC,sEAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":";;;;;;AAqCA,oBASC;AAxCD,+DAAoC;AAEpC,sEAAgE;AAEhE,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AAEjC,oEAAgE;AAAvD,8HAAA,mBAAmB,OAAA;AAC5B,4EAAwE;AAA/D,sIAAA,uBAAuB,OAAA;AAEhC,wCAA4D;AAAnD,iHAAA,yBAAyB,OAAA;AAElC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,IAAI,CAIlB,MAAuC;IAEvC,OAAO,IAAI,6CAAmB,CAAmB,MAAM,EAAE;QACvD,kBAAkB,EAAE,oBAAO;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n InstantConfig,\n InstantSchemaDef,\n InstantUnknownSchema,\n} from '@instantdb/core';\n\nimport version from '../version.ts';\n\nimport { InstantNextDatabase } from './InstantNextDatabase.tsx';\n\nexport { getUserFromInstantCookie } from './getUserFromInstantCookie.ts';\n\nexport { InstantNextDatabase } from './InstantNextDatabase.tsx';\nexport { InstantSuspenseProvider } from './InstantSuspenseProvider.tsx';\n\nexport { createInstantRouteHandler } from '@instantdb/core';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/react\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/react\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nexport function init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: InstantConfig<Schema, UseDates>,\n): InstantNextDatabase<Schema, UseDates> {\n return new InstantNextDatabase<Schema, UseDates>(config, {\n '@instantdb/react': version,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydrationStreamProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HydrationStreamProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,SAAwD,CAAC;AAI9E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,eAAe;IACvB,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAChC,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;CACnC;AAWD,UAAU,sBAAsB,CAAC,MAAM;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QACN;;;;WAIG;QACH,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;KACzC,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B,CAAC,MAAM;IAClD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,6BAA6B,CAAC,MAAM;sBAaD;QAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B;;;WAGG;QACH,WAAW,CAAC,EAAE,eAAe,CAAC;QAC9B;;;WAGG;QACH,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;QAC5C;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;;EAmGF"}
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// This allows us to send serialized json from the server to the client using 'useServerInsertedHTML'
|
|
4
4
|
// We are allowed to send whatever json we want, however it must be triggered at the same time as the client is recieving new html to display
|
|
5
5
|
// after a suspsense boundary resolves
|
|
6
|
+
// We do this to send a list of triples and attrs for each query that the server made so they can be pre-filled on the client render.
|
|
7
|
+
// useServerInsertedHTML is called whenever a suspense boundary resolves, resulting in new html being streamed down to the client.
|
|
6
8
|
export const isServer = typeof window === 'undefined' || 'Deno' in globalThis;
|
|
7
9
|
import { useServerInsertedHTML } from 'next/navigation.js';
|
|
8
10
|
import * as React from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydrationStreamProvider.js","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,qGAAqG;AACrG,6IAA6I;AAC7I,sCAAsC;
|
|
1
|
+
{"version":3,"file":"HydrationStreamProvider.js","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,qGAAqG;AACrG,6IAA6I;AAC7I,sCAAsC;AACtC,qIAAqI;AACrI,kIAAkI;AAElI,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,IAAI,UAAU,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAmD9C,MAAM,UAAU,6BAA6B;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,IAAW,CACZ,CAAC;IACF;;;;;;;;QAQI;IACJ,SAAS,gCAAgC,CAAC,KAqBzC;;QACC,mCAAmC;QACnC,MAAM,EAAE,GAAG,OAAO,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAClC,GAAG,EAAE;;YACH,OAAA,CAAC,MAAA,KAAK,CAAC,WAAW,mCAAI;gBACpB,OAAO;gBACP,SAAS,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG;gBAC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AAI,CAAC,EAAE,CAAC;iBACtB,IAJI,KAAK,CAAC,OAAO,EAAE,CAKpB,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,kBAAkB;QAElB,iBAAiB;QACjB,2EAA2E;QAC3E,qEAAqE;QACrE,6EAA6E;QAC7E,yCAAyC;QACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG,GAAG,MAAa,CAAC;YAC1B,IAAI,CAAC,CAAA,MAAA,GAAG,CAAC,EAAE,CAAC,0CAAE,WAAW,CAAA,EAAE,CAAC;gBAC1B,yBAAyB;gBACzB,MAAM,SAAS,GAAG,CAAC,GAAG,iBAA4C,EAAE,EAAE;oBACpE,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACnD,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CACpC,CAAC;oBACF,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC3B,CAAC,CAAC;gBAEF,MAAM,SAAS,GAA8B,MAAA,GAAG,CAAC,EAAE,CAAC,mCAAI,EAAE,CAAC;gBAE3D,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;gBAExB,oDAAoD;gBACpD,GAAG,CAAC,EAAE,CAAC,GAAG;oBACR,WAAW,EAAE,IAAI;oBACjB,IAAI,EAAE,SAAS;iBAChB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,kBAAkB;QAElB,OAAO,CACL,KAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YACpC,KAAK,CAAC,QAAQ,GACE,CACpB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,gCAAgC;QAC1C,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\n// This allows us to send serialized json from the server to the client using 'useServerInsertedHTML'\n// We are allowed to send whatever json we want, however it must be triggered at the same time as the client is recieving new html to display\n// after a suspsense boundary resolves\n// We do this to send a list of triples and attrs for each query that the server made so they can be pre-filled on the client render.\n// useServerInsertedHTML is called whenever a suspense boundary resolves, resulting in new html being streamed down to the client.\n\nexport const isServer = typeof window === 'undefined' || 'Deno' in globalThis;\n\nimport { useServerInsertedHTML } from 'next/navigation.js';\n\nimport * as React from 'react';\nimport { htmlEscapeJsonString } from './htmlescape.js';\n\nconst serializedSymbol = Symbol('serialized');\n\ninterface DataTransformer {\n serialize: (object: any) => any;\n deserialize: (object: any) => any;\n}\n\ntype Serialized<TData> = unknown & {\n [serializedSymbol]: TData;\n};\n\ninterface TypedDataTransformer<TData> {\n serialize: (obj: TData) => Serialized<TData>;\n deserialize: (obj: Serialized<TData>) => TData;\n}\n\ninterface HydrationStreamContext<TShape> {\n id: string;\n stream: {\n /**\n * **Server method**\n * Push a new entry to the stream\n * Will be ignored on the client\n */\n push: (...shape: Array<TShape>) => void;\n };\n}\n\nexport interface HydrationStreamProviderProps<TShape> {\n children: React.ReactNode;\n /**\n * Optional transformer to serialize/deserialize the data\n * Example devalue, superjson et al\n */\n transformer?: DataTransformer;\n /**\n * **Client method**\n * Called in the browser when new entries are received\n */\n onEntries: (entries: Array<TShape>) => void;\n /**\n * **Server method**\n * onFlush is called on the server when the cache is flushed\n */\n onFlush?: () => Array<TShape>;\n /**\n * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced\n */\n nonce?: string;\n}\n\nexport function createHydrationStreamProvider<TShape>() {\n const context = React.createContext<HydrationStreamContext<TShape>>(\n null as any,\n );\n /**\n\n * 1. (Happens on server): `useServerInsertedHTML()` is called **on the server** whenever a `Suspense`-boundary completes\n * - This means that we might have some new entries in the cache that needs to be flushed\n * - We pass these to the client by inserting a `<script>`-tag where we do `window[id].push(serializedVersionOfCache)`\n * 2. (Happens in browser) In `useEffect()`:\n * - We check if `window[id]` is set to an array and call `push()` on all the entries which will call `onEntries()` with the new entries\n * - We replace `window[id]` with a `push()`-method that will be called whenever new entries are received\n **/\n function UseClientHydrationStreamProvider(props: {\n children: React.ReactNode;\n /**\n * Optional transformer to serialize/deserialize the data\n * Example devalue, superjson et al\n */\n transformer?: DataTransformer;\n /**\n * **Client method**\n * Called in the browser when new entries are received\n */\n onEntries: (entries: Array<TShape>) => void;\n /**\n * **Server method**\n * onFlush is called on the server when the cache is flushed\n */\n onFlush?: () => Array<TShape>;\n /**\n * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced\n */\n nonce?: string;\n }) {\n // unique id for the cache provider\n const id = `__RQ${React.useId()}`;\n const idJSON = htmlEscapeJsonString(JSON.stringify(id));\n\n const [transformer] = React.useState(\n () =>\n (props.transformer ?? {\n // noop\n serialize: (obj: any) => obj,\n deserialize: (obj: any) => obj,\n }) as unknown as TypedDataTransformer<TShape>,\n );\n\n // <server stuff>\n const [stream] = React.useState<Array<TShape>>(() => {\n if (!isServer) {\n return {\n push() {\n // no-op on the client\n },\n } as unknown as Array<TShape>;\n }\n return [];\n });\n const count = React.useRef(0);\n useServerInsertedHTML(() => {\n // This only happens on the server\n stream.push(...(props.onFlush?.() ?? []));\n\n if (!stream.length) {\n return null;\n }\n // console.log(`pushing ${stream.length} entries`)\n const serializedCacheArgs = stream\n .map((entry) => transformer.serialize(entry))\n .map((entry) => JSON.stringify(entry))\n .join(',');\n\n // Flush stream\n // eslint-disable-next-line react-hooks/immutability\n stream.length = 0;\n\n const html: Array<string> = [\n `window[${idJSON}] = window[${idJSON}] || [];`,\n `window[${idJSON}].push(${htmlEscapeJsonString(serializedCacheArgs)});`,\n ];\n return (\n <script\n key={count.current++}\n nonce={props.nonce}\n dangerouslySetInnerHTML={{\n __html: html.join(''),\n }}\n />\n );\n });\n // </server stuff>\n\n // <client stuff>\n // Setup and run the onEntries handler on the client only, but do it during\n // the initial render so children have access to the data immediately\n // This is important to avoid the client suspending during the initial render\n // if the data has not yet been hydrated.\n if (!isServer) {\n const win = window as any;\n if (!win[id]?.initialized) {\n // Client: consume cache:\n const onEntries = (...serializedEntries: Array<Serialized<TShape>>) => {\n const entries = serializedEntries.map((serialized) =>\n transformer.deserialize(serialized),\n );\n props.onEntries(entries);\n };\n\n const winStream: Array<Serialized<TShape>> = win[id] ?? [];\n\n onEntries(...winStream);\n\n // eslint-disable-next-line react-hooks/immutability\n win[id] = {\n initialized: true,\n push: onEntries,\n };\n }\n }\n // </client stuff>\n\n return (\n <context.Provider value={{ stream, id }}>\n {props.children}\n </context.Provider>\n );\n }\n\n return {\n Provider: UseClientHydrationStreamProvider,\n context,\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserFromInstantCookie.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/getUserFromInstantCookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,KACZ,OAAO,CAAC,IAAI,GAAG,IAAI,CAKrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserFromInstantCookie.js","sourceRoot":"","sources":["../../../src/next-ssr/getUserFromInstantCookie.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,KAAa,EACS,EAAE;IACxB,MAAM,WAAW,GAAG,MAAM,OAAO,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC","sourcesContent":["import { User } from '@instantdb/core';\nimport { cookies } from 'next/headers.js';\n\nexport const getUserFromInstantCookie = async (\n appId: string,\n): Promise<User | null> => {\n const cookieStore = await cookies();\n const userJSON = cookieStore.get('instant_user_' + appId);\n const user = userJSON ? JSON.parse(userJSON.value) : null;\n return user;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InstantConfig, InstantSchemaDef, InstantUnknownSchema } from '@instantdb/core';
|
|
2
2
|
import { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
3
|
-
export { getUserFromInstantCookie } from './
|
|
3
|
+
export { getUserFromInstantCookie } from './getUserFromInstantCookie.ts';
|
|
4
4
|
export { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
5
5
|
export { InstantSuspenseProvider } from './InstantSuspenseProvider.tsx';
|
|
6
6
|
export { createInstantRouteHandler } from '@instantdb/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,EACrE,QAAQ,SAAS,OAAO,GAAG,KAAK,EAEhC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,GACtC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAIvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import version from "../version.js";
|
|
2
2
|
import { InstantNextDatabase } from "./InstantNextDatabase.js";
|
|
3
|
-
export { getUserFromInstantCookie } from "./
|
|
3
|
+
export { getUserFromInstantCookie } from "./getUserFromInstantCookie.js";
|
|
4
4
|
export { InstantNextDatabase } from "./InstantNextDatabase.js";
|
|
5
5
|
export { InstantSuspenseProvider } from "./InstantSuspenseProvider.js";
|
|
6
6
|
export { createInstantRouteHandler } from '@instantdb/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA+B,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,IAAI,CAIlB,MAAuC;IAEvC,OAAO,IAAI,mBAAmB,CAAmB,MAAM,EAAE;QACvD,kBAAkB,EAAE,OAAO;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n InstantConfig,\n InstantSchemaDef,\n InstantUnknownSchema,\n} from '@instantdb/core';\n\nimport version from '../version.ts';\n\nimport { InstantNextDatabase } from './InstantNextDatabase.tsx';\n\nexport { getUserFromInstantCookie } from './getUserFromInstantCookie.ts';\n\nexport { InstantNextDatabase } from './InstantNextDatabase.tsx';\nexport { InstantSuspenseProvider } from './InstantSuspenseProvider.tsx';\n\nexport { createInstantRouteHandler } from '@instantdb/core';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/react\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/react\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nexport function init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: InstantConfig<Schema, UseDates>,\n): InstantNextDatabase<Schema, UseDates> {\n return new InstantNextDatabase<Schema, UseDates>(config, {\n '@instantdb/react': version,\n });\n}\n"]}
|