@instantdb/core 0.22.56 → 0.22.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/Reactor.d.ts +5 -0
- package/dist/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +43 -5
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/SyncTable.d.ts +140 -0
- package/dist/commonjs/SyncTable.d.ts.map +1 -0
- package/dist/commonjs/SyncTable.js +538 -0
- package/dist/commonjs/SyncTable.js.map +1 -0
- package/dist/commonjs/index.d.ts +21 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +19 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/instaql.d.ts +1 -0
- package/dist/commonjs/instaql.d.ts.map +1 -1
- package/dist/commonjs/instaql.js +9 -5
- package/dist/commonjs/instaql.js.map +1 -1
- package/dist/commonjs/store.d.ts +5 -0
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +11 -0
- package/dist/commonjs/store.js.map +1 -1
- package/dist/commonjs/utils/PersistedObject.d.ts +11 -5
- package/dist/commonjs/utils/PersistedObject.d.ts.map +1 -1
- package/dist/commonjs/utils/PersistedObject.js +12 -2
- package/dist/commonjs/utils/PersistedObject.js.map +1 -1
- package/dist/esm/Reactor.d.ts +5 -0
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +43 -5
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/SyncTable.d.ts +140 -0
- package/dist/esm/SyncTable.d.ts.map +1 -0
- package/dist/esm/SyncTable.js +498 -0
- package/dist/esm/SyncTable.js.map +1 -0
- package/dist/esm/index.d.ts +21 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +19 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instaql.d.ts +1 -0
- package/dist/esm/instaql.d.ts.map +1 -1
- package/dist/esm/instaql.js +8 -5
- package/dist/esm/instaql.js.map +1 -1
- package/dist/esm/store.d.ts +5 -0
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +9 -3
- package/dist/esm/store.js.map +1 -1
- package/dist/esm/utils/PersistedObject.d.ts +11 -5
- package/dist/esm/utils/PersistedObject.d.ts.map +1 -1
- package/dist/esm/utils/PersistedObject.js +12 -2
- package/dist/esm/utils/PersistedObject.js.map +1 -1
- package/dist/standalone/index.js +1579 -1135
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Reactor.js +60 -4
- package/src/SyncTable.ts +821 -0
- package/src/index.ts +48 -0
- package/src/instaql.js +11 -5
- package/src/store.js +11 -3
- package/src/utils/PersistedObject.ts +15 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncTable.js","sourceRoot":"","sources":["../../src/SyncTable.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,CAAC,MAAM,YAAY,CAAC;AAChC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AAEnC,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA8ErD,oEAAoE;AACpE,SAAS,mBAAmB,CAC1B,MAAqB,EACrB,cAAuB;IAEvB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YACnC,CAAC,CAAC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;YACxC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,O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B;QACC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG;YACZ,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,gDAAgD;YACxE,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;SACf,CAAC;QAEF,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YACnB,IAAI,EAAE,iBAAiB,CAAC,KAAK;YAC7B,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE;YACjB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAEM,aAAa,CAAC,GAKpB;QACC,mEAAmE;QACnE,sEAAsE;QACtE,qDAAqD;QACrD,MAAM,cAAc,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAC9D,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF","sourcesContent":["import { PersistedObject } from './utils/PersistedObject.ts';\nimport * as s from './store.js';\nimport weakHash from './utils/weakHash.ts';\nimport uuid from './utils/uuid.ts';\nimport { Logger } from './Reactor.js';\nimport instaql, { compareOrder } from './instaql.js';\nimport { InstaQLResponse, ValidQuery } from './queryTypes.ts';\nimport { EntitiesDef, IContainEntitiesAndLinks } from './schemaTypes.ts';\n\ntype SubState = {\n txId?: number;\n subscriptionId: string;\n token: string;\n};\n\ntype Sub = {\n query: any;\n hash: string;\n table: string;\n orderField: string;\n orderDirection: 'asc' | 'desc';\n orderFieldType: 'string' | 'number' | 'date' | 'boolean';\n state?: SubState;\n entities?: Array<{ entity: any; store: any; serverCreatedAt: number }>;\n createdAt: number;\n updatedAt: number;\n};\n\n// We could make a better type for this if we had a return type for s.toJSON\ntype SubsInStorage = Subs;\n\ntype Subs = { [hash: string]: Sub };\n\ntype StartMsg = {\n op: 'start-sync';\n q: string;\n};\n\ntype EndMsg = {\n op: 'remove-sync';\n 'subscription-id': string;\n};\n\ntype ResyncMsg = {\n op: 'resync-table';\n 'subscription-id': string;\n 'tx-id': number;\n token: string;\n};\n\ntype SendMsg = StartMsg | EndMsg | ResyncMsg;\n\ntype StartSyncOkMsg = {\n 'subscription-id': string;\n 'client-event-id': string;\n q: string;\n token: string;\n};\n\ntype Triple = [string, string, any, number];\n\ntype SyncLoadBatchMsg = {\n 'subscription-id': string;\n 'join-rows': Array<Triple[]>;\n};\n\ntype SyncInitFinishMsg = {\n 'subscription-id': string;\n 'tx-id': number;\n};\n\ntype SyncUpdateTriplesMsg = {\n 'subscription-id': string;\n txes: {\n 'tx-id': number;\n changes: { action: 'added' | 'removed'; triple: Triple }[];\n }[];\n};\n\ntype TrySend = (eventId: string, msg: SendMsg) => void;\n\ntype Config = { useDateObjects: boolean };\n\n// Modifies the data in place because it comes directly from storage\nfunction syncSubsFromStorage(\n parsed: SubsInStorage,\n useDateObjects: boolean,\n): Subs {\n for (const key in parsed) {\n const sub = parsed[key];\n for (const e of sub.entities || []) {\n e.store.useDateObjects = useDateObjects;\n e.store = s.fromJSON(e.store);\n }\n }\n return parsed;\n}\n\nfunction syncSubsToStorage(subs: Subs): SubsInStorage {\n const jsonSubs = {};\n for (const key in subs) {\n const sub = subs[key];\n if (sub.entities) {\n const entities = [];\n for (const e of sub.entities) {\n entities.push({ ...e, store: s.toJSON(e.store) });\n }\n jsonSubs[key] = { ...sub, entities };\n } else {\n jsonSubs[key] = sub;\n }\n }\n return jsonSubs;\n}\n\nfunction onMergeSubs(storageSubs: Subs | null, inMemorySubs: Subs): Subs {\n const subs = {};\n for (const [k, v] of Object.entries(inMemorySubs)) {\n subs[k] = v;\n }\n if (storageSubs) {\n for (const [k, v] of Object.entries(storageSubs)) {\n subs[k] = v;\n }\n }\n return subs;\n}\n\nfunction queryEntity(sub: Sub, store: any) {\n const res = instaql({ store, pageInfo: null, aggregate: null }, sub.query);\n return res.data[sub.table][0];\n}\n\nfunction getServerCreatedAt(sub: Sub, store: any, entityId: string): number {\n const aid = s.getAttrByFwdIdentName(store, sub.table, 'id')?.id;\n if (!aid) {\n return -1;\n }\n const t = s.getInMap(store.eav, [entityId, aid, entityId]);\n if (!t) {\n return -1;\n }\n return t[3];\n}\n\nfunction applyChangesToStore(\n store: any,\n changes: SyncUpdateTriplesMsg['txes'][number]['changes'],\n): void {\n for (const { action, triple } of changes) {\n switch (action) {\n case 'added':\n s.addTriple(store, triple);\n break;\n case 'removed':\n s.retractTriple(store, triple);\n break;\n }\n }\n}\n\nfunction changedFieldsOfChanges(\n store: any,\n changes: SyncUpdateTriplesMsg['txes'][number]['changes'],\n): {\n [eid: string]: SyncTransaction<\n any,\n any,\n any\n >['updated'][number]['changedFields'];\n} {\n // This will be more complicated when we include links, we can either add a\n // changedLinks field or we can have something like 'bookshelves.title`\n const changedFields = {};\n for (const { action, triple } of changes) {\n const [e, a, v] = triple;\n const field = store.attrs[a]?.['forward-identity']?.[2];\n if (!field) continue;\n\n const fields = changedFields[e] ?? {};\n changedFields[e] = fields;\n\n const oldNew = fields[field] ?? {};\n fields[field] = oldNew;\n\n switch (action) {\n case 'added':\n oldNew.newValue = v;\n break;\n case 'removed':\n // Only take the first thing that was removed, in case we modified things in the middle\n if (oldNew.oldValue === undefined) {\n oldNew.oldValue = v;\n }\n break;\n }\n }\n return changedFields;\n}\n\nfunction subData(sub: Sub, entities: NonNullable<Sub['entities']>) {\n return { [sub.table]: entities.map((e) => e.entity) };\n}\n\nfunction sortEntitiesInPlace(sub: Sub, entities: NonNullable<Sub['entities']>) {\n const dataType = sub.orderFieldType;\n if (sub.orderField === 'serverCreatedAt') {\n entities.sort(\n sub.orderDirection === 'asc'\n ? function compareEntities(a, b) {\n return compareOrder(\n a.entity.id,\n a.serverCreatedAt,\n b.entity.id,\n b.serverCreatedAt,\n dataType,\n );\n }\n : function compareEntities(b, a) {\n return compareOrder(\n a.entity.id,\n a.serverCreatedAt,\n b.entity.id,\n b.serverCreatedAt,\n dataType,\n );\n },\n );\n return;\n }\n\n const field = sub.orderField;\n\n entities.sort(\n sub.orderDirection === 'asc'\n ? function compareEntities(a, b) {\n return compareOrder(\n a.entity.id,\n a.entity[field],\n b.entity.id,\n b.entity[field],\n dataType,\n );\n }\n : function compareEntities(b, a) {\n return compareOrder(\n a.entity.id,\n a.entity[field],\n b.entity.id,\n b.entity[field],\n dataType,\n );\n },\n );\n}\n\nexport enum CallbackEventType {\n InitialSyncBatch = 'InitialSyncBatch',\n InitialSyncComplete = 'InitialSyncComplete',\n LoadFromStorage = 'LoadFromStorage',\n SyncTransaction = 'SyncTransaction',\n Error = 'Error',\n}\n\ntype QueryEntities<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> = InstaQLResponse<Schema, Q, UseDates>[keyof InstaQLResponse<\n Schema,\n Q,\n UseDates\n>];\n\ntype QueryEntity<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> = QueryEntities<Schema, Q, UseDates> extends (infer E)[] ? E : never;\n\ntype ChangedFields<Entity> = {\n [K in keyof Entity]?: {\n oldValue: Entity[K];\n newValue: Entity[K];\n };\n};\n\nexport interface BaseCallbackEvent<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> {\n type: CallbackEventType;\n data: InstaQLResponse<Schema, Q, UseDates>;\n}\n\nexport interface InitialSyncBatch<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> extends BaseCallbackEvent<Schema, Q, UseDates> {\n type: CallbackEventType.InitialSyncBatch;\n batch: QueryEntities<Schema, Q, UseDates>;\n}\n\nexport interface InitialSyncComplete<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> extends BaseCallbackEvent<Schema, Q, UseDates> {\n type: CallbackEventType.InitialSyncComplete;\n}\n\nexport interface SyncTransaction<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> extends BaseCallbackEvent<Schema, Q, UseDates> {\n type: CallbackEventType.SyncTransaction;\n added: QueryEntities<Schema, Q, UseDates>;\n removed: QueryEntities<Schema, Q, UseDates>;\n updated: {\n oldEntity: QueryEntity<Schema, Q, UseDates>;\n newEntity: QueryEntity<Schema, Q, UseDates>;\n changedFields: ChangedFields<QueryEntity<Schema, Q, UseDates>>;\n }[];\n}\n\nexport interface LoadFromStorage<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> extends BaseCallbackEvent<Schema, Q, UseDates> {\n type: CallbackEventType.LoadFromStorage;\n}\n\nexport interface SetupError<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> extends BaseCallbackEvent<Schema, Q, UseDates> {\n type: CallbackEventType.Error;\n error: { message: string; hint?: any; type: string; status: number };\n}\n\nexport type CallbackEvent<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> =\n | InitialSyncBatch<Schema, Q, UseDates>\n | InitialSyncComplete<Schema, Q, UseDates>\n | SyncTransaction<Schema, Q, UseDates>\n | LoadFromStorage<Schema, Q, UseDates>\n | SetupError<Schema, Q, UseDates>;\n\nexport type SyncTableCallback<\n Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> = (event: CallbackEvent<Schema, Q, UseDates>) => void;\n\nexport class SyncTable {\n private trySend: TrySend;\n private subs: PersistedObject<Subs>;\n // Using any for the SyncCallback because we'd need Reactor to be typed\n private callbacks: { [hash: string]: SyncTableCallback<any, any, any>[] } =\n {};\n private config: Config;\n private idToHash: { [subscriptionId: string]: string } = {};\n private log: Logger;\n private createStore: (triples: Triple[]) => any;\n\n constructor(\n trySend: TrySend,\n persister: Storage,\n config: Config,\n log: Logger,\n createStore: (triples: Triple[]) => any,\n ) {\n this.trySend = trySend;\n this.config = config;\n this.log = log;\n this.createStore = createStore;\n\n this.subs = new PersistedObject<Subs>(\n persister,\n 'subs',\n {},\n onMergeSubs,\n syncSubsToStorage,\n (x) => syncSubsFromStorage(x, this.config.useDateObjects),\n );\n }\n\n public beforeUnload() {\n this.subs.flush();\n }\n\n public subscribe(\n q: any,\n cb: SyncTableCallback<any, any, any>,\n ): (\n opts?: { keepSubscription?: boolean | null | undefined } | null | undefined,\n ) => void {\n const hash = weakHash(q);\n this.callbacks[hash] = this.callbacks[hash] || [];\n this.callbacks[hash].push(cb);\n\n this.initSubscription(q, hash, cb);\n\n return (opts?: { keepSubscription?: boolean | null | undefined }) => {\n this.unsubscribe(hash, cb, opts?.keepSubscription);\n };\n }\n\n private unsubscribe(\n hash: string,\n cb: SyncTableCallback<any, any, any>,\n keepSubscription: boolean | null | undefined,\n ) {\n const cbs = (this.callbacks[hash] || []).filter((x) => x !== cb);\n this.callbacks[hash] = cbs;\n\n if (!cbs.length) {\n delete this.callbacks[hash];\n if (keepSubscription) {\n return;\n }\n const sub = this.subs.currentValue[hash];\n if (sub?.state) {\n this.clearSubscriptionData(sub.state.subscriptionId);\n }\n this.subs.set((prev) => {\n delete prev[hash];\n return prev;\n });\n }\n }\n\n private sendStart(query: string) {\n this.trySend(uuid(), {\n op: 'start-sync',\n q: query,\n });\n }\n\n private sendResync(sub: Sub, state: SubState) {\n // Make sure we can find the hash from the subscriptionId\n this.idToHash[state.subscriptionId] = sub.hash;\n this.trySend(state.subscriptionId, {\n op: 'resync-table',\n 'subscription-id': state.subscriptionId,\n 'tx-id': state.txId,\n token: state.token,\n });\n }\n\n private sendRemove(state: SubState) {\n this.trySend(uuid(), {\n op: 'remove-sync',\n 'subscription-id': state.subscriptionId,\n });\n }\n\n private async initSubscription(\n query: any,\n hash: string,\n cb?: SyncTableCallback<any, any, any>,\n ) {\n // Wait for storage to load so that we know if we already have an existing subscription\n await this.subs.waitForLoaded();\n const existingSub = this.subs.currentValue[hash];\n\n if (existingSub && existingSub.state && existingSub.state.txId) {\n this.sendResync(existingSub, existingSub.state);\n\n if (existingSub.entities && cb) {\n const k = Object.keys(query)[0];\n cb({\n type: CallbackEventType.LoadFromStorage,\n data: subData(existingSub, existingSub.entities),\n });\n }\n\n return;\n }\n\n const table = Object.keys(query)[0];\n const orderBy = query[table]?.$?.order || { serverCreatedAt: 'asc' };\n const [orderField, orderDirection] = Object.entries(orderBy)[0] as [\n string,\n 'asc' | 'desc',\n ];\n\n const orderFieldType =\n orderField === 'serverCreatedAt'\n ? 'number'\n : s.getAttrByFwdIdentName(this.createStore([]), table, orderField)?.[\n 'checked-data-type'\n ];\n\n this.subs.set((prev) => {\n prev[hash] = {\n query,\n hash: hash,\n table,\n orderDirection,\n orderField,\n orderFieldType,\n createdAt: Date.now(),\n updatedAt: Date.now(),\n };\n return prev;\n });\n\n this.sendStart(query);\n }\n\n public async flushPending() {\n await this.subs.waitForLoaded();\n for (const hash of Object.keys(this.callbacks)) {\n const sub = this.subs.currentValue[hash];\n if (sub) {\n await this.initSubscription(sub.query, sub.hash);\n } else {\n this.log.error('Missing sub for hash in flushPending', hash);\n }\n }\n }\n\n public onStartSyncOk(msg: StartSyncOkMsg) {\n const subscriptionId = msg['subscription-id'];\n const q = msg.q;\n const hash = weakHash(q);\n\n this.idToHash[subscriptionId] = hash;\n\n this.subs.set((prev) => {\n const sub = prev[hash];\n if (!sub) {\n this.log.error(\n 'Missing sub for hash',\n hash,\n 'subscription-id',\n subscriptionId,\n 'query',\n q,\n );\n return prev;\n }\n\n sub.state = {\n subscriptionId: subscriptionId,\n token: msg.token,\n };\n return prev;\n });\n }\n\n private notifyCbs(hash: string, event: CallbackEvent<any, any, any>) {\n for (const cb of this.callbacks[hash] || []) {\n cb(event);\n }\n }\n\n public onSyncLoadBatch(msg: SyncLoadBatchMsg) {\n const subscriptionId = msg['subscription-id'];\n const joinRows = msg['join-rows'];\n const hash = this.idToHash[subscriptionId];\n if (!hash) {\n this.log.error('Missing hash for subscription', msg);\n return;\n }\n\n const batch = [];\n const currentValue = this.subs.set((prev) => {\n const sub = prev[hash];\n if (!sub) {\n this.log.error('Missing sub for hash', hash, msg);\n return prev;\n }\n\n const entities = sub.entities ?? [];\n sub.entities = entities;\n\n for (const entRows of joinRows) {\n const store = this.createStore(entRows);\n const entity = queryEntity(sub, store);\n entities.push({\n store,\n entity,\n serverCreatedAt: getServerCreatedAt(sub, store, entity.id),\n });\n batch.push(entity);\n }\n\n sub.updatedAt = Date.now();\n\n return prev;\n });\n\n const sub = currentValue[hash];\n if (sub.entities) {\n this.notifyCbs(hash, {\n type: CallbackEventType.InitialSyncBatch,\n data: subData(sub, sub.entities),\n batch,\n });\n }\n }\n\n public onSyncInitFinish(msg: SyncInitFinishMsg) {\n const subscriptionId = msg['subscription-id'];\n const hash = this.idToHash[subscriptionId];\n if (!hash) {\n this.log.error('Missing hash for subscription', msg);\n return;\n }\n this.subs.set((prev) => {\n const sub = prev[hash];\n if (!sub) {\n this.log.error('Missing sub for hash', hash, msg);\n return prev;\n }\n const state = sub.state;\n if (!state) {\n this.log.error('Sub never set init, missing result', sub, msg);\n return prev;\n }\n state.txId = msg['tx-id'];\n sub.updatedAt = Date.now();\n return prev;\n });\n\n const sub = this.subs.currentValue[hash];\n\n if (sub) {\n this.notifyCbs(hash, {\n type: CallbackEventType.InitialSyncComplete,\n data: subData(sub, sub.entities || []),\n });\n }\n }\n\n public onSyncUpdateTriples(msg: SyncUpdateTriplesMsg) {\n const subscriptionId = msg['subscription-id'];\n const hash = this.idToHash[subscriptionId];\n if (!hash) {\n this.log.error('Missing hash for subscription', msg);\n return;\n }\n this.subs.set((prev) => {\n const sub = prev[hash];\n if (!sub) {\n this.log.error('Missing sub for hash', hash, msg);\n return prev;\n }\n\n const state = sub.state;\n if (!state) {\n this.log.error('Missing state for sub', sub, msg);\n return prev;\n }\n\n for (const tx of msg.txes) {\n if (state.txId >= tx['tx-id']) {\n continue;\n }\n state.txId = tx['tx-id'];\n const idxesToDelete = [];\n // Note: this won't work as well when links are involved\n const byEid: {\n [eid: string]: SyncUpdateTriplesMsg['txes'][number]['changes'];\n } = {};\n for (const change of tx.changes) {\n const eidChanges = byEid[change.triple[0]] ?? [];\n byEid[change.triple[0]] = eidChanges;\n eidChanges.push(change);\n }\n\n const entities = sub.entities || [];\n sub.entities = entities;\n\n const updated: SyncTransaction<any, any, any>['updated'] = [];\n // Update the existing stores, if we already know about this entity\n eidLoop: for (const [eid, changes] of Object.entries(byEid)) {\n for (const [entIdx, ent] of Object.entries(entities)) {\n if (s.hasEntity(ent.store, eid)) {\n applyChangesToStore(ent.store, changes);\n const entity = queryEntity(sub, ent.store);\n const changedFields = changedFieldsOfChanges(ent.store, changes)[\n eid\n ];\n for (const [k, { oldValue, newValue }] of Object.entries(\n changedFields || {},\n )) {\n if (oldValue === newValue) {\n delete changedFields[k];\n }\n }\n if (entity) {\n updated.push({\n oldEntity: ent.entity,\n newEntity: entity,\n changedFields: changedFields || {},\n });\n ent.entity = entity;\n } else {\n idxesToDelete.push(entIdx);\n }\n delete byEid[eid];\n continue eidLoop;\n }\n }\n }\n\n const added = [];\n // If we have anything left in byEid, then this must be a new entity we don't know about\n for (const [_eid, changes] of Object.entries(byEid)) {\n const store = this.createStore([]);\n applyChangesToStore(store, changes);\n const entity = queryEntity(sub, store);\n if (!entity) {\n this.log.error('No entity found after applying change', {\n sub,\n changes,\n store,\n });\n 1;\n continue;\n }\n entities.push({\n store,\n entity,\n serverCreatedAt: getServerCreatedAt(sub, store, entity.id),\n });\n added.push(entity);\n }\n\n const removed = [];\n\n for (const idx of idxesToDelete.sort().reverse()) {\n removed.push(entities[idx].entity);\n entities.splice(idx, 1);\n }\n\n sortEntitiesInPlace(sub, entities);\n this.notifyCbs(hash, {\n type: CallbackEventType.SyncTransaction,\n data: subData(sub, sub.entities),\n added,\n removed,\n updated,\n });\n sub.updatedAt = Date.now();\n }\n\n return prev;\n });\n }\n\n private clearSubscriptionData(subscriptionId: string) {\n const hash = this.idToHash[subscriptionId];\n if (hash) {\n delete this.idToHash[subscriptionId];\n const sub = this.subs.currentValue[hash];\n if (sub.state) {\n this.sendRemove(sub.state);\n }\n this.subs.set((prev) => {\n delete prev[hash];\n return prev;\n });\n if (sub) {\n return sub;\n }\n }\n }\n\n public onStartSyncError(msg: {\n op: 'error';\n 'original-event': StartMsg;\n 'client-event-id': string;\n status: number;\n type: string;\n message?: string;\n hint?: any;\n }) {\n const hash = weakHash(msg['original-event']['q']);\n const error = {\n message: msg.message || 'Uh-oh, something went wrong. Ping Joe & Stopa.',\n status: msg.status,\n type: msg.type,\n hint: msg.hint,\n };\n\n const k = Object.keys(msg['original-event']['q'])[0];\n this.notifyCbs(hash, {\n type: CallbackEventType.Error,\n data: { [k]: [] },\n error,\n });\n }\n\n public onResyncError(msg: {\n op: 'error';\n 'original-event': ResyncMsg;\n status: number;\n type: string;\n }) {\n // Clear the subscription and start from scrath on any resync error\n // This can happen if the auth changed and we need to refetch with the\n // new auth or if the subscription is too far behind.\n const subscriptionId = msg['original-event']['subscription-id'];\n const removedSub = this.clearSubscriptionData(subscriptionId);\n if (removedSub) {\n this.initSubscription(removedSub.query, removedSub.hash);\n }\n }\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { tx, txInit, lookup, getOps, type TxChunk, type TransactionChunk } from
|
|
|
3
3
|
import weakHash from './utils/weakHash.js';
|
|
4
4
|
import id from './utils/uuid.js';
|
|
5
5
|
import IndexedDBStorage from './IndexedDBStorage.ts';
|
|
6
|
+
import { coerceToDate } from './utils/dates.js';
|
|
6
7
|
import WindowNetworkListener from './WindowNetworkListener.js';
|
|
7
8
|
import { i } from './schema.js';
|
|
8
9
|
import version from './version.ts';
|
|
@@ -22,6 +23,11 @@ import type { ExchangeCodeForTokenParams, SendMagicCodeParams, SendMagicCodeResp
|
|
|
22
23
|
import { InstantAPIError, type InstantIssue } from './utils/fetch.js';
|
|
23
24
|
import { InstantError } from './InstantError.ts';
|
|
24
25
|
import { EventSourceType } from './Connection.ts';
|
|
26
|
+
import { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';
|
|
27
|
+
import type { SyncTableCallback, CallbackEvent as SyncTableCallbackEvent, InitialSyncBatch as SyncTableInitialSyncBatch, InitialSyncComplete as SyncTableInitialSyncComplete, SyncTransaction as SyncTableSyncTransaction, LoadFromStorage as SyncTableLoadFromStorage, SetupError as SyncTableSetupError } from './SyncTable.ts';
|
|
28
|
+
type ExactlyOne<T> = {
|
|
29
|
+
[K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;
|
|
30
|
+
}[keyof T];
|
|
25
31
|
export type Config = {
|
|
26
32
|
appId: string;
|
|
27
33
|
websocketURI?: string;
|
|
@@ -415,6 +421,20 @@ declare class InstantCoreDatabase<Schema extends InstantSchemaDef<any, any, any>
|
|
|
415
421
|
data: InstaQLResponse<Schema, Q, UseDates>;
|
|
416
422
|
pageInfo: PageInfoResponse<Q>;
|
|
417
423
|
}>;
|
|
424
|
+
/**
|
|
425
|
+
* @deprecated This is an experimental function that is not yet ready for production use.
|
|
426
|
+
* Use this function to sync an entire namespace.
|
|
427
|
+
* It has many limitations that will be removed in the future:
|
|
428
|
+
* 1. Must be used with an admin token
|
|
429
|
+
* 2. Does not support permissions
|
|
430
|
+
* 3. Does not support where clauses
|
|
431
|
+
* 4. Does not support links
|
|
432
|
+
* It also does not support multiple top-level namespaces. For example,
|
|
433
|
+
* {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.
|
|
434
|
+
*/
|
|
435
|
+
_syncTableExperimental<Q extends ValidQuery<Q, Schema>>(query: ExactlyOne<Q>, cb: SyncTableCallback<Schema, Q, UseDates>): (opts?: {
|
|
436
|
+
keepSubscription: boolean | null | undefined;
|
|
437
|
+
} | null | undefined) => void;
|
|
418
438
|
}
|
|
419
439
|
/**
|
|
420
440
|
*
|
|
@@ -454,5 +474,5 @@ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUn
|
|
|
454
474
|
* const db = init({ ... });
|
|
455
475
|
*/
|
|
456
476
|
declare const init_experimental: typeof init;
|
|
457
|
-
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, TransactionValidationError, InstantAPIError, i, getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type PresencePeer, type InstaQLParams, type ValidQuery, type InstaQLOptions, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type InstaQLFields, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type InstantUnknownSchemaDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type TopicOf, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type RuleParams, type InstantDBAttr, type InstantDBAttrOnDelete, type InstantDBCheckedDataType, type InstantDBIdent, type InstantDBInferredType, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type EventSourceType, type InstantIssue, };
|
|
477
|
+
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, TransactionValidationError, InstantAPIError, i, getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError, SyncTableCallbackEventType, type IDatabase, type RoomSchemaShape, type Query, type QueryResponse, type InstaQLResponse, type PageInfoResponse, type InstantObject, type Exactly, type TransactionChunk, type AuthState, type ConnectionStatus, type User, type AuthToken, type TxChunk, type SubscriptionState, type InstaQLSubscriptionState, type LifecycleSubscriptionState, type InstaQLLifecycleState, type PresenceOpts, type PresenceSlice, type PresenceResponse, type PresencePeer, type InstaQLParams, type ValidQuery, type InstaQLOptions, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type InstaQLFields, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type InstantUnknownSchemaDef, type EntitiesWithLinks, type EntityDef, type RoomsDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type RoomsOf, type PresenceOf, type TopicsOf, type TopicOf, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type InstantSchemaDef, type InstantUnknownSchema, type IInstantDatabase, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type RuleParams, type InstantDBAttr, type InstantDBAttrOnDelete, type InstantDBCheckedDataType, type InstantDBIdent, type InstantDBInferredType, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type EventSourceType, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, };
|
|
458
478
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;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ACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,UAAU,EAGf,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAG1B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAGnB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGvB,KAAK,eAAe,EAGpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,KAAK,YAAY,GAClB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { tx, txInit, lookup, getOps, } from './instatx.js';
|
|
|
3
3
|
import weakHash from './utils/weakHash.js';
|
|
4
4
|
import id from './utils/uuid.js';
|
|
5
5
|
import IndexedDBStorage from "./IndexedDBStorage.js";
|
|
6
|
+
import { coerceToDate } from './utils/dates.js';
|
|
6
7
|
import WindowNetworkListener from './WindowNetworkListener.js';
|
|
7
8
|
import { i } from './schema.js';
|
|
8
9
|
import { createDevtool } from './devtool.js';
|
|
@@ -11,6 +12,7 @@ import { validateQuery, QueryValidationError } from "./queryValidation.js";
|
|
|
11
12
|
import { validateTransactions, TransactionValidationError, } from "./transactionValidation.js";
|
|
12
13
|
import { InstantAPIError } from './utils/fetch.js';
|
|
13
14
|
import { InstantError } from "./InstantError.js";
|
|
15
|
+
import { CallbackEventType as SyncTableCallbackEventType } from "./SyncTable.js";
|
|
14
16
|
const defaultOpenDevtool = true;
|
|
15
17
|
// consts
|
|
16
18
|
const defaultConfig = {
|
|
@@ -413,6 +415,20 @@ class InstantCoreDatabase {
|
|
|
413
415
|
queryOnce(query, opts) {
|
|
414
416
|
return this._reactor.queryOnce(query, opts);
|
|
415
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* @deprecated This is an experimental function that is not yet ready for production use.
|
|
420
|
+
* Use this function to sync an entire namespace.
|
|
421
|
+
* It has many limitations that will be removed in the future:
|
|
422
|
+
* 1. Must be used with an admin token
|
|
423
|
+
* 2. Does not support permissions
|
|
424
|
+
* 3. Does not support where clauses
|
|
425
|
+
* 4. Does not support links
|
|
426
|
+
* It also does not support multiple top-level namespaces. For example,
|
|
427
|
+
* {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.
|
|
428
|
+
*/
|
|
429
|
+
_syncTableExperimental(query, cb) {
|
|
430
|
+
return this._reactor.subscribeTable(query, cb);
|
|
431
|
+
}
|
|
416
432
|
}
|
|
417
433
|
function schemaHash(schema) {
|
|
418
434
|
if (!schema) {
|
|
@@ -500,5 +516,7 @@ InstantAPIError,
|
|
|
500
516
|
// cli
|
|
501
517
|
i,
|
|
502
518
|
// util
|
|
503
|
-
getOps, coerceQuery, weakHash, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError,
|
|
519
|
+
getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError,
|
|
520
|
+
// sync table enums
|
|
521
|
+
SyncTableCallbackEventType, };
|
|
504
522
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,GAGP,MAAM,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AA0FpC,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AA2GhC,SAAS;AAET,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,2BAA2B;IACnC,YAAY,EAAE,yCAAyC;CACxD,CAAC;AAEF,MAAM;AACN,SAAS,mBAAmB;;IAC1B,UAAU,CAAC,0BAA0B;QACnC,MAAA,UAAU,CAAC,0BAA0B,mCAAI,IAAI,OAAO,EAAe,CAAC;IACtE,OAAO,UAAU,CAAC,0BAA0B,CAAC;AAC/C,CAAC;AAED,SAAS,0BAA0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,CAChD,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO;IACT,CAAC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,OAAO;AACL,sBAAsB;AACtB,IAAI,EACJ,iBAAiB,EACjB,EAAE,EACF,EAAE,EACF,MAAM,EACN,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B;AAE1B,QAAQ;AACR,eAAe;AAEf,MAAM;AACN,CAAC;AAED,OAAO;AACP,MAAM,EACN,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,IAAI,EACJ,OAAO,EACP,OAAO,EACP,YAAY,GAiGb,CAAC","sourcesContent":["import Reactor from './Reactor.js';\nimport {\n tx,\n txInit,\n lookup,\n getOps,\n type TxChunk,\n type TransactionChunk,\n} from './instatx.js';\nimport weakHash from './utils/weakHash.js';\nimport id from './utils/uuid.js';\nimport IndexedDBStorage from './IndexedDBStorage.ts';\nimport WindowNetworkListener from './WindowNetworkListener.js';\nimport { i } from './schema.js';\nimport { createDevtool } from './devtool.js';\nimport version from './version.ts';\nimport { validateQuery, QueryValidationError } from './queryValidation.ts';\nimport {\n validateTransactions,\n TransactionValidationError,\n} from './transactionValidation.ts';\n\nimport type {\n PresenceOpts,\n PresenceResponse,\n PresenceSlice,\n RoomSchemaShape,\n} from './presence.ts';\nimport type {\n DevtoolConfig,\n IDatabase,\n IInstantDatabase,\n StrictDevtoolConfig,\n} from './coreTypes.ts';\nimport type {\n Query,\n QueryResponse,\n InstaQLResponse,\n PageInfoResponse,\n Exactly,\n InstantObject,\n InstaQLParams,\n InstaQLOptions,\n InstaQLQueryParams,\n InstaQLEntity,\n InstaQLEntitySubquery,\n InstaQLResult,\n InstaQLFields,\n ValidQuery,\n} from './queryTypes.ts';\nimport type { PresencePeer } from './presenceTypes.ts';\nimport type {\n AuthState,\n User,\n AuthResult,\n ConnectionStatus,\n} from './clientTypes.ts';\nimport type {\n InstantQuery,\n InstantQueryResult,\n InstantSchema,\n InstantEntity,\n InstantSchemaDatabase,\n} from './helperTypes.ts';\nimport type {\n InstantDBAttr,\n InstantDBAttrOnDelete,\n InstantDBCheckedDataType,\n InstantDBIdent,\n InstantDBInferredType,\n} from './attrTypes.ts';\nimport type {\n AttrsDefs,\n CardinalityKind,\n DataAttrDef,\n EntitiesDef,\n EntitiesWithLinks,\n EntityDef,\n RoomsDef,\n InstantSchemaDef,\n InstantGraph,\n LinkAttrDef,\n LinkDef,\n LinksDef,\n PresenceOf,\n ResolveAttrs,\n RoomsOf,\n TopicsOf,\n TopicOf,\n ValueTypes,\n InstantUnknownSchema,\n InstantUnknownSchemaDef,\n BackwardsCompatibleSchema,\n UpdateParams,\n LinkParams,\n CreateParams,\n RuleParams,\n} from './schemaTypes.ts';\nimport type { InstantRules } from './rulesTypes.ts';\nimport type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';\n\nimport type {\n ExchangeCodeForTokenParams,\n SendMagicCodeParams,\n SendMagicCodeResponse,\n SignInWithIdTokenParams,\n VerifyMagicCodeParams,\n VerifyResponse,\n} from './authAPI.ts';\n\nimport { InstantAPIError, type InstantIssue } from './utils/fetch.js';\nimport { InstantError } from './InstantError.ts';\nimport { EventSourceType } from './Connection.ts';\n\nconst defaultOpenDevtool = true;\n\n// types\n\nexport type Config = {\n appId: string;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects?: boolean;\n disableValidation?: boolean;\n};\n\nexport type InstantConfig<\n S extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> = {\n appId: string;\n schema?: S;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects?: UseDates;\n disableValidation?: boolean;\n};\n\nexport type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {\n schema: S;\n};\n\nexport type TransactionResult = {\n status: 'synced' | 'enqueued';\n clientId: string;\n};\n\nexport type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(\n topic: Key,\n data: TopicsByKey[Key],\n) => void;\n\nexport type SubscribeTopic<PresenceShape, TopicsByKey> = <\n Key extends keyof TopicsByKey,\n>(\n topic: Key,\n onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void,\n) => () => void;\n\nexport type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(\n opts: PresenceOpts<PresenceShape, Keys>,\n) => PresenceResponse<PresenceShape, Keys>;\n\nexport type SubscribePresence<PresenceShape> = <\n Keys extends keyof PresenceShape,\n>(\n opts: PresenceOpts<PresenceShape, Keys>,\n onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void,\n) => () => void;\n\nexport type RoomHandle<PresenceShape, TopicsByKey> = {\n leaveRoom: () => void;\n publishTopic: PublishTopic<TopicsByKey>;\n subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;\n publishPresence: (data: Partial<PresenceShape>) => void;\n getPresence: GetPresence<PresenceShape>;\n subscribePresence: SubscribePresence<PresenceShape>;\n};\n\ntype AuthToken = string;\n\ntype SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: QueryResponse<Q, Schema, WithCardinalityInference>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype LifecycleSubscriptionState<\n Q,\n Schema,\n WithCardinalityInference extends boolean,\n> = SubscriptionState<Q, Schema, WithCardinalityInference> & {\n isLoading: boolean;\n};\n\ntype InstaQLLifecycleState<\n Schema,\n Q,\n UseDates extends boolean = false,\n> = InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n};\n\ntype UnsubscribeFn = () => void;\n\n// consts\n\nconst defaultConfig = {\n apiURI: 'https://api.instantdb.com',\n websocketURI: 'wss://api.instantdb.com/runtime/session',\n};\n\n// hmr\nfunction initSchemaHashStore(): WeakMap<any, string> {\n globalThis.__instantDbSchemaHashStore =\n globalThis.__instantDbSchemaHashStore ?? new WeakMap<any, string>();\n return globalThis.__instantDbSchemaHashStore;\n}\n\nfunction initGlobalInstantCoreStore(): Record<string, any> {\n globalThis.__instantDbStore = globalThis.__instantDbStore ?? {};\n return globalThis.__instantDbStore;\n}\n\nfunction reactorKey(config: InstantConfig<any, boolean>): string {\n // @ts-expect-error\n const adminToken = config.__adminToken;\n return (\n config.appId +\n '_' +\n (config.websocketURI || 'default_ws_uri') +\n '_' +\n (config.apiURI || 'default_api_uri') +\n '_' +\n (adminToken || 'client_only') +\n '_' +\n config.useDateObjects\n );\n}\n\nconst globalInstantCoreStore = initGlobalInstantCoreStore();\nconst schemaHashStore = initSchemaHashStore();\n\ntype SignoutOpts = {\n invalidateToken?: boolean;\n};\n\n/**\n * Functions to log users in and out.\n *\n * @see https://instantdb.com/docs/auth\n */\nclass Auth {\n constructor(private db: Reactor) {}\n\n /**\n * Sends a magic code to the user's email address.\n *\n * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the\n * user verify.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth.sendMagicCode({email: \"example@gmail.com\"})\n * .catch((err) => console.error(err.body?.message))\n */\n sendMagicCode = (\n params: SendMagicCodeParams,\n ): Promise<SendMagicCodeResponse> => {\n return this.db.sendMagicCode(params);\n };\n\n /**\n * Verify a magic code that was sent to the user's email address.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInWithMagicCode({email: \"example@gmail.com\", code: \"123456\"})\n * .catch((err) => console.error(err.body?.message))\n */\n signInWithMagicCode = (\n params: VerifyMagicCodeParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithMagicCode(params);\n };\n\n /**\n * Sign in a user with a refresh token\n *\n * @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token\n *\n * @example\n * // Get the token from your backend\n * const token = await fetch('/signin', ...);\n * //Sign in\n * db.auth.signInWithToken(token);\n */\n signInWithToken = (token: AuthToken): Promise<VerifyResponse> => {\n return this.db.signInWithCustomToken(token);\n };\n\n /**\n * Sign in as guest, creating a new user without email\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInAsGuest();\n */\n signInAsGuest = (): Promise<VerifyResponse> => {\n return this.db.signInAsGuest();\n };\n\n /**\n * Create an authorization url to sign in with an external provider.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * // Get the authorization url from your backend\n * const url = db.auth.createAuthorizationUrl({\n * clientName: \"google\",\n * redirectURL: window.location.href,\n * });\n *\n * // Put it in a sign in link\n * <a href={url}>Log in with Google</a>\n */\n createAuthorizationURL = (params: {\n clientName: string;\n redirectURL: string;\n }): string => {\n return this.db.createAuthorizationURL(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .signInWithIdToken({\n * // Token from external service\n * idToken: id_token,\n * // The name you gave the client when you registered it with Instant\n * clientName: \"google\",\n * // The nonce, if any, that you used when you initiated the auth flow\n * // with the external service.\n * nonce: your_nonce\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n signInWithIdToken = (\n params: SignInWithIdTokenParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithIdToken(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .exchangeOAuthCode({\n * // code received in redirect from OAuth callback\n * code: code\n * // The PKCE code_verifier, if any, that you used when you\n * // initiated the auth flow\n * codeVerifier: your_code_verifier\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n exchangeOAuthCode = (params: ExchangeCodeForTokenParams) => {\n return this.db.exchangeCodeForToken(params);\n };\n\n /**\n * OpenID Discovery path for use with tools like\n * expo-auth-session that use auto-discovery of\n * OAuth parameters.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const discovery = useAutoDiscovery(\n * db.auth.issuerURI()\n * );\n */\n issuerURI = (): string => {\n return this.db.issuerURI();\n };\n\n /**\n * Sign out the current user\n */\n signOut = (opts: SignoutOpts = { invalidateToken: true }): Promise<void> => {\n return this.db.signOut(opts);\n };\n}\n\ntype FileOpts = {\n contentType?: string;\n contentDisposition?: string;\n fileSize?: number; // Required for streaming uploads\n};\n\n/**\n * Functions to manage file storage.\n */\nclass Storage {\n constructor(private db: Reactor) {}\n\n /**\n * Uploads file at the provided path.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * const [file] = e.target.files; // result of file input\n * const data = await db.storage.uploadFile('photos/demo.png', file);\n */\n uploadFile = (\n path: string,\n file: File | Blob,\n opts: FileOpts = {},\n ): Promise<UploadFileResponse> => {\n return this.db.uploadFile(path, file, opts);\n };\n\n /**\n * Deletes a file by path name.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * await db.storage.delete('photos/demo.png');\n */\n delete = (pathname: string) => {\n return this.db.deleteFile(pathname);\n };\n\n // Deprecated Storage API (Jan 2025)\n // ---------------------------------\n\n /**\n * @deprecated. Use `db.storage.uploadFile` instead\n * remove in the future.\n */\n upload = (pathname: string, file: File) => {\n return this.db.upload(pathname, file);\n };\n\n /**\n * @deprecated Use `db.storage.uploadFile` instead\n */\n put = this.upload;\n\n /**\n * @deprecated. getDownloadUrl will be removed in the future.\n * Use `useQuery` instead to query and fetch for valid urls\n *\n * db.useQuery({\n * $files: {\n * $: {\n * where: {\n * path: \"moop.png\"\n * }\n * }\n * }\n * })\n */\n getDownloadUrl = (pathname: string) => {\n return this.db.getDownloadUrl(pathname);\n };\n}\n\n// util\n\nfunction coerceQuery(o: any) {\n // stringify and parse to remove undefined values\n return JSON.parse(JSON.stringify(o));\n}\n\nclass InstantCoreDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> implements IInstantDatabase<Schema>\n{\n public _reactor: Reactor<RoomsOf<Schema>>;\n public auth: Auth;\n public storage: Storage;\n\n public tx = txInit<Schema>();\n\n constructor(reactor: Reactor<RoomsOf<Schema>>) {\n this._reactor = reactor;\n this.auth = new Auth(this._reactor);\n this.storage = new Storage(this._reactor);\n }\n\n /**\n * Use this to write data! You can create, update, delete, and link objects\n *\n * @see https://instantdb.com/docs/instaml\n *\n * @example\n * // Create a new object in the `goals` namespace\n * const goalId = id();\n * db.transact(db.tx.goals[goalId].update({title: \"Get fit\"}))\n *\n * // Update the title\n * db.transact(db.tx.goals[goalId].update({title: \"Get super fit\"}))\n *\n * // Delete it\n * db.transact(db.tx.goals[goalId].delete())\n *\n * // Or create an association:\n * todoId = id();\n * db.transact([\n * db.tx.todos[todoId].update({ title: 'Go on a run' }),\n * db.tx.goals[goalId].link({todos: todoId}),\n * ])\n */\n transact(\n chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],\n ): Promise<TransactionResult> {\n return this._reactor.pushTx(chunks);\n }\n\n getLocalId(name: string): Promise<string> {\n return this._reactor.getLocalId(name);\n }\n\n /**\n * Use this to query your data!\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n * // listen to all goals\n * db.subscribeQuery({ goals: {} }, (resp) => {\n * console.log(resp.data.goals)\n * })\n *\n * // goals where the title is \"Get Fit\"\n * db.subscribeQuery(\n * { goals: { $: { where: { title: \"Get Fit\" } } } },\n * (resp) => {\n * console.log(resp.data.goals)\n * }\n * )\n *\n * // all goals, _alongside_ their todos\n * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {\n * console.log(resp.data.goals)\n * });\n */\n subscribeQuery<\n Q extends ValidQuery<Q, Schema>,\n UseDatesLocal extends boolean = UseDates,\n >(\n query: Q,\n cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,\n opts?: InstaQLOptions,\n ) {\n return this._reactor.subscribeQuery(query, cb, opts);\n }\n\n /**\n * Listen for the logged in state. This is useful\n * for deciding when to show a login screen.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const unsub = db.subscribeAuth((auth) => {\n * if (auth.user) {\n * console.log('logged in as', auth.user.email)\n * } else {\n * console.log('logged out')\n * }\n * })\n */\n subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {\n return this._reactor.subscribeAuth(cb);\n }\n\n /**\n * One time query for the logged in state. This is useful\n * for scenarios where you want to know the current auth\n * state without subscribing to changes.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const user = await db.getAuth();\n * console.log('logged in as', user.email)\n */\n getAuth(): Promise<User | null> {\n return this._reactor.getAuth();\n }\n\n /**\n * Listen for connection status changes to Instant. This is useful\n * for building things like connectivity indicators\n *\n * @see https://www.instantdb.com/docs/patterns#connection-status\n * @example\n * const unsub = db.subscribeConnectionStatus((status) => {\n * const connectionState =\n * status === 'connecting' || status === 'opened'\n * ? 'authenticating'\n * : status === 'authenticated'\n * ? 'connected'\n * : status === 'closed'\n * ? 'closed'\n * : status === 'errored'\n * ? 'errored'\n * : 'unexpected state';\n *\n * console.log('Connection status:', connectionState);\n * });\n */\n subscribeConnectionStatus(\n cb: (status: ConnectionStatus) => void,\n ): UnsubscribeFn {\n return this._reactor.subscribeConnectionStatus(cb);\n }\n\n /**\n * Join a room to publish and subscribe to topics and presence.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * // init\n * const db = init();\n * const room = db.joinRoom(roomType, roomId);\n * // usage\n * const unsubscribeTopic = room.subscribeTopic(\"foo\", console.log);\n * const unsubscribePresence = room.subscribePresence({}, console.log);\n * room.publishTopic(\"hello\", { message: \"hello world!\" });\n * room.publishPresence({ name: \"joe\" });\n * // later\n * unsubscribePresence();\n * unsubscribeTopic();\n * room.leaveRoom();\n */\n joinRoom<RoomType extends keyof RoomsOf<Schema>>(\n roomType: RoomType = '_defaultRoomType' as RoomType,\n roomId: string = '_defaultRoomId',\n opts?: {\n initialPresence?: Partial<PresenceOf<Schema, RoomType>>;\n },\n ): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>> {\n const leaveRoom = this._reactor.joinRoom(roomId, opts?.initialPresence);\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomId, topic, onEvent),\n subscribePresence: (opts, onChange) =>\n this._reactor.subscribePresence(roomType, roomId, opts, onChange),\n publishTopic: (topic, data) =>\n this._reactor.publishTopic({ roomType, roomId, topic, data }),\n publishPresence: (data) =>\n this._reactor.publishPresence(roomType, roomId, data),\n getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),\n };\n }\n\n shutdown() {\n delete globalInstantCoreStore[reactorKey(this._reactor.config)];\n this._reactor.shutdown();\n }\n\n /**\n * Use this for one-off queries.\n * Returns local data if available, otherwise fetches from the server.\n * Because we want to avoid stale data, this method will throw an error\n * if the user is offline or there is no active connection to the server.\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n *\n * const resp = await db.queryOnce({ goals: {} });\n * console.log(resp.data.goals)\n */\n queryOnce<Q extends ValidQuery<Q, Schema>>(\n query: Q,\n opts?: InstaQLOptions,\n ): Promise<{\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n }> {\n return this._reactor.queryOnce(query, opts);\n }\n}\n\nfunction schemaHash(schema?: InstantSchemaDef<any, any, any>): string {\n if (!schema) {\n return '0';\n }\n\n if (schemaHashStore.get(schema)) {\n return schemaHashStore.get(schema);\n }\n const hash = weakHash(schema);\n schemaHashStore.set(schema, hash);\n return hash;\n}\n\nfunction schemaChanged(\n existingClient: InstantCoreDatabase<any, boolean>,\n newSchema?: InstantSchemaDef<any, any, any>,\n): boolean {\n return (\n schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)\n );\n}\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/core\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/core\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: InstantConfig<Schema, UseDates>,\n Storage?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const existingClient = globalInstantCoreStore[\n reactorKey(config)\n ] as InstantCoreDatabase<any, Config['useDateObjects']>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, config.schema)) {\n existingClient._reactor.updateSchema(config.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...config,\n cardinalityInference: config.schema ? true : false,\n },\n Storage || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, Config['useDateObjects']>(\n reactor,\n );\n globalInstantCoreStore[reactorKey(config)] = client;\n\n handleDevtool(config.appId, config.devtool);\n\n return client;\n}\n\nfunction handleDevtool(appId: string, devtool: boolean | DevtoolConfig) {\n if (\n typeof window === 'undefined' ||\n typeof window.location === 'undefined' ||\n typeof document === 'undefined'\n ) {\n return;\n }\n\n if (typeof devtool === 'boolean' && !devtool) {\n return;\n }\n\n const config: StrictDevtoolConfig = {\n position: 'bottom-right' as const,\n allowedHosts: ['localhost'],\n ...(typeof devtool === 'object' ? devtool : {}),\n };\n\n if (!config.allowedHosts.includes(window.location.hostname)) {\n return;\n }\n\n createDevtool(appId, config);\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/core\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/core\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nexport {\n // bada bing bada boom\n init,\n init_experimental,\n id,\n tx,\n txInit,\n lookup,\n validateQuery,\n QueryValidationError,\n validateTransactions,\n TransactionValidationError,\n\n // error\n InstantAPIError,\n\n // cli\n i,\n\n // util\n getOps,\n coerceQuery,\n weakHash,\n IndexedDBStorage,\n WindowNetworkListener,\n InstantCoreDatabase,\n Auth,\n Storage,\n version,\n InstantError,\n\n // og types\n type IDatabase,\n type RoomSchemaShape,\n type Query,\n type QueryResponse,\n type InstaQLResponse,\n type PageInfoResponse,\n type InstantObject,\n type Exactly,\n type TransactionChunk,\n type AuthState,\n type ConnectionStatus,\n type User,\n type AuthToken,\n type TxChunk,\n type SubscriptionState,\n type InstaQLSubscriptionState,\n type LifecycleSubscriptionState,\n type InstaQLLifecycleState,\n\n // presence types\n type PresenceOpts,\n type PresenceSlice,\n type PresenceResponse,\n type PresencePeer,\n\n // new query types\n type InstaQLParams,\n type ValidQuery,\n type InstaQLOptions,\n type InstaQLQueryParams,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstaQLFields,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type InstantUnknownSchemaDef,\n type EntitiesWithLinks,\n type EntityDef,\n type RoomsDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type RoomsOf,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type IInstantDatabase,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type RuleParams,\n\n // attr types\n type InstantDBAttr,\n type InstantDBAttrOnDelete,\n type InstantDBCheckedDataType,\n type InstantDBIdent,\n type InstantDBInferredType,\n\n // auth types\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // SSE\n type EventSourceType,\n\n // error types\n type InstantIssue,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,GAGP,MAAM,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AA0FpC,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE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n txInit,\n lookup,\n getOps,\n type TxChunk,\n type TransactionChunk,\n} from './instatx.js';\nimport weakHash from './utils/weakHash.js';\nimport id from './utils/uuid.js';\nimport IndexedDBStorage from './IndexedDBStorage.ts';\nimport { coerceToDate } from './utils/dates.js';\nimport WindowNetworkListener from './WindowNetworkListener.js';\nimport { i } from './schema.js';\nimport { createDevtool } from './devtool.js';\nimport version from './version.ts';\nimport { validateQuery, QueryValidationError } from './queryValidation.ts';\nimport {\n validateTransactions,\n TransactionValidationError,\n} from './transactionValidation.ts';\n\nimport type {\n PresenceOpts,\n PresenceResponse,\n PresenceSlice,\n RoomSchemaShape,\n} from './presence.ts';\nimport type {\n DevtoolConfig,\n IDatabase,\n IInstantDatabase,\n StrictDevtoolConfig,\n} from './coreTypes.ts';\nimport type {\n Query,\n QueryResponse,\n InstaQLResponse,\n PageInfoResponse,\n Exactly,\n InstantObject,\n InstaQLParams,\n InstaQLOptions,\n InstaQLQueryParams,\n InstaQLEntity,\n InstaQLEntitySubquery,\n InstaQLResult,\n InstaQLFields,\n ValidQuery,\n} from './queryTypes.ts';\nimport type { PresencePeer } from './presenceTypes.ts';\nimport type {\n AuthState,\n User,\n AuthResult,\n ConnectionStatus,\n} from './clientTypes.ts';\nimport type {\n InstantQuery,\n InstantQueryResult,\n InstantSchema,\n InstantEntity,\n InstantSchemaDatabase,\n} from './helperTypes.ts';\nimport type {\n InstantDBAttr,\n InstantDBAttrOnDelete,\n InstantDBCheckedDataType,\n InstantDBIdent,\n InstantDBInferredType,\n} from './attrTypes.ts';\nimport type {\n AttrsDefs,\n CardinalityKind,\n DataAttrDef,\n EntitiesDef,\n EntitiesWithLinks,\n EntityDef,\n RoomsDef,\n InstantSchemaDef,\n InstantGraph,\n LinkAttrDef,\n LinkDef,\n LinksDef,\n PresenceOf,\n ResolveAttrs,\n RoomsOf,\n TopicsOf,\n TopicOf,\n ValueTypes,\n InstantUnknownSchema,\n InstantUnknownSchemaDef,\n BackwardsCompatibleSchema,\n UpdateParams,\n LinkParams,\n CreateParams,\n RuleParams,\n} from './schemaTypes.ts';\nimport type { InstantRules } from './rulesTypes.ts';\nimport type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';\n\nimport type {\n ExchangeCodeForTokenParams,\n SendMagicCodeParams,\n SendMagicCodeResponse,\n SignInWithIdTokenParams,\n VerifyMagicCodeParams,\n VerifyResponse,\n} from './authAPI.ts';\n\nimport { InstantAPIError, type InstantIssue } from './utils/fetch.js';\nimport { InstantError } from './InstantError.ts';\nimport { EventSourceType } from './Connection.ts';\nimport { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';\nimport type {\n SyncTableCallback,\n CallbackEvent as SyncTableCallbackEvent,\n InitialSyncBatch as SyncTableInitialSyncBatch,\n InitialSyncComplete as SyncTableInitialSyncComplete,\n SyncTransaction as SyncTableSyncTransaction,\n LoadFromStorage as SyncTableLoadFromStorage,\n SetupError as SyncTableSetupError,\n} from './SyncTable.ts';\n\nconst defaultOpenDevtool = true;\n\n// types\n\ntype ExactlyOne<T> = {\n [K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;\n}[keyof T];\n\nexport type Config = {\n appId: string;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects?: boolean;\n disableValidation?: boolean;\n};\n\nexport type InstantConfig<\n S extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> = {\n appId: string;\n schema?: S;\n websocketURI?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects?: UseDates;\n disableValidation?: boolean;\n};\n\nexport type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {\n schema: S;\n};\n\nexport type TransactionResult = {\n status: 'synced' | 'enqueued';\n clientId: string;\n};\n\nexport type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(\n topic: Key,\n data: TopicsByKey[Key],\n) => void;\n\nexport type SubscribeTopic<PresenceShape, TopicsByKey> = <\n Key extends keyof TopicsByKey,\n>(\n topic: Key,\n onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void,\n) => () => void;\n\nexport type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(\n opts: PresenceOpts<PresenceShape, Keys>,\n) => PresenceResponse<PresenceShape, Keys>;\n\nexport type SubscribePresence<PresenceShape> = <\n Keys extends keyof PresenceShape,\n>(\n opts: PresenceOpts<PresenceShape, Keys>,\n onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void,\n) => () => void;\n\nexport type RoomHandle<PresenceShape, TopicsByKey> = {\n leaveRoom: () => void;\n publishTopic: PublishTopic<TopicsByKey>;\n subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;\n publishPresence: (data: Partial<PresenceShape>) => void;\n getPresence: GetPresence<PresenceShape>;\n subscribePresence: SubscribePresence<PresenceShape>;\n};\n\ntype AuthToken = string;\n\ntype SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: QueryResponse<Q, Schema, WithCardinalityInference>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =\n | { error: { message: string }; data: undefined; pageInfo: undefined }\n | {\n error: undefined;\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n };\n\ntype LifecycleSubscriptionState<\n Q,\n Schema,\n WithCardinalityInference extends boolean,\n> = SubscriptionState<Q, Schema, WithCardinalityInference> & {\n isLoading: boolean;\n};\n\ntype InstaQLLifecycleState<\n Schema,\n Q,\n UseDates extends boolean = false,\n> = InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n};\n\ntype UnsubscribeFn = () => void;\n\n// consts\n\nconst defaultConfig = {\n apiURI: 'https://api.instantdb.com',\n websocketURI: 'wss://api.instantdb.com/runtime/session',\n};\n\n// hmr\nfunction initSchemaHashStore(): WeakMap<any, string> {\n globalThis.__instantDbSchemaHashStore =\n globalThis.__instantDbSchemaHashStore ?? new WeakMap<any, string>();\n return globalThis.__instantDbSchemaHashStore;\n}\n\nfunction initGlobalInstantCoreStore(): Record<string, any> {\n globalThis.__instantDbStore = globalThis.__instantDbStore ?? {};\n return globalThis.__instantDbStore;\n}\n\nfunction reactorKey(config: InstantConfig<any, boolean>): string {\n // @ts-expect-error\n const adminToken = config.__adminToken;\n return (\n config.appId +\n '_' +\n (config.websocketURI || 'default_ws_uri') +\n '_' +\n (config.apiURI || 'default_api_uri') +\n '_' +\n (adminToken || 'client_only') +\n '_' +\n config.useDateObjects\n );\n}\n\nconst globalInstantCoreStore = initGlobalInstantCoreStore();\nconst schemaHashStore = initSchemaHashStore();\n\ntype SignoutOpts = {\n invalidateToken?: boolean;\n};\n\n/**\n * Functions to log users in and out.\n *\n * @see https://instantdb.com/docs/auth\n */\nclass Auth {\n constructor(private db: Reactor) {}\n\n /**\n * Sends a magic code to the user's email address.\n *\n * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the\n * user verify.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth.sendMagicCode({email: \"example@gmail.com\"})\n * .catch((err) => console.error(err.body?.message))\n */\n sendMagicCode = (\n params: SendMagicCodeParams,\n ): Promise<SendMagicCodeResponse> => {\n return this.db.sendMagicCode(params);\n };\n\n /**\n * Verify a magic code that was sent to the user's email address.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInWithMagicCode({email: \"example@gmail.com\", code: \"123456\"})\n * .catch((err) => console.error(err.body?.message))\n */\n signInWithMagicCode = (\n params: VerifyMagicCodeParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithMagicCode(params);\n };\n\n /**\n * Sign in a user with a refresh token\n *\n * @see https://instantdb.com/docs/backend#frontend-auth-sign-in-with-token\n *\n * @example\n * // Get the token from your backend\n * const token = await fetch('/signin', ...);\n * //Sign in\n * db.auth.signInWithToken(token);\n */\n signInWithToken = (token: AuthToken): Promise<VerifyResponse> => {\n return this.db.signInWithCustomToken(token);\n };\n\n /**\n * Sign in as guest, creating a new user without email\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * db.auth.signInAsGuest();\n */\n signInAsGuest = (): Promise<VerifyResponse> => {\n return this.db.signInAsGuest();\n };\n\n /**\n * Create an authorization url to sign in with an external provider.\n *\n * @see https://instantdb.com/docs/auth\n *\n * @example\n * // Get the authorization url from your backend\n * const url = db.auth.createAuthorizationUrl({\n * clientName: \"google\",\n * redirectURL: window.location.href,\n * });\n *\n * // Put it in a sign in link\n * <a href={url}>Log in with Google</a>\n */\n createAuthorizationURL = (params: {\n clientName: string;\n redirectURL: string;\n }): string => {\n return this.db.createAuthorizationURL(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .signInWithIdToken({\n * // Token from external service\n * idToken: id_token,\n * // The name you gave the client when you registered it with Instant\n * clientName: \"google\",\n * // The nonce, if any, that you used when you initiated the auth flow\n * // with the external service.\n * nonce: your_nonce\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n signInWithIdToken = (\n params: SignInWithIdTokenParams,\n ): Promise<VerifyResponse> => {\n return this.db.signInWithIdToken(params);\n };\n\n /**\n * Sign in with the id_token from an external provider like Google\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * db.auth\n * .exchangeOAuthCode({\n * // code received in redirect from OAuth callback\n * code: code\n * // The PKCE code_verifier, if any, that you used when you\n * // initiated the auth flow\n * codeVerifier: your_code_verifier\n * })\n * .catch((err) => console.error(err.body?.message));\n *\n */\n exchangeOAuthCode = (params: ExchangeCodeForTokenParams) => {\n return this.db.exchangeCodeForToken(params);\n };\n\n /**\n * OpenID Discovery path for use with tools like\n * expo-auth-session that use auto-discovery of\n * OAuth parameters.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const discovery = useAutoDiscovery(\n * db.auth.issuerURI()\n * );\n */\n issuerURI = (): string => {\n return this.db.issuerURI();\n };\n\n /**\n * Sign out the current user\n */\n signOut = (opts: SignoutOpts = { invalidateToken: true }): Promise<void> => {\n return this.db.signOut(opts);\n };\n}\n\ntype FileOpts = {\n contentType?: string;\n contentDisposition?: string;\n fileSize?: number; // Required for streaming uploads\n};\n\n/**\n * Functions to manage file storage.\n */\nclass Storage {\n constructor(private db: Reactor) {}\n\n /**\n * Uploads file at the provided path.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * const [file] = e.target.files; // result of file input\n * const data = await db.storage.uploadFile('photos/demo.png', file);\n */\n uploadFile = (\n path: string,\n file: File | Blob,\n opts: FileOpts = {},\n ): Promise<UploadFileResponse> => {\n return this.db.uploadFile(path, file, opts);\n };\n\n /**\n * Deletes a file by path name.\n *\n * @see https://instantdb.com/docs/storage\n * @example\n * await db.storage.delete('photos/demo.png');\n */\n delete = (pathname: string) => {\n return this.db.deleteFile(pathname);\n };\n\n // Deprecated Storage API (Jan 2025)\n // ---------------------------------\n\n /**\n * @deprecated. Use `db.storage.uploadFile` instead\n * remove in the future.\n */\n upload = (pathname: string, file: File) => {\n return this.db.upload(pathname, file);\n };\n\n /**\n * @deprecated Use `db.storage.uploadFile` instead\n */\n put = this.upload;\n\n /**\n * @deprecated. getDownloadUrl will be removed in the future.\n * Use `useQuery` instead to query and fetch for valid urls\n *\n * db.useQuery({\n * $files: {\n * $: {\n * where: {\n * path: \"moop.png\"\n * }\n * }\n * }\n * })\n */\n getDownloadUrl = (pathname: string) => {\n return this.db.getDownloadUrl(pathname);\n };\n}\n\n// util\n\nfunction coerceQuery(o: any) {\n // stringify and parse to remove undefined values\n return JSON.parse(JSON.stringify(o));\n}\n\nclass InstantCoreDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean = false,\n> implements IInstantDatabase<Schema>\n{\n public _reactor: Reactor<RoomsOf<Schema>>;\n public auth: Auth;\n public storage: Storage;\n\n public tx = txInit<Schema>();\n\n constructor(reactor: Reactor<RoomsOf<Schema>>) {\n this._reactor = reactor;\n this.auth = new Auth(this._reactor);\n this.storage = new Storage(this._reactor);\n }\n\n /**\n * Use this to write data! You can create, update, delete, and link objects\n *\n * @see https://instantdb.com/docs/instaml\n *\n * @example\n * // Create a new object in the `goals` namespace\n * const goalId = id();\n * db.transact(db.tx.goals[goalId].update({title: \"Get fit\"}))\n *\n * // Update the title\n * db.transact(db.tx.goals[goalId].update({title: \"Get super fit\"}))\n *\n * // Delete it\n * db.transact(db.tx.goals[goalId].delete())\n *\n * // Or create an association:\n * todoId = id();\n * db.transact([\n * db.tx.todos[todoId].update({ title: 'Go on a run' }),\n * db.tx.goals[goalId].link({todos: todoId}),\n * ])\n */\n transact(\n chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],\n ): Promise<TransactionResult> {\n return this._reactor.pushTx(chunks);\n }\n\n getLocalId(name: string): Promise<string> {\n return this._reactor.getLocalId(name);\n }\n\n /**\n * Use this to query your data!\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n * // listen to all goals\n * db.subscribeQuery({ goals: {} }, (resp) => {\n * console.log(resp.data.goals)\n * })\n *\n * // goals where the title is \"Get Fit\"\n * db.subscribeQuery(\n * { goals: { $: { where: { title: \"Get Fit\" } } } },\n * (resp) => {\n * console.log(resp.data.goals)\n * }\n * )\n *\n * // all goals, _alongside_ their todos\n * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {\n * console.log(resp.data.goals)\n * });\n */\n subscribeQuery<\n Q extends ValidQuery<Q, Schema>,\n UseDatesLocal extends boolean = UseDates,\n >(\n query: Q,\n cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,\n opts?: InstaQLOptions,\n ) {\n return this._reactor.subscribeQuery(query, cb, opts);\n }\n\n /**\n * Listen for the logged in state. This is useful\n * for deciding when to show a login screen.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const unsub = db.subscribeAuth((auth) => {\n * if (auth.user) {\n * console.log('logged in as', auth.user.email)\n * } else {\n * console.log('logged out')\n * }\n * })\n */\n subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {\n return this._reactor.subscribeAuth(cb);\n }\n\n /**\n * One time query for the logged in state. This is useful\n * for scenarios where you want to know the current auth\n * state without subscribing to changes.\n *\n * @see https://instantdb.com/docs/auth\n * @example\n * const user = await db.getAuth();\n * console.log('logged in as', user.email)\n */\n getAuth(): Promise<User | null> {\n return this._reactor.getAuth();\n }\n\n /**\n * Listen for connection status changes to Instant. This is useful\n * for building things like connectivity indicators\n *\n * @see https://www.instantdb.com/docs/patterns#connection-status\n * @example\n * const unsub = db.subscribeConnectionStatus((status) => {\n * const connectionState =\n * status === 'connecting' || status === 'opened'\n * ? 'authenticating'\n * : status === 'authenticated'\n * ? 'connected'\n * : status === 'closed'\n * ? 'closed'\n * : status === 'errored'\n * ? 'errored'\n * : 'unexpected state';\n *\n * console.log('Connection status:', connectionState);\n * });\n */\n subscribeConnectionStatus(\n cb: (status: ConnectionStatus) => void,\n ): UnsubscribeFn {\n return this._reactor.subscribeConnectionStatus(cb);\n }\n\n /**\n * Join a room to publish and subscribe to topics and presence.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * // init\n * const db = init();\n * const room = db.joinRoom(roomType, roomId);\n * // usage\n * const unsubscribeTopic = room.subscribeTopic(\"foo\", console.log);\n * const unsubscribePresence = room.subscribePresence({}, console.log);\n * room.publishTopic(\"hello\", { message: \"hello world!\" });\n * room.publishPresence({ name: \"joe\" });\n * // later\n * unsubscribePresence();\n * unsubscribeTopic();\n * room.leaveRoom();\n */\n joinRoom<RoomType extends keyof RoomsOf<Schema>>(\n roomType: RoomType = '_defaultRoomType' as RoomType,\n roomId: string = '_defaultRoomId',\n opts?: {\n initialPresence?: Partial<PresenceOf<Schema, RoomType>>;\n },\n ): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>> {\n const leaveRoom = this._reactor.joinRoom(roomId, opts?.initialPresence);\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomId, topic, onEvent),\n subscribePresence: (opts, onChange) =>\n this._reactor.subscribePresence(roomType, roomId, opts, onChange),\n publishTopic: (topic, data) =>\n this._reactor.publishTopic({ roomType, roomId, topic, data }),\n publishPresence: (data) =>\n this._reactor.publishPresence(roomType, roomId, data),\n getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),\n };\n }\n\n shutdown() {\n delete globalInstantCoreStore[reactorKey(this._reactor.config)];\n this._reactor.shutdown();\n }\n\n /**\n * Use this for one-off queries.\n * Returns local data if available, otherwise fetches from the server.\n * Because we want to avoid stale data, this method will throw an error\n * if the user is offline or there is no active connection to the server.\n *\n * @see https://instantdb.com/docs/instaql\n *\n * @example\n *\n * const resp = await db.queryOnce({ goals: {} });\n * console.log(resp.data.goals)\n */\n queryOnce<Q extends ValidQuery<Q, Schema>>(\n query: Q,\n opts?: InstaQLOptions,\n ): Promise<{\n data: InstaQLResponse<Schema, Q, UseDates>;\n pageInfo: PageInfoResponse<Q>;\n }> {\n return this._reactor.queryOnce(query, opts);\n }\n\n /**\n * @deprecated This is an experimental function that is not yet ready for production use.\n * Use this function to sync an entire namespace.\n * It has many limitations that will be removed in the future:\n * 1. Must be used with an admin token\n * 2. Does not support permissions\n * 3. Does not support where clauses\n * 4. Does not support links\n * It also does not support multiple top-level namespaces. For example,\n * {posts: {}, users: {}} is invalid. Only `posts` or `users` is allowed, but not both.\n */\n _syncTableExperimental<Q extends ValidQuery<Q, Schema>>(\n query: ExactlyOne<Q>,\n cb: SyncTableCallback<Schema, Q, UseDates>,\n ): (\n opts?: { keepSubscription: boolean | null | undefined } | null | undefined,\n ) => void {\n return this._reactor.subscribeTable(query, cb);\n }\n}\n\nfunction schemaHash(schema?: InstantSchemaDef<any, any, any>): string {\n if (!schema) {\n return '0';\n }\n\n if (schemaHashStore.get(schema)) {\n return schemaHashStore.get(schema);\n }\n const hash = weakHash(schema);\n schemaHashStore.set(schema, hash);\n return hash;\n}\n\nfunction schemaChanged(\n existingClient: InstantCoreDatabase<any, boolean>,\n newSchema?: InstantSchemaDef<any, any, any>,\n): boolean {\n return (\n schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)\n );\n}\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://instantdb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@instantdb/core\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@instantdb/core\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://instantdb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n config: InstantConfig<Schema, UseDates>,\n Storage?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const existingClient = globalInstantCoreStore[\n reactorKey(config)\n ] as InstantCoreDatabase<any, Config['useDateObjects']>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, config.schema)) {\n existingClient._reactor.updateSchema(config.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...config,\n cardinalityInference: config.schema ? true : false,\n },\n Storage || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, Config['useDateObjects']>(\n reactor,\n );\n globalInstantCoreStore[reactorKey(config)] = client;\n\n handleDevtool(config.appId, config.devtool);\n\n return client;\n}\n\nfunction handleDevtool(appId: string, devtool: boolean | DevtoolConfig) {\n if (\n typeof window === 'undefined' ||\n typeof window.location === 'undefined' ||\n typeof document === 'undefined'\n ) {\n return;\n }\n\n if (typeof devtool === 'boolean' && !devtool) {\n return;\n }\n\n const config: StrictDevtoolConfig = {\n position: 'bottom-right' as const,\n allowedHosts: ['localhost'],\n ...(typeof devtool === 'object' ? devtool : {}),\n };\n\n if (!config.allowedHosts.includes(window.location.hostname)) {\n return;\n }\n\n createDevtool(appId, config);\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@instantdb/core\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@instantdb/core\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nexport {\n // bada bing bada boom\n init,\n init_experimental,\n id,\n tx,\n txInit,\n lookup,\n validateQuery,\n QueryValidationError,\n validateTransactions,\n TransactionValidationError,\n\n // error\n InstantAPIError,\n\n // cli\n i,\n\n // util\n getOps,\n coerceQuery,\n weakHash,\n coerceToDate,\n IndexedDBStorage,\n WindowNetworkListener,\n InstantCoreDatabase,\n Auth,\n Storage,\n version,\n InstantError,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // og types\n type IDatabase,\n type RoomSchemaShape,\n type Query,\n type QueryResponse,\n type InstaQLResponse,\n type PageInfoResponse,\n type InstantObject,\n type Exactly,\n type TransactionChunk,\n type AuthState,\n type ConnectionStatus,\n type User,\n type AuthToken,\n type TxChunk,\n type SubscriptionState,\n type InstaQLSubscriptionState,\n type LifecycleSubscriptionState,\n type InstaQLLifecycleState,\n\n // presence types\n type PresenceOpts,\n type PresenceSlice,\n type PresenceResponse,\n type PresencePeer,\n\n // new query types\n type InstaQLParams,\n type ValidQuery,\n type InstaQLOptions,\n type InstaQLQueryParams,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantEntity,\n type InstantSchemaDatabase,\n type InstaQLFields,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type InstantUnknownSchemaDef,\n type EntitiesWithLinks,\n type EntityDef,\n type RoomsDef,\n type InstantGraph,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type RoomsOf,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type IInstantDatabase,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type CreateParams,\n type RuleParams,\n\n // attr types\n type InstantDBAttr,\n type InstantDBAttrOnDelete,\n type InstantDBCheckedDataType,\n type InstantDBIdent,\n type InstantDBInferredType,\n\n // auth types\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // SSE\n type EventSourceType,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // error types\n type InstantIssue,\n};\n"]}
|
package/dist/esm/instaql.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instaql.d.ts","sourceRoot":"","sources":["../../src/instaql.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"instaql.d.ts","sourceRoot":"","sources":["../../src/instaql.js"],"names":[],"mappings":"AAmfA,8FAaC;AA4PD;;;;;;EA0BC"}
|
package/dist/esm/instaql.js
CHANGED
|
@@ -365,7 +365,7 @@ function compareDisparateValues(a, b, dataType) {
|
|
|
365
365
|
}
|
|
366
366
|
return -1;
|
|
367
367
|
}
|
|
368
|
-
function compareOrder(
|
|
368
|
+
export function compareOrder(id_a, v_a, id_b, v_b, dataType) {
|
|
369
369
|
if (v_a === v_b || (v_a == null && v_b == null)) {
|
|
370
370
|
return uuidCompare(id_a, id_b);
|
|
371
371
|
}
|
|
@@ -377,6 +377,9 @@ function compareOrder([id_a, v_a], [id_b, v_b], dataType) {
|
|
|
377
377
|
}
|
|
378
378
|
return compareDisparateValues(v_a, v_b, dataType);
|
|
379
379
|
}
|
|
380
|
+
function compareOrderTriples([id_a, v_a], [id_b, v_b], dataType) {
|
|
381
|
+
return compareOrder(id_a, v_a, id_b, v_b, dataType);
|
|
382
|
+
}
|
|
380
383
|
function comparableDate(x) {
|
|
381
384
|
if (x == null) {
|
|
382
385
|
return x;
|
|
@@ -388,13 +391,13 @@ function isBefore(startCursor, orderAttr, direction, idVec) {
|
|
|
388
391
|
const [c_e, _c_a, c_v, c_t] = startCursor;
|
|
389
392
|
const compareVal = direction === 'desc' ? 1 : -1;
|
|
390
393
|
if (((_a = orderAttr['forward-identity']) === null || _a === void 0 ? void 0 : _a[2]) === 'id') {
|
|
391
|
-
return
|
|
394
|
+
return compareOrderTriples(idVec, [c_e, c_t], null) === compareVal;
|
|
392
395
|
}
|
|
393
396
|
const [e, v] = idVec;
|
|
394
397
|
const dataType = orderAttr['checked-data-type'];
|
|
395
398
|
const v_new = dataType === 'date' ? comparableDate(v) : v;
|
|
396
399
|
const c_v_new = dataType === 'date' ? comparableDate(c_v) : c_v;
|
|
397
|
-
return
|
|
400
|
+
return (compareOrderTriples([e, v_new], [c_e, c_v_new], dataType) === compareVal);
|
|
398
401
|
}
|
|
399
402
|
function orderAttrFromCursor(store, cursor) {
|
|
400
403
|
const cursorAttrId = cursor[1];
|
|
@@ -459,10 +462,10 @@ function runDataloadAndReturnObjects(store, { etype, pageInfo, dq, form }) {
|
|
|
459
462
|
}
|
|
460
463
|
idVecs.sort(direction === 'asc'
|
|
461
464
|
? function compareIdVecs(a, b) {
|
|
462
|
-
return
|
|
465
|
+
return compareOrderTriples(a, b, orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr['checked-data-type']);
|
|
463
466
|
}
|
|
464
467
|
: function compareIdVecs(a, b) {
|
|
465
|
-
return
|
|
468
|
+
return compareOrderTriples(b, a, orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr['checked-data-type']);
|
|
466
469
|
});
|
|
467
470
|
let objects = {};
|
|
468
471
|
const attrs = objectAttrs(store, etype, dq);
|