@instantdb/react 0.22.88 → 0.22.89-experimental.drewh-ssr.20277611943.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/commonjs/index.d.ts +2 -2
  2. package/dist/commonjs/index.d.ts.map +1 -1
  3. package/dist/commonjs/index.js +2 -1
  4. package/dist/commonjs/index.js.map +1 -1
  5. package/dist/commonjs/next-ssr/HydrationStreamProvider.d.ts +66 -0
  6. package/dist/commonjs/next-ssr/HydrationStreamProvider.d.ts.map +1 -0
  7. package/dist/commonjs/next-ssr/HydrationStreamProvider.js +135 -0
  8. package/dist/commonjs/next-ssr/HydrationStreamProvider.js.map +1 -0
  9. package/dist/commonjs/next-ssr/htmlescape.d.ts +3 -0
  10. package/dist/commonjs/next-ssr/htmlescape.d.ts.map +1 -0
  11. package/dist/commonjs/next-ssr/htmlescape.js +25 -0
  12. package/dist/commonjs/next-ssr/htmlescape.js.map +1 -0
  13. package/dist/commonjs/next-ssr/index.d.ts +50 -0
  14. package/dist/commonjs/next-ssr/index.d.ts.map +1 -0
  15. package/dist/commonjs/next-ssr/index.js +161 -0
  16. package/dist/commonjs/next-ssr/index.js.map +1 -0
  17. package/dist/esm/index.d.ts +2 -2
  18. package/dist/esm/index.d.ts.map +1 -1
  19. package/dist/esm/index.js +2 -2
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/next-ssr/HydrationStreamProvider.d.ts +66 -0
  22. package/dist/esm/next-ssr/HydrationStreamProvider.d.ts.map +1 -0
  23. package/dist/esm/next-ssr/HydrationStreamProvider.js +98 -0
  24. package/dist/esm/next-ssr/HydrationStreamProvider.js.map +1 -0
  25. package/dist/esm/next-ssr/htmlescape.d.ts +3 -0
  26. package/dist/esm/next-ssr/htmlescape.d.ts.map +1 -0
  27. package/dist/esm/next-ssr/htmlescape.js +21 -0
  28. package/dist/esm/next-ssr/htmlescape.js.map +1 -0
  29. package/dist/esm/next-ssr/index.d.ts +50 -0
  30. package/dist/esm/next-ssr/index.d.ts.map +1 -0
  31. package/dist/esm/next-ssr/index.js +151 -0
  32. package/dist/esm/next-ssr/index.js.map +1 -0
  33. package/dist/standalone/index.js +2647 -2390
  34. package/dist/standalone/index.umd.cjs +15 -15
  35. package/package.json +18 -6
  36. package/src/index.ts +2 -0
  37. package/src/next-ssr/HydrationStreamProvider.tsx +193 -0
  38. package/src/next-ssr/htmlescape.ts +24 -0
  39. package/src/next-ssr/index.tsx +273 -0
  40. package/tsconfig.json +1 -0
@@ -1,7 +1,7 @@
1
- import { id, tx, lookup, i, InstantAPIError, SyncTableCallbackEventType, type QueryResponse, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantObject, type InstantEntity, type InstantSchemaDatabase, type InstantUnknownSchemaDef, type IInstantDatabase, type User, type AuthState, type Query, type Config, type InstaQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLFields, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError } from '@instantdb/core';
1
+ import { id, tx, lookup, i, InstantAPIError, SyncTableCallbackEventType, type QueryResponse, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantObject, type InstantEntity, type InstantSchemaDatabase, type InstantUnknownSchemaDef, type IInstantDatabase, type User, type AuthState, type Query, type Config, type InstaQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLFields, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, createInstantRouteHandler } from '@instantdb/core';
2
2
  import { InstantReactAbstractDatabase } from '@instantdb/react-common';
3
3
  import InstantReactWebDatabase from './InstantReactWebDatabase.ts';
4
4
  import { init, init_experimental } from './init.ts';
5
5
  import { Cursors } from './Cursors.tsx';
6
- export { id, tx, lookup, init, init_experimental, InstantReactWebDatabase, Cursors, i, InstantAPIError, InstantReactAbstractDatabase, SyncTableCallbackEventType, type Config, type InstantConfig, type InstantUnknownSchemaDef, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type IInstantDatabase, type InstaQLParams, type ValidQuery, type InstaQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, };
6
+ export { id, tx, lookup, init, init_experimental, createInstantRouteHandler, InstantReactWebDatabase, Cursors, i, InstantAPIError, InstantReactAbstractDatabase, SyncTableCallbackEventType, type Config, type InstantConfig, type InstantUnknownSchemaDef, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type IInstantDatabase, type InstaQLParams, type ValidQuery, type InstaQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, };
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,EAAE,EACF,MAAM,EACN,CAAC,EAGD,eAAe,EAGf,0BAA0B,EAG1B,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAGf,KAAK,YAAY,EAGjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,E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@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SyncTableCallbackEventType = exports.InstantReactAbstractDatabase = exports.InstantAPIError = exports.i = exports.Cursors = exports.InstantReactWebDatabase = exports.init_experimental = exports.init = exports.lookup = exports.tx = exports.id = void 0;
6
+ exports.SyncTableCallbackEventType = exports.InstantReactAbstractDatabase = exports.InstantAPIError = exports.i = exports.Cursors = exports.InstantReactWebDatabase = exports.createInstantRouteHandler = exports.init_experimental = exports.init = exports.lookup = exports.tx = exports.id = void 0;
7
7
  const core_1 = require("@instantdb/core");
8
8
  Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });
9
9
  Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } });
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "InstantAPIError", { enumerable: true, get: funct
15
15
  Object.defineProperty(exports, "SyncTableCallbackEventType", { enumerable: true, get: function () { return
16
16
  // sync table enums
17
17
  core_1.SyncTableCallbackEventType; } });
18
+ Object.defineProperty(exports, "createInstantRouteHandler", { enumerable: true, get: function () { return core_1.createInstantRouteHandler; } });
18
19
  const react_common_1 = require("@instantdb/react-common");
19
20
  Object.defineProperty(exports, "InstantReactAbstractDatabase", { enumerable: true, get: function () { return react_common_1.InstantReactAbstractDatabase; } });
20
21
  const InstantReactWebDatabase_ts_1 = __importDefault(require("./InstantReactWebDatabase.js"));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAqFyB;AAQvB,mFA5FA,SAAE,OA4FA;AACF,mFA5FA,SAAE,OA4FA;AACF,uFA5FA,aAAM,OA4FA;AAKN,kFAhGA,QAAC,OAgGA;AAGD;IAjGA,QAAQ;IACR,sBAAe,OAgGA;AAMf;IApGA,mBAAmB;IACnB,iCAA0B,OAmGA;AAtB5B,0DAAuE;AAmBrE,6GAnBO,2CAA4B,OAmBP;AAlB9B,8FAAmE;AAUjE,kCAVK,oCAAuB,CAUL;AATzB,uCAAoD;AAOlD,qFAPO,cAAI,OAOP;AACJ,kGARa,2BAAiB,OAQb;AAPnB,8CAAwC;AAStC,wFATO,qBAAO,OASP","sourcesContent":["import {\n id,\n tx,\n lookup,\n i,\n\n // error\n InstantAPIError,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type QueryResponse,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantObject,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstantUnknownSchemaDef,\n type IInstantDatabase,\n type User,\n type AuthState,\n type Query,\n type Config,\n type InstaQLParams,\n type ConnectionStatus,\n type ValidQuery,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type InstantConfig,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstaQLEntity,\n type InstaQLFields,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type TransactionChunk,\n type InstantUnknownSchema,\n type InstantSchemaDef,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n} from '@instantdb/core';\n\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\nimport InstantReactWebDatabase from './InstantReactWebDatabase.ts';\nimport { init, init_experimental } from './init.ts';\nimport { Cursors } from './Cursors.tsx';\n\nexport {\n id,\n tx,\n lookup,\n init,\n init_experimental,\n InstantReactWebDatabase,\n Cursors,\n i,\n\n // error\n InstantAPIError,\n\n // internal\n InstantReactAbstractDatabase,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type InstantConfig,\n type InstantUnknownSchemaDef,\n type Query,\n type QueryResponse,\n type InstantObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type IInstantDatabase,\n type InstaQLParams,\n type ValidQuery,\n type InstaQLFields,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type TransactionChunk,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type InstantUnknownSchema,\n type InstantSchemaDef,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAsFyB;AAQvB,mFA7FA,SAAE,OA6FA;AACF,mFA7FA,SAAE,OA6FA;AACF,uFA7FA,aAAM,OA6FA;AAMN,kFAlGA,QAAC,OAkGA;AAGD;IAnGA,QAAQ;IACR,sBAAe,OAkGA;AAMf;IAtGA,mBAAmB;IACnB,iCAA0B,OAqGA;AAZ1B,0GAdA,gCAAyB,OAcA;AAX3B,0DAAuE;AAoBrE,6GApBO,2CAA4B,OAoBP;AAnB9B,8FAAmE;AAWjE,kCAXK,oCAAuB,CAWL;AAVzB,uCAAoD;AAOlD,qFAPO,cAAI,OAOP;AACJ,kGARa,2BAAiB,OAQb;AAPnB,8CAAwC;AAUtC,wFAVO,qBAAO,OAUP","sourcesContent":["import {\n id,\n tx,\n lookup,\n i,\n\n // error\n InstantAPIError,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type QueryResponse,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantObject,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstantUnknownSchemaDef,\n type IInstantDatabase,\n type User,\n type AuthState,\n type Query,\n type Config,\n type InstaQLParams,\n type ConnectionStatus,\n type ValidQuery,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type InstantConfig,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstaQLEntity,\n type InstaQLFields,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type TransactionChunk,\n type InstantUnknownSchema,\n type InstantSchemaDef,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n createInstantRouteHandler,\n} from '@instantdb/core';\n\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\nimport InstantReactWebDatabase from './InstantReactWebDatabase.ts';\nimport { init, init_experimental } from './init.ts';\nimport { Cursors } from './Cursors.tsx';\n\nexport {\n id,\n tx,\n lookup,\n init,\n init_experimental,\n createInstantRouteHandler,\n InstantReactWebDatabase,\n Cursors,\n i,\n\n // error\n InstantAPIError,\n\n // internal\n InstantReactAbstractDatabase,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type InstantConfig,\n type InstantUnknownSchemaDef,\n type Query,\n type QueryResponse,\n type InstantObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type IInstantDatabase,\n type InstaQLParams,\n type ValidQuery,\n type InstaQLFields,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type TransactionChunk,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type InstantUnknownSchema,\n type InstantSchemaDef,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n};\n"]}
@@ -0,0 +1,66 @@
1
+ export declare const isServer: boolean;
2
+ import * as React from 'react';
3
+ interface DataTransformer {
4
+ serialize: (object: any) => any;
5
+ deserialize: (object: any) => any;
6
+ }
7
+ interface HydrationStreamContext<TShape> {
8
+ id: string;
9
+ stream: {
10
+ /**
11
+ * **Server method**
12
+ * Push a new entry to the stream
13
+ * Will be ignored on the client
14
+ */
15
+ push: (...shape: Array<TShape>) => void;
16
+ };
17
+ }
18
+ export interface HydrationStreamProviderProps<TShape> {
19
+ children: React.ReactNode;
20
+ /**
21
+ * Optional transformer to serialize/deserialize the data
22
+ * Example devalue, superjson et al
23
+ */
24
+ transformer?: DataTransformer;
25
+ /**
26
+ * **Client method**
27
+ * Called in the browser when new entries are received
28
+ */
29
+ onEntries: (entries: Array<TShape>) => void;
30
+ /**
31
+ * **Server method**
32
+ * onFlush is called on the server when the cache is flushed
33
+ */
34
+ onFlush?: () => Array<TShape>;
35
+ /**
36
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
37
+ */
38
+ nonce?: string;
39
+ }
40
+ export declare function createHydrationStreamProvider<TShape>(): {
41
+ Provider: (props: {
42
+ children: React.ReactNode;
43
+ /**
44
+ * Optional transformer to serialize/deserialize the data
45
+ * Example devalue, superjson et al
46
+ */
47
+ transformer?: DataTransformer;
48
+ /**
49
+ * **Client method**
50
+ * Called in the browser when new entries are received
51
+ */
52
+ onEntries: (entries: Array<TShape>) => void;
53
+ /**
54
+ * **Server method**
55
+ * onFlush is called on the server when the cache is flushed
56
+ */
57
+ onFlush?: () => Array<TShape>;
58
+ /**
59
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
60
+ */
61
+ nonce?: string;
62
+ }) => import("react/jsx-runtime").JSX.Element;
63
+ context: React.Context<HydrationStreamContext<TShape>>;
64
+ };
65
+ export {};
66
+ //# sourceMappingURL=HydrationStreamProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HydrationStreamProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AACA,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"}
@@ -0,0 +1,135 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.isServer = void 0;
38
+ exports.createHydrationStreamProvider = createHydrationStreamProvider;
39
+ const jsx_runtime_1 = require("react/jsx-runtime");
40
+ exports.isServer = typeof window === 'undefined' || 'Deno' in globalThis;
41
+ const navigation_js_1 = require("next/navigation.js");
42
+ const React = __importStar(require("react"));
43
+ const htmlescape_js_1 = require("./htmlescape.js");
44
+ const serializedSymbol = Symbol('serialized');
45
+ function createHydrationStreamProvider() {
46
+ const context = React.createContext(null);
47
+ /**
48
+
49
+ * 1. (Happens on server): `useServerInsertedHTML()` is called **on the server** whenever a `Suspense`-boundary completes
50
+ * - This means that we might have some new entries in the cache that needs to be flushed
51
+ * - We pass these to the client by inserting a `<script>`-tag where we do `window[id].push(serializedVersionOfCache)`
52
+ * 2. (Happens in browser) In `useEffect()`:
53
+ * - 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
54
+ * - We replace `window[id]` with a `push()`-method that will be called whenever new entries are received
55
+ **/
56
+ function UseClientHydrationStreamProvider(props) {
57
+ var _a, _b;
58
+ // unique id for the cache provider
59
+ const id = `__RQ${React.useId()}`;
60
+ const idJSON = (0, htmlescape_js_1.htmlEscapeJsonString)(JSON.stringify(id));
61
+ const [transformer] = React.useState(() => {
62
+ var _a;
63
+ return ((_a = props.transformer) !== null && _a !== void 0 ? _a : {
64
+ // noop
65
+ serialize: (obj) => obj,
66
+ deserialize: (obj) => obj,
67
+ });
68
+ });
69
+ // <server stuff>
70
+ const [stream] = React.useState(() => {
71
+ if (!exports.isServer) {
72
+ return {
73
+ push() {
74
+ // no-op on the client
75
+ },
76
+ };
77
+ }
78
+ return [];
79
+ });
80
+ const count = React.useRef(0);
81
+ (0, navigation_js_1.useServerInsertedHTML)(() => {
82
+ var _a, _b;
83
+ // This only happens on the server
84
+ stream.push(...((_b = (_a = props.onFlush) === null || _a === void 0 ? void 0 : _a.call(props)) !== null && _b !== void 0 ? _b : []));
85
+ if (!stream.length) {
86
+ return null;
87
+ }
88
+ // console.log(`pushing ${stream.length} entries`)
89
+ const serializedCacheArgs = stream
90
+ .map((entry) => transformer.serialize(entry))
91
+ .map((entry) => JSON.stringify(entry))
92
+ .join(',');
93
+ // Flush stream
94
+ // eslint-disable-next-line react-hooks/immutability
95
+ stream.length = 0;
96
+ const html = [
97
+ `window[${idJSON}] = window[${idJSON}] || [];`,
98
+ `window[${idJSON}].push(${(0, htmlescape_js_1.htmlEscapeJsonString)(serializedCacheArgs)});`,
99
+ ];
100
+ return ((0, jsx_runtime_1.jsx)("script", { nonce: props.nonce, dangerouslySetInnerHTML: {
101
+ __html: html.join(''),
102
+ } }, count.current++));
103
+ });
104
+ // </server stuff>
105
+ // <client stuff>
106
+ // Setup and run the onEntries handler on the client only, but do it during
107
+ // the initial render so children have access to the data immediately
108
+ // This is important to avoid the client suspending during the initial render
109
+ // if the data has not yet been hydrated.
110
+ if (!exports.isServer) {
111
+ const win = window;
112
+ if (!((_a = win[id]) === null || _a === void 0 ? void 0 : _a.initialized)) {
113
+ // Client: consume cache:
114
+ const onEntries = (...serializedEntries) => {
115
+ const entries = serializedEntries.map((serialized) => transformer.deserialize(serialized));
116
+ props.onEntries(entries);
117
+ };
118
+ const winStream = (_b = win[id]) !== null && _b !== void 0 ? _b : [];
119
+ onEntries(...winStream);
120
+ // eslint-disable-next-line react-hooks/immutability
121
+ win[id] = {
122
+ initialized: true,
123
+ push: onEntries,
124
+ };
125
+ }
126
+ }
127
+ // </client stuff>
128
+ return ((0, jsx_runtime_1.jsx)(context.Provider, { value: { stream, id }, children: props.children }));
129
+ }
130
+ return {
131
+ Provider: UseClientHydrationStreamProvider,
132
+ context,
133
+ };
134
+ }
135
+ //# sourceMappingURL=HydrationStreamProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HydrationStreamProvider.js","sourceRoot":"","sources":["../../../src/next-ssr/HydrationStreamProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,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,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';\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,3 @@
1
+ export declare const ESCAPE_REGEX: RegExp;
2
+ export declare function htmlEscapeJsonString(str: string): string;
3
+ //# sourceMappingURL=htmlescape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htmlescape.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/htmlescape.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,YAAY,QAAuB,CAAC;AAEjD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // --------------------------------------------------------------------------------
3
+ //
4
+ // copied from
5
+ // https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts
6
+ // License: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/license.md
7
+ //
8
+ // --------------------------------------------------------------------------------
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ESCAPE_REGEX = void 0;
11
+ exports.htmlEscapeJsonString = htmlEscapeJsonString;
12
+ // This utility is based on https://github.com/zertosh/htmlescape
13
+ // License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
14
+ const ESCAPE_LOOKUP = {
15
+ '&': '\\u0026',
16
+ '>': '\\u003e',
17
+ '<': '\\u003c',
18
+ '\u2028': '\\u2028',
19
+ '\u2029': '\\u2029',
20
+ };
21
+ exports.ESCAPE_REGEX = /[&><\u2028\u2029]/g;
22
+ function htmlEscapeJsonString(str) {
23
+ return str.replace(exports.ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
24
+ }
25
+ //# sourceMappingURL=htmlescape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htmlescape.js","sourceRoot":"","sources":["../../../src/next-ssr/htmlescape.ts"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,EAAE;AACF,cAAc;AACd,yHAAyH;AACzH,oHAAoH;AACpH,EAAE;AACF,mFAAmF;;;AAenF,oDAEC;AAfD,iEAAiE;AACjE,uGAAuG;AAEvG,MAAM,aAAa,GAA2B;IAC5C,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEW,QAAA,YAAY,GAAG,oBAAoB,CAAC;AAEjD,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["// --------------------------------------------------------------------------------\n//\n// copied from\n// https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts\n// License: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/license.md\n//\n// --------------------------------------------------------------------------------\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst ESCAPE_LOOKUP: Record<string, string> = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\n\nexport const ESCAPE_REGEX = /[&><\\u2028\\u2029]/g;\n\nexport function htmlEscapeJsonString(str: string): string {\n return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]!);\n}\n"]}
@@ -0,0 +1,50 @@
1
+ import { AuthState, InstantConfig, InstantSchemaDef, InstantUnknownSchema, InstaQLResponse, PageInfoResponse, RuleParams, User, ValidQuery } from '@instantdb/core';
2
+ import InstantReactWebDatabase from '../InstantReactWebDatabase.ts';
3
+ type InstantSuspenseProviderProps<Schema extends InstantSchemaDef<any, any, any>> = {
4
+ nonce?: string;
5
+ children: React.ReactNode;
6
+ db?: InstantReactWebDatabase<Schema, any>;
7
+ config?: Omit<InstantConfig<any, any>, 'schema'> & {
8
+ schema: string;
9
+ };
10
+ user?: User | null;
11
+ };
12
+ export declare const createUseSuspenseQuery: <Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean>(_db: InstantReactWebDatabase<Schema, UseDates>) => (<Q extends ValidQuery<Q, Schema>>(q: Q, opts?: {
13
+ ruleParams: RuleParams;
14
+ }) => {
15
+ data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;
16
+ pageInfo?: PageInfoResponse<Q>;
17
+ });
18
+ export declare const InstantSuspenseProvider: (props: InstantSuspenseProviderProps<any>) => import("react/jsx-runtime").JSX.Element;
19
+ /**
20
+ *
21
+ * The first step: init your application!
22
+ *
23
+ * Visit https://instantdb.com/dash to get your `appId` :)
24
+ *
25
+ * @example
26
+ * import { init } from "@instantdb/react"
27
+ *
28
+ * const db = init({ appId: "my-app-id" })
29
+ *
30
+ * // You can also provide a schema for type safety and editor autocomplete!
31
+ *
32
+ * import { init } from "@instantdb/react"
33
+ * import schema from ""../instant.schema.ts";
34
+ *
35
+ * const db = init({ appId: "my-app-id", schema })
36
+ *
37
+ * // To learn more: https://instantdb.com/docs/modeling-data
38
+ */
39
+ export declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: InstantConfig<Schema, UseDates>): InstantNextDatabase<Schema, UseDates>;
40
+ export declare class InstantNextDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean> extends InstantReactWebDatabase<Schema, UseDates> {
41
+ useSuspenseQuery: <Q extends ValidQuery<Q, Schema>>(q: Q, opts?: {
42
+ ruleParams: RuleParams;
43
+ }) => {
44
+ data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;
45
+ pageInfo?: PageInfoResponse<Q>;
46
+ };
47
+ useAuth: () => AuthState;
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAET,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAEhB,UAAU,EACV,IAAI,EACJ,UAAU,EACX,MAAM,iBAAiB,CAAC;AAQzB,OAAO,uBAAuB,MAAM,+BAA+B,CAAC;AAIpE,KAAK,4BAA4B,CAC/B,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,C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AAmB,CAC9B,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,SAAS,OAAO,CACxB,SAAQ,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1C,gBAAgB,GAAI,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,EACxD,GAAG,CAAC,EACJ,OAAO;QACL,UAAU,EAAE,UAAU,CAAC;KACxB,KACA;QACD,IAAI,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;KAChC,CAQC;IAEF,OAAO,QAAO,SAAS,CAoBrB;CACH"}
@@ -0,0 +1,161 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.InstantNextDatabase = exports.InstantSuspenseProvider = exports.createUseSuspenseQuery = void 0;
8
+ exports.init = init;
9
+ const jsx_runtime_1 = require("react/jsx-runtime");
10
+ const core_1 = require("@instantdb/core");
11
+ const react_1 = require("react");
12
+ const HydrationStreamProvider_tsx_1 = require("./HydrationStreamProvider.js");
13
+ const version_ts_1 = __importDefault(require("../version.js"));
14
+ const InstantReactWebDatabase_ts_1 = __importDefault(require("../InstantReactWebDatabase.js"));
15
+ const init_ts_1 = require("../init.js");
16
+ const stream = (0, HydrationStreamProvider_tsx_1.createHydrationStreamProvider)();
17
+ const SuspsenseQueryContext = (0, react_1.createContext)(null);
18
+ // Creates a typed useSuspense hook
19
+ const createUseSuspenseQuery = (_db) => {
20
+ return (q, opts) => {
21
+ const ctx = (0, react_1.useContext)(SuspsenseQueryContext);
22
+ if (!ctx) {
23
+ throw new Error('useSuspenseQuery must be used within a SuspenseQueryProvider');
24
+ }
25
+ return ctx.useSuspenseQuery(q, opts);
26
+ };
27
+ };
28
+ exports.createUseSuspenseQuery = createUseSuspenseQuery;
29
+ const InstantSuspenseProvider = (props) => {
30
+ var _a;
31
+ const clientRef = (0, react_1.useRef)(null);
32
+ if (!props.db && !props.config) {
33
+ throw new Error('Must provide either a db or config to InstantSuspenseProvider');
34
+ }
35
+ const db = (0, react_1.useRef)(props.db
36
+ ? props.db
37
+ : (0, init_ts_1.init)(Object.assign(Object.assign({}, props.config), { schema: (0, core_1.parseSchemaFromJSON)(JSON.parse(props.config.schema)) })));
38
+ const [trackedKeys] = (0, react_1.useState)(() => new Set());
39
+ if (!clientRef.current) {
40
+ if (props.user && !props.user.refresh_token) {
41
+ throw new Error('User must have a refresh_token field. Recieved: ' +
42
+ JSON.stringify(props.user, null, 2));
43
+ }
44
+ clientRef.current = new core_1.FrameworkClient({
45
+ token: (_a = props.user) === null || _a === void 0 ? void 0 : _a.refresh_token,
46
+ db: db.current.core,
47
+ });
48
+ }
49
+ if (HydrationStreamProvider_tsx_1.isServer) {
50
+ clientRef.current.subscribe((result) => {
51
+ const { queryHash } = result;
52
+ trackedKeys.add(queryHash);
53
+ });
54
+ }
55
+ const useSuspenseQuery = (query, opts) => {
56
+ const nonSuspenseResult = db.current.useQuery(query, Object.assign({}, opts));
57
+ if (nonSuspenseResult.data) {
58
+ return {
59
+ data: nonSuspenseResult.data,
60
+ pageInfo: nonSuspenseResult.pageInfo,
61
+ };
62
+ }
63
+ // should never happen (typeguard)
64
+ if (!clientRef.current) {
65
+ throw new Error('Client ref not set up');
66
+ }
67
+ let entry = clientRef.current.getExistingResultForQuery(query, {
68
+ ruleParams: opts === null || opts === void 0 ? void 0 : opts.ruleParams,
69
+ });
70
+ if (!entry) {
71
+ entry = clientRef.current.query(query, opts);
72
+ }
73
+ if (entry.status === 'pending') {
74
+ throw entry.promise;
75
+ }
76
+ if (entry.status === 'error') {
77
+ throw entry.error;
78
+ }
79
+ if (entry.status === 'success') {
80
+ const data = entry.data;
81
+ const result = clientRef.current.completeIsomorphic(query, data.triples, data.attrs, data.pageInfo);
82
+ return result;
83
+ }
84
+ };
85
+ return ((0, jsx_runtime_1.jsx)(SuspsenseQueryContext.Provider, { value: { useSuspenseQuery, ssrUser: props.user }, children: (0, jsx_runtime_1.jsx)(stream.Provider, { nonce: props.nonce, onFlush: () => {
86
+ const toSend = [];
87
+ for (const [key, value] of clientRef.current.resultMap.entries()) {
88
+ if (trackedKeys.has(key) && value.status === 'success') {
89
+ toSend.push({
90
+ queryKey: key,
91
+ value: value.data,
92
+ });
93
+ }
94
+ }
95
+ trackedKeys.clear();
96
+ return toSend;
97
+ }, onEntries: (entries) => {
98
+ entries.forEach((entry) => {
99
+ clientRef.current.addQueryResult(entry.queryKey, entry.value);
100
+ });
101
+ }, children: props.children }) }));
102
+ };
103
+ exports.InstantSuspenseProvider = InstantSuspenseProvider;
104
+ /**
105
+ *
106
+ * The first step: init your application!
107
+ *
108
+ * Visit https://instantdb.com/dash to get your `appId` :)
109
+ *
110
+ * @example
111
+ * import { init } from "@instantdb/react"
112
+ *
113
+ * const db = init({ appId: "my-app-id" })
114
+ *
115
+ * // You can also provide a schema for type safety and editor autocomplete!
116
+ *
117
+ * import { init } from "@instantdb/react"
118
+ * import schema from ""../instant.schema.ts";
119
+ *
120
+ * const db = init({ appId: "my-app-id", schema })
121
+ *
122
+ * // To learn more: https://instantdb.com/docs/modeling-data
123
+ */
124
+ function init(config) {
125
+ return new InstantNextDatabase(config, {
126
+ '@instantdb/react': version_ts_1.default,
127
+ });
128
+ }
129
+ class InstantNextDatabase extends InstantReactWebDatabase_ts_1.default {
130
+ constructor() {
131
+ super(...arguments);
132
+ this.useSuspenseQuery = (q, opts) => {
133
+ const ctx = (0, react_1.useContext)(SuspsenseQueryContext);
134
+ if (!ctx) {
135
+ throw new Error('useSuspenseQuery must be used within a SuspenseQueryProvider');
136
+ }
137
+ return ctx.useSuspenseQuery(q, opts);
138
+ };
139
+ this.useAuth = () => {
140
+ const ctx = (0, react_1.useContext)(SuspsenseQueryContext);
141
+ const realAuthResult = this._useAuth();
142
+ if (!ctx) {
143
+ return realAuthResult;
144
+ }
145
+ const { ssrUser } = ctx;
146
+ if (ssrUser === undefined) {
147
+ return realAuthResult;
148
+ }
149
+ if (realAuthResult.isLoading) {
150
+ return {
151
+ error: undefined,
152
+ isLoading: false,
153
+ user: ssrUser !== null && ssrUser !== void 0 ? ssrUser : undefined, // null -> undefined for the response
154
+ };
155
+ }
156
+ return realAuthResult;
157
+ };
158
+ }
159
+ }
160
+ exports.InstantNextDatabase = InstantNextDatabase;
161
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AA0Nb,oBASC;;AAlOD,0CAYyB;AACzB,iCAAoE;AACpE,8EAGuC;AACvC,+DAAoC;AAEpC,+FAAoE;AAEpE,wCAA8C;AAc9C,MAAM,MAAM,GAAG,IAAA,2DAA6B,GAAO,CAAC;AAOpD,MAAM,qBAAqB,GAAG,IAAA,qBAAa,EACzC,IAAI,CACL,CAAC;AAEF,mCAAmC;AAC5B,MAAM,sBAAsB,GAAG,CAIpC,GAA8C,EAS7C,EAAE;IACH,OAAO,CAAkC,CAAM,EAAE,IAAS,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAQ,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,sBAAsB,0BAuBjC;AAMK,MAAM,uBAAuB,GAAG,CACrC,KAAwC,EACxC,EAAE;;IACF,MAAM,SAAS,GAAG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CAAyC;IAHnD;;QAIS,qBAAgB,GAAG,CACxB,CAAI,EACJ,IAEC,EAID,EAAE;YACF,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAQ,CAAC;QAC9C,CAAC,CAAC;QAEF,YAAO,GAAG,GAAc,EAAE;YACxB,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;YAC9C,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,cAAc,CAAC;YACxB,CAAC;YAED,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;YACxB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,cAAc,CAAC;YACxB,CAAC;YACD,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;gBAC7B,OAAO;oBACL,KAAK,EAAE,SAAS;oBAChB,SAAS,EAAE,KAAK;oBAChB,IAAI,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,SAAS,EAAE,qCAAqC;iBAClE,CAAC;YACJ,CAAC;YAED,OAAO,cAAc,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC;CAAA;AA3CD,kDA2CC","sourcesContent":["'use client';\nimport {\n AuthState,\n FrameworkClient,\n InstantConfig,\n InstantSchemaDef,\n InstantUnknownSchema,\n InstaQLResponse,\n PageInfoResponse,\n parseSchemaFromJSON,\n RuleParams,\n User,\n ValidQuery,\n} from '@instantdb/core';\nimport { createContext, useContext, useRef, useState } from 'react';\nimport {\n createHydrationStreamProvider,\n isServer,\n} from './HydrationStreamProvider.tsx';\nimport version from '../version.ts';\n\nimport InstantReactWebDatabase from '../InstantReactWebDatabase.ts';\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\nimport { init as baseInit } from '../init.ts';\n\ntype InstantSuspenseProviderProps<\n Schema extends InstantSchemaDef<any, any, any>,\n> = {\n nonce?: string;\n children: React.ReactNode;\n db?: InstantReactWebDatabase<Schema, any>;\n config?: Omit<InstantConfig<any, any>, 'schema'> & {\n schema: string;\n };\n user?: User | null;\n};\n\nconst stream = createHydrationStreamProvider<any>();\n\ntype SuspenseQueryContextValue = {\n useSuspenseQuery: (query: any, opts?: SuspenseQueryOpts) => any;\n ssrUser: User | null | undefined;\n};\n\nconst SuspsenseQueryContext = createContext<SuspenseQueryContextValue | null>(\n null,\n);\n\n// Creates a typed useSuspense hook\nexport const createUseSuspenseQuery = <\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean,\n>(\n _db: InstantReactWebDatabase<Schema, UseDates>,\n): (<Q extends ValidQuery<Q, Schema>>(\n q: Q,\n opts?: {\n ruleParams: RuleParams;\n },\n) => {\n data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;\n pageInfo?: PageInfoResponse<Q>;\n}) => {\n return <Q extends ValidQuery<Q, Schema>>(q: any, opts: any) => {\n const ctx = useContext(SuspsenseQueryContext);\n if (!ctx) {\n throw new Error(\n 'useSuspenseQuery must be used within a SuspenseQueryProvider',\n );\n }\n return ctx.useSuspenseQuery(q, opts) as any;\n };\n};\n\ntype SuspenseQueryOpts = {\n ruleParams: RuleParams;\n};\n\nexport const InstantSuspenseProvider = (\n props: InstantSuspenseProviderProps<any>,\n) => {\n const clientRef = useRef<FrameworkClient | null>(null);\n\n if (!props.db && !props.config) {\n throw new Error(\n 'Must provide either a db or config to InstantSuspenseProvider',\n );\n }\n\n const db = useRef<InstantReactAbstractDatabase<any, any>>(\n props.db\n ? props.db\n : baseInit({\n ...props.config!,\n schema: parseSchemaFromJSON(JSON.parse(props.config!.schema)),\n }),\n );\n\n const [trackedKeys] = useState(() => new Set<string>());\n\n if (!clientRef.current) {\n if (props.user && !props.user.refresh_token) {\n throw new Error(\n 'User must have a refresh_token field. Recieved: ' +\n JSON.stringify(props.user, null, 2),\n );\n }\n clientRef.current = new FrameworkClient({\n token: props.user?.refresh_token,\n db: db.current.core,\n });\n }\n\n if (isServer) {\n clientRef.current.subscribe((result) => {\n const { queryHash } = result;\n trackedKeys.add(queryHash);\n });\n }\n\n const useSuspenseQuery = (query: any, opts: SuspenseQueryOpts) => {\n const nonSuspenseResult = db.current.useQuery(query, {\n ...opts,\n });\n\n if (nonSuspenseResult.data) {\n return {\n data: nonSuspenseResult.data,\n pageInfo: nonSuspenseResult.pageInfo,\n };\n }\n\n // should never happen (typeguard)\n if (!clientRef.current) {\n throw new Error('Client ref not set up');\n }\n\n let entry = clientRef.current.getExistingResultForQuery(query, {\n ruleParams: opts?.ruleParams,\n });\n\n if (!entry) {\n entry = clientRef.current!.query(query, opts);\n }\n\n if (entry.status === 'pending') {\n throw entry.promise;\n }\n\n if (entry.status === 'error') {\n throw entry.error;\n }\n\n if (entry.status === 'success') {\n const data = entry.data;\n const result = clientRef.current.completeIsomorphic(\n query,\n data.triples,\n data.attrs,\n data.pageInfo,\n );\n\n return result;\n }\n };\n\n return (\n <SuspsenseQueryContext.Provider\n value={{ useSuspenseQuery, ssrUser: props.user }}\n >\n <stream.Provider\n nonce={props.nonce}\n onFlush={() => {\n const toSend: { queryKey: string; value: any }[] = [];\n for (const [key, value] of clientRef.current!.resultMap.entries()) {\n if (trackedKeys.has(key) && value.status === 'success') {\n toSend.push({\n queryKey: key,\n value: value.data,\n });\n }\n }\n\n trackedKeys.clear();\n return toSend;\n }}\n onEntries={(entries) => {\n entries.forEach((entry) => {\n clientRef.current!.addQueryResult(entry.queryKey, entry.value);\n });\n }}\n >\n {props.children}\n </stream.Provider>\n </SuspsenseQueryContext.Provider>\n );\n};\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\nexport class InstantNextDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean,\n> extends InstantReactWebDatabase<Schema, UseDates> {\n public useSuspenseQuery = <Q extends ValidQuery<Q, Schema>>(\n q: Q,\n opts?: {\n ruleParams: RuleParams;\n },\n ): {\n data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;\n pageInfo?: PageInfoResponse<Q>;\n } => {\n const ctx = useContext(SuspsenseQueryContext);\n if (!ctx) {\n throw new Error(\n 'useSuspenseQuery must be used within a SuspenseQueryProvider',\n );\n }\n return ctx.useSuspenseQuery(q, opts) as any;\n };\n\n useAuth = (): AuthState => {\n const ctx = useContext(SuspsenseQueryContext);\n const realAuthResult = this._useAuth();\n if (!ctx) {\n return realAuthResult;\n }\n\n const { ssrUser } = ctx;\n if (ssrUser === undefined) {\n return realAuthResult;\n }\n if (realAuthResult.isLoading) {\n return {\n error: undefined,\n isLoading: false,\n user: ssrUser ?? undefined, // null -> undefined for the response\n };\n }\n\n return realAuthResult;\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { id, tx, lookup, i, InstantAPIError, SyncTableCallbackEventType, type QueryResponse, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantObject, type InstantEntity, type InstantSchemaDatabase, type InstantUnknownSchemaDef, type IInstantDatabase, type User, type AuthState, type Query, type Config, type InstaQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLFields, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError } from '@instantdb/core';
1
+ import { id, tx, lookup, i, InstantAPIError, SyncTableCallbackEventType, type QueryResponse, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantObject, type InstantEntity, type InstantSchemaDatabase, type InstantUnknownSchemaDef, type IInstantDatabase, type User, type AuthState, type Query, type Config, type InstaQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLFields, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, createInstantRouteHandler } from '@instantdb/core';
2
2
  import { InstantReactAbstractDatabase } from '@instantdb/react-common';
3
3
  import InstantReactWebDatabase from './InstantReactWebDatabase.ts';
4
4
  import { init, init_experimental } from './init.ts';
5
5
  import { Cursors } from './Cursors.tsx';
6
- export { id, tx, lookup, init, init_experimental, InstantReactWebDatabase, Cursors, i, InstantAPIError, InstantReactAbstractDatabase, SyncTableCallbackEventType, type Config, type InstantConfig, type InstantUnknownSchemaDef, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type IInstantDatabase, type InstaQLParams, type ValidQuery, type InstaQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, };
6
+ export { id, tx, lookup, init, init_experimental, createInstantRouteHandler, InstantReactWebDatabase, Cursors, i, InstantAPIError, InstantReactAbstractDatabase, SyncTableCallbackEventType, type Config, type InstantConfig, type InstantUnknownSchemaDef, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type IInstantDatabase, type InstaQLParams, type ValidQuery, type InstaQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, };
7
7
  //# sourceMappingURL=index.d.ts.map