@instantdb/core
Advanced tools
Comparing version 0.14.27 to 0.14.28-experimental.0
@@ -8,2 +8,3 @@ import Reactor from "./Reactor"; | ||
import { i } from "./schema"; | ||
import version from "./version"; | ||
import type { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from "./presence"; | ||
@@ -77,3 +78,5 @@ import type { IDatabase } from "./coreTypes"; | ||
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): InstantCore<Schema, RoomSchema, WithCardinalityInference>; | ||
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> { | ||
@@ -352,3 +355,3 @@ withCardinalityInference?: WithCardinalityInference; | ||
declare function coerceQuery(o: any): any; | ||
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type User, type AuthToken, type TxChunk, type SubscriptionState, type LifecycleSubscriptionState, type PresenceOpts, type PresenceSlice, type PresenceResponse, 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 InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, }; | ||
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type User, type AuthToken, type TxChunk, type SubscriptionState, type LifecycleSubscriptionState, type PresenceOpts, type PresenceSlice, type PresenceResponse, 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 InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Storage = exports.Auth = 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.InstantClient = exports.WindowNetworkListener = exports.IndexedDBStorage = exports.weakHash = exports.getOps = exports.i = exports.lookup = exports.txInit = exports.tx = exports.id = void 0; | ||
exports.init = init; | ||
@@ -29,2 +29,4 @@ exports.init_experimental = init_experimental; | ||
const devtool_1 = require("./devtool"); | ||
const version_1 = __importDefault(require("./version")); | ||
exports.version = version_1.default; | ||
const defaultOpenDevtool = true; | ||
@@ -70,3 +72,3 @@ // consts | ||
} | ||
function _init_internal(config, Storage, NetworkListener) { | ||
function _init_internal(config, Storage, NetworkListener, versions) { | ||
const existingClient = globalInstantCoreStore[config.appId]; | ||
@@ -76,3 +78,3 @@ if (existingClient) { | ||
} | ||
const reactor = new Reactor_1.default(Object.assign(Object.assign({}, defaultConfig), config), Storage || IndexedDBStorage_1.default, NetworkListener || WindowNetworkListener_1.default); | ||
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); | ||
@@ -79,0 +81,0 @@ globalInstantCoreStore[config.appId] = client; |
@@ -8,2 +8,3 @@ import Reactor from "./Reactor"; | ||
import { i } from "./schema"; | ||
import version from "./version"; | ||
import type { PresenceOpts, PresenceResponse, PresenceSlice, RoomSchemaShape } from "./presence"; | ||
@@ -77,3 +78,5 @@ import type { IDatabase } from "./coreTypes"; | ||
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): InstantCore<Schema, RoomSchema, WithCardinalityInference>; | ||
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> { | ||
@@ -352,3 +355,3 @@ withCardinalityInference?: WithCardinalityInference; | ||
declare function coerceQuery(o: any): any; | ||
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type User, type AuthToken, type TxChunk, type SubscriptionState, type LifecycleSubscriptionState, type PresenceOpts, type PresenceSlice, type PresenceResponse, 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 InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, }; | ||
export { init, init_experimental, _init_internal, id, tx, txInit, lookup, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, version, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type User, type AuthToken, type TxChunk, type SubscriptionState, type LifecycleSubscriptionState, type PresenceOpts, type PresenceSlice, type PresenceResponse, 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 InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,2 +9,3 @@ import Reactor from "./Reactor"; | ||
import { createDevtool } from "./devtool"; | ||
import version from "./version"; | ||
const defaultOpenDevtool = true; | ||
@@ -50,3 +51,3 @@ // consts | ||
} | ||
function _init_internal(config, Storage, NetworkListener) { | ||
function _init_internal(config, Storage, NetworkListener, versions) { | ||
const existingClient = globalInstantCoreStore[config.appId]; | ||
@@ -56,3 +57,3 @@ if (existingClient) { | ||
} | ||
const reactor = new Reactor(Object.assign(Object.assign({}, defaultConfig), config), Storage || IndexedDBStorage, NetworkListener || WindowNetworkListener); | ||
const reactor = new Reactor(Object.assign(Object.assign({}, defaultConfig), config), Storage || IndexedDBStorage, NetworkListener || WindowNetworkListener, versions); | ||
const client = new InstantCore(reactor); | ||
@@ -387,3 +388,3 @@ globalInstantCoreStore[config.appId] = client; | ||
// util | ||
getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, }; | ||
getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCore as InstantClient, Auth, Storage, version, }; | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ /** | ||
export default class Reactor<RoomSchema extends import("./presence").RoomSchemaShape = {}> { | ||
constructor(config: any, Storage?: typeof IndexedDBStorage, NetworkListener?: typeof WindowNetworkListener); | ||
constructor(config: any, Storage: typeof IndexedDBStorage, NetworkListener: typeof WindowNetworkListener, versions: any); | ||
attrs: any; | ||
@@ -64,2 +64,3 @@ _isOnline: boolean; | ||
_dataForQueryCache: {}; | ||
versions: any; | ||
_beforeUnload(): void; | ||
@@ -66,0 +67,0 @@ _initStorage(Storage: any): void; |
@@ -27,2 +27,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { createLinkIndex } from "./utils/linkIndex"; | ||
import version from "./version"; | ||
const STATUS = { | ||
@@ -92,3 +93,3 @@ CONNECTING: "connecting", | ||
export default class Reactor { | ||
constructor(config, Storage = IndexedDBStorage, NetworkListener = WindowNetworkListener) { | ||
constructor(config, Storage = IndexedDBStorage, NetworkListener = WindowNetworkListener, versions) { | ||
this._isOnline = true; | ||
@@ -253,2 +254,3 @@ this._isShutdown = false; | ||
"refresh-token": (_a = resp.user) === null || _a === void 0 ? void 0 : _a["refresh_token"], | ||
versions: this.versions, | ||
// If an admin token is provided for an app, we will | ||
@@ -305,2 +307,3 @@ // skip all permission checks. This is an advanced feature, | ||
this.config = Object.assign(Object.assign({}, defaultConfig), config); | ||
this.versions = Object.assign(Object.assign({}, (versions || {})), { "@instantdb/core": version }); | ||
if (this.config.schema) { | ||
@@ -307,0 +310,0 @@ this._linkIndex = createLinkIndex(this.config.schema); |
@@ -5,3 +5,3 @@ /** | ||
export default class Reactor<RoomSchema extends import("./presence").RoomSchemaShape = {}> { | ||
constructor(config: any, Storage?: typeof IndexedDBStorage, NetworkListener?: typeof WindowNetworkListener); | ||
constructor(config: any, Storage: typeof IndexedDBStorage, NetworkListener: typeof WindowNetworkListener, versions: any); | ||
attrs: any; | ||
@@ -64,2 +64,3 @@ _isOnline: boolean; | ||
_dataForQueryCache: {}; | ||
versions: any; | ||
_beforeUnload(): void; | ||
@@ -66,0 +67,0 @@ _initStorage(Storage: any): void; |
{ | ||
"name": "@instantdb/core", | ||
"version": "v0.14.27", | ||
"version": "v0.14.28-experimental.0", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -16,2 +16,3 @@ import Reactor from "./Reactor"; | ||
import { createDevtool } from "./devtool"; | ||
import version from "./version"; | ||
@@ -196,2 +197,3 @@ import type { | ||
NetworkListener?: any, | ||
versions?: { [key: string]: string }, | ||
): InstantCore<Schema, RoomSchema, WithCardinalityInference> { | ||
@@ -215,2 +217,3 @@ const existingClient = globalInstantCoreStore[config.appId] as InstantCore< | ||
NetworkListener || WindowNetworkListener, | ||
versions, | ||
); | ||
@@ -639,2 +642,3 @@ | ||
Storage, | ||
version, | ||
@@ -641,0 +645,0 @@ // og types |
@@ -18,2 +18,3 @@ // @ts-check | ||
import { createLinkIndex } from "./utils/linkIndex"; | ||
import version from "./version"; | ||
@@ -146,4 +147,6 @@ const STATUS = { | ||
NetworkListener = WindowNetworkListener, | ||
versions, | ||
) { | ||
this.config = { ...defaultConfig, ...config }; | ||
this.versions = { ...(versions || {}), "@instantdb/core": version }; | ||
@@ -1055,2 +1058,3 @@ if (this.config.schema) { | ||
"refresh-token": resp.user?.["refresh_token"], | ||
versions: this.versions, | ||
// If an admin token is provided for an app, we will | ||
@@ -1057,0 +1061,0 @@ // skip all permission checks. This is an advanced feature, |
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
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
2411933
317
42691