@instantdb/core
Advanced tools
Comparing version 0.12.5 to 0.12.6
@@ -74,3 +74,3 @@ import Reactor from "./Reactor"; | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* @see https://instantdb.com/docs/instaml | ||
* | ||
@@ -100,3 +100,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* @see https://instantdb.com/docs/instaql | ||
* | ||
@@ -127,3 +127,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -142,3 +142,3 @@ * const unsub = db.subscribeAuth((auth) => { | ||
* | ||
* @see https://docs.instantdb.com/docs/presence-and-topics | ||
* @see https://instantdb.com/docs/presence-and-topics | ||
* @example | ||
@@ -164,3 +164,3 @@ * // init | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
*/ | ||
@@ -176,3 +176,3 @@ declare class Auth { | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -188,3 +188,3 @@ * db.auth.sendMagicCode({email: "example@gmail.com"}) | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -202,3 +202,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* | ||
@@ -215,3 +215,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -235,3 +235,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -259,3 +259,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -282,3 +282,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -304,3 +304,3 @@ * const discovery = useAutoDiscovery( | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -314,3 +314,3 @@ * const [file] = e.target.files; // result of file input | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -317,0 +317,0 @@ * const url = await db.storage.getDownloadUrl('photos/demo.png'); |
@@ -95,3 +95,3 @@ "use strict"; | ||
globalInstantCoreStore[config.appId] = client; | ||
if (typeof window !== "undefined") { | ||
if (typeof window !== "undefined" && typeof window.location !== "undefined") { | ||
const showDevtool = | ||
@@ -101,3 +101,3 @@ // show widget by deafult? | ||
// only run on localhost (dev env) | ||
location.hostname === "localhost" && | ||
window.location.hostname === "localhost" && | ||
// used by dash and other internal consumers | ||
@@ -120,3 +120,3 @@ !Boolean(globalThis._nodevtool); | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* @see https://instantdb.com/docs/instaml | ||
* | ||
@@ -150,3 +150,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* @see https://instantdb.com/docs/instaql | ||
* | ||
@@ -179,3 +179,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -196,3 +196,3 @@ * const unsub = db.subscribeAuth((auth) => { | ||
* | ||
* @see https://docs.instantdb.com/docs/presence-and-topics | ||
* @see https://instantdb.com/docs/presence-and-topics | ||
* @example | ||
@@ -232,3 +232,3 @@ * // init | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
*/ | ||
@@ -244,3 +244,3 @@ class Auth { | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -256,3 +256,3 @@ * db.auth.sendMagicCode({email: "example@gmail.com"}) | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -269,3 +269,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* | ||
@@ -284,3 +284,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -303,3 +303,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -325,3 +325,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -347,3 +347,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -375,3 +375,3 @@ * const discovery = useAutoDiscovery( | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -387,3 +387,3 @@ * const [file] = e.target.files; // result of file input | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -390,0 +390,0 @@ * const url = await db.storage.getDownloadUrl('photos/demo.png'); |
@@ -161,2 +161,3 @@ "use strict"; | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -178,2 +179,3 @@ } | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -204,3 +206,13 @@ } | ||
const attrTxSteps = objectAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const attr = getAttrByFwdIdentName(attrs, etype, label); | ||
if (attr === null || attr === void 0 ? void 0 : attr.isUnsynced) { | ||
ret.push(attr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -218,3 +230,17 @@ function createMissingRefAttrs(attrs, ops) { | ||
const attrTxSteps = refAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const fwdAttr = getAttrByFwdIdentName(attrs, etype, label); | ||
const revAttr = getAttrByReverseIdentName(attrs, etype, label); | ||
if (fwdAttr === null || fwdAttr === void 0 ? void 0 : fwdAttr.isUnsynced) { | ||
ret.push(fwdAttr); | ||
} | ||
if (revAttr === null || revAttr === void 0 ? void 0 : revAttr.isUnsynced) { | ||
ret.push(revAttr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -221,0 +247,0 @@ function transform(attrs, inputChunks) { |
@@ -74,3 +74,3 @@ import Reactor from "./Reactor"; | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* @see https://instantdb.com/docs/instaml | ||
* | ||
@@ -100,3 +100,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* @see https://instantdb.com/docs/instaql | ||
* | ||
@@ -127,3 +127,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -142,3 +142,3 @@ * const unsub = db.subscribeAuth((auth) => { | ||
* | ||
* @see https://docs.instantdb.com/docs/presence-and-topics | ||
* @see https://instantdb.com/docs/presence-and-topics | ||
* @example | ||
@@ -164,3 +164,3 @@ * // init | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
*/ | ||
@@ -176,3 +176,3 @@ declare class Auth { | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -188,3 +188,3 @@ * db.auth.sendMagicCode({email: "example@gmail.com"}) | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -202,3 +202,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* | ||
@@ -215,3 +215,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -235,3 +235,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -259,3 +259,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -282,3 +282,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -304,3 +304,3 @@ * const discovery = useAutoDiscovery( | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -314,3 +314,3 @@ * const [file] = e.target.files; // result of file input | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -317,0 +317,0 @@ * const url = await db.storage.getDownloadUrl('photos/demo.png'); |
@@ -56,3 +56,3 @@ import Reactor from "./Reactor"; | ||
globalInstantCoreStore[config.appId] = client; | ||
if (typeof window !== "undefined") { | ||
if (typeof window !== "undefined" && typeof window.location !== "undefined") { | ||
const showDevtool = | ||
@@ -62,3 +62,3 @@ // show widget by deafult? | ||
// only run on localhost (dev env) | ||
location.hostname === "localhost" && | ||
window.location.hostname === "localhost" && | ||
// used by dash and other internal consumers | ||
@@ -81,3 +81,3 @@ !Boolean(globalThis._nodevtool); | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* @see https://instantdb.com/docs/instaml | ||
* | ||
@@ -111,3 +111,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* @see https://instantdb.com/docs/instaql | ||
* | ||
@@ -140,3 +140,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -157,3 +157,3 @@ * const unsub = db.subscribeAuth((auth) => { | ||
* | ||
* @see https://docs.instantdb.com/docs/presence-and-topics | ||
* @see https://instantdb.com/docs/presence-and-topics | ||
* @example | ||
@@ -192,3 +192,3 @@ * // init | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
*/ | ||
@@ -204,3 +204,3 @@ class Auth { | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -216,3 +216,3 @@ * db.auth.sendMagicCode({email: "example@gmail.com"}) | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -229,3 +229,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* | ||
@@ -244,3 +244,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -263,3 +263,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -285,3 +285,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -307,3 +307,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -334,3 +334,3 @@ * const discovery = useAutoDiscovery( | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -346,3 +346,3 @@ * const [file] = e.target.files; // result of file input | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -349,0 +349,0 @@ * const url = await db.storage.getDownloadUrl('photos/demo.png'); |
@@ -153,2 +153,3 @@ import { getOps, isLookup, parseLookup } from "./instatx"; | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -170,2 +171,3 @@ } | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -196,3 +198,13 @@ } | ||
const attrTxSteps = objectAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const attr = getAttrByFwdIdentName(attrs, etype, label); | ||
if (attr === null || attr === void 0 ? void 0 : attr.isUnsynced) { | ||
ret.push(attr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -210,3 +222,17 @@ function createMissingRefAttrs(attrs, ops) { | ||
const attrTxSteps = refAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const fwdAttr = getAttrByFwdIdentName(attrs, etype, label); | ||
const revAttr = getAttrByReverseIdentName(attrs, etype, label); | ||
if (fwdAttr === null || fwdAttr === void 0 ? void 0 : fwdAttr.isUnsynced) { | ||
ret.push(fwdAttr); | ||
} | ||
if (revAttr === null || revAttr === void 0 ? void 0 : revAttr.isUnsynced) { | ||
ret.push(revAttr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -213,0 +239,0 @@ export function transform(attrs, inputChunks) { |
@@ -5,3 +5,3 @@ export { graph, entity, string, number, boolean, json, any, InstaQLQueryResult, }; | ||
* | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @see https://instantdb.com/docs/schema#defining-entities | ||
* @example | ||
@@ -39,3 +39,3 @@ * export default i.graph( | ||
* | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @see https://instantdb.com/docs/schema | ||
* @example | ||
@@ -42,0 +42,0 @@ * { |
@@ -11,3 +11,3 @@ export { | ||
* | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @see https://instantdb.com/docs/schema#defining-entities | ||
* @example | ||
@@ -53,3 +53,3 @@ * export default i.graph( | ||
* | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @see https://instantdb.com/docs/schema | ||
* @example | ||
@@ -56,0 +56,0 @@ * { |
@@ -5,3 +5,3 @@ export { graph, entity, string, number, boolean, json, any, InstaQLQueryResult, }; | ||
* | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @see https://instantdb.com/docs/schema#defining-entities | ||
* @example | ||
@@ -39,3 +39,3 @@ * export default i.graph( | ||
* | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @see https://instantdb.com/docs/schema | ||
* @example | ||
@@ -42,0 +42,0 @@ * { |
@@ -15,3 +15,3 @@ "use strict"; | ||
* | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @see https://instantdb.com/docs/schema#defining-entities | ||
* @example | ||
@@ -57,3 +57,3 @@ * export default i.graph( | ||
* | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @see https://instantdb.com/docs/schema | ||
* @example | ||
@@ -60,0 +60,0 @@ * { |
{ | ||
"name": "@instantdb/core", | ||
"version": "0.12.5", | ||
"version": "0.12.6", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,3 +0,45 @@ | ||
# @instantdb/core | ||
<p align="center"> | ||
<a href="https://instantdb.com"> | ||
<img alt="Shows the Instant logo" src="https://instantdb.com/img/icon/android-chrome-512x512.png" width="10%"> | ||
</a> | ||
<h1 align="center">@instantdb/core</h1> | ||
</p> | ||
Instant's core local abstraction. Houses ReactiveDB. | ||
<p align="center"> | ||
<a | ||
href="https://discord.com/invite/VU53p7uQcE" > | ||
<img height=20 src="https://img.shields.io/discord/1031957483243188235" /> | ||
</a> | ||
<img src="https://img.shields.io/github/stars/instantdb/instant" alt="stars"> | ||
</p> | ||
<p align="center"> | ||
<a href="https://www.instantdb.com/docs/start-vanilla">Get Started</a> · | ||
<a href="https://instantdb.com/examples">Examples</a> · | ||
<a href="https://www.instantdb.com/docs/start-vanilla">Docs</a> · | ||
<a href="https://discord.com/invite/VU53p7uQcE">Discord</a> | ||
<p> | ||
Welcome to [Instant's](http://instantdb.com) vanilla javascript SDK. | ||
```javascript | ||
db.subscribeQuery({ todos: {} }, (resp) => { | ||
if (resp.error) { | ||
renderError(resp.error.message); | ||
return; | ||
} | ||
if (resp.data) { | ||
render(resp.data); // wohoo! | ||
} | ||
}); | ||
``` | ||
# Get Started | ||
Follow the [getting started in vanilla Javascript](https://www.instantdb.com/docs/start-vanilla) tutorial to set up a live app in under 5 minutes! | ||
# Questions? | ||
If you have any questions, feel free to drop us a line on our [Discord](https://discord.com/invite/VU53p7uQcE) | ||
@@ -146,3 +146,3 @@ import Reactor from "./Reactor"; | ||
if (typeof window !== "undefined") { | ||
if (typeof window !== "undefined" && typeof window.location !== "undefined") { | ||
const showDevtool = | ||
@@ -152,3 +152,3 @@ // show widget by deafult? | ||
// only run on localhost (dev env) | ||
location.hostname === "localhost" && | ||
window.location.hostname === "localhost" && | ||
// used by dash and other internal consumers | ||
@@ -179,3 +179,3 @@ !Boolean((globalThis as any)._nodevtool); | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* @see https://instantdb.com/docs/instaml | ||
* | ||
@@ -213,3 +213,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/instaql | ||
* @see https://instantdb.com/docs/instaql | ||
* | ||
@@ -246,3 +246,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -264,3 +264,3 @@ * const unsub = db.subscribeAuth((auth) => { | ||
* | ||
* @see https://docs.instantdb.com/docs/presence-and-topics | ||
* @see https://instantdb.com/docs/presence-and-topics | ||
* @example | ||
@@ -312,3 +312,3 @@ * // init | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
*/ | ||
@@ -324,3 +324,3 @@ class Auth { | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -336,3 +336,3 @@ * db.auth.sendMagicCode({email: "example@gmail.com"}) | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -350,3 +350,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token | ||
* | ||
@@ -366,3 +366,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* | ||
@@ -386,3 +386,3 @@ * @example | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -413,3 +413,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -439,3 +439,3 @@ * db.auth | ||
* | ||
* @see https://docs.instantdb.com/docs/auth | ||
* @see https://instantdb.com/docs/auth | ||
* @example | ||
@@ -467,3 +467,3 @@ * const discovery = useAutoDiscovery( | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -480,3 +480,3 @@ * const [file] = e.target.files; // result of file input | ||
* | ||
* @see https://docs.instantdb.com/docs/storage | ||
* @see https://instantdb.com/docs/storage | ||
* @example | ||
@@ -483,0 +483,0 @@ * const url = await db.storage.getDownloadUrl('photos/demo.png'); |
@@ -170,2 +170,3 @@ import { getOps, isLookup, parseLookup } from "./instatx"; | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -188,2 +189,3 @@ } | ||
"index?": false, | ||
isUnsynced: true, | ||
}; | ||
@@ -223,3 +225,15 @@ } | ||
const attrTxSteps = objectAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const attr = getAttrByFwdIdentName(attrs, etype, label); | ||
if (attr?.isUnsynced) { | ||
ret.push(attr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -246,3 +260,19 @@ | ||
const attrTxSteps = refAttrs.map((attr) => ["add-attr", attr]); | ||
return [newAttrs, attrTxSteps]; | ||
const localAttrs = objectIdents.flatMap(([etype, label]) => { | ||
const ret = []; | ||
const fwdAttr = getAttrByFwdIdentName(attrs, etype, label); | ||
const revAttr = getAttrByReverseIdentName(attrs, etype, label); | ||
if (fwdAttr?.isUnsynced) { | ||
ret.push(fwdAttr); | ||
} | ||
if (revAttr?.isUnsynced) { | ||
ret.push(revAttr); | ||
} | ||
return ret; | ||
}); | ||
const localAttrTxSteps = localAttrs.map((attr) => ["add-attr", attr]); | ||
const txSteps = [...attrTxSteps, ...localAttrTxSteps]; | ||
return [newAttrs, txSteps]; | ||
} | ||
@@ -249,0 +279,0 @@ |
@@ -21,3 +21,3 @@ export { | ||
* | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @see https://instantdb.com/docs/schema#defining-entities | ||
* @example | ||
@@ -70,3 +70,3 @@ * export default i.graph( | ||
* | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @see https://instantdb.com/docs/schema | ||
* @example | ||
@@ -73,0 +73,0 @@ * { |
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
1622969
34031
46