@instantdb/core
Advanced tools
Comparing version 0.12.37 to 0.13.0
@@ -9,3 +9,2 @@ import { test, expect } from "vitest"; | ||
const schema = i.graph( | ||
"", | ||
{ | ||
@@ -88,3 +87,2 @@ posts: i.entity({}), | ||
const schema = i.graph( | ||
"", | ||
{ | ||
@@ -91,0 +89,0 @@ users: i.entity({}), |
@@ -8,3 +8,2 @@ import { test } from "vitest"; | ||
const graph = i.graph( | ||
"123", | ||
{ | ||
@@ -110,3 +109,4 @@ users: i.entity({ | ||
Graph["entities"], | ||
typeof demoQuery | ||
typeof demoQuery, | ||
true | ||
>; | ||
@@ -113,0 +113,0 @@ queryResult?.users[0].friends[0]._friends[0].bio; |
@@ -9,3 +9,2 @@ import type { RoomSchemaShape } from "./presence"; | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
@@ -36,3 +35,3 @@ * posts: i.entity({ | ||
*/ | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(appId: string, entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>, {}>; | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>, {}>; | ||
/** | ||
@@ -80,6 +79,5 @@ * Creates an entity definition, to be used in conjunction with `i.graph`. | ||
declare class InstantGraph<Entities extends EntitiesDef, Links extends LinksDef<Entities>, RoomSchema extends RoomSchemaShape = {}> { | ||
appId: string; | ||
entities: Entities; | ||
links: Links; | ||
constructor(appId: string, entities: Entities, links: Links); | ||
constructor(entities: Entities, links: Links); | ||
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantGraph<Entities, Links, _RoomSchema>; | ||
@@ -86,0 +84,0 @@ } |
@@ -14,3 +14,2 @@ export { | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
@@ -41,4 +40,4 @@ * posts: i.entity({ | ||
*/ | ||
function graph(appId, entities, links) { | ||
return new InstantGraph(appId, enrichEntitiesWithLinks(entities, links), | ||
function graph(entities, links) { | ||
return new InstantGraph(enrichEntitiesWithLinks(entities, links), | ||
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the | ||
@@ -130,4 +129,3 @@ // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with | ||
class InstantGraph { | ||
constructor(appId, entities, links) { | ||
this.appId = appId; | ||
constructor(entities, links) { | ||
this.entities = entities; | ||
@@ -137,3 +135,3 @@ this.links = links; | ||
withRoomSchema() { | ||
return new InstantGraph(this.appId, this.entities, this.links); | ||
return new InstantGraph(this.entities, this.links); | ||
} | ||
@@ -140,0 +138,0 @@ } |
@@ -9,3 +9,2 @@ import type { RoomSchemaShape } from "./presence"; | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
@@ -36,3 +35,3 @@ * posts: i.entity({ | ||
*/ | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(appId: string, entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>, {}>; | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>, {}>; | ||
/** | ||
@@ -80,6 +79,5 @@ * Creates an entity definition, to be used in conjunction with `i.graph`. | ||
declare class InstantGraph<Entities extends EntitiesDef, Links extends LinksDef<Entities>, RoomSchema extends RoomSchemaShape = {}> { | ||
appId: string; | ||
entities: Entities; | ||
links: Links; | ||
constructor(appId: string, entities: Entities, links: Links); | ||
constructor(entities: Entities, links: Links); | ||
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantGraph<Entities, Links, _RoomSchema>; | ||
@@ -86,0 +84,0 @@ } |
@@ -18,3 +18,2 @@ "use strict"; | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
@@ -45,4 +44,4 @@ * posts: i.entity({ | ||
*/ | ||
function graph(appId, entities, links) { | ||
return new InstantGraph(appId, enrichEntitiesWithLinks(entities, links), | ||
function graph(entities, links) { | ||
return new InstantGraph(enrichEntitiesWithLinks(entities, links), | ||
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the | ||
@@ -134,4 +133,3 @@ // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with | ||
class InstantGraph { | ||
constructor(appId, entities, links) { | ||
this.appId = appId; | ||
constructor(entities, links) { | ||
this.entities = entities; | ||
@@ -141,3 +139,3 @@ this.links = links; | ||
withRoomSchema() { | ||
return new InstantGraph(this.appId, this.entities, this.links); | ||
return new InstantGraph(this.entities, this.links); | ||
} | ||
@@ -144,0 +142,0 @@ } |
{ | ||
"name": "@instantdb/core", | ||
"version": "v0.12.37", | ||
"version": "v0.13.0", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -33,3 +33,2 @@ import type { RoomSchemaShape } from "./presence"; | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
@@ -63,5 +62,4 @@ * posts: i.entity({ | ||
const Links extends LinksDef<EntitiesWithoutLinks>, | ||
>(appId: string, entities: EntitiesWithoutLinks, links: Links) { | ||
>(entities: EntitiesWithoutLinks, links: Links) { | ||
return new InstantGraph( | ||
appId, | ||
enrichEntitiesWithLinks<EntitiesWithoutLinks, Links>(entities, links), | ||
@@ -220,3 +218,2 @@ // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the | ||
constructor( | ||
public appId: string, | ||
public entities: Entities, | ||
@@ -228,3 +225,2 @@ public links: Links, | ||
return new InstantGraph<Entities, Links, _RoomSchema>( | ||
this.appId, | ||
this.entities, | ||
@@ -231,0 +227,0 @@ this.links, |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
2002743
40832