@instantdb/react 0.22.90-experimental.drewh-ssr.20312174628.1 → 0.22.90-experimental.drewh-ssr.20347747146.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/index.d.ts +2 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/next-ssr/InstantNextDatabase.d.ts +12 -0
- package/dist/commonjs/next-ssr/InstantNextDatabase.d.ts.map +1 -0
- package/dist/commonjs/next-ssr/InstantNextDatabase.js +43 -0
- package/dist/commonjs/next-ssr/InstantNextDatabase.js.map +1 -0
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.d.ts +28 -0
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.d.ts.map +1 -0
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.js +98 -0
- package/dist/commonjs/next-ssr/InstantSuspenseProvider.js.map +1 -0
- package/dist/commonjs/next-ssr/getUserOnServer.d.ts +2 -0
- package/dist/commonjs/next-ssr/getUserOnServer.d.ts.map +1 -0
- package/dist/commonjs/next-ssr/getUserOnServer.js +21 -0
- package/dist/commonjs/next-ssr/getUserOnServer.js.map +1 -0
- package/dist/commonjs/next-ssr/index.d.ts +6 -28
- package/dist/commonjs/next-ssr/index.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/index.js +11 -126
- package/dist/commonjs/next-ssr/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/next-ssr/InstantNextDatabase.d.ts +12 -0
- package/dist/esm/next-ssr/InstantNextDatabase.d.ts.map +1 -0
- package/dist/esm/next-ssr/InstantNextDatabase.js +36 -0
- package/dist/esm/next-ssr/InstantNextDatabase.js.map +1 -0
- package/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +28 -0
- package/dist/esm/next-ssr/InstantSuspenseProvider.d.ts.map +1 -0
- package/dist/esm/next-ssr/InstantSuspenseProvider.js +93 -0
- package/dist/esm/next-ssr/InstantSuspenseProvider.js.map +1 -0
- package/dist/esm/next-ssr/getUserOnServer.d.ts +2 -0
- package/dist/esm/next-ssr/getUserOnServer.d.ts.map +1 -0
- package/dist/esm/next-ssr/getUserOnServer.js +17 -0
- package/dist/esm/next-ssr/getUserOnServer.js.map +1 -0
- package/dist/esm/next-ssr/index.d.ts +6 -28
- package/dist/esm/next-ssr/index.d.ts.map +1 -1
- package/dist/esm/next-ssr/index.js +5 -121
- package/dist/esm/next-ssr/index.js.map +1 -1
- package/dist/standalone/index.js +1322 -1383
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
- package/src/index.ts +0 -2
- package/src/next-ssr/InstantNextDatabase.tsx +57 -0
- package/src/next-ssr/InstantSuspenseProvider.tsx +187 -0
- package/src/next-ssr/getUserOnServer.ts +8 -0
- package/src/next-ssr/index.tsx +6 -223
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -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
|
|
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';
|
|
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,
|
|
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, };
|
|
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,EAC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AY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAGnB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -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.
|
|
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;
|
|
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,7 +15,6 @@ 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; } });
|
|
19
18
|
const react_common_1 = require("@instantdb/react-common");
|
|
20
19
|
Object.defineProperty(exports, "InstantReactAbstractDatabase", { enumerable: true, get: function () { return react_common_1.InstantReactAbstractDatabase; } });
|
|
21
20
|
const InstantReactWebDatabase_ts_1 = __importDefault(require("./InstantReactWebDatabase.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthState, InstantSchemaDef, InstaQLResponse, PageInfoResponse, RuleParams, ValidQuery } from '@instantdb/core';
|
|
2
|
+
import InstantReactWebDatabase from '../InstantReactWebDatabase.ts';
|
|
3
|
+
export declare class InstantNextDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean> extends InstantReactWebDatabase<Schema, UseDates> {
|
|
4
|
+
useSuspenseQuery: <Q extends ValidQuery<Q, Schema>>(q: Q, opts?: {
|
|
5
|
+
ruleParams: RuleParams;
|
|
6
|
+
}) => {
|
|
7
|
+
data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;
|
|
8
|
+
pageInfo?: PageInfoResponse<Q>;
|
|
9
|
+
};
|
|
10
|
+
useAuth: () => AuthState;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=InstantNextDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstantNextDatabase.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/InstantNextDatabase.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,MAAM,+BAA+B,CAAC;AAIpE,qBAAa,mBAAmB,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,43 @@
|
|
|
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 = void 0;
|
|
8
|
+
const InstantReactWebDatabase_ts_1 = __importDefault(require("../InstantReactWebDatabase.js"));
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const InstantSuspenseProvider_tsx_1 = require("./InstantSuspenseProvider.js");
|
|
11
|
+
class InstantNextDatabase extends InstantReactWebDatabase_ts_1.default {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.useSuspenseQuery = (q, opts) => {
|
|
15
|
+
const ctx = (0, react_1.useContext)(InstantSuspenseProvider_tsx_1.SuspsenseQueryContext);
|
|
16
|
+
if (!ctx) {
|
|
17
|
+
throw new Error('useSuspenseQuery must be used within a SuspenseQueryProvider');
|
|
18
|
+
}
|
|
19
|
+
return ctx.useSuspenseQuery(q, opts);
|
|
20
|
+
};
|
|
21
|
+
this.useAuth = () => {
|
|
22
|
+
const ctx = (0, react_1.useContext)(InstantSuspenseProvider_tsx_1.SuspsenseQueryContext);
|
|
23
|
+
const realAuthResult = this._useAuth();
|
|
24
|
+
if (!ctx) {
|
|
25
|
+
return realAuthResult;
|
|
26
|
+
}
|
|
27
|
+
const { ssrUser } = ctx;
|
|
28
|
+
if (ssrUser === undefined) {
|
|
29
|
+
return realAuthResult;
|
|
30
|
+
}
|
|
31
|
+
if (realAuthResult.isLoading) {
|
|
32
|
+
return {
|
|
33
|
+
error: undefined,
|
|
34
|
+
isLoading: false,
|
|
35
|
+
user: ssrUser !== null && ssrUser !== void 0 ? ssrUser : undefined, // null -> undefined for the response
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return realAuthResult;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.InstantNextDatabase = InstantNextDatabase;
|
|
43
|
+
//# sourceMappingURL=InstantNextDatabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstantNextDatabase.js","sourceRoot":"","sources":["../../../src/next-ssr/InstantNextDatabase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AASb,+FAAoE;AACpE,iCAAmC;AACnC,8EAAsE;AAEtE,MAAa,mBAGX,SAAQ,oCAAyC;IAHnD;;QAIS,qBAAgB,GAAG,CACxB,CAAI,EACJ,IAEC,EAID,EAAE;YACF,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,mDAAqB,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,mDAAqB,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 InstantSchemaDef,\n InstaQLResponse,\n PageInfoResponse,\n RuleParams,\n ValidQuery,\n} from '@instantdb/core';\nimport InstantReactWebDatabase from '../InstantReactWebDatabase.ts';\nimport { useContext } from 'react';\nimport { SuspsenseQueryContext } from './InstantSuspenseProvider.tsx';\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"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { InstantConfig, InstantSchemaDef, 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
|
+
type SuspenseQueryContextValue = {
|
|
13
|
+
useSuspenseQuery: (query: any, opts?: SuspenseQueryOpts) => any;
|
|
14
|
+
ssrUser: User | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const SuspsenseQueryContext: import("react").Context<SuspenseQueryContextValue | null>;
|
|
17
|
+
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?: {
|
|
18
|
+
ruleParams: RuleParams;
|
|
19
|
+
}) => {
|
|
20
|
+
data: InstaQLResponse<Schema, Q, NonNullable<UseDates>>;
|
|
21
|
+
pageInfo?: PageInfoResponse<Q>;
|
|
22
|
+
});
|
|
23
|
+
type SuspenseQueryOpts = {
|
|
24
|
+
ruleParams: RuleParams;
|
|
25
|
+
};
|
|
26
|
+
export declare const InstantSuspenseProvider: (props: InstantSuspenseProviderProps<any>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=InstantSuspenseProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstantSuspenseProvider.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/InstantSuspenseProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,MAAM,+BAA+B,CAAC;AAQpE,KAAK,4BAA4B,CAC/B,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAC5C;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,uBAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG;QACjD,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,CAAC;AAIF,KAAK,yBAAyB,GAAG;IAC/B,gBAAgB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,iBAAiB,KAAK,GAAG,CAAC;IAChE,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,qBAAqB,2DACqB,CAAC;AAGxD,eAAO,MAAM,sBAAsB,GACjC,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,SAAS,OAAO,EAExB,KAAK,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAC7C,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,EAClC,CAAC,EAAE,CAAC,EACJ,IAAI,CAAC,EAAE;IACL,UAAU,EAAE,UAAU,CAAC;CACxB,KACE;IACH,IAAI,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAChC,CAUA,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,OAAO,4BAA4B,CAAC,GAAG,CAAC,4CAkHzC,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.InstantSuspenseProvider = exports.createUseSuspenseQuery = exports.SuspsenseQueryContext = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const core_1 = require("@instantdb/core");
|
|
7
|
+
const HydrationStreamProvider_tsx_1 = require("./HydrationStreamProvider.js");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const stream = (0, HydrationStreamProvider_tsx_1.createHydrationStreamProvider)();
|
|
10
|
+
exports.SuspsenseQueryContext = (0, react_1.createContext)(null);
|
|
11
|
+
// Creates a typed useSuspense hook
|
|
12
|
+
const createUseSuspenseQuery = (_db) => {
|
|
13
|
+
return (q, opts) => {
|
|
14
|
+
const ctx = (0, react_1.useContext)(exports.SuspsenseQueryContext);
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
throw new Error('useSuspenseQuery must be used within a SuspenseQueryProvider');
|
|
17
|
+
}
|
|
18
|
+
return ctx.useSuspenseQuery(q, opts);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.createUseSuspenseQuery = createUseSuspenseQuery;
|
|
22
|
+
const InstantSuspenseProvider = (props) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const clientRef = (0, react_1.useRef)(null);
|
|
25
|
+
if (!props.db) {
|
|
26
|
+
throw new Error('Must provide either a db or config to InstantSuspenseProvider');
|
|
27
|
+
}
|
|
28
|
+
const db = (0, react_1.useRef)(props.db);
|
|
29
|
+
const [trackedKeys] = (0, react_1.useState)(() => new Set());
|
|
30
|
+
if (!clientRef.current) {
|
|
31
|
+
if (props.user && !props.user.refresh_token) {
|
|
32
|
+
throw new Error('User must have a refresh_token field. Recieved: ' +
|
|
33
|
+
JSON.stringify(props.user, null, 2));
|
|
34
|
+
}
|
|
35
|
+
clientRef.current = new core_1.FrameworkClient({
|
|
36
|
+
token: (_a = props.user) === null || _a === void 0 ? void 0 : _a.refresh_token,
|
|
37
|
+
db: db.current.core,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (HydrationStreamProvider_tsx_1.isServer) {
|
|
41
|
+
clientRef.current.subscribe((result) => {
|
|
42
|
+
const { queryHash } = result;
|
|
43
|
+
trackedKeys.add(queryHash);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const useSuspenseQuery = (query, opts) => {
|
|
47
|
+
const nonSuspenseResult = db.current.useQuery(query, Object.assign({}, opts));
|
|
48
|
+
if (nonSuspenseResult.data) {
|
|
49
|
+
return {
|
|
50
|
+
data: nonSuspenseResult.data,
|
|
51
|
+
pageInfo: nonSuspenseResult.pageInfo,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// should never happen (typeguard)
|
|
55
|
+
if (!clientRef.current) {
|
|
56
|
+
throw new Error('Client ref not set up');
|
|
57
|
+
}
|
|
58
|
+
let entry = clientRef.current.getExistingResultForQuery(query, {
|
|
59
|
+
ruleParams: opts === null || opts === void 0 ? void 0 : opts.ruleParams,
|
|
60
|
+
});
|
|
61
|
+
if (!entry) {
|
|
62
|
+
entry = clientRef.current.query(query, opts);
|
|
63
|
+
}
|
|
64
|
+
if (entry.status === 'pending') {
|
|
65
|
+
throw entry.promise;
|
|
66
|
+
}
|
|
67
|
+
if (entry.status === 'error') {
|
|
68
|
+
throw entry.error;
|
|
69
|
+
}
|
|
70
|
+
if (entry.status === 'success' && entry.type === 'session') {
|
|
71
|
+
return entry.data;
|
|
72
|
+
}
|
|
73
|
+
if (entry.status === 'success') {
|
|
74
|
+
const data = entry.data;
|
|
75
|
+
const result = clientRef.current.completeIsomorphic(query, data.triples, data.attrs, data.pageInfo);
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(exports.SuspsenseQueryContext.Provider, { value: { useSuspenseQuery, ssrUser: props.user }, children: (0, jsx_runtime_1.jsx)(stream.Provider, { nonce: props.nonce, onFlush: () => {
|
|
80
|
+
const toSend = [];
|
|
81
|
+
for (const [key, value] of clientRef.current.resultMap.entries()) {
|
|
82
|
+
if (trackedKeys.has(key) && value.status === 'success') {
|
|
83
|
+
toSend.push({
|
|
84
|
+
queryKey: key,
|
|
85
|
+
value: value.data,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
trackedKeys.clear();
|
|
90
|
+
return toSend;
|
|
91
|
+
}, onEntries: (entries) => {
|
|
92
|
+
entries.forEach((entry) => {
|
|
93
|
+
clientRef.current.addQueryResult(entry.queryKey, entry.value);
|
|
94
|
+
});
|
|
95
|
+
}, children: props.children }) }));
|
|
96
|
+
};
|
|
97
|
+
exports.InstantSuspenseProvider = InstantSuspenseProvider;
|
|
98
|
+
//# sourceMappingURL=InstantSuspenseProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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ACb,KAAK,EAAE,KAAK,CAAC,IAAI;yBAClB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,WAAW,CAAC,KAAK,EAAE,CAAC;gBACpB,OAAO,MAAM,CAAC;YAChB,CAAC,EACD,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBACrB,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBACxB,SAAS,CAAC,OAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBACjE,CAAC,CAAC,CAAC;YACL,CAAC,YAEA,KAAK,CAAC,QAAQ,GACC,GACa,CAClC,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,uBAAuB,2BAmHlC","sourcesContent":["'use client';\nimport {\n FrameworkClient,\n InstantConfig,\n InstantSchemaDef,\n InstaQLResponse,\n PageInfoResponse,\n RuleParams,\n User,\n ValidQuery,\n} from '@instantdb/core';\nimport InstantReactWebDatabase from '../InstantReactWebDatabase.ts';\nimport {\n createHydrationStreamProvider,\n isServer,\n} from './HydrationStreamProvider.tsx';\nimport { createContext, useContext, useRef, useState } from 'react';\nimport { InstantReactAbstractDatabase } from '@instantdb/react-common';\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\nexport const SuspsenseQueryContext =\n createContext<SuspenseQueryContextValue | null>(null);\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) {\n throw new Error(\n 'Must provide either a db or config to InstantSuspenseProvider',\n );\n }\n\n const db = useRef<InstantReactAbstractDatabase<any, any>>(props.db);\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' && entry.type === 'session') {\n return entry.data;\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOnServer.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/getUserOnServer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,oBAK3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getUserOnServer = void 0;
|
|
13
|
+
const headers_js_1 = require("next/headers.js");
|
|
14
|
+
const getUserOnServer = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const cookieStore = yield (0, headers_js_1.cookies)();
|
|
16
|
+
const userJSON = cookieStore.get('instant_user');
|
|
17
|
+
const user = userJSON ? JSON.parse(userJSON.value) : null;
|
|
18
|
+
return user;
|
|
19
|
+
});
|
|
20
|
+
exports.getUserOnServer = getUserOnServer;
|
|
21
|
+
//# sourceMappingURL=getUserOnServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOnServer.js","sourceRoot":"","sources":["../../../src/next-ssr/getUserOnServer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA0C;AAEnC,MAAM,eAAe,GAAG,GAAS,EAAE;IACxC,MAAM,WAAW,GAAG,MAAM,IAAA,oBAAO,GAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACjD,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;AALW,QAAA,eAAe,mBAK1B","sourcesContent":["import { cookies } from 'next/headers.js';\n\nexport const getUserOnServer = async () => {\n const cookieStore = await cookies();\n const userJSON = cookieStore.get('instant_user');\n const user = userJSON ? JSON.parse(userJSON.value) : null;\n return user;\n};\n"]}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
1
|
+
import { InstantConfig, InstantSchemaDef, InstantUnknownSchema } from '@instantdb/core';
|
|
2
|
+
import { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
3
|
+
export { getUserOnServer } from './getUserOnServer.ts';
|
|
4
|
+
export { InstantNextDatabase } from './InstantNextDatabase.tsx';
|
|
5
|
+
export { InstantSuspenseProvider } from './InstantSuspenseProvider.tsx';
|
|
6
|
+
export { createInstantRouteHandler } from '@instantdb/core';
|
|
19
7
|
/**
|
|
20
8
|
*
|
|
21
9
|
* The first step: init your application!
|
|
@@ -37,14 +25,4 @@ export declare const InstantSuspenseProvider: (props: InstantSuspenseProviderPro
|
|
|
37
25
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
38
26
|
*/
|
|
39
27
|
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
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"
|
|
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,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,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,103 +1,20 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
"use strict";
|
|
3
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
4
|
};
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
6
|
+
exports.createInstantRouteHandler = exports.InstantSuspenseProvider = exports.InstantNextDatabase = exports.getUserOnServer = void 0;
|
|
8
7
|
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
8
|
const version_ts_1 = __importDefault(require("../version.js"));
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return ctx.useSuspenseQuery(q, opts);
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.createUseSuspenseQuery = createUseSuspenseQuery;
|
|
28
|
-
const InstantSuspenseProvider = (props) => {
|
|
29
|
-
var _a;
|
|
30
|
-
const clientRef = (0, react_1.useRef)(null);
|
|
31
|
-
if (!props.db) {
|
|
32
|
-
throw new Error('Must provide either a db or config to InstantSuspenseProvider');
|
|
33
|
-
}
|
|
34
|
-
const db = (0, react_1.useRef)(props.db);
|
|
35
|
-
const [trackedKeys] = (0, react_1.useState)(() => new Set());
|
|
36
|
-
if (!clientRef.current) {
|
|
37
|
-
if (props.user && !props.user.refresh_token) {
|
|
38
|
-
throw new Error('User must have a refresh_token field. Recieved: ' +
|
|
39
|
-
JSON.stringify(props.user, null, 2));
|
|
40
|
-
}
|
|
41
|
-
clientRef.current = new core_1.FrameworkClient({
|
|
42
|
-
token: (_a = props.user) === null || _a === void 0 ? void 0 : _a.refresh_token,
|
|
43
|
-
db: db.current.core,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (HydrationStreamProvider_tsx_1.isServer) {
|
|
47
|
-
clientRef.current.subscribe((result) => {
|
|
48
|
-
const { queryHash } = result;
|
|
49
|
-
trackedKeys.add(queryHash);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const useSuspenseQuery = (query, opts) => {
|
|
53
|
-
const nonSuspenseResult = db.current.useQuery(query, Object.assign({}, opts));
|
|
54
|
-
if (nonSuspenseResult.data) {
|
|
55
|
-
return {
|
|
56
|
-
data: nonSuspenseResult.data,
|
|
57
|
-
pageInfo: nonSuspenseResult.pageInfo,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// should never happen (typeguard)
|
|
61
|
-
if (!clientRef.current) {
|
|
62
|
-
throw new Error('Client ref not set up');
|
|
63
|
-
}
|
|
64
|
-
let entry = clientRef.current.getExistingResultForQuery(query, {
|
|
65
|
-
ruleParams: opts === null || opts === void 0 ? void 0 : opts.ruleParams,
|
|
66
|
-
});
|
|
67
|
-
if (!entry) {
|
|
68
|
-
entry = clientRef.current.query(query, opts);
|
|
69
|
-
}
|
|
70
|
-
if (entry.status === 'pending') {
|
|
71
|
-
throw entry.promise;
|
|
72
|
-
}
|
|
73
|
-
if (entry.status === 'error') {
|
|
74
|
-
throw entry.error;
|
|
75
|
-
}
|
|
76
|
-
if (entry.status === 'success') {
|
|
77
|
-
const data = entry.data;
|
|
78
|
-
const result = clientRef.current.completeIsomorphic(query, data.triples, data.attrs, data.pageInfo);
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
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: () => {
|
|
83
|
-
const toSend = [];
|
|
84
|
-
for (const [key, value] of clientRef.current.resultMap.entries()) {
|
|
85
|
-
if (trackedKeys.has(key) && value.status === 'success') {
|
|
86
|
-
toSend.push({
|
|
87
|
-
queryKey: key,
|
|
88
|
-
value: value.data,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
trackedKeys.clear();
|
|
93
|
-
return toSend;
|
|
94
|
-
}, onEntries: (entries) => {
|
|
95
|
-
entries.forEach((entry) => {
|
|
96
|
-
clientRef.current.addQueryResult(entry.queryKey, entry.value);
|
|
97
|
-
});
|
|
98
|
-
}, children: props.children }) }));
|
|
99
|
-
};
|
|
100
|
-
exports.InstantSuspenseProvider = InstantSuspenseProvider;
|
|
9
|
+
const InstantNextDatabase_tsx_1 = require("./InstantNextDatabase.js");
|
|
10
|
+
var getUserOnServer_ts_1 = require("./getUserOnServer.js");
|
|
11
|
+
Object.defineProperty(exports, "getUserOnServer", { enumerable: true, get: function () { return getUserOnServer_ts_1.getUserOnServer; } });
|
|
12
|
+
var InstantNextDatabase_tsx_2 = require("./InstantNextDatabase.js");
|
|
13
|
+
Object.defineProperty(exports, "InstantNextDatabase", { enumerable: true, get: function () { return InstantNextDatabase_tsx_2.InstantNextDatabase; } });
|
|
14
|
+
var InstantSuspenseProvider_tsx_1 = require("./InstantSuspenseProvider.js");
|
|
15
|
+
Object.defineProperty(exports, "InstantSuspenseProvider", { enumerable: true, get: function () { return InstantSuspenseProvider_tsx_1.InstantSuspenseProvider; } });
|
|
16
|
+
var core_1 = require("@instantdb/core");
|
|
17
|
+
Object.defineProperty(exports, "createInstantRouteHandler", { enumerable: true, get: function () { return core_1.createInstantRouteHandler; } });
|
|
101
18
|
/**
|
|
102
19
|
*
|
|
103
20
|
* The first step: init your application!
|
|
@@ -119,40 +36,8 @@ exports.InstantSuspenseProvider = InstantSuspenseProvider;
|
|
|
119
36
|
* // To learn more: https://instantdb.com/docs/modeling-data
|
|
120
37
|
*/
|
|
121
38
|
function init(config) {
|
|
122
|
-
return new InstantNextDatabase(config, {
|
|
39
|
+
return new InstantNextDatabase_tsx_1.InstantNextDatabase(config, {
|
|
123
40
|
'@instantdb/react': version_ts_1.default,
|
|
124
41
|
});
|
|
125
42
|
}
|
|
126
|
-
class InstantNextDatabase extends InstantReactWebDatabase_ts_1.default {
|
|
127
|
-
constructor() {
|
|
128
|
-
super(...arguments);
|
|
129
|
-
this.useSuspenseQuery = (q, opts) => {
|
|
130
|
-
const ctx = (0, react_1.useContext)(SuspsenseQueryContext);
|
|
131
|
-
if (!ctx) {
|
|
132
|
-
throw new Error('useSuspenseQuery must be used within a SuspenseQueryProvider');
|
|
133
|
-
}
|
|
134
|
-
return ctx.useSuspenseQuery(q, opts);
|
|
135
|
-
};
|
|
136
|
-
this.useAuth = () => {
|
|
137
|
-
const ctx = (0, react_1.useContext)(SuspsenseQueryContext);
|
|
138
|
-
const realAuthResult = this._useAuth();
|
|
139
|
-
if (!ctx) {
|
|
140
|
-
return realAuthResult;
|
|
141
|
-
}
|
|
142
|
-
const { ssrUser } = ctx;
|
|
143
|
-
if (ssrUser === undefined) {
|
|
144
|
-
return realAuthResult;
|
|
145
|
-
}
|
|
146
|
-
if (realAuthResult.isLoading) {
|
|
147
|
-
return {
|
|
148
|
-
error: undefined,
|
|
149
|
-
isLoading: false,
|
|
150
|
-
user: ssrUser !== null && ssrUser !== void 0 ? ssrUser : undefined, // null -> undefined for the response
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return realAuthResult;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
exports.InstantNextDatabase = InstantNextDatabase;
|
|
158
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAiNb,oBASC;;AAzND,0CAWyB;AACzB,iCAAoE;AACpE,8EAGuC;AACvC,+DAAoC;AAEpC,+FAAoE;AAepE,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,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BAAO;KAC5B,CAAC,CAAC;AACL,CAAC;AAED,MAAa,mBAGX,SAAQ,oCAAyC;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 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';\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) {\n throw new Error(\n 'Must provide either a db or config to InstantSuspenseProvider',\n );\n }\n\n const db = useRef<InstantReactAbstractDatabase<any, any>>(props.db);\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
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next-ssr/index.tsx"],"names":[],"mappings":";;;;;;AAqCA,oBASC;AAxCD,+DAAoC;AAEpC,sEAAgE;AAEhE,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AAExB,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 { getUserOnServer } from './getUserOnServer.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"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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
|
|
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';
|
|
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,
|
|
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, };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|