@powerhousedao/reactor-browser 6.2.0-dev.5 → 6.2.0-dev.50

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.
Files changed (48) hide show
  1. package/dist/{client-CYhc2W1V.d.ts → client-09xv0Dq6.d.ts} +1 -1
  2. package/dist/{client-CYhc2W1V.d.ts.map → client-09xv0Dq6.d.ts.map} +1 -1
  3. package/dist/{client-CvgFU1Dv.js → client-_Gh2Uf0E.js} +1 -1
  4. package/dist/{client-CvgFU1Dv.js.map → client-_Gh2Uf0E.js.map} +1 -1
  5. package/dist/client-u13cr-Vg.js +51 -0
  6. package/dist/client-u13cr-Vg.js.map +1 -0
  7. package/dist/{document-by-id-BrIy0iHX.js → document-by-id-dLYFX-xz.js} +3 -3
  8. package/dist/{document-by-id-BrIy0iHX.js.map → document-by-id-dLYFX-xz.js.map} +1 -1
  9. package/dist/{index-Bz4MqX_j.d.ts → index-D3bV5rcl.d.ts} +1 -2
  10. package/dist/index-D3bV5rcl.d.ts.map +1 -0
  11. package/dist/{index-ZltD7u5Z.d.ts → index-DS4W07Y8.d.ts} +2 -45
  12. package/dist/index-DS4W07Y8.d.ts.map +1 -0
  13. package/dist/index.d.ts +43 -21
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +137 -131
  16. package/dist/index.js.map +1 -1
  17. package/dist/inspector-proxy-CvQDDxmT.d.ts +255 -0
  18. package/dist/inspector-proxy-CvQDDxmT.d.ts.map +1 -0
  19. package/dist/{make-ph-event-functions-DwiD1zH9.js → make-ph-event-functions-BHoLPif5.js} +2 -2
  20. package/dist/{make-ph-event-functions-DwiD1zH9.js.map → make-ph-event-functions-BHoLPif5.js.map} +1 -1
  21. package/dist/{relational-4_LVwp8p.js → relational-Dj06-YkI.js} +14 -2
  22. package/dist/relational-Dj06-YkI.js.map +1 -0
  23. package/dist/{renown-Dzmo1gJD.js → renown-D-1c_Bvx.js} +35 -48
  24. package/dist/renown-D-1c_Bvx.js.map +1 -0
  25. package/dist/src/analytics/index.d.ts +2 -2
  26. package/dist/src/analytics/index.js +2 -2
  27. package/dist/src/document-model.d.ts +8 -0
  28. package/dist/src/document-model.d.ts.map +1 -0
  29. package/dist/src/document-model.js +14 -0
  30. package/dist/src/document-model.js.map +1 -0
  31. package/dist/src/graphql/client.d.ts +1 -1
  32. package/dist/src/graphql/client.js +1 -1
  33. package/dist/src/relational/index.d.ts +46 -2
  34. package/dist/src/relational/index.d.ts.map +1 -0
  35. package/dist/src/relational/index.js +1 -1
  36. package/dist/src/renown/index.d.ts +1 -1
  37. package/dist/src/renown/index.js +1 -1
  38. package/dist/src/rpc/index.d.ts +240 -0
  39. package/dist/src/rpc/index.d.ts.map +1 -0
  40. package/dist/src/rpc/index.js +1250 -0
  41. package/dist/src/rpc/index.js.map +1 -0
  42. package/dist/{types-BmR60pPN.d.ts → types-CPV0Cnsy.d.ts} +1 -1
  43. package/dist/{types-BmR60pPN.d.ts.map → types-CPV0Cnsy.d.ts.map} +1 -1
  44. package/package.json +37 -11
  45. package/dist/index-Bz4MqX_j.d.ts.map +0 -1
  46. package/dist/index-ZltD7u5Z.d.ts.map +0 -1
  47. package/dist/relational-4_LVwp8p.js.map +0 -1
  48. package/dist/renown-Dzmo1gJD.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"document-by-id-BrIy0iHX.js","names":[],"sources":["../src/actions/queue.ts","../src/actions/sign.ts","../src/actions/dispatch.ts","../src/global/core.ts","../src/analytics/store.ts","../src/document-cache.ts","../src/hooks/document-cache.ts","../src/hooks/dispatch.ts","../src/hooks/document-by-id.ts"],"sourcesContent":["import type { FileUploadProgressCallback } from \"@powerhousedao/reactor-browser\";\nimport type {\n Action,\n DocumentOperations,\n Operation,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\n\nexport async function queueActions(\n document: PHDocument | undefined,\n actionOrActions: Action[] | Action | undefined,\n) {\n if (!document) {\n throw new Error(\"No document provided\");\n }\n if (!actionOrActions) {\n throw new Error(\"No actions provided\");\n }\n const actions = Array.isArray(actionOrActions)\n ? actionOrActions\n : [actionOrActions];\n\n if (actions.length === 0) {\n throw new Error(\"No actions provided\");\n }\n\n const reactorClient = window.ph?.reactorClient;\n if (!reactorClient) {\n throw new Error(\"ReactorClient not initialized\");\n }\n\n return await reactorClient.execute(document.header.id, \"main\", actions);\n}\n\nexport async function queueOperations(\n documentId: string,\n operationOrOperations: Operation[] | Operation | undefined,\n) {\n if (!documentId) {\n throw new Error(\"No documentId provided\");\n }\n if (!operationOrOperations) {\n throw new Error(\"No operations provided\");\n }\n const operations = Array.isArray(operationOrOperations)\n ? operationOrOperations\n : [operationOrOperations];\n\n if (operations.length === 0) {\n throw new Error(\"No operations provided\");\n }\n\n const reactorClient = window.ph?.reactorClient;\n if (!reactorClient) {\n throw new Error(\"ReactorClient not initialized\");\n }\n\n const actions = operations.map((op) => op.action);\n return await reactorClient.execute(documentId, \"main\", actions);\n}\n\nexport function deduplicateOperations(\n existingOperations: Record<string, Operation[]>,\n operationsToDeduplicate: Operation[],\n) {\n // make a set of all the operation indices for each scope to avoid duplicates\n const operationIndicesByScope = {} as Record<string, Set<number>>;\n for (const scope of Object.keys(existingOperations)) {\n operationIndicesByScope[scope] = new Set(\n existingOperations[scope].map((op) => op.index),\n );\n }\n\n const newOperations: Operation[] = [];\n\n for (const operation of operationsToDeduplicate) {\n const scope = operation.action.scope;\n const index = operation.index;\n if (operationIndicesByScope[scope].has(index)) {\n const duplicatedExistingOperation = existingOperations[scope].find(\n (op) => op.index === index,\n );\n const duplicatedNewOperation = newOperations.find(\n (op) => op.index === index,\n );\n console.warn(\"skipping duplicate operation\");\n if (duplicatedExistingOperation) {\n console.warn(\n \"duplicate existing operation\",\n duplicatedExistingOperation,\n );\n }\n if (duplicatedNewOperation) {\n console.warn(\"duplicate new operation\", duplicatedNewOperation);\n }\n continue;\n }\n newOperations.push(operation);\n operationIndicesByScope[scope].add(index);\n }\n\n const uniqueOperationIds = new Set<string>();\n const operationsDedupedById: Operation[] = [];\n\n for (const [scope, operations] of Object.entries(existingOperations)) {\n for (const operation of operations) {\n const id = operation.id;\n if (!id) {\n console.warn(\"skipping operation with no id\", operation);\n continue;\n }\n if (uniqueOperationIds.has(id)) {\n console.warn(\n \"skipping existing operation with duplicate id in scope\",\n scope,\n operation,\n );\n continue;\n }\n uniqueOperationIds.add(id);\n }\n }\n\n for (const operation of newOperations) {\n const id = operation.id;\n if (!id) {\n console.warn(\"skipping operation with no id\", operation);\n continue;\n }\n if (uniqueOperationIds.has(id)) {\n console.warn(\n \"skipping new operation with duplicate id in scope\",\n operation.action.scope,\n operation,\n );\n continue;\n }\n uniqueOperationIds.add(id);\n operationsDedupedById.push(operation);\n }\n return operationsDedupedById;\n}\n\nexport async function uploadOperations(\n documentId: string,\n allOperations: DocumentOperations,\n pushOperations: (\n documentId: string,\n operations: Operation[],\n ) => Promise<PHDocument | undefined>,\n options?: {\n operationsLimit?: number;\n onProgress?: FileUploadProgressCallback;\n },\n) {\n const operationsLimit = options?.operationsLimit || 50;\n const onProgress = options?.onProgress;\n\n logger.verbose(\n `uploadDocumentOperations(documentId:${documentId}, ops: ${Object.keys(allOperations).join(\",\")}, limit:${operationsLimit})`,\n );\n\n // Calculate total operations for progress tracking\n const allOperationsArray = Object.values(allOperations).filter(\n (ops): ops is Operation[] => ops !== undefined,\n );\n const totalOperations = allOperationsArray.reduce(\n (total, operations) => total + operations.length,\n 0,\n );\n let uploadedOperations = 0;\n\n for (const operations of allOperationsArray) {\n for (let i = 0; i < operations.length; i += operationsLimit) {\n logger.verbose(\n `uploadDocumentOperations:for(i:${i}, ops:${operations.length}, limit:${operationsLimit}): START`,\n );\n const chunk = operations.slice(i, i + operationsLimit);\n const operation = chunk.at(-1);\n if (!operation) {\n break;\n }\n const scope = operation.action.scope;\n\n await pushOperations(documentId, chunk);\n\n uploadedOperations += chunk.length;\n\n // Report progress\n if (onProgress) {\n const progress = Math.round(\n (uploadedOperations / totalOperations) * 100,\n );\n onProgress({\n stage: \"uploading\",\n progress,\n totalOperations,\n uploadedOperations,\n });\n }\n\n logger.verbose(\n `uploadDocumentOperations:for:waitForUpdate(${documentId}:${scope} rev ${operation.index}): NEXT`,\n );\n }\n }\n\n logger.verbose(\n `uploadDocumentOperations:for:waitForUpdate(${documentId}): END`,\n );\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport {\n buildSignedAction,\n type ActionSigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\n\nexport async function signAction(action: Action, document: PHDocument) {\n const reactor = window.ph?.reactorClient;\n if (!reactor) return action;\n\n const documentModelModule = await reactor.getDocumentModelModule(\n document.header.documentType,\n );\n const reducer = documentModelModule.reducer;\n const renown = window.ph?.renown;\n if (!renown?.user) return action;\n if (!action.context?.signer) return action;\n\n const actionSigner = action.context.signer;\n const unsafeSignedAction = await buildSignedAction(\n action,\n reducer,\n document,\n actionSigner,\n renown.crypto.sign,\n );\n\n // TODO: this is super dangerous and is caused by the `buildSignedAction` function returning an `Operation` instead of an `Action`\n return unsafeSignedAction as unknown as Action;\n}\n\nexport function addActionContext(action: Action) {\n const renown = window.ph?.renown;\n if (!renown?.user) return action;\n\n const signer: ActionSigner = {\n app: {\n name: \"Connect\",\n key: renown.did,\n },\n user: {\n address: renown.user.address,\n networkId: renown.user.networkId,\n chainId: renown.user.chainId,\n },\n signatures: [],\n };\n\n return {\n context: { signer },\n ...action,\n };\n}\n\nasync function makeSignedActionWithContext(\n action: Action | undefined,\n document: PHDocument | undefined,\n) {\n if (!action) {\n logger.error(\"No action found\");\n return;\n }\n if (!document) {\n logger.error(\"No document found\");\n return;\n }\n const signedAction = await signAction(action, document);\n const signedActionWithContext = addActionContext(signedAction);\n return signedActionWithContext;\n}\n\nexport async function makeSignedActionsWithContext(\n actionOrActions: Action[] | Action | undefined,\n document: PHDocument | undefined,\n) {\n if (!actionOrActions) {\n logger.error(\"No actions found\");\n return;\n }\n const actions = Array.isArray(actionOrActions)\n ? actionOrActions\n : [actionOrActions];\n\n const signedActionsWithContext = await Promise.all(\n actions.map((action) => makeSignedActionWithContext(action, document)),\n );\n return signedActionsWithContext.filter((a) => a !== undefined);\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport { queueActions } from \"./queue.js\";\nimport { makeSignedActionsWithContext } from \"./sign.js\";\n\nasync function getDocument(\n documentId: string,\n): Promise<PHDocument | undefined> {\n try {\n return await window.ph?.reactorClient?.get(documentId);\n } catch (error) {\n logger.debug(`Failed to get document with id ${documentId}:`, error);\n return undefined;\n }\n}\n\nfunction getActionErrors(result: PHDocument, actions: Action[]) {\n return actions.reduce((errors, a) => {\n const scopeOperations = result.operations[a.scope];\n if (!scopeOperations) {\n return errors;\n }\n const op = scopeOperations.findLast((op) => op.action.id === a.id);\n\n if (op?.error) {\n errors.push(new Error(op.error));\n }\n return errors;\n }, new Array<Error>());\n}\n\n/**\n * Dispatches actions to a document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param document - The document to dispatch actions to.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n * @returns The updated document, or undefined if the dispatch failed.\n */\nexport async function dispatchActions<TDocument = PHDocument, TAction = Action>(\n actionOrActions: TAction[] | TAction | undefined,\n document: TDocument | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined>;\n/**\n * Dispatches actions to a document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param documentId - The ID of the document to dispatch actions to.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n * @returns The updated document, or undefined if the dispatch failed.\n */\nexport async function dispatchActions(\n actionOrActions: Action[] | Action | undefined,\n documentId: string,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined>;\nexport async function dispatchActions(\n actionOrActions: Action[] | Action | undefined,\n documentOrDocumentId: PHDocument | string | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined> {\n const document =\n typeof documentOrDocumentId === \"string\"\n ? await getDocument(documentOrDocumentId)\n : documentOrDocumentId;\n\n if (!document) {\n logger.error(\n `Document with id ${JSON.stringify(documentOrDocumentId)} not found`,\n );\n return;\n }\n\n const signedActionsWithContext = await makeSignedActionsWithContext(\n actionOrActions,\n document,\n );\n if (!signedActionsWithContext) {\n logger.error(\"No signed actions with context found\");\n return;\n }\n const result = await queueActions(document, signedActionsWithContext);\n\n if (onErrors && result) {\n const errors = getActionErrors(result, signedActionsWithContext);\n if (errors.length) {\n onErrors(errors);\n }\n }\n\n if (onSuccess && result) {\n onSuccess(result);\n }\n\n return result;\n}\n","import type { PowerhouseGlobal } from \"./types.js\";\n\nexport function getGlobal<K extends keyof PowerhouseGlobal>(\n namespace: K,\n): PowerhouseGlobal[K] | undefined {\n if (typeof window === \"undefined\") return undefined;\n return window.powerhouse?.[namespace];\n}\n\nexport function setGlobal<K extends keyof PowerhouseGlobal>(\n namespace: K,\n value: PowerhouseGlobal[K],\n): void {\n if (typeof window === \"undefined\") return;\n window.powerhouse = window.powerhouse || {};\n window.powerhouse[namespace] = value;\n}\n\nexport function clearGlobal(namespace: keyof PowerhouseGlobal): void {\n if (typeof window === \"undefined\") return;\n\n if (window.powerhouse?.[namespace]) {\n delete window.powerhouse[namespace];\n if (Object.keys(window.powerhouse).length === 0) {\n delete window.powerhouse;\n }\n }\n}\n","import type { BrowserAnalyticsStoreOptions } from \"@powerhousedao/analytics-engine-browser\";\nimport { BrowserAnalyticsStore } from \"@powerhousedao/analytics-engine-browser\";\nimport type { IAnalyticsStore } from \"@powerhousedao/analytics-engine-core\";\nimport { AnalyticsQueryEngine } from \"@powerhousedao/analytics-engine-core\";\nimport { getGlobal } from \"../global/core.js\";\n\nexport type CreateStoreOptions = BrowserAnalyticsStoreOptions;\n\nexport async function createAnalyticsStore(options: CreateStoreOptions) {\n const store = new BrowserAnalyticsStore(options);\n await store.init();\n\n const engine = new AnalyticsQueryEngine(store);\n return {\n store,\n engine,\n options,\n };\n}\n\nexport async function getAnalyticsStore(): Promise<IAnalyticsStore | null> {\n const globalAnalytics = await getGlobal(\"analytics\");\n\n return globalAnalytics?.store ?? null;\n}\n","import {\n DocumentChangeType,\n type DocumentChangeEvent,\n type IReactorClient,\n} from \"@powerhousedao/reactor\";\nimport type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport type {\n FulfilledPromise,\n IDocumentCache,\n PromiseState,\n PromiseWithState,\n RejectedPromise,\n} from \"./types/documents.js\";\n\nexport function addPromiseState<T>(promise: Promise<T>): PromiseWithState<T> {\n if (\"status\" in promise) {\n return promise as PromiseWithState<T>;\n }\n\n const promiseWithState = promise as PromiseWithState<T>;\n promiseWithState.status = \"pending\";\n promiseWithState.then(\n (value) => {\n promiseWithState.status = \"fulfilled\";\n (promiseWithState as FulfilledPromise<T>).value = value;\n },\n (reason) => {\n promiseWithState.status = \"rejected\";\n (promiseWithState as RejectedPromise<T>).reason = reason;\n // Re-throw to preserve unhandled rejection behavior\n // This allows React's error boundaries to catch the error\n throw reason;\n },\n );\n\n return promiseWithState;\n}\n\nexport function readPromiseState<T>(\n promise: Promise<T> | PromiseWithState<T>,\n): PromiseState<T> {\n return \"status\" in promise ? promise : { status: \"pending\" };\n}\n\n/**\n * Resolves an array of document promises using `Promise.allSettled`,\n * returning only the fulfilled values. A single missing/rejected\n * document does not poison the whole batch. Rejected entries are\n * logged at warn level so developers can see dangling references.\n */\nfunction fulfilledOnly(promises: Promise<PHDocument>[]): Promise<PHDocument[]> {\n return Promise.allSettled(promises).then((results) => {\n const documents: PHDocument[] = [];\n for (const result of results) {\n if (result.status === \"fulfilled\") {\n documents.push(result.value);\n } else {\n console.warn(\n \"[DocumentCache] Skipped unavailable document:\",\n result.reason,\n );\n }\n }\n return documents;\n });\n}\n\n/**\n * Document cache implementation that uses the new ReactorClient API.\n *\n * This cache subscribes to document change events via IReactorClient.subscribe()\n * and automatically updates the cache when documents are created, updated, or deleted.\n */\nexport class DocumentCache implements IDocumentCache {\n private documents = new Map<string, PromiseWithState<PHDocument>>();\n private batchPromises = new Map<\n string,\n { promises: Promise<PHDocument>[]; promise: Promise<PHDocument[]> }\n >();\n private listeners = new Map<string, (() => void)[]>();\n private unsubscribe: (() => void) | null = null;\n\n constructor(private client: IReactorClient) {\n this.unsubscribe = client.subscribe({}, (event: DocumentChangeEvent) => {\n this.handleDocumentChange(event);\n });\n }\n\n private handleDocumentChange(event: DocumentChangeEvent): void {\n if (event.type === DocumentChangeType.Deleted) {\n const documentId = event.context?.childId;\n if (documentId) {\n this.handleDocumentDeleted(documentId);\n }\n } else if (event.type === DocumentChangeType.Updated) {\n for (const doc of event.documents) {\n this.handleDocumentUpdated(doc.header.id).catch(console.warn);\n }\n }\n }\n\n private handleDocumentDeleted(documentId: string): void {\n const listeners = this.listeners.get(documentId);\n this.documents.delete(documentId);\n this.invalidateBatchesContaining(documentId);\n if (listeners) {\n listeners.forEach((listener) => listener());\n }\n this.listeners.delete(documentId);\n }\n\n private async handleDocumentUpdated(documentId: string): Promise<void> {\n if (this.documents.has(documentId)) {\n await this.get(documentId, true);\n const listeners = this.listeners.get(documentId);\n if (listeners) {\n listeners.forEach((listener) => listener());\n }\n }\n }\n\n private invalidateBatchesContaining(documentId: string): void {\n for (const key of this.batchPromises.keys()) {\n if (key.split(\",\").includes(documentId)) {\n this.batchPromises.delete(key);\n }\n }\n }\n\n get(id: string, refetch?: boolean): Promise<PHDocument> {\n const currentData = this.documents.get(id);\n if (currentData) {\n if (currentData.status === \"pending\") {\n return currentData;\n }\n if (!refetch) {\n return currentData;\n }\n }\n\n const documentPromise = this.client.get(id);\n this.documents.set(id, addPromiseState(documentPromise));\n return documentPromise;\n }\n\n getBatch(ids: string[]): Promise<PHDocument[]> {\n const key = ids.join(\",\");\n const cached = this.batchPromises.get(key);\n\n const hasDeletedDocuments = ids.some((id) => !this.documents.has(id));\n const currentPromises = ids.map((id) => this.get(id));\n\n if (hasDeletedDocuments) {\n const batchPromise = fulfilledOnly(currentPromises);\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n if (cached) {\n const samePromises = currentPromises.every(\n (p, i) => p === cached.promises[i],\n );\n if (samePromises) {\n return cached.promise;\n }\n }\n\n const states = currentPromises.map((p) =>\n readPromiseState(p as PromiseWithState<PHDocument>),\n );\n const allSettled = states.every((s) => s.status !== \"pending\");\n\n if (allSettled) {\n const values = states\n .filter(\n (s): s is { status: \"fulfilled\"; value: PHDocument } =>\n s.status === \"fulfilled\",\n )\n .map((s) => s.value);\n const batchPromise = Promise.resolve(values) as PromiseWithState<\n PHDocument[]\n >;\n batchPromise.status = \"fulfilled\";\n (batchPromise as FulfilledPromise<PHDocument[]>).value = values;\n\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n if (cached) {\n return cached.promise;\n }\n\n const batchPromise = fulfilledOnly(currentPromises);\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n subscribe(id: string | string[], callback: () => void): () => void {\n const ids = Array.isArray(id) ? id : [id];\n for (const docId of ids) {\n const listeners = this.listeners.get(docId) ?? [];\n this.listeners.set(docId, [...listeners, callback]);\n }\n return () => {\n for (const docId of ids) {\n const listeners = this.listeners.get(docId) ?? [];\n this.listeners.set(\n docId,\n listeners.filter((listener) => listener !== callback),\n );\n }\n };\n }\n\n /**\n * Disposes of the cache and unsubscribes from document change events.\n */\n dispose(): void {\n if (this.unsubscribe) {\n this.unsubscribe();\n this.unsubscribe = null;\n }\n }\n}\n","import type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { use, useCallback, useSyncExternalStore } from \"react\";\nimport { readPromiseState } from \"../document-cache.js\";\nimport type { IDocumentCache } from \"../types/documents.js\";\nimport type { SetPHGlobalValue, UsePHGlobalValue } from \"../types/global.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst documentEventFunctions = makePHEventFunctions(\"documentCache\");\n\n/** Returns all documents in the reactor. */\nexport const useDocumentCache: UsePHGlobalValue<IDocumentCache> =\n documentEventFunctions.useValue;\n\n/** Sets all of the documents in the reactor. */\nexport const setDocumentCache: SetPHGlobalValue<IDocumentCache> =\n documentEventFunctions.setValue;\n\n/** Adds an event handler for all of the documents in the reactor. */\nexport const addDocumentCacheEventHandler =\n documentEventFunctions.addEventHandler;\n\n/**\n * Reads the state of a document promise and converts it to a query state object.\n * @param promise - The document promise to read\n * @returns An object containing the status, data, error, and isPending flag\n */\nfunction getDocumentQueryState(promise: Promise<PHDocument>) {\n const state = readPromiseState(promise);\n switch (state.status) {\n case \"pending\":\n return {\n status: \"pending\",\n isPending: true,\n error: undefined,\n data: undefined,\n } as const;\n case \"fulfilled\":\n return {\n status: \"success\",\n isPending: false,\n error: undefined,\n data: state.value,\n } as const;\n case \"rejected\":\n return {\n status: \"error\",\n isPending: false,\n error: state.reason,\n data: undefined,\n } as const;\n }\n}\n\n/**\n * Retrieves a document from the reactor and subscribes to changes using React Suspense.\n * This hook will suspend rendering while the document is loading.\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns The document if found, or undefined if id is null/undefined\n */\nexport function useDocument(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n const document = useSyncExternalStore(\n (cb) => (id && documentCache ? documentCache.subscribe(id, cb) : () => {}),\n () => (id ? documentCache?.get(id) : undefined),\n );\n return document ? use(document) : undefined;\n}\n\n/**\n * Retrieves a document from the reactor and subscribes to changes without\n * suspending or throwing. Use this when the ID might be stale (e.g., a\n * previously selected node that has since been deleted) and the consumer\n * wants to render a placeholder instead of crashing.\n *\n * Unlike {@link useGetDocumentAsync}, this hook subscribes to cache\n * updates, so the returned state stays in sync with reactor changes.\n *\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns An object containing:\n * - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n * - data: The document if successfully loaded\n * - isPending: Whether the document is currently loading\n * - error: Any error that occurred during loading (e.g., document not found)\n * - reload: Function to force a refetch, or undefined when no id is supplied\n */\nexport function useDocumentSafe(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n const promise = useSyncExternalStore(\n (cb) => (id && documentCache ? documentCache.subscribe(id, cb) : () => {}),\n () => (id ? documentCache?.get(id) : undefined),\n );\n\n if (!promise || !documentCache || !id) {\n return {\n status: \"initial\",\n isPending: false,\n error: undefined,\n data: undefined,\n reload: undefined,\n } as const;\n }\n\n const state = getDocumentQueryState(promise);\n return { ...state, reload: () => documentCache.get(id, true) } as const;\n}\n\n/**\n * Retrieves multiple documents from the reactor using React Suspense.\n * This hook will suspend rendering while any of the documents are loading.\n *\n * Uses getBatch from the document cache which handles promise caching internally,\n * ensuring stable references for useSyncExternalStore.\n *\n * @param ids - Array of document IDs to retrieve, or null/undefined to skip retrieval\n * @returns An array of documents if found, or empty array if ids is null/undefined\n */\nexport function useDocuments(ids: string[] | null | undefined) {\n const documentCache = useDocumentCache();\n\n const documents = useSyncExternalStore(\n (cb) =>\n ids?.length && documentCache\n ? documentCache.subscribe(ids, cb)\n : () => {},\n () =>\n ids?.length && documentCache ? documentCache.getBatch(ids) : undefined,\n );\n\n return documents ? use(documents) : [];\n}\n\n/**\n * Returns a function to retrieve a document from the cache.\n * The returned function fetches and returns a document by ID.\n * @returns A function that takes a document ID and returns a Promise of the document\n */\nexport function useGetDocument() {\n const documentCache = useDocumentCache();\n\n return useCallback(\n (id: string) => {\n if (!documentCache) {\n return Promise.reject(new Error(\"Document cache not initialized\"));\n }\n return documentCache.get(id);\n },\n [documentCache],\n );\n}\n\n/**\n * Returns a function to retrieve multiple documents from the cache.\n * The returned function fetches and returns documents by their IDs.\n * @returns A function that takes an array of document IDs and returns a Promise of the documents\n */\nexport function useGetDocuments() {\n const documentCache = useDocumentCache();\n\n return useCallback(\n (ids: string[]) => {\n if (!documentCache) {\n return Promise.reject(new Error(\"Document cache not initialized\"));\n }\n return documentCache.getBatch(ids);\n },\n [documentCache],\n );\n}\n\n/**\n * Retrieves a document from the reactor without suspending rendering.\n * Returns the current state of the document loading operation.\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns An object containing:\n * - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n * - data: The document if successfully loaded\n * - isPending: Boolean indicating if the document is currently loading\n * - error: Any error that occurred during loading\n * - reload: Function to force reload the document from cache\n */\nexport function useGetDocumentAsync(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n if (!id || !documentCache) {\n return {\n status: \"initial\",\n data: undefined,\n isPending: false,\n error: undefined,\n reload: undefined,\n } as const;\n }\n\n const promise = documentCache.get(id);\n const state = getDocumentQueryState(promise);\n\n return { ...state, reload: () => documentCache.get(id, true) } as const;\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport { dispatchActions } from \"../actions/dispatch.js\";\n\n/**\n * Returns a dispatch function for dispatching actions to a document.\n * Used internally by other hooks to provide action dispatching capabilities.\n * @param document - The document to dispatch actions to.\n * @returns A tuple containing the document and a dispatch function.\n */\nexport type DispatchFn<TAction> = (\n actionOrActions: TAction[] | TAction | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n) => void;\n\nexport type UseDispatchResult<TDocument, TAction> = readonly [\n TDocument | undefined,\n DispatchFn<TAction>,\n];\n\nexport function useDispatch<TDocument = PHDocument, TAction = Action>(\n document: TDocument | undefined,\n): UseDispatchResult<TDocument, TAction> {\n /**\n * Dispatches actions to the document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n */\n function dispatch(\n actionOrActions: TAction[] | TAction | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n ) {\n dispatchActions(actionOrActions, document, onErrors, onSuccess).catch(\n logger.error,\n );\n }\n return [document, dispatch] as const;\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { useDispatch, type UseDispatchResult } from \"./dispatch.js\";\nimport { useDocument, useDocuments } from \"./document-cache.js\";\n\n/** Returns a document by id. */\nexport function useDocumentById(\n id: string | null | undefined,\n): UseDispatchResult<PHDocument, Action> {\n const document = useDocument(id);\n const [, dispatch] = useDispatch<PHDocument, Action>(document);\n return [document, dispatch] as const;\n}\n\n/** Returns documents by ids. */\nexport function useDocumentsByIds(ids: string[] | null | undefined) {\n return useDocuments(ids);\n}\n"],"mappings":";;;;;;;;AASA,eAAsB,aACpB,UACA,iBACA;AACA,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,uBAAuB;AAEzC,KAAI,CAAC,gBACH,OAAM,IAAI,MAAM,sBAAsB;CAExC,MAAM,UAAU,MAAM,QAAQ,gBAAgB,GAC1C,kBACA,CAAC,gBAAgB;AAErB,KAAI,QAAQ,WAAW,EACrB,OAAM,IAAI,MAAM,sBAAsB;CAGxC,MAAM,gBAAgB,OAAO,IAAI;AACjC,KAAI,CAAC,cACH,OAAM,IAAI,MAAM,gCAAgC;AAGlD,QAAO,MAAM,cAAc,QAAQ,SAAS,OAAO,IAAI,QAAQ,QAAQ;;AAGzE,eAAsB,gBACpB,YACA,uBACA;AACA,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,yBAAyB;AAE3C,KAAI,CAAC,sBACH,OAAM,IAAI,MAAM,yBAAyB;CAE3C,MAAM,aAAa,MAAM,QAAQ,sBAAsB,GACnD,wBACA,CAAC,sBAAsB;AAE3B,KAAI,WAAW,WAAW,EACxB,OAAM,IAAI,MAAM,yBAAyB;CAG3C,MAAM,gBAAgB,OAAO,IAAI;AACjC,KAAI,CAAC,cACH,OAAM,IAAI,MAAM,gCAAgC;CAGlD,MAAM,UAAU,WAAW,KAAK,OAAO,GAAG,OAAO;AACjD,QAAO,MAAM,cAAc,QAAQ,YAAY,QAAQ,QAAQ;;AAqFjE,eAAsB,iBACpB,YACA,e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M,gBAAgB,kBAAkB;AAExC,QAAO,aACJ,QAAkB;AACjB,MAAI,CAAC,cACH,QAAO,QAAQ,uBAAO,IAAI,MAAM,iCAAiC,CAAC;AAEpE,SAAO,cAAc,SAAS,IAAI;IAEpC,CAAC,cAAc,CAChB;;;;;;;;;;;;;AAcH,SAAgB,oBAAoB,IAA+B;CACjE,MAAM,gBAAgB,kBAAkB;AACxC,KAAI,CAAC,MAAM,CAAC,cACV,QAAO;EACL,QAAQ;EACR,MAAM,KAAA;EACN,WAAW;EACX,OAAO,KAAA;EACP,QAAQ,KAAA;EACT;AAMH,QAAO;EAAE,GAFK,sBADE,cAAc,IAAI,GAAG,CACO;EAEzB,cAAc,cAAc,IAAI,IAAI,KAAK;EAAE;;;;AC9KhE,SAAgB,YACd,UACuC;;;;;;CAMvC,SAAS,SACP,iBACA,UACA,WACA;AACA,kBAAgB,iBAAiB,UAAU,UAAU,UAAU,CAAC,MAC9D,OAAO,MACR;;AAEH,QAAO,CAAC,UAAU,SAAS;;;;;ACjC7B,SAAgB,gBACd,IACuC;CACvC,MAAM,WAAW,YAAY,GAAG;CAChC,MAAM,GAAG,YAAY,YAAgC,SAAS;AAC9D,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,kBAAkB,KAAkC;AAClE,QAAO,aAAa,IAAI"}
1
+ {"version":3,"file":"document-by-id-dLYFX-xz.js","names":[],"sources":["../src/actions/queue.ts","../src/actions/sign.ts","../src/actions/dispatch.ts","../src/global/core.ts","../src/analytics/store.ts","../src/document-cache.ts","../src/hooks/document-cache.ts","../src/hooks/dispatch.ts","../src/hooks/document-by-id.ts"],"sourcesContent":["import type { FileUploadProgressCallback } from \"@powerhousedao/reactor-browser\";\nimport type {\n Action,\n DocumentOperations,\n Operation,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\n\nexport async function queueActions(\n document: PHDocument | undefined,\n actionOrActions: Action[] | Action | undefined,\n) {\n if (!document) {\n throw new Error(\"No document provided\");\n }\n if (!actionOrActions) {\n throw new Error(\"No actions provided\");\n }\n const actions = Array.isArray(actionOrActions)\n ? actionOrActions\n : [actionOrActions];\n\n if (actions.length === 0) {\n throw new Error(\"No actions provided\");\n }\n\n const reactorClient = window.ph?.reactorClient;\n if (!reactorClient) {\n throw new Error(\"ReactorClient not initialized\");\n }\n\n return await reactorClient.execute(document.header.id, \"main\", actions);\n}\n\nexport async function queueOperations(\n documentId: string,\n operationOrOperations: Operation[] | Operation | undefined,\n) {\n if (!documentId) {\n throw new Error(\"No documentId provided\");\n }\n if (!operationOrOperations) {\n throw new Error(\"No operations provided\");\n }\n const operations = Array.isArray(operationOrOperations)\n ? operationOrOperations\n : [operationOrOperations];\n\n if (operations.length === 0) {\n throw new Error(\"No operations provided\");\n }\n\n const reactorClient = window.ph?.reactorClient;\n if (!reactorClient) {\n throw new Error(\"ReactorClient not initialized\");\n }\n\n const actions = operations.map((op) => op.action);\n return await reactorClient.execute(documentId, \"main\", actions);\n}\n\nexport function deduplicateOperations(\n existingOperations: Record<string, Operation[]>,\n operationsToDeduplicate: Operation[],\n) {\n // make a set of all the operation indices for each scope to avoid duplicates\n const operationIndicesByScope = {} as Record<string, Set<number>>;\n for (const scope of Object.keys(existingOperations)) {\n operationIndicesByScope[scope] = new Set(\n existingOperations[scope].map((op) => op.index),\n );\n }\n\n const newOperations: Operation[] = [];\n\n for (const operation of operationsToDeduplicate) {\n const scope = operation.action.scope;\n const index = operation.index;\n if (operationIndicesByScope[scope].has(index)) {\n const duplicatedExistingOperation = existingOperations[scope].find(\n (op) => op.index === index,\n );\n const duplicatedNewOperation = newOperations.find(\n (op) => op.index === index,\n );\n console.warn(\"skipping duplicate operation\");\n if (duplicatedExistingOperation) {\n console.warn(\n \"duplicate existing operation\",\n duplicatedExistingOperation,\n );\n }\n if (duplicatedNewOperation) {\n console.warn(\"duplicate new operation\", duplicatedNewOperation);\n }\n continue;\n }\n newOperations.push(operation);\n operationIndicesByScope[scope].add(index);\n }\n\n const uniqueOperationIds = new Set<string>();\n const operationsDedupedById: Operation[] = [];\n\n for (const [scope, operations] of Object.entries(existingOperations)) {\n for (const operation of operations) {\n const id = operation.id;\n if (!id) {\n console.warn(\"skipping operation with no id\", operation);\n continue;\n }\n if (uniqueOperationIds.has(id)) {\n console.warn(\n \"skipping existing operation with duplicate id in scope\",\n scope,\n operation,\n );\n continue;\n }\n uniqueOperationIds.add(id);\n }\n }\n\n for (const operation of newOperations) {\n const id = operation.id;\n if (!id) {\n console.warn(\"skipping operation with no id\", operation);\n continue;\n }\n if (uniqueOperationIds.has(id)) {\n console.warn(\n \"skipping new operation with duplicate id in scope\",\n operation.action.scope,\n operation,\n );\n continue;\n }\n uniqueOperationIds.add(id);\n operationsDedupedById.push(operation);\n }\n return operationsDedupedById;\n}\n\nexport async function uploadOperations(\n documentId: string,\n allOperations: DocumentOperations,\n pushOperations: (\n documentId: string,\n operations: Operation[],\n ) => Promise<PHDocument | undefined>,\n options?: {\n operationsLimit?: number;\n onProgress?: FileUploadProgressCallback;\n },\n) {\n const operationsLimit = options?.operationsLimit || 50;\n const onProgress = options?.onProgress;\n\n logger.verbose(\n `uploadDocumentOperations(documentId:${documentId}, ops: ${Object.keys(allOperations).join(\",\")}, limit:${operationsLimit})`,\n );\n\n // Calculate total operations for progress tracking\n const allOperationsArray = Object.values(allOperations).filter(\n (ops): ops is Operation[] => ops !== undefined,\n );\n const totalOperations = allOperationsArray.reduce(\n (total, operations) => total + operations.length,\n 0,\n );\n let uploadedOperations = 0;\n\n for (const operations of allOperationsArray) {\n for (let i = 0; i < operations.length; i += operationsLimit) {\n logger.verbose(\n `uploadDocumentOperations:for(i:${i}, ops:${operations.length}, limit:${operationsLimit}): START`,\n );\n const chunk = operations.slice(i, i + operationsLimit);\n const operation = chunk.at(-1);\n if (!operation) {\n break;\n }\n const scope = operation.action.scope;\n\n await pushOperations(documentId, chunk);\n\n uploadedOperations += chunk.length;\n\n // Report progress\n if (onProgress) {\n const progress = Math.round(\n (uploadedOperations / totalOperations) * 100,\n );\n onProgress({\n stage: \"uploading\",\n progress,\n totalOperations,\n uploadedOperations,\n });\n }\n\n logger.verbose(\n `uploadDocumentOperations:for:waitForUpdate(${documentId}:${scope} rev ${operation.index}): NEXT`,\n );\n }\n }\n\n logger.verbose(\n `uploadDocumentOperations:for:waitForUpdate(${documentId}): END`,\n );\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport {\n buildSignedAction,\n type ActionSigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\n\nexport async function signAction(action: Action, document: PHDocument) {\n const reactor = window.ph?.reactorClient;\n if (!reactor) return action;\n\n const documentModelModule = await reactor.getDocumentModelModule(\n document.header.documentType,\n );\n const reducer = documentModelModule.reducer;\n const renown = window.ph?.renown;\n if (!renown?.user) return action;\n if (!action.context?.signer) return action;\n\n const actionSigner = action.context.signer;\n const unsafeSignedAction = await buildSignedAction(\n action,\n reducer,\n document,\n actionSigner,\n renown.crypto.sign,\n );\n\n // TODO: this is super dangerous and is caused by the `buildSignedAction` function returning an `Operation` instead of an `Action`\n return unsafeSignedAction as unknown as Action;\n}\n\nexport function addActionContext(action: Action) {\n const renown = window.ph?.renown;\n if (!renown?.user) return action;\n\n const signer: ActionSigner = {\n app: {\n name: \"Connect\",\n key: renown.did,\n },\n user: {\n address: renown.user.address,\n networkId: renown.user.networkId,\n chainId: renown.user.chainId,\n },\n signatures: [],\n };\n\n return {\n context: { signer },\n ...action,\n };\n}\n\nasync function makeSignedActionWithContext(\n action: Action | undefined,\n document: PHDocument | undefined,\n) {\n if (!action) {\n logger.error(\"No action found\");\n return;\n }\n if (!document) {\n logger.error(\"No document found\");\n return;\n }\n const signedAction = await signAction(action, document);\n const signedActionWithContext = addActionContext(signedAction);\n return signedActionWithContext;\n}\n\nexport async function makeSignedActionsWithContext(\n actionOrActions: Action[] | Action | undefined,\n document: PHDocument | undefined,\n) {\n if (!actionOrActions) {\n logger.error(\"No actions found\");\n return;\n }\n const actions = Array.isArray(actionOrActions)\n ? actionOrActions\n : [actionOrActions];\n\n const signedActionsWithContext = await Promise.all(\n actions.map((action) => makeSignedActionWithContext(action, document)),\n );\n return signedActionsWithContext.filter((a) => a !== undefined);\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport { queueActions } from \"./queue.js\";\nimport { makeSignedActionsWithContext } from \"./sign.js\";\n\nasync function getDocument(\n documentId: string,\n): Promise<PHDocument | undefined> {\n try {\n return await window.ph?.reactorClient?.get(documentId);\n } catch (error) {\n logger.debug(`Failed to get document with id ${documentId}:`, error);\n return undefined;\n }\n}\n\nfunction getActionErrors(result: PHDocument, actions: Action[]) {\n return actions.reduce((errors, a) => {\n const scopeOperations = result.operations[a.scope];\n if (!scopeOperations) {\n return errors;\n }\n const op = scopeOperations.findLast((op) => op.action.id === a.id);\n\n if (op?.error) {\n errors.push(new Error(op.error));\n }\n return errors;\n }, new Array<Error>());\n}\n\n/**\n * Dispatches actions to a document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param document - The document to dispatch actions to.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n * @returns The updated document, or undefined if the dispatch failed.\n */\nexport async function dispatchActions<TDocument = PHDocument, TAction = Action>(\n actionOrActions: TAction[] | TAction | undefined,\n document: TDocument | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined>;\n/**\n * Dispatches actions to a document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param documentId - The ID of the document to dispatch actions to.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n * @returns The updated document, or undefined if the dispatch failed.\n */\nexport async function dispatchActions(\n actionOrActions: Action[] | Action | undefined,\n documentId: string,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined>;\nexport async function dispatchActions(\n actionOrActions: Action[] | Action | undefined,\n documentOrDocumentId: PHDocument | string | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n): Promise<PHDocument | undefined> {\n const document =\n typeof documentOrDocumentId === \"string\"\n ? await getDocument(documentOrDocumentId)\n : documentOrDocumentId;\n\n if (!document) {\n logger.error(\n `Document with id ${JSON.stringify(documentOrDocumentId)} not found`,\n );\n return;\n }\n\n const signedActionsWithContext = await makeSignedActionsWithContext(\n actionOrActions,\n document,\n );\n if (!signedActionsWithContext) {\n logger.error(\"No signed actions with context found\");\n return;\n }\n const result = await queueActions(document, signedActionsWithContext);\n\n if (onErrors && result) {\n const errors = getActionErrors(result, signedActionsWithContext);\n if (errors.length) {\n onErrors(errors);\n }\n }\n\n if (onSuccess && result) {\n onSuccess(result);\n }\n\n return result;\n}\n","import type { PowerhouseGlobal } from \"./types.js\";\n\nexport function getGlobal<K extends keyof PowerhouseGlobal>(\n namespace: K,\n): PowerhouseGlobal[K] | undefined {\n if (typeof window === \"undefined\") return undefined;\n return window.powerhouse?.[namespace];\n}\n\nexport function setGlobal<K extends keyof PowerhouseGlobal>(\n namespace: K,\n value: PowerhouseGlobal[K],\n): void {\n if (typeof window === \"undefined\") return;\n window.powerhouse = window.powerhouse || {};\n window.powerhouse[namespace] = value;\n}\n\nexport function clearGlobal(namespace: keyof PowerhouseGlobal): void {\n if (typeof window === \"undefined\") return;\n\n if (window.powerhouse?.[namespace]) {\n delete window.powerhouse[namespace];\n if (Object.keys(window.powerhouse).length === 0) {\n delete window.powerhouse;\n }\n }\n}\n","import type { BrowserAnalyticsStoreOptions } from \"@powerhousedao/analytics-engine-browser\";\nimport { BrowserAnalyticsStore } from \"@powerhousedao/analytics-engine-browser\";\nimport type { IAnalyticsStore } from \"@powerhousedao/analytics-engine-core\";\nimport { AnalyticsQueryEngine } from \"@powerhousedao/analytics-engine-core\";\nimport { getGlobal } from \"../global/core.js\";\n\nexport type CreateStoreOptions = BrowserAnalyticsStoreOptions;\n\nexport async function createAnalyticsStore(options: CreateStoreOptions) {\n const store = new BrowserAnalyticsStore(options);\n await store.init();\n\n const engine = new AnalyticsQueryEngine(store);\n return {\n store,\n engine,\n options,\n };\n}\n\nexport async function getAnalyticsStore(): Promise<IAnalyticsStore | null> {\n const globalAnalytics = await getGlobal(\"analytics\");\n\n return globalAnalytics?.store ?? null;\n}\n","import {\n DocumentChangeType,\n type DocumentChangeEvent,\n type IReactorClient,\n} from \"@powerhousedao/reactor\";\nimport type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport type {\n FulfilledPromise,\n IDocumentCache,\n PromiseState,\n PromiseWithState,\n RejectedPromise,\n} from \"./types/documents.js\";\n\nexport function addPromiseState<T>(promise: Promise<T>): PromiseWithState<T> {\n if (\"status\" in promise) {\n return promise as PromiseWithState<T>;\n }\n\n const promiseWithState = promise as PromiseWithState<T>;\n promiseWithState.status = \"pending\";\n promiseWithState.then(\n (value) => {\n promiseWithState.status = \"fulfilled\";\n (promiseWithState as FulfilledPromise<T>).value = value;\n },\n (reason) => {\n promiseWithState.status = \"rejected\";\n (promiseWithState as RejectedPromise<T>).reason = reason;\n // Re-throw to preserve unhandled rejection behavior\n // This allows React's error boundaries to catch the error\n throw reason;\n },\n );\n\n return promiseWithState;\n}\n\nexport function readPromiseState<T>(\n promise: Promise<T> | PromiseWithState<T>,\n): PromiseState<T> {\n return \"status\" in promise ? promise : { status: \"pending\" };\n}\n\n/**\n * Resolves an array of document promises using `Promise.allSettled`,\n * returning only the fulfilled values. A single missing/rejected\n * document does not poison the whole batch. Rejected entries are\n * logged at warn level so developers can see dangling references.\n */\nfunction fulfilledOnly(promises: Promise<PHDocument>[]): Promise<PHDocument[]> {\n return Promise.allSettled(promises).then((results) => {\n const documents: PHDocument[] = [];\n for (const result of results) {\n if (result.status === \"fulfilled\") {\n documents.push(result.value);\n } else {\n console.warn(\n \"[DocumentCache] Skipped unavailable document:\",\n result.reason,\n );\n }\n }\n return documents;\n });\n}\n\n/**\n * Document cache implementation that uses the new ReactorClient API.\n *\n * This cache subscribes to document change events via IReactorClient.subscribe()\n * and automatically updates the cache when documents are created, updated, or deleted.\n */\nexport class DocumentCache implements IDocumentCache {\n private documents = new Map<string, PromiseWithState<PHDocument>>();\n private batchPromises = new Map<\n string,\n { promises: Promise<PHDocument>[]; promise: Promise<PHDocument[]> }\n >();\n private listeners = new Map<string, (() => void)[]>();\n private unsubscribe: (() => void) | null = null;\n\n constructor(private client: IReactorClient) {\n this.unsubscribe = client.subscribe({}, (event: DocumentChangeEvent) => {\n this.handleDocumentChange(event);\n });\n }\n\n private handleDocumentChange(event: DocumentChangeEvent): void {\n if (event.type === DocumentChangeType.Deleted) {\n const documentId = event.context?.childId;\n if (documentId) {\n this.handleDocumentDeleted(documentId);\n }\n } else if (event.type === DocumentChangeType.Updated) {\n for (const doc of event.documents) {\n this.handleDocumentUpdated(doc.header.id).catch(console.warn);\n }\n }\n }\n\n private handleDocumentDeleted(documentId: string): void {\n const listeners = this.listeners.get(documentId);\n this.documents.delete(documentId);\n this.invalidateBatchesContaining(documentId);\n if (listeners) {\n listeners.forEach((listener) => listener());\n }\n this.listeners.delete(documentId);\n }\n\n private async handleDocumentUpdated(documentId: string): Promise<void> {\n if (this.documents.has(documentId)) {\n await this.get(documentId, true);\n const listeners = this.listeners.get(documentId);\n if (listeners) {\n listeners.forEach((listener) => listener());\n }\n }\n }\n\n private invalidateBatchesContaining(documentId: string): void {\n for (const key of this.batchPromises.keys()) {\n if (key.split(\",\").includes(documentId)) {\n this.batchPromises.delete(key);\n }\n }\n }\n\n get(id: string, refetch?: boolean): Promise<PHDocument> {\n const currentData = this.documents.get(id);\n if (currentData) {\n if (currentData.status === \"pending\") {\n return currentData;\n }\n if (!refetch) {\n return currentData;\n }\n }\n\n const documentPromise = this.client.get(id);\n this.documents.set(id, addPromiseState(documentPromise));\n return documentPromise;\n }\n\n getBatch(ids: string[]): Promise<PHDocument[]> {\n const key = ids.join(\",\");\n const cached = this.batchPromises.get(key);\n\n const hasDeletedDocuments = ids.some((id) => !this.documents.has(id));\n const currentPromises = ids.map((id) => this.get(id));\n\n if (hasDeletedDocuments) {\n const batchPromise = fulfilledOnly(currentPromises);\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n if (cached) {\n const samePromises = currentPromises.every(\n (p, i) => p === cached.promises[i],\n );\n if (samePromises) {\n return cached.promise;\n }\n }\n\n const states = currentPromises.map((p) =>\n readPromiseState(p as PromiseWithState<PHDocument>),\n );\n const allSettled = states.every((s) => s.status !== \"pending\");\n\n if (allSettled) {\n const values = states\n .filter(\n (s): s is { status: \"fulfilled\"; value: PHDocument } =>\n s.status === \"fulfilled\",\n )\n .map((s) => s.value);\n const batchPromise = Promise.resolve(values) as PromiseWithState<\n PHDocument[]\n >;\n batchPromise.status = \"fulfilled\";\n (batchPromise as FulfilledPromise<PHDocument[]>).value = values;\n\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n if (cached) {\n return cached.promise;\n }\n\n const batchPromise = fulfilledOnly(currentPromises);\n this.batchPromises.set(key, {\n promises: currentPromises,\n promise: batchPromise,\n });\n return batchPromise;\n }\n\n subscribe(id: string | string[], callback: () => void): () => void {\n const ids = Array.isArray(id) ? id : [id];\n for (const docId of ids) {\n const listeners = this.listeners.get(docId) ?? [];\n this.listeners.set(docId, [...listeners, callback]);\n }\n return () => {\n for (const docId of ids) {\n const listeners = this.listeners.get(docId) ?? [];\n this.listeners.set(\n docId,\n listeners.filter((listener) => listener !== callback),\n );\n }\n };\n }\n\n /**\n * Disposes of the cache and unsubscribes from document change events.\n */\n dispose(): void {\n if (this.unsubscribe) {\n this.unsubscribe();\n this.unsubscribe = null;\n }\n }\n}\n","import type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { use, useCallback, useSyncExternalStore } from \"react\";\nimport { readPromiseState } from \"../document-cache.js\";\nimport type { IDocumentCache } from \"../types/documents.js\";\nimport type { SetPHGlobalValue, UsePHGlobalValue } from \"../types/global.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst documentEventFunctions = makePHEventFunctions(\"documentCache\");\n\n/** Returns all documents in the reactor. */\nexport const useDocumentCache: UsePHGlobalValue<IDocumentCache> =\n documentEventFunctions.useValue;\n\n/** Sets all of the documents in the reactor. */\nexport const setDocumentCache: SetPHGlobalValue<IDocumentCache> =\n documentEventFunctions.setValue;\n\n/** Adds an event handler for all of the documents in the reactor. */\nexport const addDocumentCacheEventHandler =\n documentEventFunctions.addEventHandler;\n\n/**\n * Reads the state of a document promise and converts it to a query state object.\n * @param promise - The document promise to read\n * @returns An object containing the status, data, error, and isPending flag\n */\nfunction getDocumentQueryState(promise: Promise<PHDocument>) {\n const state = readPromiseState(promise);\n switch (state.status) {\n case \"pending\":\n return {\n status: \"pending\",\n isPending: true,\n error: undefined,\n data: undefined,\n } as const;\n case \"fulfilled\":\n return {\n status: \"success\",\n isPending: false,\n error: undefined,\n data: state.value,\n } as const;\n case \"rejected\":\n return {\n status: \"error\",\n isPending: false,\n error: state.reason,\n data: undefined,\n } as const;\n }\n}\n\n/**\n * Retrieves a document from the reactor and subscribes to changes using React Suspense.\n * This hook will suspend rendering while the document is loading.\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns The document if found, or undefined if id is null/undefined\n */\nexport function useDocument(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n const document = useSyncExternalStore(\n (cb) => (id && documentCache ? documentCache.subscribe(id, cb) : () => {}),\n () => (id ? documentCache?.get(id) : undefined),\n );\n return document ? use(document) : undefined;\n}\n\n/**\n * Retrieves a document from the reactor and subscribes to changes without\n * suspending or throwing. Use this when the ID might be stale (e.g., a\n * previously selected node that has since been deleted) and the consumer\n * wants to render a placeholder instead of crashing.\n *\n * Unlike {@link useGetDocumentAsync}, this hook subscribes to cache\n * updates, so the returned state stays in sync with reactor changes.\n *\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns An object containing:\n * - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n * - data: The document if successfully loaded\n * - isPending: Whether the document is currently loading\n * - error: Any error that occurred during loading (e.g., document not found)\n * - reload: Function to force a refetch, or undefined when no id is supplied\n */\nexport function useDocumentSafe(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n const promise = useSyncExternalStore(\n (cb) => (id && documentCache ? documentCache.subscribe(id, cb) : () => {}),\n () => (id ? documentCache?.get(id) : undefined),\n );\n\n if (!promise || !documentCache || !id) {\n return {\n status: \"initial\",\n isPending: false,\n error: undefined,\n data: undefined,\n reload: undefined,\n } as const;\n }\n\n const state = getDocumentQueryState(promise);\n return { ...state, reload: () => documentCache.get(id, true) } as const;\n}\n\n/**\n * Retrieves multiple documents from the reactor using React Suspense.\n * This hook will suspend rendering while any of the documents are loading.\n *\n * Uses getBatch from the document cache which handles promise caching internally,\n * ensuring stable references for useSyncExternalStore.\n *\n * @param ids - Array of document IDs to retrieve, or null/undefined to skip retrieval\n * @returns An array of documents if found, or empty array if ids is null/undefined\n */\nexport function useDocuments(ids: string[] | null | undefined) {\n const documentCache = useDocumentCache();\n\n const documents = useSyncExternalStore(\n (cb) =>\n ids?.length && documentCache\n ? documentCache.subscribe(ids, cb)\n : () => {},\n () =>\n ids?.length && documentCache ? documentCache.getBatch(ids) : undefined,\n );\n\n return documents ? use(documents) : [];\n}\n\n/**\n * Returns a function to retrieve a document from the cache.\n * The returned function fetches and returns a document by ID.\n * @returns A function that takes a document ID and returns a Promise of the document\n */\nexport function useGetDocument() {\n const documentCache = useDocumentCache();\n\n return useCallback(\n (id: string) => {\n if (!documentCache) {\n return Promise.reject(new Error(\"Document cache not initialized\"));\n }\n return documentCache.get(id);\n },\n [documentCache],\n );\n}\n\n/**\n * Returns a function to retrieve multiple documents from the cache.\n * The returned function fetches and returns documents by their IDs.\n * @returns A function that takes an array of document IDs and returns a Promise of the documents\n */\nexport function useGetDocuments() {\n const documentCache = useDocumentCache();\n\n return useCallback(\n (ids: string[]) => {\n if (!documentCache) {\n return Promise.reject(new Error(\"Document cache not initialized\"));\n }\n return documentCache.getBatch(ids);\n },\n [documentCache],\n );\n}\n\n/**\n * Retrieves a document from the reactor without suspending rendering.\n * Returns the current state of the document loading operation.\n * @param id - The document ID to retrieve, or null/undefined to skip retrieval\n * @returns An object containing:\n * - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n * - data: The document if successfully loaded\n * - isPending: Boolean indicating if the document is currently loading\n * - error: Any error that occurred during loading\n * - reload: Function to force reload the document from cache\n */\nexport function useGetDocumentAsync(id: string | null | undefined) {\n const documentCache = useDocumentCache();\n if (!id || !documentCache) {\n return {\n status: \"initial\",\n data: undefined,\n isPending: false,\n error: undefined,\n reload: undefined,\n } as const;\n }\n\n const promise = documentCache.get(id);\n const state = getDocumentQueryState(promise);\n\n return { ...state, reload: () => documentCache.get(id, true) } as const;\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport { dispatchActions } from \"../actions/dispatch.js\";\n\n/**\n * Returns a dispatch function for dispatching actions to a document.\n * Used internally by other hooks to provide action dispatching capabilities.\n * @param document - The document to dispatch actions to.\n * @returns A tuple containing the document and a dispatch function.\n */\nexport type DispatchFn<TAction> = (\n actionOrActions: TAction[] | TAction | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n) => void;\n\nexport type UseDispatchResult<TDocument, TAction> = readonly [\n TDocument | undefined,\n DispatchFn<TAction>,\n];\n\nexport function useDispatch<TDocument = PHDocument, TAction = Action>(\n document: TDocument | undefined,\n): UseDispatchResult<TDocument, TAction> {\n /**\n * Dispatches actions to the document.\n * @param actionOrActions - The action or actions to dispatch.\n * @param onErrors - Callback invoked with any errors that occurred during action execution.\n */\n function dispatch(\n actionOrActions: TAction[] | TAction | undefined,\n onErrors?: (errors: Error[]) => void,\n onSuccess?: (result: PHDocument) => void,\n ) {\n dispatchActions(actionOrActions, document, onErrors, onSuccess).catch(\n logger.error,\n );\n }\n return [document, dispatch] as const;\n}\n","import type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { useDispatch, type UseDispatchResult } from \"./dispatch.js\";\nimport { useDocument, useDocuments } from \"./document-cache.js\";\n\n/** Returns a document by id. */\nexport function useDocumentById(\n id: string | null | undefined,\n): UseDispatchResult<PHDocument, Action> {\n const document = useDocument(id);\n const [, dispatch] = useDispatch<PHDocument, Action>(document);\n return [document, dispatch] as const;\n}\n\n/** Returns documents by ids. */\nexport function useDocumentsByIds(ids: string[] | null | undefined) {\n return useDocuments(ids);\n}\n"],"mappings":";;;;;;;;AASA,eAAsB,aACpB,UACA,iBACA;AACA,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,uBAAuB;AAEzC,KAAI,CAAC,gBACH,OAAM,IAAI,MAAM,sBAAsB;CAExC,MAAM,UAAU,MAAM,QAAQ,gBAAgB,GAC1C,kBACA,CAAC,gBAAgB;AAErB,KAAI,QAAQ,WAAW,EACrB,OAAM,IAAI,MAAM,sBAAsB;CAGxC,MAAM,gBAAgB,OAAO,IAAI;AACjC,KAAI,CAAC,cACH,OAAM,IAAI,MAAM,gCAAgC;AAGlD,QAAO,MAAM,cAAc,QAAQ,SAAS,OAAO,IAAI,QAAQ,QAAQ;;AAGzE,eAAsB,gBACpB,YACA,uBACA;AACA,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,yBAAyB;AAE3C,KAAI,CAAC,sBACH,OAAM,IAAI,MAAM,yBAAyB;CAE3C,MAAM,aAAa,MAAM,QAAQ,sBAAsB,GACnD,wBACA,CAAC,sBAAsB;AAE3B,KAAI,WAAW,WAAW,EACxB,OAAM,IAAI,MAAM,yBAAyB;CAG3C,MAAM,gBAAgB,OAAO,IAAI;AACjC,KAAI,CAAC,cACH,OAAM,IAAI,MAAM,gCAAgC;CAGlD,MAAM,UAAU,WAAW,KAAK,OAAO,GAAG,OAAO;AACjD,QAAO,MAAM,cAAc,QAAQ,YAAY,QAAQ,QAAQ;;AAqFjE,eAAsB,iBACpB,YAC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MAAM,gBAAgB,kBAAkB;AAExC,QAAO,aACJ,QAAkB;AACjB,MAAI,CAAC,cACH,QAAO,QAAQ,uBAAO,IAAI,MAAM,iCAAiC,CAAC;AAEpE,SAAO,cAAc,SAAS,IAAI;IAEpC,CAAC,cAAc,CAChB;;;;;;;;;;;;;AAcH,SAAgB,oBAAoB,IAA+B;CACjE,MAAM,gBAAgB,kBAAkB;AACxC,KAAI,CAAC,MAAM,CAAC,cACV,QAAO;EACL,QAAQ;EACR,MAAM,KAAA;EACN,WAAW;EACX,OAAO,KAAA;EACP,QAAQ,KAAA;EACT;AAMH,QAAO;EAAE,GAFK,sBADE,cAAc,IAAI,GAAG,CACO;EAEzB,cAAc,cAAc,IAAI,IAAI,KAAK;EAAE;;;;AC9KhE,SAAgB,YACd,UACuC;;;;;;CAMvC,SAAS,SACP,iBACA,UACA,WACA;AACA,kBAAgB,iBAAiB,UAAU,UAAU,UAAU,CAAC,MAC9D,OAAO,MACR;;AAEH,QAAO,CAAC,UAAU,SAAS;;;;;ACjC7B,SAAgB,gBACd,IACuC;CACvC,MAAM,WAAW,YAAY,GAAG;CAChC,MAAM,GAAG,YAAY,YAAgC,SAAS;AAC9D,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,kBAAkB,KAAkC;AAClE,QAAO,aAAa,IAAI"}
@@ -60,7 +60,6 @@ interface RenownLoginButtonProps {
60
60
  }
61
61
  declare function RenownLoginButton({
62
62
  onLogin: onLoginProp,
63
- darkMode,
64
63
  style,
65
64
  className,
66
65
  asChild,
@@ -214,4 +213,4 @@ declare function Renown({
214
213
  }: RenownProps): null;
215
214
  //#endregion
216
215
  export { logout as A, RenownUserButtonMenuItem as C, RenownAuthButton as D, RenownLoginButtonProps as E, RenownAuth as M, RenownAuthStatus as N, RenownAuthButtonProps as O, useRenownAuth as P, RenownUserButton as S, RenownLoginButton as T, CopyIcon as _, CREDENTIAL_SCHEMA_EIP712_TYPE as a, SpinnerIcon as b, DOMAIN_TYPE as c, RENOWN_NETWORK_ID as d, RENOWN_URL as f, ChevronDownIcon as g, initRenownCrypto as h, useRenownInit as i, openRenown as j, login as k, ISSUER_TYPE as l, initConnectCrypto as m, RenownProps as n, CREDENTIAL_SUBJECT_TYPE as o, VERIFIABLE_CREDENTIAL_EIP712_TYPE as p, RenownInitOptions as r, CREDENTIAL_TYPES as s, Renown as t, RENOWN_CHAIN_ID as u, DisconnectIcon as v, RenownUserButtonProps as w, UserIcon as x, RenownLogo as y };
217
- //# sourceMappingURL=index-Bz4MqX_j.d.ts.map
216
+ //# sourceMappingURL=index-D3bV5rcl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-D3bV5rcl.d.ts","names":[],"sources":["../src/renown/use-renown-auth.ts","../src/renown/utils.ts","../src/renown/components/RenownAuthButton.tsx","../src/renown/components/RenownLoginButton.tsx","../src/renown/components/RenownUserButton.tsx","../src/renown/components/icons.tsx","../src/renown/crypto.ts","../src/renown/constants.ts","../src/renown/use-renown-init.ts","../src/renown/renown-init.tsx"],"mappings":";;;;;;KAKY,gBAAA,GAAmB,WAAA;AAAA,UAEd,UAAA;EACf,MAAA,EAAQ,gBAAA;EACR,IAAA,EAAM,IAAA;EACN,OAAA;EACA,OAAA;EACA,SAAA;EACA,SAAA;EACA,WAAA;EACA,cAAA;EACA,KAAA;EACA,MAAA,QAAc,OAAA;EACd,WAAA;AAAA;AAAA,iBAkBc,aAAA,CAAA,GAAiB,UAAA;;;iBChCjB,UAAA,CAAW,UAAA;;;;;ADC3B;;iBCkDsB,KAAA,CACpB,OAAA,sBACA,MAAA,EAAQ,OAAA,eACP,OAAA,CAAQ,IAAA;AAAA,iBA0BW,MAAA,CAAA,GAAM,OAAA;;;UC/EX,qBAAA;EACf,SAAA;EACA,QAAA;EACA,YAAA,GAAe,SAAA;EACf,WAAA,GAAc,SAAA;EACd,cAAA,GAAiB,SAAA;EACjB,QAAA,IAAY,IAAA,EAAM,UAAA,KAAe,SAAA;AAAA;AAAA,iBAGnB,gB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GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA2BI,cAAA,CAAA;EACd,IAAA;EACA;AAAA,GACC,SAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAkCI,WAAA,CAAA;EAAc,IAAA;EAAW;AAAA,GAA0B,SAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiE5D,eAAA,CAAA;EACd,IAAA;EACA,KAAA;EACA;AAAA,GACC,SAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAqBI,QAAA,CAAA;EAAW,IAAA;EAAW;AAAA,GAAqB,SAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;iBClM9C,iBAAA,CAAA,GAAiB,OAAA,CAAA,YAAA,CAAA,YAAA;;;;;iBAQjB,gBAAA,CAAA,GAAgB,OAAA,CAAA,YAAA,CAAA,YAAA;;;cChBzB,UAAA;AAAA,cACA,iBAAA;AAAA,cACA,eAAA;;;UCKI,iBAAA;EACf,OAAA;;;;ARHF;EQQE,SAAA;EACA,GAAA;AAAA;;ARPF;;;;;;;;;;;;iBQ2CgB,aAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA;AAAA,GACC,iBAAA,GAAoB,OAAA,CAAQ,OAAA;;;UCpDd,WAAA,SAAoB,iBAAA;EACnC,OAAA,IAAW,KAAA;AAAA;;;ATEb;;;;;AAEA;;;;;;;;;iBSegB,MAAA,CAAA;EAAS,OAAA;EAAA,GAAY;AAAA,GAAe,WAAA"}
@@ -1,7 +1,3 @@
1
- import { CompiledQuery } from "kysely";
2
- import { QueryCallbackReturnType, useRelationalQueryOptions } from "@powerhousedao/reactor-browser";
3
- import { IRelationalDb, IRelationalQueryBuilder, RelationalDbProcessorClass } from "@powerhousedao/shared/processors";
4
-
5
1
  //#region ../../node_modules/.pnpm/@electric-sql+pglite@0.3.15/node_modules/@electric-sql/pglite/dist/pglite-CntadC_p.d.ts
6
2
  type MessageName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice';
7
3
  type BackendMessage = {
@@ -683,44 +679,5 @@ type PGliteWithLive = PGliteInterface & {
683
679
  live: LiveNamespace;
684
680
  };
685
681
  //#endregion
686
- //#region src/relational/hooks/useRelationalDb.d.ts
687
- type RelationalDbWithLive<Schema> = IRelationalDb<Schema> & {
688
- live: LiveNamespace;
689
- };
690
- interface IRelationalDbState<Schema> {
691
- db: RelationalDbWithLive<Schema> | null;
692
- isLoading: boolean;
693
- error: Error | null;
694
- }
695
- declare const useRelationalDb: <Schema>() => IRelationalDbState<Schema>;
696
- //#endregion
697
- //#region src/relational/hooks/useRelationalQuery.d.ts
698
- type QueryCallbackReturnType$1 = {
699
- sql: string;
700
- parameters?: readonly unknown[];
701
- };
702
- type useRelationalQueryOptions$1 = {
703
- hashNamespace?: boolean;
704
- };
705
- declare function useRelationalQuery<Schema, T = unknown, TParams = undefined>(ProcessorClass: RelationalDbProcessorClass<Schema>, driveId: string, queryCallback: (db: IRelationalQueryBuilder<Schema>, parameters?: TParams) => QueryCallbackReturnType$1, parameters?: TParams, _options?: useRelationalQueryOptions$1): {
706
- readonly isLoading: boolean;
707
- readonly error: Error | null;
708
- readonly result: LiveQueryResults<T> | null;
709
- };
710
- //#endregion
711
- //#region src/relational/utils/createProcessorQuery.d.ts
712
- declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProcessorClass<TSchema>): {
713
- <TQueryBuilder extends (db: IRelationalQueryBuilder<TSchema>) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder): {
714
- isLoading: boolean;
715
- error: Error | null;
716
- result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
717
- };
718
- <TParams, TQueryBuilder extends (db: IRelationalQueryBuilder<TSchema>, parameters: TParams) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder, parameters: TParams, options?: useRelationalQueryOptions): {
719
- isLoading: boolean;
720
- error: Error | null;
721
- result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
722
- };
723
- };
724
- //#endregion
725
- export { type RelationalDbWithLive as a, type PGlite as c, type useRelationalQueryOptions$1 as i, type QueryCallbackReturnType$1 as n, type useRelationalDb as o, type useRelationalQuery as r, type PGliteWithLive as s, createProcessorQuery as t };
726
- //# sourceMappingURL=index-ZltD7u5Z.d.ts.map
682
+ export { type PGlite as i, type LiveQueryResults as n, type PGliteWithLive as r, LiveNamespace as t };
683
+ //# sourceMappingURL=index-DS4W07Y8.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DS4W07Y8.d.ts","names":["Modes","text","binary","Mode","BufferParameter","ArrayBuffer","ArrayBufferView","MessageName","BackendMessage","name","length","parseComplete","bindComplete","closeComplete","noData","portalSuspended","replicationStart","emptyQuery","copyDone","AuthenticationOk","constructor","AuthenticationCleartextPassword","AuthenticationMD5Password","Uint8Array","salt","AuthenticationSASL","mechanisms","AuthenticationSASLContinue","data","AuthenticationSASLFinal","AuthenticationMessage","NoticeOrError","message","severity","code","detail","hint","position","internalPosition","internalQuery","where","schema","table","column","dataType","constraint","file","line","routine","DatabaseError","Error","CopyDataMessage","chunk","CopyResponse","columnTypes","columnCount","Field","tableID","columnID","dataTypeID","dataTypeSize","dataTypeModifier","format","RowDescriptionMessage","fieldCount","fields","ParameterDescriptionMessage","parameterCount","dataTypeIDs","ParameterStatusMessage","parameterName","parameterValue","BackendKeyDataMessage","processID","secretKey","NotificationResponseMessage","processId","channel","payload","ReadyForQueryMessage","status","CommandCompleteMessage","DataRowMessage","NoticeMessage","messages_AuthenticationCleartextPassword","messages_AuthenticationMD5Password","messages_AuthenticationMessage","messages_AuthenticationOk","messages_AuthenticationSASL","messages_AuthenticationSASLContinue","messages_AuthenticationSASLFinal","messages_BackendKeyDataMessage","messages_BackendMessage","messages_CommandCompleteMessage","messages_CopyDataMessage","messages_CopyResponse","messages_DataRowMessage","messages_DatabaseError","messages_Field","messages_MessageName","messages_NoticeMessage","messages_NotificationResponseMessage","messages_ParameterDescriptionMessage","messages_ParameterStatusMessage","messages_ReadyForQueryMessage","messages_RowDescriptionMessage","messages_bindComplete","messages_closeComplete","messages_copyDone","messages_emptyQuery","messages_noData","messages_parseComplete","messages_portalSuspended","messages_replicationStart","messages","IDBFS","Emscripten","FileSystemType","IDBDatabase","Record","quit","dbs","FS","filesystems","MEMFS","NODEFS","PostgresMod","EmscriptenModule","Array","Blob","Promise","Omit","preInit","mod","preRun","postRun","FD_BUFFER_MAX","WASM_PREFIX","INITIAL_MEMORY","pg_extensions","_pgl_initdb","_pgl_backend","_pgl_shutdown","_interactive_write","msgLength","_interactive_one","peek","_set_read_write_cbs","read_cb","write_cb","addFunction","ptr","cb","signature","removeFunction","f","PostgresFactory","T","Partial","moduleOverrides","_default","postgresMod_FS","postgresMod_PostgresMod","postgresMod","default","DumpTarCompressionOptions","PGDATA","FsType","Filesystem","PGlite","File","init","pg","emscriptenOptions","emscriptenOpts","syncToFs","relaxedDurability","initialSyncFs","dumpTar","dbname","compression","closeFs","EmscriptenBuiltinFilesystem","dataDir","_relaxedDurability","BaseFilesystem","debug","FsStats","chmod","path","mode","close","fd","fstat","lstat","mkdir","recursive","options","open","flags","readdir","read","buffer","offset","rename","oldPath","newPath","rmdir","truncate","len","unlink","utimes","atime","mtime","writeFile","encoding","flag","write","dev","ino","nlink","uid","gid","rdev","size","blksize","blocks","ctime","ERRNO_CODES","EBADF","EBADFD","EEXIST","EINVAL","EISDIR","ENODEV","ENOENT","ENOTDIR","ENOTEMPTY","FilesystemType","DebugLevel","RowMode","ParserOptions","pgType","value","SerializerOptions","QueryOptions","rowMode","parsers","serializers","blob","onNotice","notice","paramTypes","ExecProtocolOptions","throwOnError","ExtensionSetupResult","TNamespace","URL","namespaceObj","bundlePath","ExtensionSetup","PGliteInterface","clientOnly","Extension","setup","ExtensionNamespace","Extensions","namespace","InitializedExtensions","TExtensions","K","ExecProtocolResult","DumpDataDirResult","tarball","extension","filename","PGliteOptions","WebAssembly","Module","username","database","fs","extensions","loadDataDir","initialMemory","wasmModule","fsBundle","Results","TemplateStringsArray","DescribeQueryResult","Transaction","waitReady","ready","closed","query","params","sql","sqlStrings","exec","describeQuery","transaction","tx","callback","execProtocolRaw","execProtocol","runExclusive","fn","listen","unlisten","onNotification","offNotification","dumpDataDir","refreshArrayTypes","PGliteInterfaceExtensions","E","ReturnType","Awaited","N","Row","key","rows","affectedRows","rollback","Serializer","Parser","queryParams","serializer","resultFields","parser","BOOL","BYTEA","CHAR","INT8","INT2","INT4","REGPROC","TEXT","OID","TID","XID","CID","JSON","XML","PG_NODE_TREE","SMGR","PATH","POLYGON","CIDR","FLOAT4","FLOAT8","ABSTIME","RELTIME","TINTERVAL","CIRCLE","MACADDR8","MONEY","MACADDR","INET","ACLITEM","BPCHAR","VARCHAR","DATE","TIME","TIMESTAMP","TIMESTAMPTZ","INTERVAL","TIMETZ","BIT","VARBIT","NUMERIC","REFCURSOR","REGPROCEDURE","REGOPER","REGOPERATOR","REGCLASS","REGTYPE","UUID","TXID_SNAPSHOT","PG_LSN","PG_NDISTINCT","PG_DEPENDENCIES","TSVECTOR","TSQUERY","GTSVECTOR","REGCONFIG","REGDICTIONARY","JSONB","REGNAMESPACE","REGROLE","types","Date","string","to","from","serialize","x","parse","number","bigint","json","boolean","date","bytea","typeId","TypeHandler","TypeHandlers","parseType","type","arraySerializer","xs","typarray","arrayParser","types$1_ABSTIME","types$1_ACLITEM","types$1_BIT","types$1_BOOL","types$1_BPCHAR","types$1_BYTEA","types$1_CHAR","types$1_CID","types$1_CIDR","types$1_CIRCLE","types$1_DATE","types$1_FLOAT4","types$1_FLOAT8","types$1_GTSVECTOR","types$1_INET","types$1_INT2","types$1_INT4","types$1_INT8","types$1_INTERVAL","types$1_JSON","types$1_JSONB","types$1_MACADDR","types$1_MACADDR8","types$1_MONEY","types$1_NUMERIC","types$1_OID","types$1_PATH","types$1_PG_DEPENDENCIES","types$1_PG_LSN","types$1_PG_NDISTINCT","types$1_PG_NODE_TREE","types$1_POLYGON","types$1_Parser","types$1_REFCURSOR","types$1_REGCLASS","types$1_REGCONFIG","types$1_REGDICTIONARY","types$1_REGNAMESPACE","types$1_REGOPER","types$1_REGOPERATOR","types$1_REGPROC","types$1_REGPROCEDURE","types$1_REGROLE","types$1_REGTYPE","types$1_RELTIME","types$1_SMGR","types$1_Serializer","types$1_TEXT","types$1_TID","types$1_TIME","types$1_TIMESTAMP","types$1_TIMESTAMPTZ","types$1_TIMETZ","types$1_TINTERVAL","types$1_TSQUERY","types$1_TSVECTOR","types$1_TXID_SNAPSHOT","types$1_TypeHandler","types$1_TypeHandlers","types$1_UUID","types$1_VARBIT","types$1_VARCHAR","types$1_XID","types$1_XML","types$1_arrayParser","types$1_arraySerializer","types$1_parseType","types$1_parsers","types$1_serializers","types$1_types","types$1","BasePGlite","force","Pick","private","execProtocolStream","_handleBlob","_getWrittenBlob","_cleanupBlob","_checkReady","_runExclusiveQuery","_runExclusiveTransaction","_initArrayTypes","O","Symbol","asyncDispose","AsyncDisposable","DEFAULT_RECV_BUF_SIZE","MAX_BUFFER_SIZE","create","execProtocolRawSync","isInTransaction","clone","_runExclusiveListen","A","B","C","D","F","G","I","M","P","Q","R","S","W","a","b","c","d","e","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","z","R","Results","d","PGliteInterface","LiveQueryOptions","T","AbortSignal","key","query","params","offset","limit","callback","results","signal","LiveChangesOptions","Change","Array","changes","LiveIncrementalQueryOptions","LiveNamespace","LiveQuery","Promise","LiveChanges","options","incrementalQuery","LiveQueryResults","totalCount","initialResults","subscribe","unsubscribe","refresh","fields","name","dataTypeID","initialChanges","ChangeInsert","__changed_columns__","__op__","__after__","ChangeDelete","ChangeUpdate","ChangeReset","live","setup","pg","_emscriptenOpts","namespaceObj","PGliteWithLive"],"sources":["../../../node_modules/.pnpm/@electric-sql+pglite@0.3.15/node_modules/@electric-sql/pglite/dist/pglite-CntadC_p.d.ts","../../../node_modules/.pnpm/@electric-sql+pglite@0.3.15/node_modules/@electric-sql/pglite/dist/live/index.d.ts"],"x_google_ignoreList":[0,1],"mappings":";KAOKO,WAAAA;AAAAA,KACAC,cAAAA;EACDC,IAAAA,EAAMF,WAAAA;EACNG,MAAAA;AAAAA;AAAAA,UA6CMqB,aAAAA;EACNC,OAAAA;EACAC,QAAAA;EACAC,IAAAA;EACAC,MAAAA;EACAC,IAAAA;EACAC,QAAAA;EACAC,gBAAAA;EACAC,aAAAA;EACAC,KAAAA;EACAC,MAAAA;EACAC,KAAAA;EACAC,MAAAA;EACAC,QAAAA;EACAC,UAAAA;EACAC,IAAAA;EACAC,IAAAA;EACAC,OAAAA;AAAAA;AAAAA,cAqGUmC,aAAAA,YAAyB3E,cAAAA,EAAgBuB,aAAAA;EAAAA,SAC1CrB,MAAAA;EAAAA,SACAsB,OAAAA;EACTZ,WAAAA,CAAYV,MAAAA,UAAgBsB,OAAAA;EAAAA,SACnBvB,IAAAA;EACTwB,QAAAA;EACAC,IAAAA;EACAC,MAAAA;EACAC,IAAAA;EACAC,QAAAA;EACAC,gBAAAA;EACAC,aAAAA;EACAC,KAAAA;EACAC,MAAAA;EACAC,KAAAA;EACAC,MAAAA;EACAC,QAAAA;EACAC,UAAAA;EACAC,IAAAA;EACAC,IAAAA;EACAC,OAAAA;AAAAA;AAAAA,KAwDCmE,KAAAA,GAAQC,UAAAA,CAAWC,cAAAA;EACpBG,IAAAA;EACAC,GAAAA,EAAKF,MAAAA,SAAeD,WAAAA;AAAAA;AAAAA,KAE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A,CAAMD,MAAAA,CAAOX,CAAAA;EAC7BwB,SAAAA,GAAYjB,QAAAA,GAAWM,OAAAA,EAASD,KAAAA,CAAMD,MAAAA,CAAOX,CAAAA;EAC7CyB,WAAAA,GAAclB,QAAAA,IAAYM,OAAAA,EAASD,KAAAA,CAAMD,MAAAA,CAAOX,CAAAA,gBAAiBiB,OAAAA;EACjES,OAAAA,QAAeT,OAAAA;AAAAA;AAAAA,KAEdc,YAAAA;EACDC,mBAAAA;EACAC,MAAAA;EACAC,SAAAA;AAAAA,IACAlC,CAAAA;AAAAA,KACCmC,YAAAA;EACDH,mBAAAA;EACAC,MAAAA;EACAC,SAAAA;AAAAA,IACAlC,CAAAA;AAAAA,KACCoC,YAAAA;EACDJ,mBAAAA;EACAC,MAAAA;EACAC,SAAAA;AAAAA,IACAlC,CAAAA;AAAAA,KACCqC,WAAAA;EACDJ,MAAAA;AAAAA,IACAjC,CAAAA;AAAAA,KACCW,MAAAA,MAAYoB,YAAAA,CAAa/B,CAAAA,IAAKmC,YAAAA,CAAanC,CAAAA,IAAKoC,YAAAA,CAAapC,CAAAA,IAAKqC,WAAAA,CAAYrC,CAAAA;AAAAA,KAQ9E2C,cAAAA,GAAiB7C,eAAAA;EAClBwC,IAAAA,EAAMvB,aAAAA;AAAAA"}
package/dist/index.d.ts CHANGED
@@ -1,20 +1,23 @@
1
- import { a as getAnalyticsStore, i as createAnalyticsStore, n as IPowerhouseAnalytics, r as CreateStoreOptions } from "./types-BmR60pPN.js";
2
- import { a as RelationalDbWithLive, c as PGlite, i as useRelationalQueryOptions, n as QueryCallbackReturnType, o as useRelationalDb, r as useRelationalQuery, s as PGliteWithLive, t as createProcessorQuery } from "./index-ZltD7u5Z.js";
3
- import { C as PhDocumentFieldsFragment, S as MutateDocumentMutation, T as Scalars, _ as DeleteDocumentMutation, a as GraphQLDocumentEventOperationName, b as GetDocumentOperationsQuery, c as GraphQLDocumentsEvents, d as DEFAULT_DRIVE_ID, f as DEFAULT_SWITCHBOARD_URL, g as CreateDocumentMutation, h as graphqlEventsToSyncDrive, i as GraphQLClientWindowEvents, l as ReactorGraphQLClient, m as graphqlDocumentsEvents, n as GraphQLClientDocumentEvent, o as GraphQLDocumentEvents, p as graphqlDocumentEvents, r as GraphQLClientDocumentsEvent, s as GraphQLDocumentEventsOperationName, t as createClient, u as TStateSchemaZodObject, v as DeleteDocumentsMutation, w as PropagationMode, x as GetDocumentWithOperationsQuery, y as FindDocumentsQuery } from "./client-CYhc2W1V.js";
4
- import { A as logout, C as RenownUserButtonMenuItem, D as RenownAuthButton, E as RenownLoginButtonProps, M as RenownAuth, N as RenownAuthStatus, O as RenownAuthButtonProps, P as useRenownAuth, S as RenownUserButton, T as RenownLoginButton, _ as CopyIcon, a as CREDENTIAL_SCHEMA_EIP712_TYPE, b as SpinnerIcon, c as DOMAIN_TYPE, d as RENOWN_NETWORK_ID, f as RENOWN_URL, g as ChevronDownIcon, h as initRenownCrypto, i as useRenownInit, j as openRenown, k as login, l as ISSUER_TYPE, m as initConnectCrypto, n as RenownProps, o as CREDENTIAL_SUBJECT_TYPE, p as VERIFIABLE_CREDENTIAL_EIP712_TYPE, r as RenownInitOptions, s as CREDENTIAL_TYPES, t as Renown, u as RENOWN_CHAIN_ID, v as DisconnectIcon, w as RenownUserButtonProps, x as UserIcon, y as RenownLogo } from "./index-Bz4MqX_j.js";
1
+ import { a as getAnalyticsStore, i as createAnalyticsStore, n as IPowerhouseAnalytics, r as CreateStoreOptions } from "./types-CPV0Cnsy.js";
2
+ import { baseDocumentModels, baseDocumentModelsMap } from "./src/document-model.js";
3
+ import { i as PGlite, r as PGliteWithLive } from "./index-DS4W07Y8.js";
4
+ import { C as PhDocumentFieldsFragment, S as MutateDocumentMutation, T as Scalars, _ as DeleteDocumentMutation, a as GraphQLDocumentEventOperationName, b as GetDocumentOperationsQuery, c as GraphQLDocumentsEvents, d as DEFAULT_DRIVE_ID, f as DEFAULT_SWITCHBOARD_URL, g as CreateDocumentMutation, h as graphqlEventsToSyncDrive, i as GraphQLClientWindowEvents, l as ReactorGraphQLClient, m as graphqlDocumentsEvents, n as GraphQLClientDocumentEvent, o as GraphQLDocumentEvents, p as graphqlDocumentEvents, r as GraphQLClientDocumentsEvent, s as GraphQLDocumentEventsOperationName, t as createClient, u as TStateSchemaZodObject, v as DeleteDocumentsMutation, w as PropagationMode, x as GetDocumentWithOperationsQuery, y as FindDocumentsQuery } from "./client-09xv0Dq6.js";
5
+ import { A as logout, C as RenownUserButtonMenuItem, D as RenownAuthButton, E as RenownLoginButtonProps, M as RenownAuth, N as RenownAuthStatus, O as RenownAuthButtonProps, P as useRenownAuth, S as RenownUserButton, T as RenownLoginButton, _ as CopyIcon, a as CREDENTIAL_SCHEMA_EIP712_TYPE, b as SpinnerIcon, c as DOMAIN_TYPE, d as RENOWN_NETWORK_ID, f as RENOWN_URL, g as ChevronDownIcon, h as initRenownCrypto, i as useRenownInit, j as openRenown, k as login, l as ISSUER_TYPE, m as initConnectCrypto, n as RenownProps, o as CREDENTIAL_SUBJECT_TYPE, p as VERIFIABLE_CREDENTIAL_EIP712_TYPE, r as RenownInitOptions, s as CREDENTIAL_TYPES, t as Renown, u as RENOWN_CHAIN_ID, v as DisconnectIcon, w as RenownUserButtonProps, x as UserIcon, y as RenownLogo } from "./index-D3bV5rcl.js";
6
+ import { r as IWorkerAdminClient, t as IInspectorProxy } from "./inspector-proxy-CvQDDxmT.js";
7
+ import { QueryCallbackReturnType, RelationalDbWithLive, createProcessorQuery, useRelationalDb, useRelationalQuery, useRelationalQueryOptions } from "./src/relational/index.js";
5
8
  import * as document_model0 from "document-model";
6
9
  import { DocumentModelLib, DocumentModelModule, EditorModule, PHDocument, PHDocumentController } from "document-model";
7
- import { Action, DocumentAction, DocumentModelModule as DocumentModelModule$1, DocumentModelPHState, DocumentOperations, ISigner, Operation, PHBaseState, PHDocument as PHDocument$1, PHDocumentHeader, SubgraphModule, ValidationError } from "@powerhousedao/shared/document-model";
10
+ import { Action, DocumentAction, DocumentModelModule as DocumentModelModule$1, DocumentOperations, ISigner, Operation, PHBaseState, PHDocument as PHDocument$1, PHDocumentHeader, SubgraphModule, ValidationError } from "@powerhousedao/shared/document-model";
8
11
  import * as _powerhousedao_shared_document_drive0 from "@powerhousedao/shared/document-drive";
9
12
  import { DocumentDriveAction, DocumentDriveDocument, DriveInput, FileNode, FolderNode, Node, SharingType } from "@powerhousedao/shared/document-drive";
10
13
  import * as _powerhousedao_reactor0 from "@powerhousedao/reactor";
11
- import { ChannelScheme, ConnectionState, ConnectionStateSnapshot, ConnectionStateSnapshot as ConnectionStateSnapshot$1, Database, Database as Database$1, DocumentChangeType, DocumentIntegrityService, GqlRequestChannel, IChannel, IDocumentModelLoader, IDocumentModelLoader as IDocumentModelLoader$1, IDocumentModelRegistry, IProcessor, IProcessorHostModule, IProcessorHostModule as IProcessorHostModule$1, IQueue, IReactorClient, IReactorClient as IReactorClient$1, IRelationalDb, ISyncManager, InMemoryQueue, IntervalPollTimer, Job, JwtHandler, KeyframeValidationIssue, OperationWithContext, ParsedDriveUrl, PollBehavior, PollBehavior as PollBehavior$1, ProcessorApp, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, REACTOR_SCHEMA, ReactorBuilder, ReactorClientBuilder, ReactorClientModule, RebuildResult, RelationalDbProcessor, Remote, SignerConfig, SnapshotValidationIssue, SyncOperation, SyncOperationStatus, ValidationResult, driveCollectionId, driveIdFromUrl, parseDriveUrl } from "@powerhousedao/reactor";
14
+ import { ChannelScheme, ConnectionState, ConnectionStateSnapshot, ConnectionStateSnapshot as ConnectionStateSnapshot$1, Database, Database as Database$1, DocumentChangeType, DocumentIntegrityService, DriveCollectionId, GqlRequestChannel, IChannel, IDocumentModelLoader, IDocumentModelLoader as IDocumentModelLoader$1, IDocumentModelRegistry, IProcessor, IProcessorHostModule, IProcessorHostModule as IProcessorHostModule$1, IQueue, IReactorClient, IReactorClient as IReactorClient$1, IRelationalDb, ISyncManager, InMemoryQueue, InProcessReactorClientModule, InProcessReactorModule, IntervalPollTimer, Job, JwtHandler, KeyframeValidationIssue, OperationWithContext, ParsedDriveUrl, PollBehavior, PollBehavior as PollBehavior$1, ProcessorApp, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, REACTOR_SCHEMA, ReactorBuilder, ReactorClientBuilder, ReactorClientModule, ReactorModule, RebuildResult, RelationalDbProcessor, Remote, RemoteFilter, RemoteMeta, SignerConfig, SnapshotValidationIssue, SyncOperation, SyncOperationStatus, ValidationResult, driveIdFromUrl, isDriveAuthError, parseDriveUrl } from "@powerhousedao/reactor";
12
15
  import { DragEventHandler, ReactNode } from "react";
13
16
  import { IRenown, LoginStatus, User } from "@renown/sdk";
14
17
  import { IAttachmentClient, IAttachmentService, PreprocessResult } from "@powerhousedao/reactor-attachments/client";
15
18
  import { Kysely } from "kysely";
16
19
  import * as _powerhousedao_reactor_browser0 from "@powerhousedao/reactor-browser";
17
- import { AddPHGlobalEventHandler as AddPHGlobalEventHandler$1, BrowserReactorClientModule as BrowserReactorClientModule$1, DocumentDispatch as DocumentDispatch$1, PHAppConfig as PHAppConfig$1, PHAppConfigHooks as PHAppConfigHooks$1, PHAppConfigKey as PHAppConfigKey$1, PHAppConfigSetters as PHAppConfigSetters$1, PHDocumentEditorConfig as PHDocumentEditorConfig$1, PHDocumentEditorConfigHooks as PHDocumentEditorConfigHooks$1, PHDocumentEditorConfigKey as PHDocumentEditorConfigKey$1, PHDocumentEditorConfigSetters as PHDocumentEditorConfigSetters$1, PHGlobal as PHGlobal$1, PHGlobalConfig as PHGlobalConfig$1, PHGlobalConfigHooks as PHGlobalConfigHooks$1, PHGlobalConfigKey as PHGlobalConfigKey$1, PHGlobalConfigSetters as PHGlobalConfigSetters$1, PHGlobalKey as PHGlobalKey$1, PHModal as PHModal$1, SetPHGlobalValue as SetPHGlobalValue$1, UsePHGlobalValue as UsePHGlobalValue$1 } from "@powerhousedao/reactor-browser";
20
+ import { AddPHGlobalEventHandler as AddPHGlobalEventHandler$1, BrowserReactorClientModule as BrowserReactorClientModule$1, DocumentDispatch as DocumentDispatch$1, PHAppConfig as PHAppConfig$1, PHAppConfigHooks as PHAppConfigHooks$1, PHAppConfigKey as PHAppConfigKey$1, PHAppConfigSetters as PHAppConfigSetters$1, PHDocumentEditorConfig as PHDocumentEditorConfig$1, PHDocumentEditorConfigHooks as PHDocumentEditorConfigHooks$1, PHDocumentEditorConfigKey as PHDocumentEditorConfigKey$1, PHDocumentEditorConfigSetters as PHDocumentEditorConfigSetters$1, PHGlobal as PHGlobal$1, PHGlobalConfig as PHGlobalConfig$1, PHGlobalConfigHooks as PHGlobalConfigHooks$1, PHGlobalConfigKey as PHGlobalConfigKey$1, PHGlobalConfigSetters as PHGlobalConfigSetters$1, PHGlobalKey as PHGlobalKey$1, PHModal as PHModal$1, SetPHGlobalValue as SetPHGlobalValue$1, UsePHGlobalValue as UsePHGlobalValue$1, WorkerReactorClientModule as WorkerReactorClientModule$1 } from "@powerhousedao/reactor-browser";
18
21
  import { DocumentModelLib as DocumentModelLib$1, Node as Node$1, RegistryPackageSource } from "@powerhousedao/shared";
19
22
  import { PackageInfo } from "@powerhousedao/shared/registry";
20
23
 
@@ -85,6 +88,8 @@ declare function setDriveMetadata(driveId: string, metadata: {
85
88
  //#region src/constants.d.ts
86
89
  declare const DEFAULT_DRIVE_EDITOR_ID = "powerhouse/generic-drive-explorer";
87
90
  declare const COMMON_PACKAGE_ID = "powerhouse/common";
91
+ /** Document types that represent a "drive": a container of nodes. */
92
+ declare const DRIVE_DOCUMENT_TYPES: readonly ["powerhouse/document-drive", "powerhouse/reactor-drive"];
88
93
  //#endregion
89
94
  //#region src/types/documents.d.ts
90
95
  type DocumentDispatch<TAction extends Action> = (actionOrActions: TAction | TAction[] | DocumentAction | DocumentAction[] | undefined, onErrors?: (errors: Error[]) => void, onSuccess?: (result: PHDocument$1) => void) => void;
@@ -141,19 +146,15 @@ declare class DocumentCache implements IDocumentCache {
141
146
  dispose(): void;
142
147
  }
143
148
  //#endregion
144
- //#region src/document-model.d.ts
145
- declare const baseDocumentModelsMap: Record<string, DocumentModelModule$1<DocumentModelPHState>>;
146
- declare const baseDocumentModels: DocumentModelModule$1<DocumentModelPHState>[];
147
- //#endregion
148
149
  //#region src/global/types.d.ts
149
- interface PGliteState {
150
+ interface PGliteState$1 {
150
151
  db: PGliteWithLive | null;
151
152
  isLoading: boolean;
152
153
  error: Error | null;
153
154
  }
154
155
  interface PowerhouseGlobal {
155
156
  analytics?: Promise<IPowerhouseAnalytics>;
156
- pglite?: PGliteState;
157
+ pglite?: PGliteState$1;
157
158
  }
158
159
  declare global {
159
160
  interface Window {
@@ -527,6 +528,8 @@ type PHModal = {
527
528
  } | {
528
529
  type: "missingPackage";
529
530
  documentType: string;
531
+ } | {
532
+ type: "driveAuthRequired";
530
533
  };
531
534
  //#endregion
532
535
  //#region src/types/package-discovery.d.ts
@@ -677,13 +680,24 @@ declare function useDropNode(targetId: string | undefined): {
677
680
  };
678
681
  //#endregion
679
682
  //#region src/types/global.d.ts
680
- type BrowserReactorClientModule = ReactorClientModule & {
683
+ interface BrowserReactorModule extends InProcessReactorModule {
681
684
  pg: PGlite;
682
- };
685
+ }
686
+ interface BrowserReactorClientModule extends InProcessReactorClientModule {
687
+ kind: "browser";
688
+ reactorModule: BrowserReactorModule | undefined;
689
+ }
690
+ type WorkerReactorModule = ReactorModule;
691
+ interface WorkerReactorClientModule extends ReactorClientModule {
692
+ kind: "worker";
693
+ reactorModule: WorkerReactorModule;
694
+ adminClient: IWorkerAdminClient;
695
+ inspector: IInspectorProxy;
696
+ }
683
697
  type LOADING = null;
684
698
  type PHGlobal = PHGlobalConfig & {
685
699
  loading?: boolean;
686
- reactorClientModule?: BrowserReactorClientModule;
700
+ reactorClientModule?: BrowserReactorClientModule | WorkerReactorClientModule;
687
701
  reactorClient?: IReactorClient$1;
688
702
  attachmentService?: IAttachmentService;
689
703
  reactorGraphQLClient?: ReactorGraphQLClient | undefined;
@@ -845,10 +859,10 @@ declare const useLoading: () => boolean | undefined, setLoading: (value: boolean
845
859
  declare const loading: LOADING;
846
860
  //#endregion
847
861
  //#region src/hooks/reactor.d.ts
848
- /** Returns the reactor client module */
849
- declare const useReactorClientModule: UsePHGlobalValue$1<BrowserReactorClientModule$1>;
862
+ /** Returns the reactor client module (in-process or worker-backed) */
863
+ declare const useReactorClientModule: UsePHGlobalValue$1<BrowserReactorClientModule$1 | WorkerReactorClientModule$1>;
850
864
  /** Sets the reactor client module */
851
- declare const setReactorClientModule: SetPHGlobalValue$1<BrowserReactorClientModule$1>;
865
+ declare const setReactorClientModule: SetPHGlobalValue$1<BrowserReactorClientModule$1 | WorkerReactorClientModule$1>;
852
866
  /** Adds an event handler for the reactor client module */
853
867
  declare const addReactorClientModuleEventHandler: AddPHGlobalEventHandler$1;
854
868
  /** Returns the reactor client */
@@ -941,7 +955,7 @@ declare function useDocumentOperations(documentId: string | null | undefined): D
941
955
  declare function useDocumentTypes(): string[] | undefined;
942
956
  //#endregion
943
957
  //#region src/hooks/download-document.d.ts
944
- declare function useDownloadDocument(id: string | undefined): () => void;
958
+ declare function useDownloadDocument(id: string | undefined): () => Promise<void>;
945
959
  //#endregion
946
960
  //#region src/hooks/drive-by-id.d.ts
947
961
  declare function useDriveById(driveId: string | undefined | null): [DocumentDriveDocument, DocumentDispatch<DocumentDriveAction>];
@@ -1292,6 +1306,14 @@ declare function useAttachmentUpload(): UseAttachmentUploadReturn;
1292
1306
  declare function truncateAllTables(pg: PGlite, schema?: string): Promise<void>;
1293
1307
  declare function dropAllReactorStorage(pg: PGlite): Promise<void>;
1294
1308
  //#endregion
1309
+ //#region src/pglite/usePGlite.d.ts
1310
+ interface PGliteState {
1311
+ db: PGliteWithLive | null;
1312
+ isLoading: boolean;
1313
+ error: Error | null;
1314
+ }
1315
+ declare function setPGliteDB(pglite: Partial<PGliteState>): void;
1316
+ //#endregion
1295
1317
  //#region src/reactor.d.ts
1296
1318
  type ReactorDefaultDrivesConfig = {
1297
1319
  defaultDrivesUrl?: string[];
@@ -1727,5 +1749,5 @@ declare function getUserPermissions(): {
1727
1749
  //#region src/utils/validate-document.d.ts
1728
1750
  declare const validateDocument: (document: PHDocument$1) => ValidationError[];
1729
1751
  //#endregion
1730
- export { ActionTracker, AddPHGlobalEventHandler, BaseStorage, BrowserLocalStorage, BrowserReactorClientModule, COMMON_PACKAGE_ID, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChannelScheme, ChevronDownIcon, ConflictError, type ConflictInfo, ConflictResolution, type ConflictStrategy, type ConnectionState, type ConnectionStateSnapshot, CopyIcon, CreateStoreOptions, DEFAULT_DRIVE_EDITOR_ID, DEFAULT_DRIVE_ID, DEFAULT_SWITCHBOARD_URL, DOMAIN_TYPE, type Database, DisconnectIcon, DiscoveryEvent, DiscoveryEventListener, DispatchFn, DocumentCache, type RemoteDocumentChangeEvent as DocumentChangeEvent, type DocumentChangeListener, DocumentChangeType, DocumentDispatch, DocumentIntegrityService, DocumentTypeIcon, DraggingNode, DriveSystemInfoState, EDITOR_FILE_DROP_OPT_OUT_ATTR, FailedInstallation, FailedInstallationReason, FileUploadProgress, FileUploadProgressCallback, FulfilledPromise, FullPHGlobalConfig, type GetDocumentResult, type GetDocumentWithOperationsResult, type GetOperationsResult, GqlRequestChannel, GraphQLClientDocumentCache, GraphQLClientDocumentEvent, GraphQLClientDocumentsEvent, GraphQLClientWindowEvents, GraphQLDocumentEventOperationName, GraphQLDocumentEvents, GraphQLDocumentEventsOperationName, GraphQLDocumentsEvents, type IChannel, IDocumentCache, type IDocumentModelLoader, IPackageDiscoveryService, IPackageListerUnsubscribe, IPackageManager, IPackagesListener, type IProcessor, type IProcessorHostModule, type IQueue, type IReactorClient, IReactorProcessorHostModule, type IRelationalDb, type IRemoteClient, type IRemoteController, ISSUER_TYPE, IStorage, InMemoryQueue, IntervalPollTimer, type Job, type JwtHandler, type KeyframeValidationIssue, LOADING, type MergeHandler, NodeKind, type OperationWithContext, PHAnalyticsGlobalConfig, PHAppConfig, PHAppConfigHooks, PHAppConfigKey, PHAppConfigSetters, PHCommonGlobalConfig, PHDocumentEditorConfig, PHDocumentEditorConfigHooks, PHDocumentEditorConfigKey, PHDocumentEditorConfigSetters, PHDrivesGlobalConfig, PHGlobal, PHGlobalConfig, PHGlobalConfigHooks, PHGlobalConfigHooksForKey, PHGlobalConfigKey, PHGlobalConfigSetters, PHGlobalConfigSettersForKey, PHGlobalEventHandlerAdders, PHGlobalKey, PHGlobalValue, PHModal, PHProcessorsGlobalConfig, PHRelationalProcessorsGlobalConfig, PHRenownGlobalConfig, PHSentryGlobalConfig, PHToastFn, PHToastOptions, PHToastType, PackageManagerInstallResult, type ParsedDriveUrl, PendingInstallation, PollBehavior, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorRecord, PromiseState, PromiseWithState, PropagationMode, PublishEvent, type PushResult, QueryCallbackReturnType, REACTOR_SCHEMA, RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL, ReactorBuilder, ReactorClientBuilder, ReactorDefaultDrivesConfig, ReactorGraphQLClient, type RebuildResult, RefreshReactorDataConfig, RegistryClient, RejectedPromise, RelationalDbProcessor, RelationalDbWithLive, type Remote, RemoteClient, type RemoteControllerGraphQLClient, type RemoteControllerOptions, RemoteDocumentController, type RemoteDocumentControllerWith, type RemoteDocumentData, type RemoteOperation, type RemoteOperationResultPage, Renown, RenownAuth, RenownAuthButton, RenownAuthButtonProps, RenownAuthStatus, RenownInitOptions, RenownLoginButton, RenownLoginButtonProps, RenownLogo, RenownProps, RenownUserButton, RenownUserButtonMenuItem, RenownUserButtonProps, SetEvent, SetPHGlobalValue, type SignerConfig, type SnapshotValidationIssue, SpinnerIcon, type SyncOperation, SyncOperationStatus, type SyncStatus, TStateSchemaZodObject, TimelineBarItem, TimelineDividerItem, TimelineItem, type TrackedAction, UISyncStatus, UploadStatus, UseAttachmentUploadReturn, UseDispatchResult, UseEditorFileDropOptions, UseEditorFileDropResult, UseOnDropFile, UsePHGlobalValue, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, type ValidationResult, addAllowListEventHandler, addAllowedDocumentTypesEventHandler, addAnalyticsDatabaseNameEventHandler, addAttachmentServiceEventHandler, addBasePathEventHandler, addCliVersionEventHandler, addDefaultDrivesUrlEventHandler, addDisabledEditorsEventHandler, addDocument, addDocumentCacheEventHandler, addDraggingNodeEventHandler, addDrive, addDrivesEventHandler, addDrivesPreserveStrategyEventHandler, addEnabledEditorsEventHandler, addFeaturesEventHandler, addFileUploadOperationsChunkSizeEventHandler, addFolder, addGaTrackingIdEventHandler, addGraphQLReactorClientEventHandler, addIsAddCloudDrivesEnabledEventHandler, addIsAddDriveEnabledEventHandler, addIsAddLocalDrivesEnabledEventHandler, addIsAddPublicDrivesEnabledEventHandler, addIsAnalyticsDatabaseWorkerEnabledEventHandler, addIsAnalyticsEnabledEventHandler, addIsAnalyticsExternalProcessorsEnabledEventHandler, addIsCloudDrivesEnabledEventHandler, addIsDeleteCloudDrivesEnabledEventHandler, addIsDeleteLocalDrivesEnabledEventHandler, addIsDeletePublicDrivesEnabledEventHandler, addIsDiffAnalyticsEnabledEventHandler, addIsDocumentModelSelectionSettingsEnabledEventHandler, addIsDragAndDropEnabledEventHandler, addIsDriveAnalyticsEnabledEventHandler, addIsEditorDebugModeEnabledEventHandler, addIsEditorReadModeEnabledEventHandler, addIsExternalControlsEnabledEventHandler, addIsExternalPackagesEnabledEventHandler, addIsExternalProcessorsEnabledEventHandler, addIsExternalRelationalProcessorsEnabledEventHandler, addIsLocalDrivesEnabledEventHandler, addIsPublicDrivesEnabledEventHandler, addIsRelationalProcessorsEnabledEventHandler, addIsSentryTracingEnabledEventHandler, addLoadingEventHandler, addLocalDrivesEnabledEventHandler, addLogLevelEventHandler, addModalEventHandler, addPHEventHandlers, addPackageDiscoveryServiceEventHandler, addPromiseState, addReactorClientEventHandler, addReactorClientModuleEventHandler, addRemoteDrive, addRenownChainIdEventHandler, addRenownEventHandler, addRenownNetworkIdEventHandler, addRenownUrlEventHandler, addRequiresHardRefreshEventHandler, addResetSelectedNodeEventHandler, addRevisionHistoryVisibleEventHandler, addRouterBasenameEventHandler, addSelectedDriveIdEventHandler, addSelectedNodeIdEventHandler, addSelectedTimelineItemEventHandler, addSelectedTimelineRevisionEventHandler, addSentryDsnEventHandler, addSentryEnvEventHandler, addSentryReleaseEventHandler, addSetSelectedDriveOnPopStateEventHandler, addSetSelectedNodeOnPopStateEventHandler, addStudioModeEventHandler, addToastEventHandler, addVersionCheckIntervalEventHandler, addVersionEventHandler, addVetraPackageManagerEventHandler, addWarnOutdatedAppEventHandler, baseDocumentModels, baseDocumentModelsMap, buildDocumentSubgraphQuery, buildDocumentSubgraphUrl, callEventHandlerRegisterFunctions, callGlobalSetterForKey, clearGlobal, closePHModal, commonGlobalEventHandlerFunctions, convertRemoteOperations, createAnalyticsStore, createClient, createProcessorQuery, createUrlWithPreservedParams, deleteDrive, deleteNode, deriveSystemUrl, dispatchActions, downloadDocument, driveCollectionId, driveIdFromUrl, dropAllReactorStorage, exportFile, extractDriveIdFromPath, extractDriveIdFromSlug, extractDriveSlugFromPath, extractNodeIdFromPath, extractNodeIdFromSlug, extractNodeSlugFromPath, findUuid, getAnalyticsStore, getDocumentGraphqlQuery, getDriveIdBySlug, getDrives, getGlobal, getPackages, getPackagesByDocumentType, getPathWithoutBase, getRevisionFromDate, getSlugFromDriveUrl, getSwitchboardGatewayUrlFromDriveUrl, getSyncStatus, getSyncStatusSync, getUserPermissions, graphqlDocumentEvents, graphqlDocumentsEvents, graphqlEventsToSyncDrive, hideRevisionHistory, identifierFromMutateDocumentOperationVariables, initConnectCrypto, initRenownCrypto, initTheme, isDocumentTypeSupported, isExternalControlsEnabledEventFunctions, isFileNodeKind, isFolderNodeKind, loading, login, logout, makeDriveUrlComponent, makeNodeSlug, makePHEventFunctions, openRenown, parseDriveUrl, phAppConfigHooks, phAppConfigSetters, phDocumentEditorConfigHooks, phDocumentEditorConfigSetters, phDocumentFromQuery, phDocumentsFromQuery, phGlobalConfigHooks, phGlobalConfigSetters, reactorGraphqlBatchFetchDocuments, reactorGraphqlCreateDocument, reactorGraphqlDeleteDocument, reactorGraphqlDeleteDocuments, reactorGraphqlFetchDocument, reactorGraphqlMutateDocument, readPromiseState, refreshReactorData, refreshReactorDataClient, renameDrive, renameDriveNode, resolveUrlPathname, setAllowList, setAllowedDocumentTypes, setAnalyticsDatabaseName, setAttachmentService, setBasePath, setCliVersion, setDefaultDrivesUrl, setDefaultPHGlobalConfig, setDisabledEditors, setDocumentCache, setDriveAvailableOffline, setDriveMetadata, setDriveSharingType, setDrives, setDrivesPreserveStrategy, setEnabledEditors, setFeatures, setFileUploadOperationsChunkSize, setGaTrackingId, setGlobal, setGraphQLReactorClient, setIsAddCloudDrivesEnabled, setIsAddDriveEnabled, setIsAddLocalDrivesEnabled, setIsAddPublicDrivesEnabled, setIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsEnabled, setIsAnalyticsExternalProcessorsEnabled, setIsCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, setIsDeleteLocalDrivesEnabled, setIsDeletePublicDrivesEnabled, setIsDiffAnalyticsEnabled, setIsDocumentModelSelectionSettingsEnabled, setIsDragAndDropEnabled, setIsDriveAnalyticsEnabled, setIsEditorDebugModeEnabled, setIsEditorReadModeEnabled, setIsExternalControlsEnabled, setIsExternalPackagesEnabled, setIsExternalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, setIsLocalDrivesEnabled, setIsPublicDrivesEnabled, setIsRelationalProcessorsEnabled, setIsSentryTracingEnabled, setLoading, setLocalDrivesEnabled, setLogLevel, setPHAppConfig, setPHAppConfigByKey, setPHDocumentEditorConfig, setPHDocumentEditorConfigByKey, setPHGlobalConfig, setPHGlobalConfigByKey, setPHModal, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setRenownChainId, setRenownNetworkId, setRenownUrl, setRequiresHardRefresh, setRevisionHistoryVisible, setRouterBasename, setSelectedDrive, setSelectedDriveId, setSelectedNode, setSelectedTimelineItem, setSelectedTimelineRevision, setSentryDsn, setSentryEnv, setSentryRelease, setStudioMode, setVersion, setVersionCheckInterval, setVetraPackageManager, setWarnOutdatedApp, showCreateDocumentModal, showDeleteNodeModal, showPHModal, showRevisionHistory, sortNodesByName, trimTrailingSlash, truncateAllTables, useAllowList, useAllowedDocumentModelModules, useAllowedDocumentTypes, useAnalyticsDatabaseName, useAppModuleById, useAppModules, useAttachmentService, useAttachmentUpload, useAttachments, useBasePath, useCliVersion, useConnectionState, useConnectionStates, useDatabase, useDefaultAppModule, useDefaultDrivesUrl, useDid, useDisabledEditors, useDispatch, useDocument, useDocumentById, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOfType, useDocumentOperations, useDocumentSafe, useDocumentTypes, useDocumentTypesInSelectedDrive, useDocuments, useDocumentsByIds, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDownloadDocument, useDragNode, useDriveById, useDriveSystemInfo, useDrives, useDrivesPreserveStrategy, useDropFile, useDropNode, useEditorFileDrop, useEditorModuleById, useEditorModules, useEditorModulesForDocumentType, useEnabledEditors, useFallbackEditorModule, useFeatures, useFileNodesInSelectedDrive, useFileNodesInSelectedFolder, useFileUploadOperationsChunkSize, useFolderById, useFolderNodesInSelectedDrive, useFolderNodesInSelectedFolder, useGaTrackingId, useGetDocument, useGetDocumentAsync, useGetDocuments, useGetSwitchboardLink, useGraphQLReactorClient, useInitReactorGraphqlClient, useIsAddCloudDrivesEnabled, useIsAddDriveEnabled, useIsAddLocalDrivesEnabled, useIsAddPublicDrivesEnabled, useIsAnalyticsDatabaseWorkerEnabled, useIsAnalyticsEnabled, useIsAnalyticsExternalProcessorsEnabled, useIsCloudDrivesEnabled, useIsDeleteCloudDrivesEnabled, useIsDeleteLocalDrivesEnabled, useIsDeletePublicDrivesEnabled, useIsDiffAnalyticsEnabled, useIsDocumentModelSelectionSettingsEnabled, useIsDragAndDropEnabled, useIsDriveAnalyticsEnabled, useIsEditorDebugModeEnabled, useIsEditorReadModeEnabled, useIsExternalControlsEnabled, useIsExternalPackagesEnabled, useIsExternalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, useIsLocalDrivesEnabled, useIsPublicDrivesEnabled, useIsRelationalProcessorsEnabled, useIsSentryTracingEnabled, useLoading, useLocalDrivesEnabled, useLogLevel, useLoginStatus, useModelRegistry, useNodeActions, useNodeById, useNodeParentFolderById, useNodePathById, useNodesInSelectedDrive, useNodesInSelectedDriveOrFolder, useNodesInSelectedFolder, useOnDropFile, usePGlite, usePHAppConfigByKey, usePHDocumentEditorConfigByKey, usePHGlobalConfigByKey, usePHModal, usePHToast, usePackageDiscoveryService, useParentFolderForSelectedNode, useReactorClient, useReactorClientModule, useRelationalDb, useRelationalQuery, useRelationalQueryOptions, useRenown, useRenownAuth, useRenownChainId, useRenownInit, useRenownNetworkId, useRenownUrl, useRequiresHardRefresh, useResetPHGlobalConfig, useRevisionHistoryVisible, useRouterBasename, useSelectedDocument, useSelectedDocumentId, useSelectedDocumentOfType, useSelectedDocumentSafe, useSelectedDrive, useSelectedDriveId, useSelectedDriveSafe, useSelectedFolder, useSelectedNode, useSelectedNodePath, useSelectedTimelineItem, useSelectedTimelineRevision, useSentryDsn, useSentryEnv, useSentryRelease, useSetDefaultPHGlobalConfig, useSetPHAppConfig, useSetPHDocumentEditorConfig, useSetPHGlobalConfig, useStudioMode, useSubgraphModules, useSupportedDocumentTypesInReactor, useSync, useSyncList, useTheme, useUser, useUserPermissions, useVersion, useVersionCheckInterval, useVetraPackageManager, useVetraPackages, useWarnOutdatedApp, validateDocument, waitForDocumentReady };
1752
+ export { ActionTracker, AddPHGlobalEventHandler, BaseStorage, BrowserLocalStorage, BrowserReactorClientModule, BrowserReactorModule, COMMON_PACKAGE_ID, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChannelScheme, ChevronDownIcon, ConflictError, type ConflictInfo, ConflictResolution, type ConflictStrategy, type ConnectionState, type ConnectionStateSnapshot, CopyIcon, CreateStoreOptions, DEFAULT_DRIVE_EDITOR_ID, DEFAULT_DRIVE_ID, DEFAULT_SWITCHBOARD_URL, DOMAIN_TYPE, DRIVE_DOCUMENT_TYPES, type Database, DisconnectIcon, DiscoveryEvent, DiscoveryEventListener, DispatchFn, DocumentCache, type RemoteDocumentChangeEvent as DocumentChangeEvent, type DocumentChangeListener, DocumentChangeType, DocumentDispatch, DocumentIntegrityService, DocumentTypeIcon, DraggingNode, DriveCollectionId, DriveSystemInfoState, EDITOR_FILE_DROP_OPT_OUT_ATTR, FailedInstallation, FailedInstallationReason, FileUploadProgress, FileUploadProgressCallback, FulfilledPromise, FullPHGlobalConfig, type GetDocumentResult, type GetDocumentWithOperationsResult, type GetOperationsResult, GqlRequestChannel, GraphQLClientDocumentCache, GraphQLClientDocumentEvent, GraphQLClientDocumentsEvent, GraphQLClientWindowEvents, GraphQLDocumentEventOperationName, GraphQLDocumentEvents, GraphQLDocumentEventsOperationName, GraphQLDocumentsEvents, type IChannel, IDocumentCache, type IDocumentModelLoader, IPackageDiscoveryService, IPackageListerUnsubscribe, IPackageManager, IPackagesListener, type IProcessor, type IProcessorHostModule, type IQueue, type IReactorClient, IReactorProcessorHostModule, type IRelationalDb, type IRemoteClient, type IRemoteController, ISSUER_TYPE, IStorage, InMemoryQueue, IntervalPollTimer, type Job, type JwtHandler, type KeyframeValidationIssue, LOADING, type MergeHandler, NodeKind, type OperationWithContext, PHAnalyticsGlobalConfig, PHAppConfig, PHAppConfigHooks, PHAppConfigKey, PHAppConfigSetters, PHCommonGlobalConfig, PHDocumentEditorConfig, PHDocumentEditorConfigHooks, PHDocumentEditorConfigKey, PHDocumentEditorConfigSetters, PHDrivesGlobalConfig, PHGlobal, PHGlobalConfig, PHGlobalConfigHooks, PHGlobalConfigHooksForKey, PHGlobalConfigKey, PHGlobalConfigSetters, PHGlobalConfigSettersForKey, PHGlobalEventHandlerAdders, PHGlobalKey, PHGlobalValue, PHModal, PHProcessorsGlobalConfig, PHRelationalProcessorsGlobalConfig, PHRenownGlobalConfig, PHSentryGlobalConfig, PHToastFn, PHToastOptions, PHToastType, PackageManagerInstallResult, type ParsedDriveUrl, PendingInstallation, PollBehavior, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorRecord, PromiseState, PromiseWithState, PropagationMode, PublishEvent, type PushResult, QueryCallbackReturnType, REACTOR_SCHEMA, RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL, ReactorBuilder, ReactorClientBuilder, ReactorDefaultDrivesConfig, ReactorGraphQLClient, type RebuildResult, RefreshReactorDataConfig, RegistryClient, RejectedPromise, RelationalDbProcessor, RelationalDbWithLive, type Remote, RemoteClient, type RemoteControllerGraphQLClient, type RemoteControllerOptions, RemoteDocumentController, type RemoteDocumentControllerWith, type RemoteDocumentData, type RemoteFilter, type RemoteMeta, type RemoteOperation, type RemoteOperationResultPage, Renown, RenownAuth, RenownAuthButton, RenownAuthButtonProps, RenownAuthStatus, RenownInitOptions, RenownLoginButton, RenownLoginButtonProps, RenownLogo, RenownProps, RenownUserButton, RenownUserButtonMenuItem, RenownUserButtonProps, SetEvent, SetPHGlobalValue, type SignerConfig, type SnapshotValidationIssue, SpinnerIcon, type SyncOperation, SyncOperationStatus, type SyncStatus, TStateSchemaZodObject, TimelineBarItem, TimelineDividerItem, TimelineItem, type TrackedAction, UISyncStatus, UploadStatus, UseAttachmentUploadReturn, UseDispatchResult, UseEditorFileDropOptions, UseEditorFileDropResult, UseOnDropFile, UsePHGlobalValue, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, type ValidationResult, WorkerReactorClientModule, WorkerReactorModule, addAllowListEventHandler, addAllowedDocumentTypesEventHandler, addAnalyticsDatabaseNameEventHandler, addAttachmentServiceEventHandler, addBasePathEventHandler, addCliVersionEventHandler, addDefaultDrivesUrlEventHandler, addDisabledEditorsEventHandler, addDocument, addDocumentCacheEventHandler, addDraggingNodeEventHandler, addDrive, addDrivesEventHandler, addDrivesPreserveStrategyEventHandler, addEnabledEditorsEventHandler, addFeaturesEventHandler, addFileUploadOperationsChunkSizeEventHandler, addFolder, addGaTrackingIdEventHandler, addGraphQLReactorClientEventHandler, addIsAddCloudDrivesEnabledEventHandler, addIsAddDriveEnabledEventHandler, addIsAddLocalDrivesEnabledEventHandler, addIsAddPublicDrivesEnabledEventHandler, addIsAnalyticsDatabaseWorkerEnabledEventHandler, addIsAnalyticsEnabledEventHandler, addIsAnalyticsExternalProcessorsEnabledEventHandler, addIsCloudDrivesEnabledEventHandler, addIsDeleteCloudDrivesEnabledEventHandler, addIsDeleteLocalDrivesEnabledEventHandler, addIsDeletePublicDrivesEnabledEventHandler, addIsDiffAnalyticsEnabledEventHandler, addIsDocumentModelSelectionSettingsEnabledEventHandler, addIsDragAndDropEnabledEventHandler, addIsDriveAnalyticsEnabledEventHandler, addIsEditorDebugModeEnabledEventHandler, addIsEditorReadModeEnabledEventHandler, addIsExternalControlsEnabledEventHandler, addIsExternalPackagesEnabledEventHandler, addIsExternalProcessorsEnabledEventHandler, addIsExternalRelationalProcessorsEnabledEventHandler, addIsLocalDrivesEnabledEventHandler, addIsPublicDrivesEnabledEventHandler, addIsRelationalProcessorsEnabledEventHandler, addIsSentryTracingEnabledEventHandler, addLoadingEventHandler, addLocalDrivesEnabledEventHandler, addLogLevelEventHandler, addModalEventHandler, addPHEventHandlers, addPackageDiscoveryServiceEventHandler, addPromiseState, addReactorClientEventHandler, addReactorClientModuleEventHandler, addRemoteDrive, addRenownChainIdEventHandler, addRenownEventHandler, addRenownNetworkIdEventHandler, addRenownUrlEventHandler, addRequiresHardRefreshEventHandler, addResetSelectedNodeEventHandler, addRevisionHistoryVisibleEventHandler, addRouterBasenameEventHandler, addSelectedDriveIdEventHandler, addSelectedNodeIdEventHandler, addSelectedTimelineItemEventHandler, addSelectedTimelineRevisionEventHandler, addSentryDsnEventHandler, addSentryEnvEventHandler, addSentryReleaseEventHandler, addSetSelectedDriveOnPopStateEventHandler, addSetSelectedNodeOnPopStateEventHandler, addStudioModeEventHandler, addToastEventHandler, addVersionCheckIntervalEventHandler, addVersionEventHandler, addVetraPackageManagerEventHandler, addWarnOutdatedAppEventHandler, baseDocumentModels, baseDocumentModelsMap, buildDocumentSubgraphQuery, buildDocumentSubgraphUrl, callEventHandlerRegisterFunctions, callGlobalSetterForKey, clearGlobal, closePHModal, commonGlobalEventHandlerFunctions, convertRemoteOperations, createAnalyticsStore, createClient, createProcessorQuery, createUrlWithPreservedParams, deleteDrive, deleteNode, deriveSystemUrl, dispatchActions, downloadDocument, driveIdFromUrl, dropAllReactorStorage, exportFile, extractDriveIdFromPath, extractDriveIdFromSlug, extractDriveSlugFromPath, extractNodeIdFromPath, extractNodeIdFromSlug, extractNodeSlugFromPath, findUuid, getAnalyticsStore, getDocumentGraphqlQuery, getDriveIdBySlug, getDrives, getGlobal, getPackages, getPackagesByDocumentType, getPathWithoutBase, getRevisionFromDate, getSlugFromDriveUrl, getSwitchboardGatewayUrlFromDriveUrl, getSyncStatus, getSyncStatusSync, getUserPermissions, graphqlDocumentEvents, graphqlDocumentsEvents, graphqlEventsToSyncDrive, hideRevisionHistory, identifierFromMutateDocumentOperationVariables, initConnectCrypto, initRenownCrypto, initTheme, isDocumentTypeSupported, isDriveAuthError, isExternalControlsEnabledEventFunctions, isFileNodeKind, isFolderNodeKind, loading, login, logout, makeDriveUrlComponent, makeNodeSlug, makePHEventFunctions, openRenown, parseDriveUrl, phAppConfigHooks, phAppConfigSetters, phDocumentEditorConfigHooks, phDocumentEditorConfigSetters, phDocumentFromQuery, phDocumentsFromQuery, phGlobalConfigHooks, phGlobalConfigSetters, reactorGraphqlBatchFetchDocuments, reactorGraphqlCreateDocument, reactorGraphqlDeleteDocument, reactorGraphqlDeleteDocuments, reactorGraphqlFetchDocument, reactorGraphqlMutateDocument, readPromiseState, refreshReactorData, refreshReactorDataClient, renameDrive, renameDriveNode, resolveUrlPathname, setAllowList, setAllowedDocumentTypes, setAnalyticsDatabaseName, setAttachmentService, setBasePath, setCliVersion, setDefaultDrivesUrl, setDefaultPHGlobalConfig, setDisabledEditors, setDocumentCache, setDriveAvailableOffline, setDriveMetadata, setDriveSharingType, setDrives, setDrivesPreserveStrategy, setEnabledEditors, setFeatures, setFileUploadOperationsChunkSize, setGaTrackingId, setGlobal, setGraphQLReactorClient, setIsAddCloudDrivesEnabled, setIsAddDriveEnabled, setIsAddLocalDrivesEnabled, setIsAddPublicDrivesEnabled, setIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsEnabled, setIsAnalyticsExternalProcessorsEnabled, setIsCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, setIsDeleteLocalDrivesEnabled, setIsDeletePublicDrivesEnabled, setIsDiffAnalyticsEnabled, setIsDocumentModelSelectionSettingsEnabled, setIsDragAndDropEnabled, setIsDriveAnalyticsEnabled, setIsEditorDebugModeEnabled, setIsEditorReadModeEnabled, setIsExternalControlsEnabled, setIsExternalPackagesEnabled, setIsExternalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, setIsLocalDrivesEnabled, setIsPublicDrivesEnabled, setIsRelationalProcessorsEnabled, setIsSentryTracingEnabled, setLoading, setLocalDrivesEnabled, setLogLevel, setPGliteDB, setPHAppConfig, setPHAppConfigByKey, setPHDocumentEditorConfig, setPHDocumentEditorConfigByKey, setPHGlobalConfig, setPHGlobalConfigByKey, setPHModal, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setRenownChainId, setRenownNetworkId, setRenownUrl, setRequiresHardRefresh, setRevisionHistoryVisible, setRouterBasename, setSelectedDrive, setSelectedDriveId, setSelectedNode, setSelectedTimelineItem, setSelectedTimelineRevision, setSentryDsn, setSentryEnv, setSentryRelease, setStudioMode, setVersion, setVersionCheckInterval, setVetraPackageManager, setWarnOutdatedApp, showCreateDocumentModal, showDeleteNodeModal, showPHModal, showRevisionHistory, sortNodesByName, trimTrailingSlash, truncateAllTables, useAllowList, useAllowedDocumentModelModules, useAllowedDocumentTypes, useAnalyticsDatabaseName, useAppModuleById, useAppModules, useAttachmentService, useAttachmentUpload, useAttachments, useBasePath, useCliVersion, useConnectionState, useConnectionStates, useDatabase, useDefaultAppModule, useDefaultDrivesUrl, useDid, useDisabledEditors, useDispatch, useDocument, useDocumentById, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOfType, useDocumentOperations, useDocumentSafe, useDocumentTypes, useDocumentTypesInSelectedDrive, useDocuments, useDocumentsByIds, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDownloadDocument, useDragNode, useDriveById, useDriveSystemInfo, useDrives, useDrivesPreserveStrategy, useDropFile, useDropNode, useEditorFileDrop, useEditorModuleById, useEditorModules, useEditorModulesForDocumentType, useEnabledEditors, useFallbackEditorModule, useFeatures, useFileNodesInSelectedDrive, useFileNodesInSelectedFolder, useFileUploadOperationsChunkSize, useFolderById, useFolderNodesInSelectedDrive, useFolderNodesInSelectedFolder, useGaTrackingId, useGetDocument, useGetDocumentAsync, useGetDocuments, useGetSwitchboardLink, useGraphQLReactorClient, useInitReactorGraphqlClient, useIsAddCloudDrivesEnabled, useIsAddDriveEnabled, useIsAddLocalDrivesEnabled, useIsAddPublicDrivesEnabled, useIsAnalyticsDatabaseWorkerEnabled, useIsAnalyticsEnabled, useIsAnalyticsExternalProcessorsEnabled, useIsCloudDrivesEnabled, useIsDeleteCloudDrivesEnabled, useIsDeleteLocalDrivesEnabled, useIsDeletePublicDrivesEnabled, useIsDiffAnalyticsEnabled, useIsDocumentModelSelectionSettingsEnabled, useIsDragAndDropEnabled, useIsDriveAnalyticsEnabled, useIsEditorDebugModeEnabled, useIsEditorReadModeEnabled, useIsExternalControlsEnabled, useIsExternalPackagesEnabled, useIsExternalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, useIsLocalDrivesEnabled, useIsPublicDrivesEnabled, useIsRelationalProcessorsEnabled, useIsSentryTracingEnabled, useLoading, useLocalDrivesEnabled, useLogLevel, useLoginStatus, useModelRegistry, useNodeActions, useNodeById, useNodeParentFolderById, useNodePathById, useNodesInSelectedDrive, useNodesInSelectedDriveOrFolder, useNodesInSelectedFolder, useOnDropFile, usePGlite, usePHAppConfigByKey, usePHDocumentEditorConfigByKey, usePHGlobalConfigByKey, usePHModal, usePHToast, usePackageDiscoveryService, useParentFolderForSelectedNode, useReactorClient, useReactorClientModule, useRelationalDb, useRelationalQuery, useRelationalQueryOptions, useRenown, useRenownAuth, useRenownChainId, useRenownInit, useRenownNetworkId, useRenownUrl, useRequiresHardRefresh, useResetPHGlobalConfig, useRevisionHistoryVisible, useRouterBasename, useSelectedDocument, useSelectedDocumentId, useSelectedDocumentOfType, useSelectedDocumentSafe, useSelectedDrive, useSelectedDriveId, useSelectedDriveSafe, useSelectedFolder, useSelectedNode, useSelectedNodePath, useSelectedTimelineItem, useSelectedTimelineRevision, useSentryDsn, useSentryEnv, useSentryRelease, useSetDefaultPHGlobalConfig, useSetPHAppConfig, useSetPHDocumentEditorConfig, useSetPHGlobalConfig, useStudioMode, useSubgraphModules, useSupportedDocumentTypesInReactor, useSync, useSyncList, useTheme, useUser, useUserPermissions, useVersion, useVersionCheckInterval, useVetraPackageManager, useVetraPackages, useWarnOutdatedApp, validateDocument, waitForDocumentReady };
1731
1753
  //# sourceMappingURL=index.d.ts.map