@instantdb/core 0.22.139 → 0.22.140
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/Connection.d.ts +2 -1
- package/dist/commonjs/Connection.d.ts.map +1 -1
- package/dist/commonjs/Connection.js +6 -2
- package/dist/commonjs/Connection.js.map +1 -1
- package/dist/commonjs/Reactor.d.ts +12 -0
- package/dist/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +63 -18
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/Stream.d.ts +112 -0
- package/dist/commonjs/Stream.d.ts.map +1 -0
- package/dist/commonjs/Stream.js +708 -0
- package/dist/commonjs/Stream.js.map +1 -0
- package/dist/commonjs/index.d.ts +41 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +41 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/Connection.d.ts +2 -1
- package/dist/esm/Connection.d.ts.map +1 -1
- package/dist/esm/Connection.js +6 -2
- package/dist/esm/Connection.js.map +1 -1
- package/dist/esm/Reactor.d.ts +12 -0
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +53 -9
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/Stream.d.ts +112 -0
- package/dist/esm/Stream.d.ts.map +1 -0
- package/dist/esm/Stream.js +701 -0
- package/dist/esm/Stream.js.map +1 -0
- package/dist/esm/index.d.ts +41 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +42 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +2203 -1604
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Connection.ts +6 -2
- package/src/Reactor.js +56 -10
- package/src/Stream.ts +1016 -0
- package/src/index.ts +71 -1
- package/tsconfig.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stream.js","sourceRo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CAAC;oBACb,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,IAAI,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC;qBAClE,CAAC,CAAC;oBACH,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACjB,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;gBAC3C,CAAC;gBACD,MAAM;YACR,CAAC;YACD,KAAK,oBAAoB,CAAC,CAAC,CAAC;gBAC1B,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import uuid from './utils/id.ts';\nimport { Logger } from './utils/log.ts';\nimport { STATUS } from './Reactor.js';\nimport { InstantError } from './InstantError.ts';\n\nexport type WritableStreamCtor = {\n new <W = any>(\n underlyingSink?: UnderlyingSink<W>,\n strategy?: QueuingStrategy<W>,\n ): WritableStream<W>;\n};\n\nexport type ReadableStreamCtor = {\n new <R = any>(\n underlyingSource?: UnderlyingDefaultSource<R>,\n strategy?: QueuingStrategy<R>,\n ): ReadableStream<R>;\n};\n\nexport interface InstantWritableStream<T> extends WritableStream<T> {\n streamId: () => Promise<string>;\n}\n\ntype WriteStreamStartResult =\n | { type: 'ok'; streamId: string; offset: number }\n | { type: 'disconnect' }\n | { type: 'error'; error: InstantError };\n\ntype WriteStreamCbs = {\n onDisconnect: () => void;\n onConnectionReconnect: () => void;\n onFlush: (args: { offset: number; done: boolean }) => void;\n onAppendFailed: () => void;\n};\n\nfunction createWriteStream({\n WStream,\n opts,\n startStream,\n appendStream,\n registerStream,\n}: {\n WStream: WritableStreamCtor;\n opts: { clientId: string };\n startStream: (opts: {\n clientId: string;\n reconnectToken: string;\n }) => Promise<WriteStreamStartResult>;\n appendStream: (opts: {\n streamId: string;\n chunks: string[];\n isDone?: boolean;\n offset: number;\n abortReason?: string;\n }) => void;\n registerStream: (streamId: string, cbs: WriteStreamCbs) => void;\n}): {\n stream: InstantWritableStream<string>;\n closed: () => boolean;\n addCloseCb: (cb: () => void) => void;\n} {\n const clientId = opts.clientId;\n let streamId_: string | null = null;\n let controller_: WritableStreamDefaultController | null = null;\n const reconnectToken = uuid();\n let isDone: boolean = false;\n let closed: boolean = false;\n const closeCbs: (() => void)[] = [];\n const streamIdCbs: ((streamId: string) => void)[] = [];\n let disconnected: boolean = false;\n // Chunks that we haven't been notified are flushed to disk\n let bufferOffset = 0;\n let bufferByteSize = 0;\n const buffer: { chunk: string; byteLen: number }[] = [];\n const encoder = new TextEncoder();\n\n function markClosed() {\n closed = true;\n for (const cb of closeCbs) {\n cb();\n }\n }\n\n function addCloseCb(cb: () => void) {\n closeCbs.push(cb);\n return () => {\n const i = closeCbs.indexOf(cb);\n if (i !== -1) {\n closeCbs.splice(i, 1);\n }\n };\n }\n\n function addStreamIdCb(cb: (streamId: string) => void) {\n streamIdCbs.push(cb);\n return () => {\n const i = streamIdCbs.indexOf(cb);\n if (i !== -1) {\n streamIdCbs.splice(i, 1);\n }\n };\n }\n\n function setStreamId(streamId: string) {\n streamId_ = streamId;\n for (const cb of streamIdCbs) {\n cb(streamId_);\n }\n }\n\n function onDisconnect() {\n disconnected = true;\n }\n\n // Clears data from our buffer after it has been flushed to a file\n function discardFlushed(offset: number) {\n let chunkOffset = bufferOffset;\n let segmentsToDrop = 0;\n let droppedSegmentsByteLen = 0;\n\n for (const { byteLen } of buffer) {\n const nextChunkOffset = chunkOffset + byteLen;\n if (nextChunkOffset > offset) {\n break;\n }\n chunkOffset = nextChunkOffset;\n segmentsToDrop++;\n droppedSegmentsByteLen += byteLen;\n }\n\n if (segmentsToDrop > 0) {\n bufferOffset += droppedSegmentsByteLen;\n bufferByteSize -= droppedSegmentsByteLen;\n buffer.splice(0, segmentsToDrop);\n }\n }\n\n async function onConnectionReconnect() {\n const result = await startStream({\n clientId,\n reconnectToken,\n });\n switch (result.type) {\n case 'ok': {\n const { streamId, offset } = result;\n streamId_ = streamId;\n discardFlushed(offset);\n if (buffer.length) {\n appendStream({\n streamId: streamId,\n chunks: buffer.map((b) => b.chunk),\n offset: bufferOffset,\n });\n }\n disconnected = false;\n break;\n }\n case 'disconnect': {\n onDisconnect();\n break;\n }\n case 'error': {\n if (controller_) {\n controller_.error(result.error);\n markClosed();\n }\n break;\n }\n }\n }\n\n // When the append fails, we'll just try to reconnect and start again\n function onAppendFailed() {\n onDisconnect();\n onConnectionReconnect();\n }\n\n function onFlush({ offset, done }: { offset: number; done: boolean }) {\n discardFlushed(offset);\n if (done) {\n isDone = true;\n }\n }\n\n function error(\n controller: WritableStreamDefaultController,\n error: InstantError,\n ) {\n markClosed();\n controller.error(error);\n }\n\n function ensureSetup(controller): string | null {\n if (isDone) {\n error(controller, new InstantError('Stream has been closed.'));\n }\n if (!streamId_) {\n error(controller, new InstantError('Stream has not been initialized.'));\n }\n return streamId_;\n }\n\n async function start(controller: WritableStreamDefaultController) {\n controller_ = controller;\n let tryAgain = true;\n let attempts = 0;\n\n while (tryAgain) {\n // rate-limit after the first few failed connects\n let nextAttempt = Date.now() + Math.min(15000, 500 * (attempts - 1));\n tryAgain = false;\n const result = await startStream({\n clientId: opts.clientId,\n reconnectToken,\n });\n\n switch (result.type) {\n case 'ok': {\n const { streamId, offset } = result;\n if (offset !== 0) {\n const e = new InstantError('Write stream is corrupted');\n error(controller, e);\n return;\n }\n setStreamId(streamId);\n registerStream(streamId, {\n onDisconnect,\n onFlush,\n onConnectionReconnect,\n onAppendFailed,\n });\n disconnected = false;\n return;\n }\n case 'disconnect': {\n tryAgain = true;\n onDisconnect();\n attempts++;\n await new Promise((resolve) => {\n // Try again immediately for the first two attempts, then back off\n setTimeout(resolve, nextAttempt - Date.now());\n });\n break;\n }\n case 'error': {\n error(controller, result.error);\n return;\n }\n }\n }\n }\n\n class WStreamEnhanced\n extends WStream<string>\n implements InstantWritableStream<string>\n {\n constructor(\n sink?: UnderlyingSink<string>,\n strategy?: QueuingStrategy<string>,\n ) {\n super(sink, strategy);\n }\n\n public async streamId(): Promise<string> {\n if (streamId_) {\n return streamId_;\n }\n return new Promise((resolve, reject) => {\n const cleanupFns: (() => void)[] = [];\n const cleanup = () => {\n for (const f of cleanupFns) {\n f();\n }\n };\n const resolveCb = (streamId: string) => {\n resolve(streamId);\n cleanup();\n };\n const rejectCb = () => {\n reject(new InstantError('Stream is closed.'));\n cleanup();\n };\n\n cleanupFns.push(addStreamIdCb(resolveCb));\n cleanupFns.push(addCloseCb(rejectCb));\n });\n }\n }\n\n const stream = new WStreamEnhanced({\n // TODO(dww): accept a storage so that write streams can survive across\n // browser restarts\n async start(controller) {\n try {\n await start(controller);\n } catch (e) {\n error(controller, e);\n }\n },\n write(chunk, controller) {\n const streamId = ensureSetup(controller);\n if (streamId) {\n const byteLen = encoder.encode(chunk).length;\n buffer.push({ chunk, byteLen });\n const offset = bufferOffset + bufferByteSize;\n bufferByteSize += byteLen;\n if (!disconnected) {\n appendStream({ streamId, chunks: [chunk], offset });\n }\n }\n },\n close() {\n if (streamId_) {\n appendStream({\n streamId: streamId_,\n chunks: [],\n offset: bufferOffset + bufferByteSize,\n isDone: true,\n });\n }\n markClosed();\n },\n abort(reason) {\n if (streamId_) {\n appendStream({\n streamId: streamId_,\n chunks: [],\n offset: bufferOffset + bufferByteSize,\n isDone: true,\n abortReason: reason,\n });\n }\n markClosed();\n },\n });\n return {\n stream,\n addCloseCb,\n closed() {\n return closed;\n },\n };\n}\n\ntype ReadStreamUpdate =\n | {\n type: 'append';\n offset: number;\n files?: { url: string; size: number }[];\n content?: string;\n }\n | { type: 'error'; error: InstantError }\n | { type: 'reconnect' };\n\nclass StreamIterator<T> {\n private items: T[] = [];\n private resolvers: ((next: {\n value: T | undefined;\n done: boolean;\n }) => void)[] = [];\n private isClosed = false;\n\n constructor() {}\n\n push(item: T) {\n if (this.isClosed) return;\n\n const resolve = this.resolvers.shift();\n if (resolve) {\n resolve({ value: item, done: false });\n } else {\n this.items.push(item);\n }\n }\n\n close() {\n this.isClosed = true;\n while (this.resolvers.length > 0) {\n const resolve = this.resolvers.shift();\n resolve!({ value: undefined, done: true });\n }\n }\n\n async *[Symbol.asyncIterator]() {\n while (true) {\n if (this.items.length > 0) {\n yield this.items.shift()!;\n } else if (this.isClosed) {\n return;\n } else {\n const { value, done } = await new Promise<{\n value: T | undefined;\n done: boolean;\n }>((resolve) => {\n this.resolvers.push(resolve);\n });\n if (done || !value) {\n return;\n }\n yield value;\n }\n }\n }\n}\n\nfunction createReadStream({\n RStream,\n opts,\n startStream,\n cancelStream,\n}: {\n RStream: ReadableStreamCtor;\n opts: {\n clientId?: string | null | undefined;\n streamId?: string | null | undefined;\n byteOffset?: number | null | undefined;\n };\n startStream: (opts: {\n eventId: string;\n clientId?: string | null | undefined;\n streamId?: string | null | undefined;\n offset?: number;\n }) => StreamIterator<ReadStreamUpdate>;\n cancelStream: (opts: { eventId: string }) => void;\n}): {\n stream: ReadableStream<string>;\n closed: () => boolean;\n addCloseCb: (cb: () => void) => void;\n} {\n let seenOffset = opts.byteOffset || 0;\n let canceled = false;\n const decoder = new TextDecoder('utf-8');\n const encoder = new TextEncoder();\n let eventId: string | null;\n let closed = false;\n const closeCbs: (() => void)[] = [];\n\n function markClosed() {\n closed = true;\n for (const cb of closeCbs) {\n cb();\n }\n }\n\n function addCloseCb(cb: () => void) {\n closeCbs.push(cb);\n return () => {\n const i = closeCbs.indexOf(cb);\n if (i !== -1) {\n closeCbs.splice(i, 1);\n }\n };\n }\n\n function error(\n controller: ReadableStreamDefaultController<string>,\n e: InstantError,\n ) {\n controller.error(e);\n markClosed();\n }\n\n let fetchFailures = 0;\n async function runStartStream(\n opts: {\n clientId?: string | null | undefined;\n streamId?: string | null | undefined;\n offset?: number;\n },\n controller: ReadableStreamDefaultController<string>,\n ): Promise<{ retry: boolean } | undefined> {\n eventId = uuid();\n const streamOpts = { ...(opts || {}), eventId };\n for await (const item of startStream(streamOpts)) {\n if (canceled) {\n return;\n }\n\n if (item.type === 'reconnect') {\n return { retry: true };\n }\n\n if (item.type === 'error') {\n error(controller, item.error);\n return;\n }\n\n if (item.offset > seenOffset) {\n error(controller, new InstantError('Stream is corrupted.'));\n canceled = true;\n return;\n }\n\n let discardLen = seenOffset - item.offset;\n\n if (item.files && item.files.length) {\n const fetchAbort = new AbortController();\n let nextFetch = fetch(item.files[0].url, {\n signal: fetchAbort.signal,\n });\n for (let i = 0; i < item.files.length; i++) {\n const nextFile = item.files[i + 1];\n const thisFetch = nextFetch;\n const res = await thisFetch;\n if (nextFile) {\n nextFetch = fetch(nextFile.url, { signal: fetchAbort.signal });\n }\n\n if (!res.ok) {\n fetchFailures++;\n if (fetchFailures > 10) {\n error(controller, new InstantError('Unable to process stream.'));\n return;\n }\n return { retry: true };\n }\n\n if (res.body) {\n for await (const bodyChunk of res.body) {\n if (canceled) {\n fetchAbort.abort();\n return;\n }\n let chunk = bodyChunk;\n if (discardLen > 0) {\n chunk = bodyChunk.subarray(discardLen);\n discardLen -= bodyChunk.length - chunk.length;\n }\n if (!chunk.length) {\n continue;\n }\n seenOffset += chunk.length;\n const s = decoder.decode(chunk);\n\n controller.enqueue(s);\n }\n } else {\n // RN doesn't support request.body\n const bodyChunk = await res.arrayBuffer();\n let chunk: ArrayBuffer | Uint8Array<ArrayBuffer> = bodyChunk;\n if (canceled) {\n fetchAbort.abort();\n return;\n }\n if (discardLen > 0) {\n chunk = new Uint8Array(bodyChunk).subarray(discardLen);\n discardLen -= bodyChunk.byteLength - chunk.length;\n }\n if (!chunk.byteLength) {\n continue;\n }\n seenOffset += chunk.byteLength;\n const s = decoder.decode(chunk);\n controller.enqueue(s);\n }\n }\n }\n fetchFailures = 0;\n if (item.content) {\n let content = item.content;\n let encoded = encoder.encode(item.content);\n if (discardLen > 0) {\n const remaining = encoded.subarray(discardLen);\n discardLen -= encoded.length - remaining.length;\n if (!remaining.length) {\n continue;\n }\n encoded = remaining;\n content = decoder.decode(remaining);\n }\n seenOffset += encoded.length;\n controller.enqueue(content);\n }\n }\n }\n\n async function start(controller: ReadableStreamDefaultController<string>) {\n let retry = true;\n let attempts = 0;\n while (retry) {\n retry = false;\n let nextAttempt = Date.now() + Math.min(15000, 500 * (attempts - 1));\n const res = await runStartStream(\n { ...opts, offset: seenOffset },\n controller,\n );\n\n if (res?.retry) {\n retry = true;\n attempts++;\n if (nextAttempt < Date.now() - 300000) {\n // reset attempts if we last tried 5 minutes ago\n attempts = 0;\n }\n await new Promise((resolve) => {\n setTimeout(resolve, nextAttempt - Date.now());\n });\n }\n }\n if (!canceled && !closed) {\n controller.close();\n markClosed();\n }\n }\n const stream = new RStream<string>({\n start(controller) {\n start(controller);\n },\n cancel(_reason) {\n canceled = true;\n if (eventId) {\n cancelStream({ eventId });\n }\n markClosed();\n },\n });\n\n return {\n stream,\n addCloseCb,\n closed() {\n return closed;\n },\n };\n}\n\ntype StartStreamMsg = {\n op: 'start-stream';\n 'client-id': string;\n 'reconnect-token': string;\n};\n\ntype AppendStreamMsg = {\n op: 'append-stream';\n 'stream-id': string;\n chunks: string[];\n offset: number;\n done: boolean;\n 'abort-reason'?: string;\n};\n\ntype SubscribeStreamMsg = {\n op: 'subscribe-stream';\n 'stream-id'?: string;\n 'client-id'?: string;\n offset?: number;\n};\n\ntype UnsubscribeStreamMsg = {\n op: 'unsubscribe-stream';\n 'subscribe-event-id': string;\n};\n\ntype SendMsg =\n | StartStreamMsg\n | AppendStreamMsg\n | SubscribeStreamMsg\n | UnsubscribeStreamMsg;\n\ntype TrySend = (eventId: string, msg: SendMsg) => void;\n\ntype StartStreamOkMsg = {\n op: 'start-stream-ok';\n 'client-event-id': string;\n 'stream-id': string;\n offset: number;\n};\n\ntype AppendStreamFailedMsg = {\n op: 'append-failed';\n 'stream-id': string;\n};\n\ntype StreamFlushedMsg = {\n op: 'stream-flushed';\n 'stream-id': string;\n offset: number;\n done: boolean;\n};\n\n// Msg sent to reader when we receive new data\ntype StreamAppendMsg = {\n op: 'stream-append';\n 'stream-id': string;\n 'client-id': string | null;\n 'client-event-id': string;\n files?: { url: string; size: number }[];\n done?: boolean;\n 'abort-reason'?: string;\n offset: number;\n error?: string;\n retry: boolean;\n content?: string;\n};\n\ntype HandleRecieveErrorMsg = {\n 'client-event-id': string;\n 'original-event': SendMsg;\n message?: string;\n hint?: Record<string, any>;\n type?: string;\n};\n\nexport class InstantStream {\n private trySend: TrySend;\n private WStream: WritableStreamCtor;\n private RStream: ReadableStreamCtor;\n private writeStreams: Record<string, WriteStreamCbs> = {};\n private startWriteStreamCbs: Record<\n string,\n (data: WriteStreamStartResult) => void\n > = {};\n\n private readStreamIterators: Record<\n string,\n StreamIterator<ReadStreamUpdate>\n > = {};\n private log: Logger;\n private activeStreams: Set<ReadableStream | WritableStream> = new Set();\n\n constructor({\n WStream,\n RStream,\n trySend,\n log,\n }: {\n WStream: WritableStreamCtor;\n RStream: ReadableStreamCtor;\n trySend: TrySend;\n log: Logger;\n }) {\n this.WStream = WStream;\n this.RStream = RStream;\n this.trySend = trySend;\n this.log = log;\n }\n\n public createWriteStream(opts: {\n clientId: string;\n }): InstantWritableStream<string> {\n const { stream, addCloseCb } = createWriteStream({\n WStream: this.WStream,\n startStream: this.startWriteStream.bind(this),\n appendStream: this.appendStream.bind(this),\n registerStream: this.registerWriteStream.bind(this),\n opts,\n });\n this.activeStreams.add(stream);\n addCloseCb(() => {\n this.activeStreams.delete(stream);\n });\n return stream;\n }\n\n public createReadStream(opts: {\n clientId?: string | null | undefined;\n streamId?: string | null | undefined;\n byteOffset?: number | null | undefined;\n }) {\n const { stream, addCloseCb } = createReadStream({\n RStream: this.RStream,\n opts,\n startStream: this.startReadStream.bind(this),\n cancelStream: this.cancelReadStream.bind(this),\n });\n this.activeStreams.add(stream);\n addCloseCb(() => {\n this.activeStreams.delete(stream);\n });\n return stream;\n }\n\n private startWriteStream(opts: {\n clientId: string;\n reconnectToken: string;\n }): Promise<WriteStreamStartResult> {\n const eventId = uuid();\n let resolve: ((data: WriteStreamStartResult) => void) | null = null;\n const promise: Promise<WriteStreamStartResult> = new Promise((r) => {\n resolve = r;\n });\n this.startWriteStreamCbs[eventId] = resolve!;\n const msg: StartStreamMsg = {\n op: 'start-stream',\n 'client-id': opts.clientId,\n 'reconnect-token': opts.reconnectToken,\n };\n\n this.trySend(eventId, msg);\n\n return promise;\n }\n\n private registerWriteStream(streamId: string, cbs: WriteStreamCbs) {\n this.writeStreams[streamId] = cbs;\n }\n\n private appendStream({\n streamId,\n chunks,\n isDone,\n offset,\n abortReason,\n }: {\n streamId: string;\n chunks: string[];\n isDone?: boolean;\n // XXX: Handle offset on the server\n offset: number;\n abortReason?: string;\n }) {\n const msg: AppendStreamMsg = {\n op: 'append-stream',\n 'stream-id': streamId,\n chunks,\n offset,\n done: !!isDone,\n };\n\n if (abortReason) {\n msg['abort-reason'] = abortReason;\n }\n\n this.trySend(uuid(), msg);\n }\n\n onAppendFailed(msg: AppendStreamFailedMsg) {\n const cbs = this.writeStreams[msg['stream-id']];\n if (cbs) {\n cbs.onAppendFailed();\n }\n }\n\n onStartStreamOk(msg: StartStreamOkMsg) {\n const cb = this.startWriteStreamCbs[msg['client-event-id']];\n if (!cb) {\n this.log.info('No stream for start-stream-ok', msg);\n return;\n }\n cb({ type: 'ok', streamId: msg['stream-id'], offset: msg.offset });\n delete this.startWriteStreamCbs[msg['client-event-id']];\n }\n\n onStreamFlushed(msg: StreamFlushedMsg) {\n const streamId = msg['stream-id'];\n const cbs = this.writeStreams[streamId];\n if (!cbs) {\n this.log.info('No stream cbs for stream-flushed', msg);\n return;\n }\n cbs.onFlush({ offset: msg.offset, done: msg.done });\n if (msg.done) {\n delete this.writeStreams[streamId];\n }\n }\n\n private startReadStream({\n eventId,\n clientId,\n streamId,\n offset,\n }: {\n eventId: string;\n clientId?: string;\n streamId?: string;\n offset?: number;\n }): StreamIterator<ReadStreamUpdate> {\n const msg: SubscribeStreamMsg = { op: 'subscribe-stream' };\n\n if (!streamId && !clientId) {\n throw new Error(\n 'Must provide one of streamId or clientId to subscribe to the stream.',\n );\n }\n\n if (streamId) {\n msg['stream-id'] = streamId;\n }\n\n if (clientId) {\n msg['client-id'] = clientId;\n }\n\n if (offset) {\n msg['offset'] = offset;\n }\n\n const iterator = new StreamIterator<ReadStreamUpdate>();\n\n this.readStreamIterators[eventId] = iterator;\n\n this.trySend(eventId, msg);\n\n return iterator;\n }\n\n private cancelReadStream({ eventId }: { eventId: string }) {\n const msg: UnsubscribeStreamMsg = {\n op: 'unsubscribe-stream',\n 'subscribe-event-id': eventId,\n };\n this.trySend(uuid(), msg);\n delete this.readStreamIterators[eventId];\n }\n\n onStreamAppend(msg: StreamAppendMsg) {\n const eventId = msg['client-event-id'];\n const iterator = this.readStreamIterators[eventId];\n\n if (!iterator) {\n this.log.info('No iterator for read stream', msg);\n return;\n }\n\n if (msg.error) {\n if (msg.retry) {\n iterator.push({ type: 'reconnect' });\n } else {\n iterator.push({\n type: 'error',\n error: new InstantError(msg.error),\n });\n }\n iterator.close();\n delete this.readStreamIterators[eventId];\n return;\n }\n\n if (msg.files?.length || msg.content) {\n iterator.push({\n type: 'append',\n offset: msg.offset,\n files: msg.files,\n content: msg.content,\n });\n }\n\n if (msg.done) {\n iterator.close();\n delete this.readStreamIterators[eventId];\n }\n }\n\n onConnectionStatusChange(status) {\n // Tell the writers to retry:\n for (const cb of Object.values(this.startWriteStreamCbs)) {\n cb({ type: 'disconnect' });\n }\n this.startWriteStreamCbs = {};\n\n if (status !== STATUS.AUTHENTICATED) {\n // Notify the writers that they've been disconnected\n for (const { onDisconnect } of Object.values(this.writeStreams)) {\n onDisconnect();\n }\n } else {\n // Notify the writers that they need to reconnect\n for (const { onConnectionReconnect } of Object.values(\n this.writeStreams,\n )) {\n onConnectionReconnect();\n }\n\n // Notify the readers that they need to reconnect\n for (const iterator of Object.values(this.readStreamIterators)) {\n iterator.push({ type: 'reconnect' });\n iterator.close();\n }\n this.readStreamIterators = {};\n }\n }\n\n onRecieveError(msg: HandleRecieveErrorMsg) {\n const ev = msg['original-event'];\n switch (ev.op) {\n case 'append-stream': {\n const streamId = ev['stream-id'];\n const cbs = this.writeStreams[streamId];\n cbs?.onAppendFailed();\n break;\n }\n case 'start-stream': {\n const eventId = msg['client-event-id'];\n const cb = this.startWriteStreamCbs[eventId];\n if (cb) {\n cb({\n type: 'error',\n error: new InstantError(msg.message || 'Unknown error', msg.hint),\n });\n delete this.startWriteStreamCbs[eventId];\n }\n break;\n }\n case 'subscribe-stream': {\n const eventId = msg['client-event-id'];\n const iterator = this.readStreamIterators[eventId];\n if (iterator) {\n iterator.push({\n type: 'error',\n error: new InstantError(msg.message || 'Unknown error', msg.hint),\n });\n iterator.close();\n delete this.readStreamIterators[eventId];\n }\n break;\n }\n case 'unsubscribe-stream': {\n break;\n }\n }\n }\n\n hasActiveStreams() {\n return this.activeStreams.size > 0;\n }\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -27,9 +27,10 @@ import { FrameworkClient, type FrameworkConfig } from './framework.ts';
|
|
|
27
27
|
import type { ExchangeCodeForTokenParams, SendMagicCodeParams, SendMagicCodeResponse, SignInWithIdTokenParams, VerifyMagicCodeParams, VerifyResponse } from './authAPI.ts';
|
|
28
28
|
import { InstantAPIError, type InstantIssue } from './utils/fetch.js';
|
|
29
29
|
import { InstantError } from './InstantError.ts';
|
|
30
|
-
import { EventSourceType } from './Connection.ts';
|
|
30
|
+
import { SSEConnection, EventSourceType, type EventSourceConstructor } from './Connection.ts';
|
|
31
31
|
import { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';
|
|
32
32
|
import type { SyncTableCallback, CallbackEvent as SyncTableCallbackEvent, InitialSyncBatch as SyncTableInitialSyncBatch, InitialSyncComplete as SyncTableInitialSyncComplete, SyncTransaction as SyncTableSyncTransaction, LoadFromStorage as SyncTableLoadFromStorage, SetupError as SyncTableSetupError } from './SyncTable.ts';
|
|
33
|
+
import { InstantStream, InstantWritableStream, ReadableStreamCtor, WritableStreamCtor } from './Stream.ts';
|
|
33
34
|
type ExactlyOne<T> = {
|
|
34
35
|
[K in keyof T]: Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>>;
|
|
35
36
|
}[keyof T];
|
|
@@ -55,6 +56,8 @@ export type InstantConfig<S extends InstantSchemaDef<any, any, any>, UseDates ex
|
|
|
55
56
|
useDateObjects: UseDates;
|
|
56
57
|
disableValidation?: boolean;
|
|
57
58
|
Store?: StoreInterfaceClass;
|
|
59
|
+
WritableStream?: WritableStreamCtor;
|
|
60
|
+
ReadableStream?: ReadableStreamCtor;
|
|
58
61
|
};
|
|
59
62
|
export type ConfigWithSchema<S extends InstantGraph<any, any>> = Config & {
|
|
60
63
|
schema: S;
|
|
@@ -289,11 +292,47 @@ declare class Storage {
|
|
|
289
292
|
*/
|
|
290
293
|
getDownloadUrl: (pathname: string) => Promise<any>;
|
|
291
294
|
}
|
|
295
|
+
type CreateReadStreamOpts = {
|
|
296
|
+
clientId?: string | null | undefined;
|
|
297
|
+
streamId?: string | null | undefined;
|
|
298
|
+
byteOffset?: number | null | undefined;
|
|
299
|
+
};
|
|
300
|
+
type CreateWriteStreamOpts = {
|
|
301
|
+
clientId: string;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Functions to manage streams.
|
|
305
|
+
*/
|
|
306
|
+
declare class Streams {
|
|
307
|
+
private db;
|
|
308
|
+
constructor(db: Reactor);
|
|
309
|
+
/**
|
|
310
|
+
* Creates a new ReadableStream for the given clientId.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* const stream = db.streams.createReadStream({clientId: clientId})
|
|
314
|
+
* for await (const chunk of stream) {
|
|
315
|
+
* console.log(chunk);
|
|
316
|
+
* }
|
|
317
|
+
*/
|
|
318
|
+
createReadStream: (opts: CreateReadStreamOpts) => ReadableStream<string>;
|
|
319
|
+
/**
|
|
320
|
+
* Creates a new WritableStream for the given clientId.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* const writeStream = db.streams.createWriteStream({clientId: clientId})
|
|
324
|
+
* const writer = writeStream.getWriter();
|
|
325
|
+
* writer.write('Hello world');
|
|
326
|
+
* writer.close();
|
|
327
|
+
*/
|
|
328
|
+
createWriteStream: (opts: CreateWriteStreamOpts) => InstantWritableStream<string>;
|
|
329
|
+
}
|
|
292
330
|
declare function coerceQuery(o: any): any;
|
|
293
331
|
declare class InstantCoreDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean = false> implements IInstantDatabase<Schema> {
|
|
294
332
|
_reactor: Reactor<RoomsOf<Schema>>;
|
|
295
333
|
auth: Auth;
|
|
296
334
|
storage: Storage;
|
|
335
|
+
streams: Streams;
|
|
297
336
|
tx: TxChunk<Schema>;
|
|
298
337
|
constructor(reactor: Reactor<RoomsOf<Schema>>);
|
|
299
338
|
/**
|
|
@@ -488,7 +527,7 @@ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUn
|
|
|
488
527
|
* const db = init({ ... });
|
|
489
528
|
*/
|
|
490
529
|
declare const init_experimental: typeof init;
|
|
491
|
-
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, parseSchemaFromJSON, TransactionValidationError, FrameworkClient, Reactor, InstantAPIError, setInstantWarningsEnabled, 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 FrameworkConfig, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, StoreInterface, type StoreInterfaceClass, type StoreInterfaceStoreName, createInstantRouteHandler, };
|
|
530
|
+
export { init, init_experimental, id, tx, txInit, lookup, validateQuery, QueryValidationError, validateTransactions, parseSchemaFromJSON, TransactionValidationError, FrameworkClient, Reactor, InstantAPIError, setInstantWarningsEnabled, i, getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, Streams, 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, SSEConnection, type EventSourceType, type FrameworkConfig, type EventSourceConstructor, InstantStream, type WritableStreamCtor, type ReadableStreamCtor, type CreateReadStreamOpts, type CreateWriteStreamOpts, type InstantWritableStream, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type InstantIssue, StoreInterface, type StoreInterfaceClass, type StoreInterfaceStoreName, createInstantRouteHandler, };
|
|
492
531
|
/** @deprecated Use StoreInterface instead */
|
|
493
532
|
export declare const StorageInterface: typeof StoreInterface;
|
|
494
533
|
/** @deprecated Use StoreInterfaceStoreName instead */
|
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,E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vB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAG3B,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAG1B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,KAAK,YAAY,EAGjB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,yBAAyB,GAC1B,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,uBAAiB,CAAC;AAE/C,sDAAsD;AACtD,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -17,7 +17,9 @@ import { parseSchemaFromJSON } from "./parseSchemaFromJSON.js";
|
|
|
17
17
|
import { FrameworkClient } from "./framework.js";
|
|
18
18
|
import { InstantAPIError } from './utils/fetch.js';
|
|
19
19
|
import { InstantError } from "./InstantError.js";
|
|
20
|
+
import { SSEConnection, } from "./Connection.js";
|
|
20
21
|
import { CallbackEventType as SyncTableCallbackEventType } from "./SyncTable.js";
|
|
22
|
+
import { InstantStream, } from "./Stream.js";
|
|
21
23
|
const defaultOpenDevtool = true;
|
|
22
24
|
// consts
|
|
23
25
|
const defaultConfig = {
|
|
@@ -249,6 +251,39 @@ class Storage {
|
|
|
249
251
|
return this.db.getDownloadUrl(pathname);
|
|
250
252
|
};
|
|
251
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Functions to manage streams.
|
|
256
|
+
*/
|
|
257
|
+
class Streams {
|
|
258
|
+
db;
|
|
259
|
+
constructor(db) {
|
|
260
|
+
this.db = db;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Creates a new ReadableStream for the given clientId.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* const stream = db.streams.createReadStream({clientId: clientId})
|
|
267
|
+
* for await (const chunk of stream) {
|
|
268
|
+
* console.log(chunk);
|
|
269
|
+
* }
|
|
270
|
+
*/
|
|
271
|
+
createReadStream = (opts) => {
|
|
272
|
+
return this.db.createReadStream(opts);
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Creates a new WritableStream for the given clientId.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* const writeStream = db.streams.createWriteStream({clientId: clientId})
|
|
279
|
+
* const writer = writeStream.getWriter();
|
|
280
|
+
* writer.write('Hello world');
|
|
281
|
+
* writer.close();
|
|
282
|
+
*/
|
|
283
|
+
createWriteStream = (opts) => {
|
|
284
|
+
return this.db.createWriteStream(opts);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
252
287
|
// util
|
|
253
288
|
function coerceQuery(o) {
|
|
254
289
|
// stringify and parse to remove undefined values
|
|
@@ -258,11 +293,13 @@ class InstantCoreDatabase {
|
|
|
258
293
|
_reactor;
|
|
259
294
|
auth;
|
|
260
295
|
storage;
|
|
296
|
+
streams;
|
|
261
297
|
tx = txInit();
|
|
262
298
|
constructor(reactor) {
|
|
263
299
|
this._reactor = reactor;
|
|
264
300
|
this.auth = new Auth(this._reactor);
|
|
265
301
|
this.storage = new Storage(this._reactor);
|
|
302
|
+
this.streams = new Streams(this._reactor);
|
|
266
303
|
}
|
|
267
304
|
/**
|
|
268
305
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -543,9 +580,13 @@ setInstantWarningsEnabled,
|
|
|
543
580
|
// cli
|
|
544
581
|
i,
|
|
545
582
|
// util
|
|
546
|
-
getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, version, InstantError,
|
|
583
|
+
getOps, coerceQuery, weakHash, coerceToDate, IndexedDBStorage, WindowNetworkListener, InstantCoreDatabase, Auth, Storage, Streams, version, InstantError,
|
|
547
584
|
// sync table enums
|
|
548
585
|
SyncTableCallbackEventType,
|
|
586
|
+
// SSE
|
|
587
|
+
SSEConnection,
|
|
588
|
+
// streams
|
|
589
|
+
InstantStream,
|
|
549
590
|
// store (e.g. indexeddb) interface
|
|
550
591
|
StoreInterface, createInstantRouteHandler, };
|
|
551
592
|
/** @deprecated Use StoreInterface instead */
|
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,eAAe,CAAC;AAC/B,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;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EACL,cAAc,GAGf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAgF/D,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AAWv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B;AACtB,IAAI,EACJ,iBAAiB,EACjB,EAAE,EACF,EAAE,EACF,MAAM,EACN,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,OAAO;AAEP,QAAQ;AACR,eAAe;AAEf,WAAW;AACX,yBAAyB;AAEzB,MAAM;AACN,CAAC;AAED,OAAO;AACP,MAAM,EACN,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,IAAI,EACJ,OAAO,EACP,OAAO,EACP,YAAY;AAEZ,mBAAmB;AACnB,0BAA0B;AA4G1B,mCAAmC;AACnC,cAAc,EAGd,yBAAyB,GAC1B,CAAC;AAEF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,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/id.ts';\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';\nimport { setInstantWarningsEnabled } from './warningToggle.ts';\n\nimport {\n StoreInterface,\n type StoreInterfaceClass,\n type StoreInterfaceStoreName,\n} from './utils/PersistedObject.ts';\nimport { createInstantRouteHandler } from './createRouteHandler.ts';\nimport { parseSchemaFromJSON } from './parseSchemaFromJSON.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';\nimport { FrameworkClient, type FrameworkConfig } from './framework.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 firstPartyPath?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: UseDates;\n disableValidation?: boolean;\n Store?: StoreInterfaceClass;\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> | null;\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<Schema, Q, UseDates extends boolean = false> =\n | (InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n })\n | {\n isLoading: true;\n data: undefined;\n pageInfo: undefined;\n error: undefined;\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 string & 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(\n roomType,\n roomId,\n opts?.initialPresence,\n );\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomType, 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 const fromStore = schemaHashStore.get(schema);\n if (fromStore) {\n return fromStore;\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 // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n Store?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const configStrict = {\n ...config,\n appId: config.appId?.trim(),\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n const existingClient = globalInstantCoreStore[\n reactorKey(configStrict)\n ] as InstantCoreDatabase<any, UseDates>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, configStrict.schema)) {\n existingClient._reactor.updateSchema(configStrict.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...configStrict,\n cardinalityInference: configStrict.schema ? true : false,\n },\n Store || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, UseDates>(reactor);\n globalInstantCoreStore[reactorKey(configStrict)] = client;\n\n handleDevtool(configStrict.appId, configStrict.devtool);\n\n return client;\n}\n\nfunction handleDevtool(\n appId: string,\n devtool: boolean | DevtoolConfig | null | undefined,\n) {\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 parseSchemaFromJSON,\n TransactionValidationError,\n FrameworkClient,\n Reactor,\n\n // error\n InstantAPIError,\n\n // warnings\n setInstantWarningsEnabled,\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 type FrameworkConfig,\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 // store (e.g. indexeddb) interface\n StoreInterface,\n type StoreInterfaceClass,\n type StoreInterfaceStoreName,\n createInstantRouteHandler,\n};\n\n/** @deprecated Use StoreInterface instead */\nexport const StorageInterface = StoreInterface;\n\n/** @deprecated Use StoreInterfaceStoreName instead */\nexport type StorageInterfaceStoreName = StoreInterfaceStoreName;\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,eAAe,CAAC;AAC/B,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAA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,EACF,EAAE,EACF,MAAM,EACN,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,OAAO;AAEP,QAAQ;AACR,eAAe;AAEf,WAAW;AACX,yBAAyB;AAEzB,MAAM;AACN,CAAC;AAED,OAAO;AACP,MAAM,EACN,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,YAAY;AAEZ,mBAAmB;AACnB,0BAA0B;AA4F1B,MAAM;AACN,aAAa;AAKb,UAAU;AACV,aAAa;AAmBb,mCAAmC;AACnC,cAAc,EAGd,yBAAyB,GAC1B,CAAC;AAEF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,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/id.ts';\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';\nimport { setInstantWarningsEnabled } from './warningToggle.ts';\n\nimport {\n StoreInterface,\n type StoreInterfaceClass,\n type StoreInterfaceStoreName,\n} from './utils/PersistedObject.ts';\nimport { createInstantRouteHandler } from './createRouteHandler.ts';\nimport { parseSchemaFromJSON } from './parseSchemaFromJSON.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';\nimport { FrameworkClient, type FrameworkConfig } from './framework.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 {\n SSEConnection,\n EventSourceType,\n type EventSourceConstructor,\n} 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';\nimport {\n InstantStream,\n InstantWritableStream,\n ReadableStreamCtor,\n WritableStreamCtor,\n} from './Stream.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 firstPartyPath?: string;\n apiURI?: string;\n devtool?: boolean | DevtoolConfig;\n verbose?: boolean;\n queryCacheLimit?: number;\n useDateObjects: UseDates;\n disableValidation?: boolean;\n Store?: StoreInterfaceClass;\n WritableStream?: WritableStreamCtor;\n ReadableStream?: ReadableStreamCtor;\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> | null;\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<Schema, Q, UseDates extends boolean = false> =\n | (InstaQLSubscriptionState<Schema, Q, UseDates> & {\n isLoading: boolean;\n })\n | {\n isLoading: true;\n data: undefined;\n pageInfo: undefined;\n error: undefined;\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\ntype CreateReadStreamOpts = {\n clientId?: string | null | undefined;\n streamId?: string | null | undefined;\n byteOffset?: number | null | undefined;\n};\n\ntype CreateWriteStreamOpts = {\n clientId: string;\n};\n\n/**\n * Functions to manage streams.\n */\nclass Streams {\n constructor(private db: Reactor) {}\n\n /**\n * Creates a new ReadableStream for the given clientId.\n *\n * @example\n * const stream = db.streams.createReadStream({clientId: clientId})\n * for await (const chunk of stream) {\n * console.log(chunk);\n * }\n */\n createReadStream = (opts: CreateReadStreamOpts): ReadableStream<string> => {\n return this.db.createReadStream(opts);\n };\n\n /**\n * Creates a new WritableStream for the given clientId.\n *\n * @example\n * const writeStream = db.streams.createWriteStream({clientId: clientId})\n * const writer = writeStream.getWriter();\n * writer.write('Hello world');\n * writer.close();\n */\n createWriteStream = (\n opts: CreateWriteStreamOpts,\n ): InstantWritableStream<string> => {\n return this.db.createWriteStream(opts);\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 public streams: Streams;\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 this.streams = new Streams(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 string & 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(\n roomType,\n roomId,\n opts?.initialPresence,\n );\n\n return {\n leaveRoom,\n subscribeTopic: (topic, onEvent) =>\n this._reactor.subscribeTopic(roomType, 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 const fromStore = schemaHashStore.get(schema);\n if (fromStore) {\n return fromStore;\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 // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n Store?: any,\n NetworkListener?: any,\n versions?: { [key: string]: string },\n EventSourceImpl?: any,\n): InstantCoreDatabase<Schema, UseDates> {\n const configStrict = {\n ...config,\n appId: config.appId?.trim(),\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n const existingClient = globalInstantCoreStore[\n reactorKey(configStrict)\n ] as InstantCoreDatabase<any, UseDates>;\n\n if (existingClient) {\n if (schemaChanged(existingClient, configStrict.schema)) {\n existingClient._reactor.updateSchema(configStrict.schema);\n }\n return existingClient;\n }\n\n const reactor = new Reactor<RoomsOf<Schema>>(\n {\n ...defaultConfig,\n ...configStrict,\n cardinalityInference: configStrict.schema ? true : false,\n },\n Store || IndexedDBStorage,\n NetworkListener || WindowNetworkListener,\n { ...(versions || {}), '@instantdb/core': version },\n EventSourceImpl,\n );\n\n const client = new InstantCoreDatabase<any, UseDates>(reactor);\n globalInstantCoreStore[reactorKey(configStrict)] = client;\n\n handleDevtool(configStrict.appId, configStrict.devtool);\n\n return client;\n}\n\nfunction handleDevtool(\n appId: string,\n devtool: boolean | DevtoolConfig | null | undefined,\n) {\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 parseSchemaFromJSON,\n TransactionValidationError,\n FrameworkClient,\n Reactor,\n\n // error\n InstantAPIError,\n\n // warnings\n setInstantWarningsEnabled,\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 Streams,\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 SSEConnection,\n type EventSourceType,\n type FrameworkConfig,\n type EventSourceConstructor,\n\n // streams\n InstantStream,\n type WritableStreamCtor,\n type ReadableStreamCtor,\n type CreateReadStreamOpts,\n type CreateWriteStreamOpts,\n type InstantWritableStream,\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 // store (e.g. indexeddb) interface\n StoreInterface,\n type StoreInterfaceClass,\n type StoreInterfaceStoreName,\n createInstantRouteHandler,\n};\n\n/** @deprecated Use StoreInterface instead */\nexport const StorageInterface = StoreInterface;\n\n/** @deprecated Use StoreInterfaceStoreName instead */\nexport type StorageInterfaceStoreName = StoreInterfaceStoreName;\n"]}
|