@instantdb/react
Advanced tools
Comparing version 0.11.3 to 0.11.4
@@ -1,2 +0,2 @@ | ||
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape } from "@instantdb/core"; | ||
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage } from "@instantdb/core"; | ||
import { KeyboardEvent } from "react"; | ||
@@ -100,2 +100,3 @@ export type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = PresenceResponse<PresenceShape, Keys> & { | ||
auth: Auth; | ||
storage: Storage; | ||
_core: InstantClient<Schema, RoomSchema>; | ||
@@ -102,0 +103,0 @@ static Storage?: any; |
@@ -266,2 +266,3 @@ "use strict"; | ||
this.auth = this._core.auth; | ||
this.storage = this._core.storage; | ||
} | ||
@@ -284,3 +285,3 @@ /** | ||
*/ | ||
room(type = '_defaultRoomType', id = '_defaultRoomId') { | ||
room(type = "_defaultRoomType", id = "_defaultRoomId") { | ||
return new InstantReactRoom(this._core, type, id); | ||
@@ -287,0 +288,0 @@ } |
@@ -1,26 +0,5 @@ | ||
import { Query, LifecycleSubscriptionState, Exactly, RoomSchemaShape } from "@instantdb/core"; | ||
import { RoomSchemaShape } from "@instantdb/core"; | ||
import { InstantReact } from "./InstantReact"; | ||
export declare class InstantReactWeb<Schema = {}, PresenceShape extends RoomSchemaShape = {}> extends InstantReact<Schema, PresenceShape> { | ||
/** | ||
* Use this to query your data! | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* | ||
* @example | ||
* // listen to all goals | ||
* db.useQuery({ goals: {} }) | ||
* | ||
* // goals where the title is "Get Fit" | ||
* db.useQuery({ goals: { $: { where: { title: "Get Fit" } } } }) | ||
* | ||
* // all goals, _alongside_ their todos | ||
* db.useQuery({ goals: { todos: {} } }) | ||
* | ||
* Curious about the state of your query? | ||
* Just add a `debugRef` to any element to see the inspector appear! | ||
*/ | ||
useQuery: <Q extends Query>(_query: Exactly<Query, Q>) => { | ||
debugRef: React.LegacyRef<any>; | ||
} & LifecycleSubscriptionState<Q, Schema>; | ||
export declare class InstantReactWeb<Schema = {}, RoomSchema extends RoomSchemaShape = {}> extends InstantReact<Schema, RoomSchema> { | ||
} | ||
//# sourceMappingURL=InstantReactWeb.d.ts.map |
@@ -5,30 +5,5 @@ "use strict"; | ||
const InstantReact_1 = require("./InstantReact"); | ||
const useQuery_1 = require("./useQuery"); | ||
class InstantReactWeb extends InstantReact_1.InstantReact { | ||
constructor() { | ||
super(...arguments); | ||
/** | ||
* Use this to query your data! | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* | ||
* @example | ||
* // listen to all goals | ||
* db.useQuery({ goals: {} }) | ||
* | ||
* // goals where the title is "Get Fit" | ||
* db.useQuery({ goals: { $: { where: { title: "Get Fit" } } } }) | ||
* | ||
* // all goals, _alongside_ their todos | ||
* db.useQuery({ goals: { todos: {} } }) | ||
* | ||
* Curious about the state of your query? | ||
* Just add a `debugRef` to any element to see the inspector appear! | ||
*/ | ||
this.useQuery = (_query) => { | ||
return (0, useQuery_1.useQueryWithDebug)(this._core, _query); | ||
}; | ||
} | ||
} | ||
exports.InstantReactWeb = InstantReactWeb; | ||
//# sourceMappingURL=InstantReactWeb.js.map |
@@ -1,2 +0,2 @@ | ||
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape } from "@instantdb/core"; | ||
import { Config, Query, Exactly, AuthState, InstantClient, TransactionChunk, Auth, LifecycleSubscriptionState, PresenceOpts, PresenceResponse, RoomSchemaShape, Storage } from "@instantdb/core"; | ||
import { KeyboardEvent } from "react"; | ||
@@ -100,2 +100,3 @@ export type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = PresenceResponse<PresenceShape, Keys> & { | ||
auth: Auth; | ||
storage: Storage; | ||
_core: InstantClient<Schema, RoomSchema>; | ||
@@ -102,0 +103,0 @@ static Storage?: any; |
@@ -262,2 +262,3 @@ import { init as initCore, } from "@instantdb/core"; | ||
this.auth = this._core.auth; | ||
this.storage = this._core.storage; | ||
} | ||
@@ -280,3 +281,3 @@ /** | ||
*/ | ||
room(type = '_defaultRoomType', id = '_defaultRoomId') { | ||
room(type = "_defaultRoomType", id = "_defaultRoomId") { | ||
return new InstantReactRoom(this._core, type, id); | ||
@@ -283,0 +284,0 @@ } |
@@ -1,26 +0,5 @@ | ||
import { Query, LifecycleSubscriptionState, Exactly, RoomSchemaShape } from "@instantdb/core"; | ||
import { RoomSchemaShape } from "@instantdb/core"; | ||
import { InstantReact } from "./InstantReact"; | ||
export declare class InstantReactWeb<Schema = {}, PresenceShape extends RoomSchemaShape = {}> extends InstantReact<Schema, PresenceShape> { | ||
/** | ||
* Use this to query your data! | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* | ||
* @example | ||
* // listen to all goals | ||
* db.useQuery({ goals: {} }) | ||
* | ||
* // goals where the title is "Get Fit" | ||
* db.useQuery({ goals: { $: { where: { title: "Get Fit" } } } }) | ||
* | ||
* // all goals, _alongside_ their todos | ||
* db.useQuery({ goals: { todos: {} } }) | ||
* | ||
* Curious about the state of your query? | ||
* Just add a `debugRef` to any element to see the inspector appear! | ||
*/ | ||
useQuery: <Q extends Query>(_query: Exactly<Query, Q>) => { | ||
debugRef: React.LegacyRef<any>; | ||
} & LifecycleSubscriptionState<Q, Schema>; | ||
export declare class InstantReactWeb<Schema = {}, RoomSchema extends RoomSchemaShape = {}> extends InstantReact<Schema, RoomSchema> { | ||
} | ||
//# sourceMappingURL=InstantReactWeb.d.ts.map |
import { InstantReact } from "./InstantReact"; | ||
import { useQueryWithDebug } from "./useQuery"; | ||
export class InstantReactWeb extends InstantReact { | ||
constructor() { | ||
super(...arguments); | ||
/** | ||
* Use this to query your data! | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* | ||
* @example | ||
* // listen to all goals | ||
* db.useQuery({ goals: {} }) | ||
* | ||
* // goals where the title is "Get Fit" | ||
* db.useQuery({ goals: { $: { where: { title: "Get Fit" } } } }) | ||
* | ||
* // all goals, _alongside_ their todos | ||
* db.useQuery({ goals: { todos: {} } }) | ||
* | ||
* Curious about the state of your query? | ||
* Just add a `debugRef` to any element to see the inspector appear! | ||
*/ | ||
this.useQuery = (_query) => { | ||
return useQueryWithDebug(this._core, _query); | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=InstantReactWeb.js.map |
@@ -6,5 +6,2 @@ import { Query, Exactly, InstantClient, LifecycleSubscriptionState } from "@instantdb/core"; | ||
}; | ||
export declare function useQueryWithDebug<Q extends Query, Schema>(_core: InstantClient<Schema>, _query: Exactly<Query, Q>): { | ||
debugRef: React.LegacyRef<any>; | ||
} & LifecycleSubscriptionState<Q, Schema>; | ||
//# sourceMappingURL=useQuery.d.ts.map |
import { weakHash, coerceQuery, } from "@instantdb/core"; | ||
import { useEffect, useState } from "react"; | ||
import { useDebugRef } from "./debug"; | ||
export function useQuery(_core, _query) { | ||
@@ -28,7 +27,2 @@ const query = coerceQuery(_query); | ||
} | ||
export function useQueryWithDebug(_core, _query) { | ||
const { state, query } = useQuery(_core, _query); | ||
const { debugRef } = useDebugRef({ query, state }); | ||
return Object.assign(Object.assign({}, state), { debugRef }); | ||
} | ||
//# sourceMappingURL=useQuery.js.map |
@@ -6,5 +6,2 @@ import { Query, Exactly, InstantClient, LifecycleSubscriptionState } from "@instantdb/core"; | ||
}; | ||
export declare function useQueryWithDebug<Q extends Query, Schema>(_core: InstantClient<Schema>, _query: Exactly<Query, Q>): { | ||
debugRef: React.LegacyRef<any>; | ||
} & LifecycleSubscriptionState<Q, Schema>; | ||
//# sourceMappingURL=useQuery.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useQuery = useQuery; | ||
exports.useQueryWithDebug = useQueryWithDebug; | ||
const core_1 = require("@instantdb/core"); | ||
const react_1 = require("react"); | ||
const debug_1 = require("./debug"); | ||
function useQuery(_core, _query) { | ||
@@ -32,7 +30,2 @@ const query = (0, core_1.coerceQuery)(_query); | ||
} | ||
function useQueryWithDebug(_core, _query) { | ||
const { state, query } = useQuery(_core, _query); | ||
const { debugRef } = (0, debug_1.useDebugRef)({ query, state }); | ||
return Object.assign(Object.assign({}, state), { debugRef }); | ||
} | ||
//# sourceMappingURL=useQuery.js.map |
{ | ||
"name": "@instantdb/react", | ||
"version": "0.11.3", | ||
"version": "0.11.4", | ||
"description": "Instant DB for React", | ||
@@ -31,4 +31,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@instantdb/core": "0.11.3" | ||
"@instantdb/core": "0.11.4" | ||
} | ||
} |
@@ -16,2 +16,3 @@ import { | ||
RoomSchemaShape, | ||
Storage, | ||
} from "@instantdb/core"; | ||
@@ -57,3 +58,3 @@ import { | ||
RoomType extends keyof RoomSchema, | ||
> { | ||
> { | ||
_core: InstantClient<Schema, RoomSchema>; | ||
@@ -286,4 +287,5 @@ type: RoomType; | ||
RoomSchema extends RoomSchemaShape = {}, | ||
> { | ||
> { | ||
public auth: Auth; | ||
public storage: Storage; | ||
public _core: InstantClient<Schema, RoomSchema>; | ||
@@ -303,2 +305,3 @@ | ||
this.auth = this._core.auth; | ||
this.storage = this._core.storage; | ||
} | ||
@@ -327,4 +330,4 @@ | ||
room<RoomType extends keyof RoomSchema>( | ||
type: RoomType = '_defaultRoomType' as RoomType, | ||
id: string = '_defaultRoomId', | ||
type: RoomType = "_defaultRoomType" as RoomType, | ||
id: string = "_defaultRoomId", | ||
) { | ||
@@ -331,0 +334,0 @@ return new InstantReactRoom<Schema, RoomSchema, RoomType>( |
@@ -1,40 +0,7 @@ | ||
import { | ||
Query, | ||
LifecycleSubscriptionState, | ||
Exactly, | ||
RoomSchemaShape, | ||
} from "@instantdb/core"; | ||
import { RoomSchemaShape } from "@instantdb/core"; | ||
import { InstantReact } from "./InstantReact"; | ||
import { useQueryWithDebug } from "./useQuery"; | ||
export class InstantReactWeb< | ||
Schema = {}, | ||
PresenceShape extends RoomSchemaShape = {}, | ||
> extends InstantReact<Schema, PresenceShape> { | ||
/** | ||
* Use this to query your data! | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* | ||
* @example | ||
* // listen to all goals | ||
* db.useQuery({ goals: {} }) | ||
* | ||
* // goals where the title is "Get Fit" | ||
* db.useQuery({ goals: { $: { where: { title: "Get Fit" } } } }) | ||
* | ||
* // all goals, _alongside_ their todos | ||
* db.useQuery({ goals: { todos: {} } }) | ||
* | ||
* Curious about the state of your query? | ||
* Just add a `debugRef` to any element to see the inspector appear! | ||
*/ | ||
useQuery = <Q extends Query>( | ||
_query: Exactly<Query, Q>, | ||
): { debugRef: React.LegacyRef<any> } & LifecycleSubscriptionState< | ||
Q, | ||
Schema | ||
> => { | ||
return useQueryWithDebug<Q, Schema>(this._core, _query); | ||
}; | ||
} | ||
RoomSchema extends RoomSchemaShape = {}, | ||
> extends InstantReact<Schema, RoomSchema> {} |
@@ -10,3 +10,2 @@ import { | ||
import { useEffect, useState } from "react"; | ||
import { useDebugRef } from "./debug"; | ||
@@ -41,11 +40,1 @@ export function useQuery<Q extends Query, Schema>( | ||
} | ||
export function useQueryWithDebug<Q extends Query, Schema>( | ||
_core: InstantClient<Schema>, | ||
_query: Exactly<Query, Q>, | ||
): { debugRef: React.LegacyRef<any> } & LifecycleSubscriptionState<Q, Schema> { | ||
const { state, query } = useQuery<Q, Schema>(_core, _query); | ||
const { debugRef } = useDebugRef({ query, state }); | ||
return { ...state, debugRef }; | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
106837
67
2083
+ Added@instantdb/core@0.11.4(transitive)
- Removed@instantdb/core@0.11.3(transitive)
Updated@instantdb/core@0.11.4