New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@instantdb/react

Package Overview
Dependencies
Maintainers
0
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instantdb/react - npm Package Compare versions

Comparing version 0.12.19-experimental.0 to 0.12.19

4

dist/index.d.ts
import { id, tx, lookup, i, type QueryResponse, type InstantObject, type User, type AuthState, type Query, type Config } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
import { InstantReactWeb } from "./InstantReactWeb";
import { init, init_experimental } from "./init";
import { init } from "./init";
import { Cursors } from "./Cursors";
export { id, tx, lookup, init, init_experimental, InstantReactWeb, Cursors, InstantReact, Config, Query, QueryResponse, InstantObject, User, AuthState, i, };
export { id, tx, lookup, init, InstantReactWeb, Cursors, InstantReact, Config, Query, QueryResponse, InstantObject, User, AuthState, i, };
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.i = exports.InstantReact = exports.Cursors = exports.InstantReactWeb = exports.init_experimental = exports.init = exports.lookup = exports.tx = exports.id = void 0;
exports.i = exports.InstantReact = exports.Cursors = exports.InstantReactWeb = exports.init = exports.lookup = exports.tx = exports.id = void 0;
const core_1 = require("@instantdb/core");

@@ -15,5 +15,4 @@ Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });

Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_1.init; } });
Object.defineProperty(exports, "init_experimental", { enumerable: true, get: function () { return init_1.init_experimental; } });
const Cursors_1 = require("./Cursors");
Object.defineProperty(exports, "Cursors", { enumerable: true, get: function () { return Cursors_1.Cursors; } });
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { Config, i, RoomSchemaShape } from "@instantdb/core";
import { Config, RoomSchemaShape } from "@instantdb/core";
import { InstantReactWeb } from "./InstantReactWeb";

@@ -23,7 +23,3 @@ /**

*/
export declare function init<Schema = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config): InstantReactWeb<Schema, RoomSchema, false>;
export declare function init_experimental<Schema extends i.InstantGraph<any, any, any>, WithCardinalityInference extends boolean = true>(config: Config & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
}): InstantReactWeb<Schema, Schema extends i.InstantGraph<any, infer RoomSchema extends i.LinksDef<any>, any> ? RoomSchema : never, WithCardinalityInference>;
export declare function init<Schema = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config): InstantReactWeb<Schema, RoomSchema>;
//# sourceMappingURL=init.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.init = init;
exports.init_experimental = init_experimental;
const InstantReactWeb_1 = require("./InstantReactWeb");

@@ -29,5 +28,2 @@ /**

}
function init_experimental(config) {
return new InstantReactWeb_1.InstantReactWeb(config);
}
//# sourceMappingURL=init.js.map

@@ -1,2 +0,2 @@

import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage, InstaQLQueryParams, ConfigWithSchema, i } from "@instantdb/core";
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage } from "@instantdb/core";
import { KeyboardEvent } from "react";

@@ -24,3 +24,3 @@ export type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = PresenceResponse<PresenceShape, Keys> & {

id: string;
constructor(_core: InstantClient<Schema, RoomSchema, any>, type: RoomType, id: string);
constructor(_core: InstantClient<Schema, RoomSchema>, type: RoomType, id: string);
/**

@@ -99,10 +99,9 @@ * Listen for broadcasted events given a room and topic.

}
export declare abstract class InstantReact<Schema extends i.InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> {
tx: import("@instantdb/core").TxChunk<Schema extends i.InstantGraph<any, any, {}> ? Schema : i.InstantGraph<any, any, {}>>;
export declare abstract class InstantReact<Schema = {}, RoomSchema extends RoomSchemaShape = {}> {
auth: Auth;
storage: Storage;
_core: InstantClient<Schema, RoomSchema, WithCardinalityInference>;
_core: InstantClient<Schema, RoomSchema>;
static Storage?: any;
static NetworkListener?: any;
constructor(config: Config | ConfigWithSchema<any>);
constructor(config: Config);
getLocalId: (name: string) => Promise<string>;

@@ -149,3 +148,3 @@ /**

*/
transact: (chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]) => Promise<import("@instantdb/core").TransactionResult>;
transact: (chunks: TransactionChunk | TransactionChunk[]) => Promise<import("@instantdb/core").TransactionResult>;
/**

@@ -169,3 +168,3 @@ * Use this to query your data!

*/
useQuery: <Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>>(query: null | Q) => LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>;
useQuery: <Q extends Query>(query: Exactly<Query, Q> | null) => LifecycleSubscriptionState<Q, Schema>;
/**

@@ -172,0 +171,0 @@ * Listen for the logged in state. This is useful

@@ -174,3 +174,2 @@ "use strict";

constructor(config) {
this.tx = (0, core_1.txInit)();
this.getLocalId = (name) => {

@@ -265,3 +264,3 @@ return this._core.getLocalId(name);

};
this._core = (0, core_1._init_internal)(config,
this._core = (0, core_1.init)(config,
// @ts-expect-error because TS can't resolve subclass statics

@@ -268,0 +267,0 @@ this.constructor.Storage,

@@ -1,5 +0,5 @@

import { i, RoomSchemaShape } from "@instantdb/core";
import { RoomSchemaShape } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
export declare class InstantReactWeb<Schema extends i.InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> extends InstantReact<Schema, RoomSchema, WithCardinalityInference> {
export declare class InstantReactWeb<Schema = {}, RoomSchema extends RoomSchemaShape = {}> extends InstantReact<Schema, RoomSchema> {
}
//# sourceMappingURL=InstantReactWeb.d.ts.map
import { id, tx, lookup, i, type QueryResponse, type InstantObject, type User, type AuthState, type Query, type Config } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
import { InstantReactWeb } from "./InstantReactWeb";
import { init, init_experimental } from "./init";
import { init } from "./init";
import { Cursors } from "./Cursors";
export { id, tx, lookup, init, init_experimental, InstantReactWeb, Cursors, InstantReact, Config, Query, QueryResponse, InstantObject, User, AuthState, i, };
export { id, tx, lookup, init, InstantReactWeb, Cursors, InstantReact, Config, Query, QueryResponse, InstantObject, User, AuthState, i, };
//# sourceMappingURL=index.d.ts.map
import { id, tx, lookup, i, } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
import { InstantReactWeb } from "./InstantReactWeb";
import { init, init_experimental } from "./init";
import { init } from "./init";
import { Cursors } from "./Cursors";
export { id, tx, lookup, init, init_experimental, InstantReactWeb, Cursors,
export { id, tx, lookup, init, InstantReactWeb, Cursors,
// internal
InstantReact, i, };
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { Config, i, RoomSchemaShape } from "@instantdb/core";
import { Config, RoomSchemaShape } from "@instantdb/core";
import { InstantReactWeb } from "./InstantReactWeb";

@@ -23,7 +23,3 @@ /**

*/
export declare function init<Schema = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config): InstantReactWeb<Schema, RoomSchema, false>;
export declare function init_experimental<Schema extends i.InstantGraph<any, any, any>, WithCardinalityInference extends boolean = true>(config: Config & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
}): InstantReactWeb<Schema, Schema extends i.InstantGraph<any, infer RoomSchema extends i.LinksDef<any>, any> ? RoomSchema : never, WithCardinalityInference>;
export declare function init<Schema = {}, RoomSchema extends RoomSchemaShape = {}>(config: Config): InstantReactWeb<Schema, RoomSchema>;
//# sourceMappingURL=init.d.ts.map

@@ -25,5 +25,2 @@ import { InstantReactWeb } from "./InstantReactWeb";

}
export function init_experimental(config) {
return new InstantReactWeb(config);
}
//# sourceMappingURL=init.js.map

@@ -1,2 +0,2 @@

import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage, InstaQLQueryParams, ConfigWithSchema, i } from "@instantdb/core";
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage } from "@instantdb/core";
import { KeyboardEvent } from "react";

@@ -24,3 +24,3 @@ export type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = PresenceResponse<PresenceShape, Keys> & {

id: string;
constructor(_core: InstantClient<Schema, RoomSchema, any>, type: RoomType, id: string);
constructor(_core: InstantClient<Schema, RoomSchema>, type: RoomType, id: string);
/**

@@ -99,10 +99,9 @@ * Listen for broadcasted events given a room and topic.

}
export declare abstract class InstantReact<Schema extends i.InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> {
tx: import("@instantdb/core").TxChunk<Schema extends i.InstantGraph<any, any, {}> ? Schema : i.InstantGraph<any, any, {}>>;
export declare abstract class InstantReact<Schema = {}, RoomSchema extends RoomSchemaShape = {}> {
auth: Auth;
storage: Storage;
_core: InstantClient<Schema, RoomSchema, WithCardinalityInference>;
_core: InstantClient<Schema, RoomSchema>;
static Storage?: any;
static NetworkListener?: any;
constructor(config: Config | ConfigWithSchema<any>);
constructor(config: Config);
getLocalId: (name: string) => Promise<string>;

@@ -149,3 +148,3 @@ /**

*/
transact: (chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]) => Promise<import("@instantdb/core").TransactionResult>;
transact: (chunks: TransactionChunk | TransactionChunk[]) => Promise<import("@instantdb/core").TransactionResult>;
/**

@@ -169,3 +168,3 @@ * Use this to query your data!

*/
useQuery: <Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>>(query: null | Q) => LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>;
useQuery: <Q extends Query>(query: Exactly<Query, Q> | null) => LifecycleSubscriptionState<Q, Schema>;
/**

@@ -172,0 +171,0 @@ * Listen for the logged in state. This is useful

@@ -1,2 +0,2 @@

import { txInit, _init_internal, } from "@instantdb/core";
import { init as initCore, } from "@instantdb/core";
import { useCallback, useEffect, useMemo, useState, } from "react";

@@ -170,3 +170,2 @@ import { useQuery } from "./useQuery";

constructor(config) {
this.tx = txInit();
this.getLocalId = (name) => {

@@ -261,3 +260,3 @@ return this._core.getLocalId(name);

};
this._core = _init_internal(config,
this._core = initCore(config,
// @ts-expect-error because TS can't resolve subclass statics

@@ -264,0 +263,0 @@ this.constructor.Storage,

@@ -1,5 +0,5 @@

import { i, RoomSchemaShape } from "@instantdb/core";
import { RoomSchemaShape } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
export declare class InstantReactWeb<Schema extends i.InstantGraph<any, any> | {} = {}, RoomSchema extends RoomSchemaShape = {}, WithCardinalityInference extends boolean = false> extends InstantReact<Schema, RoomSchema, WithCardinalityInference> {
export declare class InstantReactWeb<Schema = {}, RoomSchema extends RoomSchemaShape = {}> extends InstantReact<Schema, RoomSchema> {
}
//# sourceMappingURL=InstantReactWeb.d.ts.map

@@ -1,6 +0,6 @@

import { Query, Exactly, InstantClient, LifecycleSubscriptionState, InstaQLQueryParams, i } from "@instantdb/core";
export declare function useQuery<Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>, Schema, WithCardinalityInference extends boolean>(_core: InstantClient<Schema, any, WithCardinalityInference>, _query: null | Q): {
state: LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>;
import { Query, Exactly, InstantClient, LifecycleSubscriptionState } from "@instantdb/core";
export declare function useQuery<Q extends Query, Schema>(_core: InstantClient<Schema>, _query: Exactly<Query, Q> | null): {
state: LifecycleSubscriptionState<Q, Schema>;
query: any;
};
//# sourceMappingURL=useQuery.d.ts.map

@@ -1,6 +0,6 @@

import { Query, Exactly, InstantClient, LifecycleSubscriptionState, InstaQLQueryParams, i } from "@instantdb/core";
export declare function useQuery<Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>, Schema, WithCardinalityInference extends boolean>(_core: InstantClient<Schema, any, WithCardinalityInference>, _query: null | Q): {
state: LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>;
import { Query, Exactly, InstantClient, LifecycleSubscriptionState } from "@instantdb/core";
export declare function useQuery<Q extends Query, Schema>(_core: InstantClient<Schema>, _query: Exactly<Query, Q> | null): {
state: LifecycleSubscriptionState<Q, Schema>;
query: any;
};
//# sourceMappingURL=useQuery.d.ts.map
{
"name": "@instantdb/react",
"version": "v0.12.19-experimental.0",
"version": "v0.12.19",
"description": "Instant DB for React",

@@ -34,4 +34,4 @@ "main": "dist/index.js",

"dependencies": {
"@instantdb/core": "v0.12.19-experimental.0"
"@instantdb/core": "v0.12.19"
}
}

@@ -18,3 +18,3 @@ import {

import { InstantReactWeb } from "./InstantReactWeb";
import { init, init_experimental } from "./init";
import { init } from "./init";
import { Cursors } from "./Cursors";

@@ -27,3 +27,2 @@

init,
init_experimental,
InstantReactWeb,

@@ -30,0 +29,0 @@ Cursors,

import {
// types
Config,
i,
RoomSchemaShape,

@@ -34,19 +33,1 @@ } from "@instantdb/core";

}
export function init_experimental<
Schema extends i.InstantGraph<any, any, any>,
WithCardinalityInference extends boolean = true,
>(
config: Config & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
},
) {
return new InstantReactWeb<
Schema,
Schema extends i.InstantGraph<any, infer RoomSchema, any>
? RoomSchema
: never,
WithCardinalityInference
>(config);
}
import {
init as initCore,
// types

@@ -15,7 +17,2 @@ Config,

Storage,
txInit,
InstaQLQueryParams,
ConfigWithSchema,
i,
_init_internal,
} from "@instantdb/core";

@@ -67,3 +64,3 @@ import {

constructor(
_core: InstantClient<Schema, RoomSchema, any>,
_core: InstantClient<Schema, RoomSchema>,
type: RoomType,

@@ -288,16 +285,8 @@ id: string,

export abstract class InstantReact<
Schema extends i.InstantGraph<any, any> | {} = {},
Schema = {},
RoomSchema extends RoomSchemaShape = {},
WithCardinalityInference extends boolean = false,
> {
public tx =
txInit<
Schema extends i.InstantGraph<any, any>
? Schema
: i.InstantGraph<any, any>
>();
public auth: Auth;
public storage: Storage;
public _core: InstantClient<Schema, RoomSchema, WithCardinalityInference>;
public _core: InstantClient<Schema, RoomSchema>;

@@ -307,4 +296,4 @@ static Storage?: any;

constructor(config: Config | ConfigWithSchema<any>) {
this._core = _init_internal<Schema, RoomSchema, WithCardinalityInference>(
constructor(config: Config) {
this._core = initCore<Schema, RoomSchema>(
config,

@@ -374,5 +363,3 @@ // @ts-expect-error because TS can't resolve subclass statics

*/
transact = (
chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
) => {
transact = (chunks: TransactionChunk | TransactionChunk[]) => {
return this._core.transact(chunks);

@@ -399,9 +386,5 @@ };

*/
useQuery = <
Q extends Schema extends i.InstantGraph<any, any>
? InstaQLQueryParams<Schema>
: Exactly<Query, Q>,
>(
query: null | Q,
): LifecycleSubscriptionState<Q, Schema, WithCardinalityInference> => {
useQuery = <Q extends Query>(
query: Exactly<Query, Q> | null,
): LifecycleSubscriptionState<Q, Schema> => {
return useQuery(this._core, query).state;

@@ -408,0 +391,0 @@ };

@@ -1,8 +0,7 @@

import { i, RoomSchemaShape } from "@instantdb/core";
import { RoomSchemaShape } from "@instantdb/core";
import { InstantReact } from "./InstantReact";
export class InstantReactWeb<
Schema extends i.InstantGraph<any, any> | {} = {},
Schema = {},
RoomSchema extends RoomSchemaShape = {},
WithCardinalityInference extends boolean = false,
> extends InstantReact<Schema, RoomSchema, WithCardinalityInference> {}
> extends InstantReact<Schema, RoomSchema> {}

@@ -8,4 +8,2 @@ import {

LifecycleSubscriptionState,
InstaQLQueryParams,
i,
} from "@instantdb/core";

@@ -21,15 +19,6 @@ import { useCallback, useRef, useSyncExternalStore } from "react";

export function useQuery<
Q extends Schema extends i.InstantGraph<any, any>
? InstaQLQueryParams<Schema>
: Exactly<Query, Q>,
Schema,
WithCardinalityInference extends boolean,
>(
_core: InstantClient<Schema, any, WithCardinalityInference>,
_query: null | Q,
): {
state: LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>;
query: any;
} {
export function useQuery<Q extends Query, Schema>(
_core: InstantClient<Schema>,
_query: Exactly<Query, Q> | null,
): { state: LifecycleSubscriptionState<Q, Schema>; query: any } {
const query = _query ? coerceQuery(_query) : null;

@@ -43,5 +32,3 @@ const queryHash = weakHash(query);

const resultCacheRef =
useRef<LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>>(
defaultState,
);
useRef<LifecycleSubscriptionState<Q, Schema>>(defaultState);

@@ -76,5 +63,3 @@ // (XXX): Similar to `resultCacheRef`, `useSyncExternalStore` will unsubscribe if

const state = useSyncExternalStore<
LifecycleSubscriptionState<Q, Schema, WithCardinalityInference>
>(
const state = useSyncExternalStore<LifecycleSubscriptionState<Q, Schema>>(
subscribe,

@@ -81,0 +66,0 @@ () => resultCacheRef.current,

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 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