Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@instantdb/core

Package Overview
Dependencies
Maintainers
0
Versions
206
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instantdb/core - npm Package Compare versions

Comparing version 0.16.6 to 0.17.0-experimental.0

168

dist/index.d.ts

@@ -78,158 +78,2 @@ import Reactor from "./Reactor";

/**
*
* The first step: init your application!
*
* Visit https://instantdb.com/dash to get your `appId` :)
*
* @example
* const db = init({ appId: "my-app-id" })
*
* // You can also provide a schema for type safety and editor autocomplete!
*
* type Schema = {
* goals: {
* title: string
* }
* }
*
* const db = init<Schema>({ appId: "my-app-id" })
*
*/
declare function init<Schema extends {} = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config, Storage?: any, NetworkListener?: any): InstantCore<Schema, RoomSchema>;
declare function _init_internal<Schema extends {} | InstantGraph<any, any, any>, RoomSchema extends RoomSchemaShape, WithCardinalityInference extends boolean = false>(config: Config, Storage?: any, NetworkListener?: any, versions?: {
[key: string]: string;
}): InstantCore<Schema, RoomSchema, WithCardinalityInference>;
declare class InstantCore<Schema extends InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> implements IDatabase<Schema, RoomSchema, WithCardinalityInference> {
withCardinalityInference?: WithCardinalityInference;
_reactor: Reactor<RoomSchema>;
auth: Auth;
storage: Storage;
tx: TxChunk<Schema extends InstantGraph<any, any, {}> ? Schema : InstantGraph<any, any, {}>>;
constructor(reactor: Reactor<RoomSchema>);
/**
* Use this to write data! You can create, update, delete, and link objects
*
* @see https://instantdb.com/docs/instaml
*
* @example
* // Create a new object in the `goals` namespace
* const goalId = id();
* db.transact(tx.goals[goalId].update({title: "Get fit"}))
*
* // Update the title
* db.transact(tx.goals[goalId].update({title: "Get super fit"}))
*
* // Delete it
* db.transact(tx.goals[goalId].delete())
*
* // Or create an association:
* todoId = id();
* db.transact([
* tx.todos[todoId].update({ title: 'Go on a run' }),
* tx.goals[goalId].link({todos: todoId}),
* ])
*/
transact(chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]): Promise<TransactionResult>;
getLocalId(name: string): Promise<string>;
/**
* Use this to query your data!
*
* @see https://instantdb.com/docs/instaql
*
* @example
* // listen to all goals
* db.subscribeQuery({ goals: {} }, (resp) => {
* console.log(resp.data.goals)
* })
*
* // goals where the title is "Get Fit"
* db.subscribeQuery(
* { goals: { $: { where: { title: "Get Fit" } } } },
* (resp) => {
* console.log(resp.data.goals)
* }
* )
*
* // all goals, _alongside_ their todos
* db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
* console.log(resp.data.goals)
* });
*/
subscribeQuery<Q extends Schema extends InstantGraph<any, any> ? InstaQLParams<Schema> : Exactly<Query, Q>>(query: Q, cb: (resp: SubscriptionState<Q, Schema, WithCardinalityInference>) => void): () => void;
/**
* Listen for the logged in state. This is useful
* for deciding when to show a login screen.
*
* @see https://instantdb.com/docs/auth
* @example
* const unsub = db.subscribeAuth((auth) => {
* if (auth.user) {
* console.log('logged in as', auth.user.email)
* } else {
* console.log('logged out')
* }
* })
*/
subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn;
/**
* Listen for connection status changes to Instant. This is useful
* for building things like connectivity indicators
*
* @see https://www.instantdb.com/docs/patterns#connection-status
* @example
* const unsub = db.subscribeConnectionStatus((status) => {
* const connectionState =
* status === 'connecting' || status === 'opened'
* ? 'authenticating'
* : status === 'authenticated'
* ? 'connected'
* : status === 'closed'
* ? 'closed'
* : status === 'errored'
* ? 'errored'
* : 'unexpected state';
*
* console.log('Connection status:', connectionState);
* });
*/
subscribeConnectionStatus(cb: (status: ConnectionStatus) => void): UnsubscribeFn;
/**
* Join a room to publish and subscribe to topics and presence.
*
* @see https://instantdb.com/docs/presence-and-topics
* @example
* // init
* const db = init();
* const room = db.joinRoom(roomType, roomId);
* // usage
* const unsubscribeTopic = room.subscribeTopic("foo", console.log);
* const unsubscribePresence = room.subscribePresence({}, console.log);
* room.publishTopic("hello", { message: "hello world!" });
* room.publishPresence({ name: "joe" });
* // later
* unsubscribePresence();
* unsubscribeTopic();
* room.leaveRoom();
*/
joinRoom<RoomType extends keyof RoomSchema>(roomType?: RoomType, roomId?: string): RoomHandle<RoomSchema[RoomType]["presence"], RoomSchema[RoomType]["topics"]>;
shutdown(): void;
/**
* Use this for one-off queries.
* Returns local data if available, otherwise fetches from the server.
* Because we want to avoid stale data, this method will throw an error
* if the user is offline or there is no active connection to the server.
*
* @see https://instantdb.com/docs/instaql
*
* @example
*
* const resp = await db.queryOnce({ goals: {} });
* console.log(resp.data.goals)
*/
queryOnce<Q extends Schema extends InstantGraph<any, any> ? InstaQLParams<Schema> : Exactly<Query, Q>>(query: Q): Promise<{
data: QueryResponse<Q, Schema, WithCardinalityInference>;
pageInfo: PageInfoResponse<Q>;
}>;
}
/**
* Functions to log users in and out.

@@ -528,3 +372,5 @@ *

}
declare function init_experimental<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema>(config: InstantConfig<Schema>, Storage?: any, NetworkListener?: any): InstantCoreDatabase<Schema>;
declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema>(config: InstantConfig<Schema>, Storage?: any, NetworkListener?: any, versions?: {
[key: string]: string;
}): InstantCoreDatabase<Schema>;
type InstantRules = {

@@ -537,2 +383,3 @@ [EntityName: string]: {

delete?: string;
$default?: string;
};

@@ -542,3 +389,8 @@ bind?: string[];

};
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, InstantCoreDatabase, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type InstaQLParams, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type InstaQLEntity, type InstaQLResult, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, };
/**
* @deprecated
* // TODO-now
*/
declare const init_experimental: typeof init;
export { init, init_experimental, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type InstaQLParams, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type InstaQLEntity, type InstaQLResult, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, };
//# sourceMappingURL=index.d.ts.map

@@ -6,6 +6,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.version = exports.Storage = exports.Auth = exports.InstantCoreDatabase = exports.InstantClient = exports.WindowNetworkListener = exports.IndexedDBStorage = exports.weakHash = exports.getOps = exports.i = exports.lookup = exports.txInit = exports.tx = exports.id = void 0;
exports.version = exports.Storage = exports.Auth = exports.InstantCoreDatabase = exports.WindowNetworkListener = exports.IndexedDBStorage = exports.weakHash = exports.getOps = exports.i = exports.lookup = exports.txInit = exports.tx = exports.id = exports.init_experimental = void 0;
exports.init = init;
exports.init_experimental = init_experimental;
exports._init_internal = _init_internal;
exports.coerceQuery = coerceQuery;

@@ -45,202 +43,2 @@ const Reactor_1 = __importDefault(require("./Reactor"));

/**
*
* The first step: init your application!
*
* Visit https://instantdb.com/dash to get your `appId` :)
*
* @example
* const db = init({ appId: "my-app-id" })
*
* // You can also provide a schema for type safety and editor autocomplete!
*
* type Schema = {
* goals: {
* title: string
* }
* }
*
* const db = init<Schema>({ appId: "my-app-id" })
*
*/
function init(config, Storage, NetworkListener) {
return _init_internal(config, Storage, NetworkListener);
}
function _init_internal(config, Storage, NetworkListener, versions) {
const existingClient = globalInstantCoreStore[config.appId];
if (existingClient) {
return existingClient;
}
const reactor = new Reactor_1.default(Object.assign(Object.assign({}, defaultConfig), config), Storage || IndexedDBStorage_1.default, NetworkListener || WindowNetworkListener_1.default, versions);
const client = new InstantCore(reactor);
globalInstantCoreStore[config.appId] = client;
if (typeof window !== "undefined" && typeof window.location !== "undefined") {
const showDevtool =
// show widget by default?
("devtool" in config ? Boolean(config.devtool) : defaultOpenDevtool) &&
// only run on localhost (dev env)
window.location.hostname === "localhost" &&
// used by dash and other internal consumers
!Boolean(globalThis._nodevtool);
if (showDevtool) {
(0, devtool_1.createDevtool)(config.appId);
}
}
return client;
}
class InstantCore {
constructor(reactor) {
this.tx = (0, instatx_1.txInit)();
this._reactor = reactor;
this.auth = new Auth(this._reactor);
this.storage = new Storage(this._reactor);
}
/**
* Use this to write data! You can create, update, delete, and link objects
*
* @see https://instantdb.com/docs/instaml
*
* @example
* // Create a new object in the `goals` namespace
* const goalId = id();
* db.transact(tx.goals[goalId].update({title: "Get fit"}))
*
* // Update the title
* db.transact(tx.goals[goalId].update({title: "Get super fit"}))
*
* // Delete it
* db.transact(tx.goals[goalId].delete())
*
* // Or create an association:
* todoId = id();
* db.transact([
* tx.todos[todoId].update({ title: 'Go on a run' }),
* tx.goals[goalId].link({todos: todoId}),
* ])
*/
transact(chunks) {
return this._reactor.pushTx(chunks);
}
getLocalId(name) {
return this._reactor.getLocalId(name);
}
/**
* Use this to query your data!
*
* @see https://instantdb.com/docs/instaql
*
* @example
* // listen to all goals
* db.subscribeQuery({ goals: {} }, (resp) => {
* console.log(resp.data.goals)
* })
*
* // goals where the title is "Get Fit"
* db.subscribeQuery(
* { goals: { $: { where: { title: "Get Fit" } } } },
* (resp) => {
* console.log(resp.data.goals)
* }
* )
*
* // all goals, _alongside_ their todos
* db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
* console.log(resp.data.goals)
* });
*/
subscribeQuery(query, cb) {
return this._reactor.subscribeQuery(query, cb);
}
/**
* Listen for the logged in state. This is useful
* for deciding when to show a login screen.
*
* @see https://instantdb.com/docs/auth
* @example
* const unsub = db.subscribeAuth((auth) => {
* if (auth.user) {
* console.log('logged in as', auth.user.email)
* } else {
* console.log('logged out')
* }
* })
*/
subscribeAuth(cb) {
return this._reactor.subscribeAuth(cb);
}
/**
* Listen for connection status changes to Instant. This is useful
* for building things like connectivity indicators
*
* @see https://www.instantdb.com/docs/patterns#connection-status
* @example
* const unsub = db.subscribeConnectionStatus((status) => {
* const connectionState =
* status === 'connecting' || status === 'opened'
* ? 'authenticating'
* : status === 'authenticated'
* ? 'connected'
* : status === 'closed'
* ? 'closed'
* : status === 'errored'
* ? 'errored'
* : 'unexpected state';
*
* console.log('Connection status:', connectionState);
* });
*/
subscribeConnectionStatus(cb) {
return this._reactor.subscribeConnectionStatus(cb);
}
/**
* Join a room to publish and subscribe to topics and presence.
*
* @see https://instantdb.com/docs/presence-and-topics
* @example
* // init
* const db = init();
* const room = db.joinRoom(roomType, roomId);
* // usage
* const unsubscribeTopic = room.subscribeTopic("foo", console.log);
* const unsubscribePresence = room.subscribePresence({}, console.log);
* room.publishTopic("hello", { message: "hello world!" });
* room.publishPresence({ name: "joe" });
* // later
* unsubscribePresence();
* unsubscribeTopic();
* room.leaveRoom();
*/
joinRoom(roomType = "_defaultRoomType", roomId = "_defaultRoomId") {
const leaveRoom = this._reactor.joinRoom(roomId);
return {
leaveRoom,
subscribeTopic: (topic, onEvent) => this._reactor.subscribeTopic(roomId, topic, onEvent),
subscribePresence: (opts, onChange) => this._reactor.subscribePresence(roomType, roomId, opts, onChange),
publishTopic: (topic, data) => this._reactor.publishTopic({ roomType, roomId, topic, data }),
publishPresence: (data) => this._reactor.publishPresence(roomType, roomId, data),
getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),
};
}
shutdown() {
delete globalInstantCoreStore[this._reactor.config.appId];
this._reactor.shutdown();
}
/**
* Use this for one-off queries.
* Returns local data if available, otherwise fetches from the server.
* Because we want to avoid stale data, this method will throw an error
* if the user is offline or there is no active connection to the server.
*
* @see https://instantdb.com/docs/instaql
*
* @example
*
* const resp = await db.queryOnce({ goals: {} });
* console.log(resp.data.goals)
*/
queryOnce(query) {
return this._reactor.queryOnce(query);
}
}
exports.InstantClient = InstantCore;
/**
* Functions to log users in and out.

@@ -578,3 +376,3 @@ *

exports.InstantCoreDatabase = InstantCoreDatabase;
function init_experimental(config, Storage, NetworkListener) {
function init(config, Storage, NetworkListener, versions) {
const existingClient = globalInstantCoreStore[config.appId];

@@ -584,3 +382,3 @@ if (existingClient) {

}
const reactor = new Reactor_1.default(Object.assign(Object.assign(Object.assign({}, defaultConfig), config), { cardinalityInference: config.schema ? true : false }), Storage || IndexedDBStorage_1.default, NetworkListener || WindowNetworkListener_1.default);
const reactor = new Reactor_1.default(Object.assign(Object.assign(Object.assign({}, defaultConfig), config), { cardinalityInference: config.schema ? true : false }), Storage || IndexedDBStorage_1.default, NetworkListener || WindowNetworkListener_1.default, Object.assign(Object.assign({}, (versions || {})), { "@instantdb/core": version_1.default }));
const client = new InstantCoreDatabase(reactor);

@@ -602,2 +400,8 @@ globalInstantCoreStore[config.appId] = client;

}
/**
* @deprecated
* // TODO-now
*/
const init_experimental = init;
exports.init_experimental = init_experimental;
//# sourceMappingURL=index.js.map

@@ -78,158 +78,2 @@ import Reactor from "./Reactor";

/**
*
* The first step: init your application!
*
* Visit https://instantdb.com/dash to get your `appId` :)
*
* @example
* const db = init({ appId: "my-app-id" })
*
* // You can also provide a schema for type safety and editor autocomplete!
*
* type Schema = {
* goals: {
* title: string
* }
* }
*
* const db = init<Schema>({ appId: "my-app-id" })
*
*/
declare function init<Schema extends {} = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config, Storage?: any, NetworkListener?: any): InstantCore<Schema, RoomSchema>;
declare function _init_internal<Schema extends {} | InstantGraph<any, any, any>, RoomSchema extends RoomSchemaShape, WithCardinalityInference extends boolean = false>(config: Config, Storage?: any, NetworkListener?: any, versions?: {
[key: string]: string;
}): InstantCore<Schema, RoomSchema, WithCardinalityInference>;
declare class InstantCore<Schema extends InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> implements IDatabase<Schema, RoomSchema, WithCardinalityInference> {
withCardinalityInference?: WithCardinalityInference;
_reactor: Reactor<RoomSchema>;
auth: Auth;
storage: Storage;
tx: TxChunk<Schema extends InstantGraph<any, any, {}> ? Schema : InstantGraph<any, any, {}>>;
constructor(reactor: Reactor<RoomSchema>);
/**
* Use this to write data! You can create, update, delete, and link objects
*
* @see https://instantdb.com/docs/instaml
*
* @example
* // Create a new object in the `goals` namespace
* const goalId = id();
* db.transact(tx.goals[goalId].update({title: "Get fit"}))
*
* // Update the title
* db.transact(tx.goals[goalId].update({title: "Get super fit"}))
*
* // Delete it
* db.transact(tx.goals[goalId].delete())
*
* // Or create an association:
* todoId = id();
* db.transact([
* tx.todos[todoId].update({ title: 'Go on a run' }),
* tx.goals[goalId].link({todos: todoId}),
* ])
*/
transact(chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]): Promise<TransactionResult>;
getLocalId(name: string): Promise<string>;
/**
* Use this to query your data!
*
* @see https://instantdb.com/docs/instaql
*
* @example
* // listen to all goals
* db.subscribeQuery({ goals: {} }, (resp) => {
* console.log(resp.data.goals)
* })
*
* // goals where the title is "Get Fit"
* db.subscribeQuery(
* { goals: { $: { where: { title: "Get Fit" } } } },
* (resp) => {
* console.log(resp.data.goals)
* }
* )
*
* // all goals, _alongside_ their todos
* db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
* console.log(resp.data.goals)
* });
*/
subscribeQuery<Q extends Schema extends InstantGraph<any, any> ? InstaQLParams<Schema> : Exactly<Query, Q>>(query: Q, cb: (resp: SubscriptionState<Q, Schema, WithCardinalityInference>) => void): () => void;
/**
* Listen for the logged in state. This is useful
* for deciding when to show a login screen.
*
* @see https://instantdb.com/docs/auth
* @example
* const unsub = db.subscribeAuth((auth) => {
* if (auth.user) {
* console.log('logged in as', auth.user.email)
* } else {
* console.log('logged out')
* }
* })
*/
subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn;
/**
* Listen for connection status changes to Instant. This is useful
* for building things like connectivity indicators
*
* @see https://www.instantdb.com/docs/patterns#connection-status
* @example
* const unsub = db.subscribeConnectionStatus((status) => {
* const connectionState =
* status === 'connecting' || status === 'opened'
* ? 'authenticating'
* : status === 'authenticated'
* ? 'connected'
* : status === 'closed'
* ? 'closed'
* : status === 'errored'
* ? 'errored'
* : 'unexpected state';
*
* console.log('Connection status:', connectionState);
* });
*/
subscribeConnectionStatus(cb: (status: ConnectionStatus) => void): UnsubscribeFn;
/**
* Join a room to publish and subscribe to topics and presence.
*
* @see https://instantdb.com/docs/presence-and-topics
* @example
* // init
* const db = init();
* const room = db.joinRoom(roomType, roomId);
* // usage
* const unsubscribeTopic = room.subscribeTopic("foo", console.log);
* const unsubscribePresence = room.subscribePresence({}, console.log);
* room.publishTopic("hello", { message: "hello world!" });
* room.publishPresence({ name: "joe" });
* // later
* unsubscribePresence();
* unsubscribeTopic();
* room.leaveRoom();
*/
joinRoom<RoomType extends keyof RoomSchema>(roomType?: RoomType, roomId?: string): RoomHandle<RoomSchema[RoomType]["presence"], RoomSchema[RoomType]["topics"]>;
shutdown(): void;
/**
* Use this for one-off queries.
* Returns local data if available, otherwise fetches from the server.
* Because we want to avoid stale data, this method will throw an error
* if the user is offline or there is no active connection to the server.
*
* @see https://instantdb.com/docs/instaql
*
* @example
*
* const resp = await db.queryOnce({ goals: {} });
* console.log(resp.data.goals)
*/
queryOnce<Q extends Schema extends InstantGraph<any, any> ? InstaQLParams<Schema> : Exactly<Query, Q>>(query: Q): Promise<{
data: QueryResponse<Q, Schema, WithCardinalityInference>;
pageInfo: PageInfoResponse<Q>;
}>;
}
/**
* Functions to log users in and out.

@@ -528,3 +372,5 @@ *

}
declare function init_experimental<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema>(config: InstantConfig<Schema>, Storage?: any, NetworkListener?: any): InstantCoreDatabase<Schema>;
declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema>(config: InstantConfig<Schema>, Storage?: any, NetworkListener?: any, versions?: {
[key: string]: string;
}): InstantCoreDatabase<Schema>;
type InstantRules = {

@@ -537,2 +383,3 @@ [EntityName: string]: {

delete?: string;
$default?: string;
};

@@ -542,3 +389,8 @@ bind?: string[];

};
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, InstantCoreDatabase, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type InstaQLParams, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type InstaQLEntity, type InstaQLResult, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, };
/**
* @deprecated
* // TODO-now
*/
declare const init_experimental: typeof init;
export { init, init_experimental, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type InstaQLParams, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type InstaQLEntity, type InstaQLResult, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, };
//# sourceMappingURL=index.d.ts.map

@@ -24,201 +24,2 @@ import Reactor from "./Reactor";

/**
*
* The first step: init your application!
*
* Visit https://instantdb.com/dash to get your `appId` :)
*
* @example
* const db = init({ appId: "my-app-id" })
*
* // You can also provide a schema for type safety and editor autocomplete!
*
* type Schema = {
* goals: {
* title: string
* }
* }
*
* const db = init<Schema>({ appId: "my-app-id" })
*
*/
function init(config, Storage, NetworkListener) {
return _init_internal(config, Storage, NetworkListener);
}
function _init_internal(config, Storage, NetworkListener, versions) {
const existingClient = globalInstantCoreStore[config.appId];
if (existingClient) {
return existingClient;
}
const reactor = new Reactor(Object.assign(Object.assign({}, defaultConfig), config), Storage || IndexedDBStorage, NetworkListener || WindowNetworkListener, versions);
const client = new InstantCore(reactor);
globalInstantCoreStore[config.appId] = client;
if (typeof window !== "undefined" && typeof window.location !== "undefined") {
const showDevtool =
// show widget by default?
("devtool" in config ? Boolean(config.devtool) : defaultOpenDevtool) &&
// only run on localhost (dev env)
window.location.hostname === "localhost" &&
// used by dash and other internal consumers
!Boolean(globalThis._nodevtool);
if (showDevtool) {
createDevtool(config.appId);
}
}
return client;
}
class InstantCore {
constructor(reactor) {
this.tx = txInit();
this._reactor = reactor;
this.auth = new Auth(this._reactor);
this.storage = new Storage(this._reactor);
}
/**
* Use this to write data! You can create, update, delete, and link objects
*
* @see https://instantdb.com/docs/instaml
*
* @example
* // Create a new object in the `goals` namespace
* const goalId = id();
* db.transact(tx.goals[goalId].update({title: "Get fit"}))
*
* // Update the title
* db.transact(tx.goals[goalId].update({title: "Get super fit"}))
*
* // Delete it
* db.transact(tx.goals[goalId].delete())
*
* // Or create an association:
* todoId = id();
* db.transact([
* tx.todos[todoId].update({ title: 'Go on a run' }),
* tx.goals[goalId].link({todos: todoId}),
* ])
*/
transact(chunks) {
return this._reactor.pushTx(chunks);
}
getLocalId(name) {
return this._reactor.getLocalId(name);
}
/**
* Use this to query your data!
*
* @see https://instantdb.com/docs/instaql
*
* @example
* // listen to all goals
* db.subscribeQuery({ goals: {} }, (resp) => {
* console.log(resp.data.goals)
* })
*
* // goals where the title is "Get Fit"
* db.subscribeQuery(
* { goals: { $: { where: { title: "Get Fit" } } } },
* (resp) => {
* console.log(resp.data.goals)
* }
* )
*
* // all goals, _alongside_ their todos
* db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
* console.log(resp.data.goals)
* });
*/
subscribeQuery(query, cb) {
return this._reactor.subscribeQuery(query, cb);
}
/**
* Listen for the logged in state. This is useful
* for deciding when to show a login screen.
*
* @see https://instantdb.com/docs/auth
* @example
* const unsub = db.subscribeAuth((auth) => {
* if (auth.user) {
* console.log('logged in as', auth.user.email)
* } else {
* console.log('logged out')
* }
* })
*/
subscribeAuth(cb) {
return this._reactor.subscribeAuth(cb);
}
/**
* Listen for connection status changes to Instant. This is useful
* for building things like connectivity indicators
*
* @see https://www.instantdb.com/docs/patterns#connection-status
* @example
* const unsub = db.subscribeConnectionStatus((status) => {
* const connectionState =
* status === 'connecting' || status === 'opened'
* ? 'authenticating'
* : status === 'authenticated'
* ? 'connected'
* : status === 'closed'
* ? 'closed'
* : status === 'errored'
* ? 'errored'
* : 'unexpected state';
*
* console.log('Connection status:', connectionState);
* });
*/
subscribeConnectionStatus(cb) {
return this._reactor.subscribeConnectionStatus(cb);
}
/**
* Join a room to publish and subscribe to topics and presence.
*
* @see https://instantdb.com/docs/presence-and-topics
* @example
* // init
* const db = init();
* const room = db.joinRoom(roomType, roomId);
* // usage
* const unsubscribeTopic = room.subscribeTopic("foo", console.log);
* const unsubscribePresence = room.subscribePresence({}, console.log);
* room.publishTopic("hello", { message: "hello world!" });
* room.publishPresence({ name: "joe" });
* // later
* unsubscribePresence();
* unsubscribeTopic();
* room.leaveRoom();
*/
joinRoom(roomType = "_defaultRoomType", roomId = "_defaultRoomId") {
const leaveRoom = this._reactor.joinRoom(roomId);
return {
leaveRoom,
subscribeTopic: (topic, onEvent) => this._reactor.subscribeTopic(roomId, topic, onEvent),
subscribePresence: (opts, onChange) => this._reactor.subscribePresence(roomType, roomId, opts, onChange),
publishTopic: (topic, data) => this._reactor.publishTopic({ roomType, roomId, topic, data }),
publishPresence: (data) => this._reactor.publishPresence(roomType, roomId, data),
getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),
};
}
shutdown() {
delete globalInstantCoreStore[this._reactor.config.appId];
this._reactor.shutdown();
}
/**
* Use this for one-off queries.
* Returns local data if available, otherwise fetches from the server.
* Because we want to avoid stale data, this method will throw an error
* if the user is offline or there is no active connection to the server.
*
* @see https://instantdb.com/docs/instaql
*
* @example
*
* const resp = await db.queryOnce({ goals: {} });
* console.log(resp.data.goals)
*/
queryOnce(query) {
return this._reactor.queryOnce(query);
}
}
/**
* Functions to log users in and out.

@@ -553,3 +354,3 @@ *

}
function init_experimental(config, Storage, NetworkListener) {
function init(config, Storage, NetworkListener, versions) {
const existingClient = globalInstantCoreStore[config.appId];

@@ -559,3 +360,3 @@ if (existingClient) {

}
const reactor = new Reactor(Object.assign(Object.assign(Object.assign({}, defaultConfig), config), { cardinalityInference: config.schema ? true : false }), Storage || IndexedDBStorage, NetworkListener || WindowNetworkListener);
const reactor = new Reactor(Object.assign(Object.assign(Object.assign({}, defaultConfig), config), { cardinalityInference: config.schema ? true : false }), Storage || IndexedDBStorage, NetworkListener || WindowNetworkListener, Object.assign(Object.assign({}, (versions || {})), { "@instantdb/core": version }));
const client = new InstantCoreDatabase(reactor);

@@ -577,9 +378,14 @@ globalInstantCoreStore[config.appId] = client;

}
/**
* @deprecated
* // TODO-now
*/
const init_experimental = init;
export {
// bada bing bada boom
init, init_experimental, _init_internal, id, tx, txInit, lookup,
init, init_experimental, id, tx, txInit, lookup,
// cli
i,
// util
getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, InstantCoreDatabase, Auth, Storage, version, };
getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, };
//# sourceMappingURL=index.js.map

2

dist/module/queryTypes.d.ts

@@ -131,3 +131,3 @@ import type { EntitiesDef, IContainEntitiesAndLinks, InstantGraph, LinkAttrDef, ResolveAttrs, ResolveEntityAttrs } from "./schemaTypes";

type InstaQLResult<Schema extends IContainEntitiesAndLinks<EntitiesDef, any>, Query extends InstaQLParams<Schema>> = Expand<{
[QueryPropName in keyof Query]: QueryPropName extends keyof Schema["entities"] ? InstaQLEntity<Schema, QueryPropName, Query[QueryPropName]>[] : never;
[QueryPropName in keyof Query]: QueryPropName extends keyof Schema["entities"] ? InstaQLEntity<Schema, QueryPropName, Remove$<Query[QueryPropName]>>[] : never;
}>;

@@ -134,0 +134,0 @@ type InstaQLEntitySubquery<Schema extends IContainEntitiesAndLinks<EntitiesDef, any>, EntityName extends keyof Schema["entities"]> = {

@@ -46,3 +46,3 @@ import { EntityDef, DataAttrDef, InstantSchemaDef, type EntitiesDef, type AttrsDefs, type EntitiesWithLinks, type LinksDef, type RoomsDef, type UnknownRooms } from "./schemaTypes";

* You can push this schema to your database with the CLI,
* or use it inside `init_experimental`, to get typesafety and autocompletion.
* or use it inside `init`, to get typesafety and autocompletion.
*

@@ -49,0 +49,0 @@ * @see https://instantdb.com/docs/schema

@@ -93,3 +93,3 @@ import { EntityDef, DataAttrDef, InstantSchemaDef, } from "./schemaTypes";

* You can push this schema to your database with the CLI,
* or use it inside `init_experimental`, to get typesafety and autocompletion.
* or use it inside `init`, to get typesafety and autocompletion.
*

@@ -96,0 +96,0 @@ * @see https://instantdb.com/docs/schema

@@ -106,4 +106,12 @@ import type { RoomSchemaShape } from "./presence";

constructor(entities: Entities, links: Links, rooms: Rooms);
/**
* @deprecated
* TOOD-now
*/
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantSchemaDef<Entities, Links, RoomDefFromShape<_RoomSchema>>;
}
/**
* @deprecated
* TODO-now
*/
export declare class InstantGraph<Entities extends EntitiesDef, Links extends LinksDef<Entities>, RoomSchema extends RoomSchemaShape = {}> implements IContainEntitiesAndLinks<Entities, Links> {

@@ -151,3 +159,3 @@ entities: Entities;

id: DataAttrDef<string, true>;
[AttrName: string]: DataAttrDef<unknown, any>;
[AttrName: string]: DataAttrDef<any, any>;
}, {

@@ -154,0 +162,0 @@ [LinkName: string]: LinkAttrDef<"many", string>;

@@ -38,2 +38,6 @@ export class DataAttrDef {

}
/**
* @deprecated
* TOOD-now
*/
withRoomSchema() {

@@ -43,2 +47,6 @@ return new InstantSchemaDef(this.entities, this.links, {});

}
/**
* @deprecated
* TODO-now
*/
export class InstantGraph {

@@ -45,0 +53,0 @@ constructor(entities, links) {

export default version;
declare const version: "v0.16.6";
declare const version: "v0.17.0-experimental.0";
//# sourceMappingURL=version.d.ts.map
// Autogenerated by publish_packages.clj
const version = "v0.16.6";
const version = "v0.17.0-experimental.0";
export default version;
//# sourceMappingURL=version.js.map

@@ -131,3 +131,3 @@ import type { EntitiesDef, IContainEntitiesAndLinks, InstantGraph, LinkAttrDef, ResolveAttrs, ResolveEntityAttrs } from "./schemaTypes";

type InstaQLResult<Schema extends IContainEntitiesAndLinks<EntitiesDef, any>, Query extends InstaQLParams<Schema>> = Expand<{
[QueryPropName in keyof Query]: QueryPropName extends keyof Schema["entities"] ? InstaQLEntity<Schema, QueryPropName, Query[QueryPropName]>[] : never;
[QueryPropName in keyof Query]: QueryPropName extends keyof Schema["entities"] ? InstaQLEntity<Schema, QueryPropName, Remove$<Query[QueryPropName]>>[] : never;
}>;

@@ -134,0 +134,0 @@ type InstaQLEntitySubquery<Schema extends IContainEntitiesAndLinks<EntitiesDef, any>, EntityName extends keyof Schema["entities"]> = {

@@ -46,3 +46,3 @@ import { EntityDef, DataAttrDef, InstantSchemaDef, type EntitiesDef, type AttrsDefs, type EntitiesWithLinks, type LinksDef, type RoomsDef, type UnknownRooms } from "./schemaTypes";

* You can push this schema to your database with the CLI,
* or use it inside `init_experimental`, to get typesafety and autocompletion.
* or use it inside `init`, to get typesafety and autocompletion.
*

@@ -49,0 +49,0 @@ * @see https://instantdb.com/docs/schema

@@ -96,3 +96,3 @@ "use strict";

* You can push this schema to your database with the CLI,
* or use it inside `init_experimental`, to get typesafety and autocompletion.
* or use it inside `init`, to get typesafety and autocompletion.
*

@@ -99,0 +99,0 @@ * @see https://instantdb.com/docs/schema

@@ -106,4 +106,12 @@ import type { RoomSchemaShape } from "./presence";

constructor(entities: Entities, links: Links, rooms: Rooms);
/**
* @deprecated
* TOOD-now
*/
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantSchemaDef<Entities, Links, RoomDefFromShape<_RoomSchema>>;
}
/**
* @deprecated
* TODO-now
*/
export declare class InstantGraph<Entities extends EntitiesDef, Links extends LinksDef<Entities>, RoomSchema extends RoomSchemaShape = {}> implements IContainEntitiesAndLinks<Entities, Links> {

@@ -151,3 +159,3 @@ entities: Entities;

id: DataAttrDef<string, true>;
[AttrName: string]: DataAttrDef<unknown, any>;
[AttrName: string]: DataAttrDef<any, any>;
}, {

@@ -154,0 +162,0 @@ [LinkName: string]: LinkAttrDef<"many", string>;

@@ -44,2 +44,6 @@ "use strict";

}
/**
* @deprecated
* TOOD-now
*/
withRoomSchema() {

@@ -50,2 +54,6 @@ return new InstantSchemaDef(this.entities, this.links, {});

exports.InstantSchemaDef = InstantSchemaDef;
/**
* @deprecated
* TODO-now
*/
class InstantGraph {

@@ -52,0 +60,0 @@ constructor(entities, links) {

export default version;
declare const version: "v0.16.6";
declare const version: "v0.17.0-experimental.0";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Autogenerated by publish_packages.clj
const version = "v0.16.6";
const version = "v0.17.0-experimental.0";
exports.default = version;
//# sourceMappingURL=version.js.map
{
"name": "@instantdb/core",
"version": "v0.16.6",
"version": "v0.17.0-experimental.0",
"description": "Instant's core local abstraction",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -175,288 +175,2 @@ import Reactor from "./Reactor";

/**
*
* The first step: init your application!
*
* Visit https://instantdb.com/dash to get your `appId` :)
*
* @example
* const db = init({ appId: "my-app-id" })
*
* // You can also provide a schema for type safety and editor autocomplete!
*
* type Schema = {
* goals: {
* title: string
* }
* }
*
* const db = init<Schema>({ appId: "my-app-id" })
*
*/
function init<Schema extends {} = {}, RoomSchema extends RoomSchemaShape = {}>(
config: Config,
Storage?: any,
NetworkListener?: any,
): InstantCore<Schema, RoomSchema> {
return _init_internal(config, Storage, NetworkListener);
}
function _init_internal<
Schema extends {} | InstantGraph<any, any, any>,
RoomSchema extends RoomSchemaShape,
WithCardinalityInference extends boolean = false,
>(
config: Config,
Storage?: any,
NetworkListener?: any,
versions?: { [key: string]: string },
): InstantCore<Schema, RoomSchema, WithCardinalityInference> {
const existingClient = globalInstantCoreStore[config.appId] as InstantCore<
any,
RoomSchema,
WithCardinalityInference
>;
if (existingClient) {
return existingClient;
}
const reactor = new Reactor<RoomSchema>(
{
...defaultConfig,
...config,
},
Storage || IndexedDBStorage,
NetworkListener || WindowNetworkListener,
versions,
);
const client = new InstantCore<any, RoomSchema, WithCardinalityInference>(
reactor,
);
globalInstantCoreStore[config.appId] = client;
if (typeof window !== "undefined" && typeof window.location !== "undefined") {
const showDevtool =
// show widget by default?
("devtool" in config ? Boolean(config.devtool) : defaultOpenDevtool) &&
// only run on localhost (dev env)
window.location.hostname === "localhost" &&
// used by dash and other internal consumers
!Boolean((globalThis as any)._nodevtool);
if (showDevtool) {
createDevtool(config.appId);
}
}
return client;
}
class InstantCore<
Schema extends InstantGraph<any, any> | {} = {},
RoomSchema extends RoomSchemaShape = {},
WithCardinalityInference extends boolean = false,
> implements IDatabase<Schema, RoomSchema, WithCardinalityInference>
{
public withCardinalityInference?: WithCardinalityInference;
public _reactor: Reactor<RoomSchema>;
public auth: Auth;
public storage: Storage;
public tx =
txInit<
Schema extends InstantGraph<any, any> ? Schema : InstantGraph<any, any>
>();
constructor(reactor: Reactor<RoomSchema>) {
this._reactor = reactor;
this.auth = new Auth(this._reactor);
this.storage = new Storage(this._reactor);
}
/**
* Use this to write data! You can create, update, delete, and link objects
*
* @see https://instantdb.com/docs/instaml
*
* @example
* // Create a new object in the `goals` namespace
* const goalId = id();
* db.transact(tx.goals[goalId].update({title: "Get fit"}))
*
* // Update the title
* db.transact(tx.goals[goalId].update({title: "Get super fit"}))
*
* // Delete it
* db.transact(tx.goals[goalId].delete())
*
* // Or create an association:
* todoId = id();
* db.transact([
* tx.todos[todoId].update({ title: 'Go on a run' }),
* tx.goals[goalId].link({todos: todoId}),
* ])
*/
transact(
chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
): Promise<TransactionResult> {
return this._reactor.pushTx(chunks);
}
getLocalId(name: string): Promise<string> {
return this._reactor.getLocalId(name);
}
/**
* Use this to query your data!
*
* @see https://instantdb.com/docs/instaql
*
* @example
* // listen to all goals
* db.subscribeQuery({ goals: {} }, (resp) => {
* console.log(resp.data.goals)
* })
*
* // goals where the title is "Get Fit"
* db.subscribeQuery(
* { goals: { $: { where: { title: "Get Fit" } } } },
* (resp) => {
* console.log(resp.data.goals)
* }
* )
*
* // all goals, _alongside_ their todos
* db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
* console.log(resp.data.goals)
* });
*/
subscribeQuery<
Q extends Schema extends InstantGraph<any, any>
? InstaQLParams<Schema>
: Exactly<Query, Q>,
>(
query: Q,
cb: (resp: SubscriptionState<Q, Schema, WithCardinalityInference>) => void,
) {
return this._reactor.subscribeQuery(query, cb);
}
/**
* Listen for the logged in state. This is useful
* for deciding when to show a login screen.
*
* @see https://instantdb.com/docs/auth
* @example
* const unsub = db.subscribeAuth((auth) => {
* if (auth.user) {
* console.log('logged in as', auth.user.email)
* } else {
* console.log('logged out')
* }
* })
*/
subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {
return this._reactor.subscribeAuth(cb);
}
/**
* Listen for connection status changes to Instant. This is useful
* for building things like connectivity indicators
*
* @see https://www.instantdb.com/docs/patterns#connection-status
* @example
* const unsub = db.subscribeConnectionStatus((status) => {
* const connectionState =
* status === 'connecting' || status === 'opened'
* ? 'authenticating'
* : status === 'authenticated'
* ? 'connected'
* : status === 'closed'
* ? 'closed'
* : status === 'errored'
* ? 'errored'
* : 'unexpected state';
*
* console.log('Connection status:', connectionState);
* });
*/
subscribeConnectionStatus(cb: (status: ConnectionStatus) => void): UnsubscribeFn {
return this._reactor.subscribeConnectionStatus(cb);
}
/**
* Join a room to publish and subscribe to topics and presence.
*
* @see https://instantdb.com/docs/presence-and-topics
* @example
* // init
* const db = init();
* const room = db.joinRoom(roomType, roomId);
* // usage
* const unsubscribeTopic = room.subscribeTopic("foo", console.log);
* const unsubscribePresence = room.subscribePresence({}, console.log);
* room.publishTopic("hello", { message: "hello world!" });
* room.publishPresence({ name: "joe" });
* // later
* unsubscribePresence();
* unsubscribeTopic();
* room.leaveRoom();
*/
joinRoom<RoomType extends keyof RoomSchema>(
roomType: RoomType = "_defaultRoomType" as RoomType,
roomId: string = "_defaultRoomId",
): RoomHandle<
RoomSchema[RoomType]["presence"],
RoomSchema[RoomType]["topics"]
> {
const leaveRoom = this._reactor.joinRoom(roomId);
return {
leaveRoom,
subscribeTopic: (topic, onEvent) =>
this._reactor.subscribeTopic(roomId, topic, onEvent),
subscribePresence: (opts, onChange) =>
this._reactor.subscribePresence(roomType, roomId, opts, onChange),
publishTopic: (topic, data) =>
this._reactor.publishTopic({ roomType, roomId, topic, data }),
publishPresence: (data) =>
this._reactor.publishPresence(roomType, roomId, data),
getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),
};
}
shutdown() {
delete globalInstantCoreStore[this._reactor.config.appId];
this._reactor.shutdown();
}
/**
* Use this for one-off queries.
* Returns local data if available, otherwise fetches from the server.
* Because we want to avoid stale data, this method will throw an error
* if the user is offline or there is no active connection to the server.
*
* @see https://instantdb.com/docs/instaql
*
* @example
*
* const resp = await db.queryOnce({ goals: {} });
* console.log(resp.data.goals)
*/
queryOnce<
Q extends Schema extends InstantGraph<any, any>
? InstaQLParams<Schema>
: Exactly<Query, Q>,
>(
query: Q,
): Promise<{
data: QueryResponse<Q, Schema, WithCardinalityInference>;
pageInfo: PageInfoResponse<Q>;
}> {
return this._reactor.queryOnce(query);
}
}
/**
* Functions to log users in and out.

@@ -843,3 +557,3 @@ *

function init_experimental<
function init<
Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,

@@ -850,2 +564,3 @@ >(

NetworkListener?: any,
versions?: { [key: string]: string },
): InstantCoreDatabase<Schema> {

@@ -868,2 +583,3 @@ const existingClient = globalInstantCoreStore[

NetworkListener || WindowNetworkListener,
{ ...(versions || {}), "@instantdb/core": version },
);

@@ -898,2 +614,3 @@

delete?: string;
$default?: string;
};

@@ -904,2 +621,7 @@ bind?: string[];

/**
* @deprecated
* // TODO-now
*/
const init_experimental = init;

@@ -910,3 +632,2 @@ export {

init_experimental,
_init_internal,
id,

@@ -926,3 +647,2 @@ tx,

WindowNetworkListener,
InstantCore as InstantClient,
InstantCoreDatabase,

@@ -929,0 +649,0 @@ Auth,

@@ -261,3 +261,3 @@ // Query

[QueryPropName in keyof Query]: QueryPropName extends keyof Schema["entities"]
? InstaQLEntity<Schema, QueryPropName, Query[QueryPropName]>[]
? InstaQLEntity<Schema, QueryPropName, Remove$<Query[QueryPropName]>>[]
: never;

@@ -264,0 +264,0 @@ }>;

@@ -144,3 +144,3 @@ import {

* You can push this schema to your database with the CLI,
* or use it inside `init_experimental`, to get typesafety and autocompletion.
* or use it inside `init`, to get typesafety and autocompletion.
*

@@ -147,0 +147,0 @@ * @see https://instantdb.com/docs/schema

@@ -306,2 +306,6 @@ import type { RoomSchemaShape } from "./presence";

/**
* @deprecated
* TOOD-now
*/
withRoomSchema<_RoomSchema extends RoomSchemaShape>() {

@@ -317,2 +321,6 @@ type RDef = RoomDefFromShape<_RoomSchema>;

/**
* @deprecated
* TODO-now
*/
export class InstantGraph<

@@ -401,3 +409,3 @@ Entities extends EntitiesDef,

id: DataAttrDef<string, true>;
[AttrName: string]: DataAttrDef<unknown, any>;
[AttrName: string]: DataAttrDef<any, any>;
},

@@ -404,0 +412,0 @@ { [LinkName: string]: LinkAttrDef<"many", string> },

// Autogenerated by publish_packages.clj
const version = "v0.16.6";
const version = "v0.17.0-experimental.0";
export default version;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc