@powerhousedao/reactor-browser 6.2.3-dev.24 → 6.2.3-dev.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attachment-service-cIdRZcTa.d.ts → attachment-service-ZjvRT9u7.d.ts} +67 -53
- package/dist/attachment-service-ZjvRT9u7.d.ts.map +1 -0
- package/dist/{client-CxJD0Ck2.d.ts → client-BAb4EAbM.d.ts} +3 -3
- package/dist/client-BAb4EAbM.d.ts.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-BiJAJ9dW.js} +1 -1
- package/dist/{client-DjK30EQ-.js.map → client-BiJAJ9dW.js.map} +1 -1
- package/dist/{client-D4bkR4pH.js → client-C-y8-2iK.js} +15 -12
- package/dist/{client-D4bkR4pH.js.map → client-C-y8-2iK.js.map} +1 -1
- package/dist/{document-by-id-DgdUGMVm.js → dispatch-DDynSeBk.js} +13 -21
- package/dist/dispatch-DDynSeBk.js.map +1 -0
- package/dist/document-by-id-DFdjM023.js +16 -0
- package/dist/document-by-id-DFdjM023.js.map +1 -0
- package/dist/{document-model-modules-D1ZEoGjN.js → document-model-modules-gE3Yh6Na.js} +14 -59
- package/dist/document-model-modules-gE3Yh6Na.js.map +1 -0
- package/dist/{document-operations-DhrcpXMf.js → document-operations-CwA7L3ef.js} +22 -19
- package/dist/document-operations-CwA7L3ef.js.map +1 -0
- package/dist/{global-BGoyNc1s.d.ts → global-B8m-7kiK.d.ts} +22 -15
- package/dist/global-B8m-7kiK.d.ts.map +1 -0
- package/dist/{index-DrgDweMA.d.ts → index-ERZ7o77d.d.ts} +19 -98
- package/dist/index-ERZ7o77d.d.ts.map +1 -0
- package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
- package/dist/index-rtDmzViP.d.ts.map +1 -0
- package/dist/index.d.ts +361 -361
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -23
- package/dist/index.js.map +1 -1
- package/dist/{inspector-proxy-6h5VKAwt.d.ts → inspector-proxy-B2qjCMEv.d.ts} +9 -4
- package/dist/inspector-proxy-B2qjCMEv.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-FzpvQtj6.js} +1 -1
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-FzpvQtj6.js.map} +1 -1
- package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
- package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
- package/dist/{relational-D1RB45sA.js → relational-ChC_AWAK.js} +3 -2
- package/dist/{relational-D1RB45sA.js.map → relational-ChC_AWAK.js.map} +1 -1
- package/dist/{renown-rqK8sokh.js → renown-C9pYZRqf.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-C9pYZRqf.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-Def5iO8k.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-Def5iO8k.js.map} +1 -1
- package/dist/src/ai/index.d.ts +50 -61
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +5 -8
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/analytics/index.d.ts +36 -44
- package/dist/src/analytics/index.d.ts.map +1 -1
- package/dist/src/analytics/index.js +2 -2
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/document-model.d.ts +3 -4
- package/dist/src/document-model.d.ts.map +1 -1
- package/dist/src/document-model.js.map +1 -1
- package/dist/src/graphql/client.d.ts +4 -3
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +5 -4
- package/dist/src/graphql-client/entry.js +3 -3
- package/dist/src/relational/index.d.ts +8 -9
- package/dist/src/relational/index.d.ts.map +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +3 -2
- package/dist/src/renown/index.js +2 -2
- package/dist/src/rpc/index.d.ts +31 -30
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +5 -3
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
- package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
- package/dist/{switchboard-BEiFkv9K.js → switchboard-CXYzj-et.js} +58 -6
- package/dist/switchboard-CXYzj-et.js.map +1 -0
- package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
- package/dist/types-520nWrB3.d.ts.map +1 -0
- package/dist/{types-N3Jy6Nry.d.ts → types-BCB-z7MN.d.ts} +17 -9
- package/dist/types-BCB-z7MN.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/attachment-service-cIdRZcTa.d.ts.map +0 -1
- package/dist/client-CxJD0Ck2.d.ts.map +0 -1
- package/dist/document-by-id-DgdUGMVm.js.map +0 -1
- package/dist/document-model-modules-D1ZEoGjN.js.map +0 -1
- package/dist/document-operations-DhrcpXMf.js.map +0 -1
- package/dist/global-BGoyNc1s.d.ts.map +0 -1
- package/dist/index-BIVDXw3K.d.ts.map +0 -1
- package/dist/index-DrgDweMA.d.ts.map +0 -1
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/switchboard-BEiFkv9K.js.map +0 -1
- package/dist/types-6vDzbRRS.d.ts.map +0 -1
- package/dist/types-N3Jy6Nry.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/analytics/context.tsx","../../../src/analytics/hooks/analytics-query.ts","../../../src/analytics/hooks/timeline-items.ts","../../../src/analytics/hooks/document-timeline.ts"],"sourcesContent":["import type { AnalyticsQueryEngine } from \"@powerhousedao/analytics-engine-core\";\nimport {\n QueryClient,\n QueryClientProvider,\n useMutation,\n useQuery,\n useQueryClient,\n useSuspenseQuery,\n} from \"@tanstack/react-query\";\nimport { childLogger } from \"document-model\";\nimport type { PropsWithChildren } from \"react\";\nimport { useEffect } from \"react\";\nimport { getGlobal } from \"../global/core.js\";\nimport type { CreateStoreOptions } from \"./store.js\";\nimport { getAnalyticsStore } from \"./store.js\";\n\nconst _logger = childLogger([\"reactor-browser\", \"analytics\", \"provider\"]);\n\nconst defaultQueryClient = new QueryClient();\n\nexport const analyticsOptionsKey = [\"analytics\", \"options\"] as const;\nexport const analyticsStoreKey = [\"analytics\", \"store\"] as const;\nexport const analyticsEngineKey = [\"analytics\", \"engine\"] as const;\n\nexport function useAnalyticsStoreOptions() {\n return useQuery<CreateStoreOptions | undefined>({\n queryKey: analyticsOptionsKey,\n }).data;\n}\n\nexport function useCreateAnalyticsStore(options?: CreateStoreOptions) {\n const queryClient = useQueryClient();\n useEffect(() => {\n queryClient.setQueryDefaults(analyticsOptionsKey, {\n queryFn: () => options,\n staleTime: Infinity,\n gcTime: Infinity,\n });\n }, [queryClient, options]);\n\n return useMutation({\n mutationFn: async () => {\n const store = getAnalyticsStore();\n queryClient.setQueryDefaults(analyticsStoreKey, {\n queryFn: () => store,\n staleTime: Infinity,\n gcTime: Infinity,\n });\n return store;\n },\n });\n}\n\nexport function useAnalyticsStoreQuery(options?: CreateStoreOptions) {\n return useSuspenseQuery({\n queryKey: [analyticsStoreKey, options],\n queryFn: () => getAnalyticsStore(),\n retry: true,\n });\n}\n\nexport function useAnalyticsStore(options?: CreateStoreOptions) {\n const store = useAnalyticsStoreQuery(options);\n return store.data;\n}\n\nexport function useAnalyticsStoreAsync(options?: CreateStoreOptions) {\n return useQuery({\n queryKey: [analyticsStoreKey, options],\n queryFn: () => getAnalyticsStore(),\n retry: true,\n throwOnError: false,\n });\n}\n\ninterface BaseAnalyticsProviderProps extends PropsWithChildren {\n /**\n * Custom QueryClient instance\n * @default undefined\n */\n queryClient?: QueryClient;\n}\n\ntype AnalyticsProviderProps = BaseAnalyticsProviderProps &\n (\n | {\n options?: CreateStoreOptions;\n }\n | {\n databaseName?: string;\n }\n );\n\nfunction CreateAnalyticsStore() {\n const { mutate } = useCreateAnalyticsStore();\n\n useEffect(() => {\n mutate();\n }, []);\n\n return null;\n}\n\nexport function AnalyticsProvider({\n children,\n queryClient = defaultQueryClient,\n ..._props\n}: AnalyticsProviderProps) {\n return (\n <QueryClientProvider client={queryClient}>\n <CreateAnalyticsStore />\n {children}\n </QueryClientProvider>\n );\n}\n\nexport function useAnalyticsEngine(): AnalyticsQueryEngine | undefined {\n return useSuspenseQuery({\n queryKey: analyticsEngineKey,\n queryFn: async () => {\n const globalAnalytics = getGlobal(\"analytics\");\n if (!globalAnalytics) {\n throw new Error(\"No analytics store available\");\n }\n return (await globalAnalytics).engine;\n },\n retry: false,\n }).data;\n}\n\nexport function useAnalyticsEngineAsync() {\n return useQuery({\n queryKey: analyticsEngineKey,\n queryFn: async () => {\n const globalAnalytics = getGlobal(\"analytics\");\n if (!globalAnalytics) {\n throw new Error(\"No analytics store available\");\n }\n return (await globalAnalytics).engine;\n },\n retry: false,\n });\n}\n","import type {\n AnalyticsQuery,\n AnalyticsQueryEngine,\n AnalyticsSeries,\n AnalyticsSeriesInput,\n AnalyticsSeriesQuery,\n GroupedPeriodResults,\n IAnalyticsStore,\n} from \"@powerhousedao/analytics-engine-core\";\nimport { AnalyticsPath } from \"@powerhousedao/analytics-engine-core\";\nimport type {\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport {\n useAnalyticsEngineAsync,\n useAnalyticsStoreAsync,\n useAnalyticsStoreOptions,\n} from \"../context.js\";\nimport { getAnalyticsStore } from \"../store.js\";\n\nfunction useAnalyticsQueryWrapper<TQueryFnData = unknown, TData = TQueryFnData>(\n options: Omit<UseQueryOptions<TQueryFnData, Error, TData>, \"queryFn\"> & {\n queryFn: (analytics: {\n store: IAnalyticsStore;\n engine: AnalyticsQueryEngine;\n }) => Promise<TQueryFnData> | TQueryFnData;\n },\n) {\n const { queryFn, ...queryOptions } = options;\n const { data: store } = useAnalyticsStoreAsync();\n const { data: engine } = useAnalyticsEngineAsync();\n const enabled =\n \"enabled\" in queryOptions ? queryOptions.enabled : !!store && !!engine;\n\n return useQuery({\n ...queryOptions,\n enabled,\n queryFn: async () => {\n if (!store || !engine) {\n throw new Error(\n \"No analytics store available. Use within an AnalyticsProvider.\",\n );\n }\n return await queryFn({ store, engine });\n },\n });\n}\n\nfunction useAnalyticsMutationWrapper<TVariables, TData>(\n options: Omit<UseMutationOptions<TData, Error, TVariables>, \"mutationFn\"> & {\n mutationFn: (\n variables: TVariables,\n context: {\n store: IAnalyticsStore;\n },\n ) => Promise<TData> | TData;\n },\n) {\n const { mutationFn, ...mutationOptions } = options;\n const _storeOptions = useAnalyticsStoreOptions();\n\n return useMutation({\n ...mutationOptions,\n mutationFn: async (value: TVariables) => {\n let store: IAnalyticsStore | null = null;\n try {\n store = await getAnalyticsStore();\n } catch (e) {\n console.error(e);\n }\n\n if (!store) {\n throw new Error(\n \"No analytics store available. Use within an AnalyticsProvider.\",\n );\n }\n return await mutationFn(value, { store });\n },\n });\n}\n\nexport type UseAnalyticsQueryOptions<TData = GroupedPeriodResults> = Omit<\n UseQueryOptions<GroupedPeriodResults, Error, TData>,\n \"queryKey\" | \"queryFn\"\n> & {\n sources?: AnalyticsPath[];\n};\n\nexport type UseAnalyticsQueryResult<TData = GroupedPeriodResults> =\n UseQueryResult<TData>;\n\nconst DEBOUNCE_INTERVAL = 200;\n\nexport function useAnalyticsQuery<TData = GroupedPeriodResults>(\n query: AnalyticsQuery,\n options?: UseAnalyticsQueryOptions<TData>,\n): UseAnalyticsQueryResult<TData> {\n const { data: store } = useAnalyticsStoreAsync();\n const queryClient = useQueryClient();\n const sources = options?.sources ?? [];\n\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"query\", query],\n queryFn: ({ engine }) => engine.execute(query),\n ...options,\n });\n\n useEffect(() => {\n if (!sources.length || !store) {\n return;\n }\n\n const subscriptions = new Array<() => void>();\n // Debounce invalidateQueries so it's not called too frequently\n let invalidateTimeout: ReturnType<typeof setTimeout> | null = null;\n const debouncedInvalidate = () => {\n if (invalidateTimeout) clearTimeout(invalidateTimeout);\n invalidateTimeout = setTimeout(() => {\n queryClient\n .invalidateQueries({\n queryKey: [\"analytics\", \"query\", query],\n })\n .catch((e) => {\n console.error(e);\n });\n }, DEBOUNCE_INTERVAL);\n };\n\n sources.forEach((path) => {\n const unsub = store.subscribeToSource(path, debouncedInvalidate);\n subscriptions.push(unsub);\n });\n\n // Unsubscribes from store when component unmounts or dependencies change\n return () => {\n subscriptions.forEach((unsub) => unsub());\n };\n }, [query, store, sources]);\n\n return result;\n}\n\nexport type UseAnalyticsSeriesOptions = Omit<\n UseQueryOptions<AnalyticsSeries[], Error, AnalyticsSeries[]>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useAnalyticsSeries(\n query: AnalyticsSeriesQuery,\n options?: UseAnalyticsSeriesOptions,\n) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"series\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n}\n\nexport type UseAddSeriesValueOptions = Omit<\n UseMutationOptions<void, Error, AnalyticsSeriesInput>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useAddSeriesValue(options?: UseAddSeriesValueOptions) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeries\"],\n mutationFn: async (value, { store }) => {\n return await store.addSeriesValue(value);\n },\n ...options,\n });\n}\n\nexport type UseClearSeriesBySourceOptions = Omit<\n UseMutationOptions<\n number,\n Error,\n { source: AnalyticsPath; cleanUpDimensions?: boolean }\n >,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useClearSeriesBySource(\n options?: UseClearSeriesBySourceOptions,\n) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearSeries\"],\n mutationFn: async ({ source, cleanUpDimensions }, { store }) => {\n return store.clearSeriesBySource(source, cleanUpDimensions);\n },\n ...options,\n });\n}\n\nexport type UseClearEmptyAnalyticsDimensionsOptions = Omit<\n UseMutationOptions<number>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useClearEmptyAnalyticsDimensions(\n options?: UseClearEmptyAnalyticsDimensionsOptions,\n) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearEmptyDimensions\"],\n mutationFn: async (_, { store }) => {\n return store.clearEmptyAnalyticsDimensions();\n },\n ...options,\n });\n}\n\nexport type UseAddSeriesValuesOptions = Omit<\n UseMutationOptions<void, Error, AnalyticsSeriesInput[]>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useAddSeriesValues(options?: UseAddSeriesValuesOptions) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeriesValues\"],\n mutationFn: async (values, { store }) => {\n return store.addSeriesValues(values);\n },\n ...options,\n });\n}\n\nexport type UseGetDimensionsOptions<TData> = Omit<\n UseQueryOptions<any, Error, TData>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useGetDimensions<TData = any>(\n options?: UseGetDimensionsOptions<TData>,\n) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"dimensions\"],\n queryFn: ({ store }) => store.getDimensions(),\n ...options,\n });\n}\n\nexport type UseMatchingSeriesOptions = Omit<\n UseQueryOptions<AnalyticsSeries[], Error, AnalyticsSeries[]>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useMatchingSeries(\n query: AnalyticsSeriesQuery,\n options?: UseMatchingSeriesOptions,\n) {\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"matchingSeries\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n\n return result;\n}\n\nexport type UseQuerySourcesOptions = Omit<\n UseQueryOptions<AnalyticsPath[] | undefined>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useQuerySources(\n query: AnalyticsSeriesQuery,\n options?: UseQuerySourcesOptions,\n) {\n const { data: matchingSeries } = useMatchingSeries(query);\n\n return useQuery({\n queryKey: [\"analytics\", \"sources\", query],\n queryFn: () => {\n if (!matchingSeries?.length) {\n return [];\n }\n const uniqueSources = [\n ...new Set(matchingSeries.map((s) => s.source.toString())),\n ];\n return uniqueSources.map((source) => AnalyticsPath.fromString(source));\n },\n enabled: !!matchingSeries,\n ...options,\n });\n}\n","import type { GroupedPeriodResults } from \"@powerhousedao/analytics-engine-core\";\nimport {\n AnalyticsGranularity,\n AnalyticsPath,\n} from \"@powerhousedao/analytics-engine-core\";\nimport { DateTime } from \"luxon\";\nimport type { UseAnalyticsQueryResult } from \"./analytics-query.js\";\nimport { useAnalyticsQuery } from \"./analytics-query.js\";\n\nconst getBarSize = (value: number) => {\n if (value <= 0) return 0;\n if (value > 0 && value <= 50) return 1;\n if (value > 50 && value <= 100) return 2;\n if (value > 100 && value <= 250) return 3;\n return 4;\n};\n\n// Define types for our timeline items\ntype BarItem = {\n id: string;\n type: \"bar\";\n addSize: 0 | 1 | 2 | 3 | 4;\n delSize: 0 | 1 | 2 | 3 | 4;\n additions: number;\n deletions: number;\n timestampUtcMs: string;\n startDate: Date;\n endDate: Date;\n revision?: number;\n};\n\ntype DividerItem = {\n id: string;\n type: \"divider\";\n revision?: number;\n startDate?: Date;\n endDate?: Date;\n};\n\ntype TimelineItem = BarItem | DividerItem;\n\nfunction addItemsDividers(items: BarItem[]): TimelineItem[] {\n if (!items.length) return [];\n\n const result: TimelineItem[] = [];\n items.forEach((item, index) => {\n result.push(item);\n\n // Check if there's a next item and if they're not in consecutive hours\n if (index < items.length - 1) {\n const currentDate = new Date(item.startDate);\n const nextDate = new Date(items[index + 1].startDate);\n\n const currentHour = currentDate.getHours();\n const nextHour = nextDate.getHours();\n\n // Get day parts (without time) for comparison\n const currentDay = currentDate.toDateString();\n const nextDay = nextDate.toDateString();\n\n // If different days or non-consecutive hours on the same day\n if (\n currentDay !== nextDay ||\n (currentDay === nextDay && Math.abs(nextHour - currentHour) > 1)\n ) {\n result.push({\n id: `divider-${item.id}-${items[index + 1].id}`,\n type: \"divider\" as const,\n revision: 0,\n });\n }\n }\n });\n\n return result;\n}\n\nfunction metricsToItems(metrics: GroupedPeriodResults): TimelineItem[] {\n if (!metrics) return [];\n\n const items = metrics\n .sort((a, b) => {\n const aDate = new Date(a.start as unknown as Date);\n const bDate = new Date(b.start as unknown as Date);\n return aDate.getTime() - bDate.getTime();\n })\n .filter((result) => {\n return result.rows.every((row) => row.value > 0);\n })\n .map((result) => {\n const { additions, deletions } = result.rows.reduce(\n (acc, row) => {\n if (\n (row.dimensions.changes.path as unknown as string) ===\n \"ph/diff/changes/add\"\n ) {\n acc.additions += row.value;\n } else if (\n (row.dimensions.changes.path as unknown as string) ===\n \"ph/diff/changes/remove\"\n ) {\n acc.deletions += row.value;\n }\n return acc;\n },\n { additions: 0, deletions: 0 },\n );\n\n const startDate = new Date(result.start as unknown as Date);\n\n return {\n id: startDate.toISOString(),\n type: \"bar\" as const,\n addSize: getBarSize(additions),\n delSize: getBarSize(deletions),\n additions,\n deletions,\n timestampUtcMs: startDate.toISOString(),\n startDate: startDate,\n endDate: new Date(result.end as unknown as Date),\n revision: 0,\n } as const;\n });\n\n return addItemsDividers(items);\n}\n\nexport type UseTimelineItemsResult = UseAnalyticsQueryResult<TimelineItem[]>;\n\nexport const useTimelineItems = (\n documentId?: string,\n startTimestamp?: string,\n driveId?: string,\n): UseTimelineItemsResult => {\n const start = startTimestamp\n ? DateTime.fromISO(startTimestamp)\n : DateTime.now().startOf(\"day\");\n\n return useAnalyticsQuery<TimelineItem[]>(\n {\n start,\n end: DateTime.now().endOf(\"day\"),\n granularity: AnalyticsGranularity.Hourly,\n metrics: [\"Count\"],\n select: {\n changes: [AnalyticsPath.fromString(`ph/diff/changes`)],\n document: [AnalyticsPath.fromString(`ph/diff/document/${documentId}`)],\n },\n lod: {\n changes: 4,\n },\n },\n {\n sources: [AnalyticsPath.fromString(`ph/diff/${driveId}/${documentId}`)],\n select: metricsToItems,\n },\n );\n};\n","import { useDocumentById } from \"../../hooks/document-by-id.js\";\nimport { useTimelineItems } from \"./timeline-items.js\";\n\nexport function useDocumentTimeline(documentId?: string) {\n const [document] = useDocumentById(documentId);\n\n const id = document?.header.id;\n const createdAt = document?.header.createdAtUtcIso;\n const timelineItems = useTimelineItems(id, createdAt);\n\n return timelineItems.data || [];\n}\n"],"mappings":";;;;;;;;;AAgBgB,YAAY;CAAC;CAAmB;CAAa;CAAW,CAAC;AAEzE,MAAM,qBAAqB,IAAI,aAAa;AAE5C,MAAa,sBAAsB,CAAC,aAAa,UAAU;AAC3D,MAAa,oBAAoB,CAAC,aAAa,QAAQ;AACvD,MAAa,qBAAqB,CAAC,aAAa,SAAS;AAEzD,SAAgB,2BAA2B;AACzC,QAAO,SAAyC,EAC9C,UAAU,qBACX,CAAC,CAAC;;AAGL,SAAgB,wBAAwB,SAA8B;CACpE,MAAM,cAAc,gBAAgB;AACpC,iBAAgB;AACd,cAAY,iBAAiB,qBAAqB;GAChD,eAAe;GACf,WAAW;GACX,QAAQ;GACT,CAAC;IACD,CAAC,aAAa,QAAQ,CAAC;AAE1B,QAAO,YAAY,EACjB,YAAY,YAAY;EACtB,MAAM,QAAQ,mBAAmB;AACjC,cAAY,iBAAiB,mBAAmB;GAC9C,eAAe;GACf,WAAW;GACX,QAAQ;GACT,CAAC;AACF,SAAO;IAEV,CAAC;;AAGJ,SAAgB,uBAAuB,SAA8B;AACnE,QAAO,iBAAiB;EACtB,UAAU,CAAC,mBAAmB,QAAQ;EACtC,eAAe,mBAAmB;EAClC,OAAO;EACR,CAAC;;AAGJ,SAAgB,kBAAkB,SAA8B;AAE9D,QADc,uBAAuB,QAAQ,CAChC;;AAGf,SAAgB,uBAAuB,SAA8B;AACnE,QAAO,SAAS;EACd,UAAU,CAAC,mBAAmB,QAAQ;EACtC,eAAe,mBAAmB;E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src/analytics/hooks/analytics-query.ts","../../../src/analytics/hooks/timeline-items.ts","../../../src/analytics/hooks/document-timeline.ts"],"sourcesContent":["import type { AnalyticsQueryEngine } from \"@powerhousedao/analytics-engine-core\";\nimport {\n QueryClient,\n QueryClientProvider,\n useMutation,\n useQuery,\n useQueryClient,\n useSuspenseQuery,\n} from \"@tanstack/react-query\";\nimport { childLogger } from \"document-model\";\nimport type { PropsWithChildren } from \"react\";\nimport { useEffect } from \"react\";\nimport { getGlobal } from \"../global/core.js\";\nimport type { CreateStoreOptions } from \"./store.js\";\nimport { getAnalyticsStore } from \"./store.js\";\n\nconst _logger = childLogger([\"reactor-browser\", \"analytics\", \"provider\"]);\n\nconst defaultQueryClient = new QueryClient();\n\nexport const analyticsOptionsKey = [\"analytics\", \"options\"] as const;\nexport const analyticsStoreKey = [\"analytics\", \"store\"] as const;\nexport const analyticsEngineKey = [\"analytics\", \"engine\"] as const;\n\nexport function useAnalyticsStoreOptions() {\n return useQuery<CreateStoreOptions | undefined>({\n queryKey: analyticsOptionsKey,\n }).data;\n}\n\nexport function useCreateAnalyticsStore(options?: CreateStoreOptions) {\n const queryClient = useQueryClient();\n useEffect(() => {\n queryClient.setQueryDefaults(analyticsOptionsKey, {\n queryFn: () => options,\n staleTime: Infinity,\n gcTime: Infinity,\n });\n }, [queryClient, options]);\n\n return useMutation({\n mutationFn: async () => {\n const store = getAnalyticsStore();\n queryClient.setQueryDefaults(analyticsStoreKey, {\n queryFn: () => store,\n staleTime: Infinity,\n gcTime: Infinity,\n });\n return store;\n },\n });\n}\n\nexport function useAnalyticsStoreQuery(options?: CreateStoreOptions) {\n return useSuspenseQuery({\n queryKey: [analyticsStoreKey, options],\n queryFn: () => getAnalyticsStore(),\n retry: true,\n });\n}\n\nexport function useAnalyticsStore(options?: CreateStoreOptions) {\n const store = useAnalyticsStoreQuery(options);\n return store.data;\n}\n\nexport function useAnalyticsStoreAsync(options?: CreateStoreOptions) {\n return useQuery({\n queryKey: [analyticsStoreKey, options],\n queryFn: () => getAnalyticsStore(),\n retry: true,\n throwOnError: false,\n });\n}\n\ninterface BaseAnalyticsProviderProps extends PropsWithChildren {\n /**\n * Custom QueryClient instance\n * @default undefined\n */\n queryClient?: QueryClient;\n}\n\ntype AnalyticsProviderProps = BaseAnalyticsProviderProps &\n (\n | {\n options?: CreateStoreOptions;\n }\n | {\n databaseName?: string;\n }\n );\n\nfunction CreateAnalyticsStore() {\n const { mutate } = useCreateAnalyticsStore();\n\n useEffect(() => {\n mutate();\n }, []);\n\n return null;\n}\n\nexport function AnalyticsProvider({\n children,\n queryClient = defaultQueryClient,\n ..._props\n}: AnalyticsProviderProps) {\n return (\n <QueryClientProvider client={queryClient}>\n <CreateAnalyticsStore />\n {children}\n </QueryClientProvider>\n );\n}\n\nexport function useAnalyticsEngine(): AnalyticsQueryEngine | undefined {\n return useSuspenseQuery({\n queryKey: analyticsEngineKey,\n queryFn: async () => {\n const globalAnalytics = getGlobal(\"analytics\");\n if (!globalAnalytics) {\n throw new Error(\"No analytics store available\");\n }\n return (await globalAnalytics).engine;\n },\n retry: false,\n }).data;\n}\n\nexport function useAnalyticsEngineAsync() {\n return useQuery({\n queryKey: analyticsEngineKey,\n queryFn: async () => {\n const globalAnalytics = getGlobal(\"analytics\");\n if (!globalAnalytics) {\n throw new Error(\"No analytics store available\");\n }\n return (await globalAnalytics).engine;\n },\n retry: false,\n });\n}\n","import type {\n AnalyticsQuery,\n AnalyticsQueryEngine,\n AnalyticsSeries,\n AnalyticsSeriesInput,\n AnalyticsSeriesQuery,\n GroupedPeriodResults,\n IAnalyticsStore,\n} from \"@powerhousedao/analytics-engine-core\";\nimport { AnalyticsPath } from \"@powerhousedao/analytics-engine-core\";\nimport type {\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport {\n useAnalyticsEngineAsync,\n useAnalyticsStoreAsync,\n useAnalyticsStoreOptions,\n} from \"../context.js\";\nimport { getAnalyticsStore } from \"../store.js\";\n\nfunction useAnalyticsQueryWrapper<TQueryFnData = unknown, TData = TQueryFnData>(\n options: Omit<UseQueryOptions<TQueryFnData, Error, TData>, \"queryFn\"> & {\n queryFn: (analytics: {\n store: IAnalyticsStore;\n engine: AnalyticsQueryEngine;\n }) => Promise<TQueryFnData> | TQueryFnData;\n },\n) {\n const { queryFn, ...queryOptions } = options;\n const { data: store } = useAnalyticsStoreAsync();\n const { data: engine } = useAnalyticsEngineAsync();\n const enabled =\n \"enabled\" in queryOptions ? queryOptions.enabled : !!store && !!engine;\n\n return useQuery({\n ...queryOptions,\n enabled,\n queryFn: async () => {\n if (!store || !engine) {\n throw new Error(\n \"No analytics store available. Use within an AnalyticsProvider.\",\n );\n }\n return await queryFn({ store, engine });\n },\n });\n}\n\nfunction useAnalyticsMutationWrapper<TVariables, TData>(\n options: Omit<UseMutationOptions<TData, Error, TVariables>, \"mutationFn\"> & {\n mutationFn: (\n variables: TVariables,\n context: {\n store: IAnalyticsStore;\n },\n ) => Promise<TData> | TData;\n },\n) {\n const { mutationFn, ...mutationOptions } = options;\n const _storeOptions = useAnalyticsStoreOptions();\n\n return useMutation({\n ...mutationOptions,\n mutationFn: async (value: TVariables) => {\n let store: IAnalyticsStore | null = null;\n try {\n store = await getAnalyticsStore();\n } catch (e) {\n console.error(e);\n }\n\n if (!store) {\n throw new Error(\n \"No analytics store available. Use within an AnalyticsProvider.\",\n );\n }\n return await mutationFn(value, { store });\n },\n });\n}\n\nexport type UseAnalyticsQueryOptions<TData = GroupedPeriodResults> = Omit<\n UseQueryOptions<GroupedPeriodResults, Error, TData>,\n \"queryKey\" | \"queryFn\"\n> & {\n sources?: AnalyticsPath[];\n};\n\nexport type UseAnalyticsQueryResult<TData = GroupedPeriodResults> =\n UseQueryResult<TData>;\n\nconst DEBOUNCE_INTERVAL = 200;\n\nexport function useAnalyticsQuery<TData = GroupedPeriodResults>(\n query: AnalyticsQuery,\n options?: UseAnalyticsQueryOptions<TData>,\n): UseAnalyticsQueryResult<TData> {\n const { data: store } = useAnalyticsStoreAsync();\n const queryClient = useQueryClient();\n const sources = options?.sources ?? [];\n\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"query\", query],\n queryFn: ({ engine }) => engine.execute(query),\n ...options,\n });\n\n useEffect(() => {\n if (!sources.length || !store) {\n return;\n }\n\n const subscriptions = new Array<() => void>();\n // Debounce invalidateQueries so it's not called too frequently\n let invalidateTimeout: ReturnType<typeof setTimeout> | null = null;\n const debouncedInvalidate = () => {\n if (invalidateTimeout) clearTimeout(invalidateTimeout);\n invalidateTimeout = setTimeout(() => {\n queryClient\n .invalidateQueries({\n queryKey: [\"analytics\", \"query\", query],\n })\n .catch((e) => {\n console.error(e);\n });\n }, DEBOUNCE_INTERVAL);\n };\n\n sources.forEach((path) => {\n const unsub = store.subscribeToSource(path, debouncedInvalidate);\n subscriptions.push(unsub);\n });\n\n // Unsubscribes from store when component unmounts or dependencies change\n return () => {\n subscriptions.forEach((unsub) => unsub());\n };\n }, [query, store, sources]);\n\n return result;\n}\n\nexport type UseAnalyticsSeriesOptions = Omit<\n UseQueryOptions<AnalyticsSeries[], Error, AnalyticsSeries[]>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useAnalyticsSeries(\n query: AnalyticsSeriesQuery,\n options?: UseAnalyticsSeriesOptions,\n) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"series\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n}\n\nexport type UseAddSeriesValueOptions = Omit<\n UseMutationOptions<void, Error, AnalyticsSeriesInput>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useAddSeriesValue(options?: UseAddSeriesValueOptions) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeries\"],\n mutationFn: async (value, { store }) => {\n return await store.addSeriesValue(value);\n },\n ...options,\n });\n}\n\nexport type UseClearSeriesBySourceOptions = Omit<\n UseMutationOptions<\n number,\n Error,\n { source: AnalyticsPath; cleanUpDimensions?: boolean }\n >,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useClearSeriesBySource(\n options?: UseClearSeriesBySourceOptions,\n) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearSeries\"],\n mutationFn: async ({ source, cleanUpDimensions }, { store }) => {\n return store.clearSeriesBySource(source, cleanUpDimensions);\n },\n ...options,\n });\n}\n\nexport type UseClearEmptyAnalyticsDimensionsOptions = Omit<\n UseMutationOptions<number>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useClearEmptyAnalyticsDimensions(\n options?: UseClearEmptyAnalyticsDimensionsOptions,\n) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearEmptyDimensions\"],\n mutationFn: async (_, { store }) => {\n return store.clearEmptyAnalyticsDimensions();\n },\n ...options,\n });\n}\n\nexport type UseAddSeriesValuesOptions = Omit<\n UseMutationOptions<void, Error, AnalyticsSeriesInput[]>,\n \"mutationKey\" | \"mutationFn\"\n>;\n\nexport function useAddSeriesValues(options?: UseAddSeriesValuesOptions) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeriesValues\"],\n mutationFn: async (values, { store }) => {\n return store.addSeriesValues(values);\n },\n ...options,\n });\n}\n\nexport type UseGetDimensionsOptions<TData> = Omit<\n UseQueryOptions<any, Error, TData>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useGetDimensions<TData = any>(\n options?: UseGetDimensionsOptions<TData>,\n) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"dimensions\"],\n queryFn: ({ store }) => store.getDimensions(),\n ...options,\n });\n}\n\nexport type UseMatchingSeriesOptions = Omit<\n UseQueryOptions<AnalyticsSeries[], Error, AnalyticsSeries[]>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useMatchingSeries(\n query: AnalyticsSeriesQuery,\n options?: UseMatchingSeriesOptions,\n) {\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"matchingSeries\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n\n return result;\n}\n\nexport type UseQuerySourcesOptions = Omit<\n UseQueryOptions<AnalyticsPath[] | undefined>,\n \"queryKey\" | \"queryFn\"\n>;\n\nexport function useQuerySources(\n query: AnalyticsSeriesQuery,\n options?: UseQuerySourcesOptions,\n) {\n const { data: matchingSeries } = useMatchingSeries(query);\n\n return useQuery({\n queryKey: [\"analytics\", \"sources\", query],\n queryFn: () => {\n if (!matchingSeries?.length) {\n return [];\n }\n const uniqueSources = [\n ...new Set(matchingSeries.map((s) => s.source.toString())),\n ];\n return uniqueSources.map((source) => AnalyticsPath.fromString(source));\n },\n enabled: !!matchingSeries,\n ...options,\n });\n}\n","import type { GroupedPeriodResults } from \"@powerhousedao/analytics-engine-core\";\nimport {\n AnalyticsGranularity,\n AnalyticsPath,\n} from \"@powerhousedao/analytics-engine-core\";\nimport { DateTime } from \"luxon\";\nimport type { UseAnalyticsQueryResult } from \"./analytics-query.js\";\nimport { useAnalyticsQuery } from \"./analytics-query.js\";\n\nconst getBarSize = (value: number) => {\n if (value <= 0) return 0;\n if (value > 0 && value <= 50) return 1;\n if (value > 50 && value <= 100) return 2;\n if (value > 100 && value <= 250) return 3;\n return 4;\n};\n\n// Define types for our timeline items\ntype BarItem = {\n id: string;\n type: \"bar\";\n addSize: 0 | 1 | 2 | 3 | 4;\n delSize: 0 | 1 | 2 | 3 | 4;\n additions: number;\n deletions: number;\n timestampUtcMs: string;\n startDate: Date;\n endDate: Date;\n revision?: number;\n};\n\ntype DividerItem = {\n id: string;\n type: \"divider\";\n revision?: number;\n startDate?: Date;\n endDate?: Date;\n};\n\ntype TimelineItem = BarItem | DividerItem;\n\nfunction addItemsDividers(items: BarItem[]): TimelineItem[] {\n if (!items.length) return [];\n\n const result: TimelineItem[] = [];\n items.forEach((item, index) => {\n result.push(item);\n\n // Check if there's a next item and if they're not in consecutive hours\n if (index < items.length - 1) {\n const currentDate = new Date(item.startDate);\n const nextDate = new Date(items[index + 1].startDate);\n\n const currentHour = currentDate.getHours();\n const nextHour = nextDate.getHours();\n\n // Get day parts (without time) for comparison\n const currentDay = currentDate.toDateString();\n const nextDay = nextDate.toDateString();\n\n // If different days or non-consecutive hours on the same day\n if (\n currentDay !== nextDay ||\n (currentDay === nextDay && Math.abs(nextHour - currentHour) > 1)\n ) {\n result.push({\n id: `divider-${item.id}-${items[index + 1].id}`,\n type: \"divider\" as const,\n revision: 0,\n });\n }\n }\n });\n\n return result;\n}\n\nfunction metricsToItems(metrics: GroupedPeriodResults): TimelineItem[] {\n if (!metrics) return [];\n\n const items = metrics\n .sort((a, b) => {\n const aDate = new Date(a.start as unknown as Date);\n const bDate = new Date(b.start as unknown as Date);\n return aDate.getTime() - bDate.getTime();\n })\n .filter((result) => {\n return result.rows.every((row) => row.value > 0);\n })\n .map((result) => {\n const { additions, deletions } = result.rows.reduce(\n (acc, row) => {\n if (\n (row.dimensions.changes.path as unknown as string) ===\n \"ph/diff/changes/add\"\n ) {\n acc.additions += row.value;\n } else if (\n (row.dimensions.changes.path as unknown as string) ===\n \"ph/diff/changes/remove\"\n ) {\n acc.deletions += row.value;\n }\n return acc;\n },\n { additions: 0, deletions: 0 },\n );\n\n const startDate = new Date(result.start as unknown as Date);\n\n return {\n id: startDate.toISOString(),\n type: \"bar\" as const,\n addSize: getBarSize(additions),\n delSize: getBarSize(deletions),\n additions,\n deletions,\n timestampUtcMs: startDate.toISOString(),\n startDate: startDate,\n endDate: new Date(result.end as unknown as Date),\n revision: 0,\n } as const;\n });\n\n return addItemsDividers(items);\n}\n\nexport type UseTimelineItemsResult = UseAnalyticsQueryResult<TimelineItem[]>;\n\nexport const useTimelineItems = (\n documentId?: string,\n startTimestamp?: string,\n driveId?: string,\n): UseTimelineItemsResult => {\n const start = startTimestamp\n ? DateTime.fromISO(startTimestamp)\n : DateTime.now().startOf(\"day\");\n\n return useAnalyticsQuery<TimelineItem[]>(\n {\n start,\n end: DateTime.now().endOf(\"day\"),\n granularity: AnalyticsGranularity.Hourly,\n metrics: [\"Count\"],\n select: {\n changes: [AnalyticsPath.fromString(`ph/diff/changes`)],\n document: [AnalyticsPath.fromString(`ph/diff/document/${documentId}`)],\n },\n lod: {\n changes: 4,\n },\n },\n {\n sources: [AnalyticsPath.fromString(`ph/diff/${driveId}/${documentId}`)],\n select: metricsToItems,\n },\n );\n};\n","import { useDocumentById } from \"../../hooks/document-by-id.js\";\nimport { useTimelineItems } from \"./timeline-items.js\";\n\nexport function useDocumentTimeline(documentId?: string) {\n const [document] = useDocumentById(documentId);\n\n const id = document?.header.id;\n const createdAt = document?.header.createdAtUtcIso;\n const timelineItems = useTimelineItems(id, createdAt);\n\n return timelineItems.data || [];\n}\n"],"mappings":";;;;;;;;;AAgBgB,YAAY;CAAC;CAAmB;CAAa;AAAU,CAAC;AAExE,MAAM,qBAAqB,IAAI,YAAY;AAE3C,MAAa,sBAAsB,CAAC,aAAa,SAAS;AAC1D,MAAa,oBAAoB,CAAC,aAAa,OAAO;AACtD,MAAa,qBAAqB,CAAC,aAAa,QAAQ;AAExD,SAAgB,2BAA2B;CACzC,OAAO,SAAyC,EAC9C,UAAU,oBACZ,CAAC,CAAC,CAAC;AACL;AAEA,SAAgB,wBAAwB,SAA8B;CACpE,MAAM,cAAc,eAAe;CACnC,gBAAgB;EACd,YAAY,iBAAiB,qBAAqB;GAChD,eAAe;GACf,WAAW;GACX,QAAQ;EACV,CAAC;CACH,GAAG,CAAC,aAAa,OAAO,CAAC;CAEzB,OAAO,YAAY,EACjB,YAAY,YAAY;EACtB,MAAM,QAAQ,kBAAkB;EAChC,YAAY,iBAAiB,mBAAmB;GAC9C,eAAe;GACf,WAAW;GACX,QAAQ;EACV,CAAC;EACD,OAAO;CACT,EACF,CAAC;AACH;AAEA,SAAgB,uBAAuB,SAA8B;CACnE,OAAO,iBAAiB;EACtB,UAAU,C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AAS,CAAC,cAAc,WAAW,iBAAiB,CAAC;GACrD,UAAU,CAAC,cAAc,WAAW,oBAAoB,YAAY,CAAC;EACvE;EACA,KAAK,EACH,SAAS,EACX;CACF,GACA;EACE,SAAS,CAAC,cAAc,WAAW,WAAW,QAAQ,GAAG,YAAY,CAAC;EACtE,QAAQ;CACV,CACF;AACF;;;AC1JA,SAAgB,oBAAoB,YAAqB;CACvD,MAAM,CAAC,YAAY,gBAAgB,UAAU;CAE7C,MAAM,KAAK,UAAU,OAAO;CAC5B,MAAM,YAAY,UAAU,OAAO;CAGnC,OAFsB,iBAAiB,IAAI,SAExB,CAAC,CAAC,QAAQ,CAAC;AAChC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { DocumentModelModule } from "@powerhousedao/shared/document-model";
|
|
2
|
-
|
|
3
2
|
//#region src/document-model.d.ts
|
|
4
|
-
declare const baseDocumentModelsMap: Record<string, DocumentModelModule>;
|
|
5
|
-
declare const baseDocumentModels: DocumentModelModule[];
|
|
3
|
+
export declare const baseDocumentModelsMap: Record<string, DocumentModelModule>;
|
|
4
|
+
export declare const baseDocumentModels: DocumentModelModule[];
|
|
6
5
|
//#endregion
|
|
7
|
-
export {
|
|
6
|
+
export {};
|
|
8
7
|
//# sourceMappingURL=document-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.d.ts","names":[],"sources":["../../src/document-model.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-model.d.ts","names":[],"sources":["../../src/document-model.ts"],"mappings":";;qBAKa,uBAAuB,eAAe;qBAQtC,oBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.js","names":[],"sources":["../../src/document-model.ts"],"sourcesContent":["import { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\n\nexport const baseDocumentModelsMap: Record<string, DocumentModelModule> = {\n DocumentModel:\n documentModelDocumentModelModule as unknown as DocumentModelModule,\n DocumentDrive: driveDocumentModelModule as unknown as DocumentModelModule,\n ReactorDrive:\n reactorDriveDocumentModelModule as unknown as DocumentModelModule,\n};\n\nexport const baseDocumentModels = Object.values(baseDocumentModelsMap);\n"],"mappings":";;;;AAKA,MAAa,wBAA6D;CACxE,eACE;CACF,eAAe;CACf,cACE;
|
|
1
|
+
{"version":3,"file":"document-model.js","names":[],"sources":["../../src/document-model.ts"],"sourcesContent":["import { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { driveDocumentModelModule } from \"@powerhousedao/shared/document-drive\";\nimport type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { documentModelDocumentModelModule } from \"document-model\";\n\nexport const baseDocumentModelsMap: Record<string, DocumentModelModule> = {\n DocumentModel:\n documentModelDocumentModelModule as unknown as DocumentModelModule,\n DocumentDrive: driveDocumentModelModule as unknown as DocumentModelModule,\n ReactorDrive:\n reactorDriveDocumentModelModule as unknown as DocumentModelModule,\n};\n\nexport const baseDocumentModels = Object.values(baseDocumentModelsMap);\n"],"mappings":";;;;AAKA,MAAa,wBAA6D;CACxE,eACE;CACF,eAAe;CACf,cACE;AACJ;AAEA,MAAa,qBAAqB,OAAO,OAAO,qBAAqB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { c as ReactorGraphQLClient, l as RunDocumentOptions } from "../../types-
|
|
2
|
-
import { t as createClient } from "../../client-
|
|
3
|
-
export { ReactorGraphQLClient, RunDocumentOptions, createClient };
|
|
1
|
+
import { c as ReactorGraphQLClient, l as RunDocumentOptions } from "../../types-BCB-z7MN.js";
|
|
2
|
+
import { t as createClient } from "../../client-BAb4EAbM.js";
|
|
3
|
+
export { type ReactorGraphQLClient, type RunDocumentOptions, createClient };
|
|
4
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createClient } from "../../client-
|
|
1
|
+
import { t as createClient } from "../../client-C-y8-2iK.js";
|
|
2
2
|
export { createClient };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ct as IOperationCache, lt as OperationsCacheEntry, rt as IReactorBrowserClient } from "../../global-
|
|
2
|
-
import { $ as useSwitchboardClient, A as useGetDocument, B as StaticPackageManager, Bt as isOperationCache, D as useDocumentCache, E as useDocument, F as DocumentChangesSubscriptionOptions, G as stampAction, H as resolveDocumentModelModule, I as isAuthRefusalClose, J as MutateDocumentWithOperationsVariables, K as MutateDocumentWithOperationsDocument, L as makeAuthConnectionParams, Lt as DocumentCache, M as useGetDocuments, N as ConnectionParams, O as useDocumentSafe, P as DocumentChangesEventPayload, Q as ensurePHEventHandlers, R as startDocumentChangesSubscription, Rt as IDLE_OPERATIONS_ENTRY, T as setDocumentCache, U as prepareSignedActions, V as packageFromDocumentModels, Vt as readPromiseState, W as signStampedAction, X as GraphQLReactorProvider, Y as ReactorOperationFieldsFragmentDoc, Z as GraphQLReactorProviderProps, _t as phDocumentFromMutation, a as DocumentOperationsState, at as SubgraphSdkFactory, b as useReactorClient, c as useDocumentModelModuleById, ct as describeGraphQLDocument, d as UseDispatchResult, dt as ambientRenownTokenProvider, et as GraphQLReactorClient, f as useDispatch, ft as makeAuthMiddleware, gt as phDocumentFromGetDocument, h as setReactorClient, ht as RevisionsListSelection, i as DocumentOperationsResult, it as GraphQLRequestOptions, j as useGetDocumentAsync, k as useDocuments, l as useDocumentModelModules, lt as subgraphUrlFromGraphqlUrl, mt as GetDocumentQueryResult, nt as isGraphQLReactorClient, o as UseDocumentOperationsOptions, ot as SubgraphSdkRegistry, pt as GetDocumentQueryFields, q as MutateDocumentWithOperationsResult, r as useAttachmentService, rt as viewFilterInputFromViewFilter, s as useDocumentOperations, st as TypedGraphQLDocument, tt as GraphQLReactorClientOptions, u as DispatchFn, ut as BearerTokenProvider, vt as revisionMapFromRevisionsList, z as subscriptionsUrlFromGraphqlUrl, zt as addPromiseState } from "../../attachment-service-
|
|
3
|
-
import { k as SdkFunctionWrapper } from "../../types-
|
|
4
|
-
export { BearerTokenProvider, ConnectionParams, type DispatchFn, DocumentCache, DocumentChangesEventPayload, DocumentChangesSubscriptionOptions, type DocumentOperationsResult, type DocumentOperationsState, GetDocumentQueryFields, GetDocumentQueryResult, GraphQLReactorClient, GraphQLReactorClientOptions, GraphQLReactorProvider, GraphQLReactorProviderProps, GraphQLRequestOptions, IDLE_OPERATIONS_ENTRY, type IOperationCache, type IReactorBrowserClient, MutateDocumentWithOperationsDocument, MutateDocumentWithOperationsResult, MutateDocumentWithOperationsVariables, type OperationsCacheEntry, ReactorOperationFieldsFragmentDoc, RevisionsListSelection, SdkFunctionWrapper, StaticPackageManager, SubgraphSdkFactory, SubgraphSdkRegistry, TypedGraphQLDocument, type UseDispatchResult, type UseDocumentOperationsOptions, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isAuthRefusalClose, isGraphQLReactorClient, isOperationCache, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
|
|
1
|
+
import { ct as IOperationCache, lt as OperationsCacheEntry, rt as IReactorBrowserClient } from "../../global-B8m-7kiK.js";
|
|
2
|
+
import { $ as useSwitchboardClient, A as useGetDocument, B as StaticPackageManager, Bt as isOperationCache, D as useDocumentCache, E as useDocument, F as DocumentChangesSubscriptionOptions, G as stampAction, H as resolveDocumentModelModule, I as isAuthRefusalClose, J as MutateDocumentWithOperationsVariables, K as MutateDocumentWithOperationsDocument, L as makeAuthConnectionParams, Lt as DocumentCache, M as useGetDocuments, N as ConnectionParams, O as useDocumentSafe, P as DocumentChangesEventPayload, Q as ensurePHEventHandlers, R as startDocumentChangesSubscription, Rt as IDLE_OPERATIONS_ENTRY, T as setDocumentCache, U as prepareSignedActions, V as packageFromDocumentModels, Vt as readPromiseState, W as signStampedAction, X as GraphQLReactorProvider, Y as ReactorOperationFieldsFragmentDoc, Z as GraphQLReactorProviderProps, _t as phDocumentFromMutation, a as DocumentOperationsState, at as SubgraphSdkFactory, b as useReactorClient, c as useDocumentModelModuleById, ct as describeGraphQLDocument, d as UseDispatchResult, dt as ambientRenownTokenProvider, et as GraphQLReactorClient, f as useDispatch, ft as makeAuthMiddleware, gt as phDocumentFromGetDocument, h as setReactorClient, ht as RevisionsListSelection, i as DocumentOperationsResult, it as GraphQLRequestOptions, j as useGetDocumentAsync, k as useDocuments, l as useDocumentModelModules, lt as subgraphUrlFromGraphqlUrl, mt as GetDocumentQueryResult, nt as isGraphQLReactorClient, o as UseDocumentOperationsOptions, ot as SubgraphSdkRegistry, pt as GetDocumentQueryFields, q as MutateDocumentWithOperationsResult, r as useAttachmentService, rt as viewFilterInputFromViewFilter, s as useDocumentOperations, st as TypedGraphQLDocument, tt as GraphQLReactorClientOptions, u as DispatchFn, ut as BearerTokenProvider, vt as revisionMapFromRevisionsList, z as subscriptionsUrlFromGraphqlUrl, zt as addPromiseState } from "../../attachment-service-ZjvRT9u7.js";
|
|
3
|
+
import { k as SdkFunctionWrapper } from "../../types-BCB-z7MN.js";
|
|
4
|
+
export { BearerTokenProvider, ConnectionParams, type DispatchFn, DocumentCache, DocumentChangesEventPayload, DocumentChangesSubscriptionOptions, type DocumentOperationsResult, type DocumentOperationsState, GetDocumentQueryFields, GetDocumentQueryResult, GraphQLReactorClient, GraphQLReactorClientOptions, GraphQLReactorProvider, GraphQLReactorProviderProps, GraphQLRequestOptions, IDLE_OPERATIONS_ENTRY, type IOperationCache, type IReactorBrowserClient, MutateDocumentWithOperationsDocument, MutateDocumentWithOperationsResult, MutateDocumentWithOperationsVariables, type OperationsCacheEntry, ReactorOperationFieldsFragmentDoc, RevisionsListSelection, type SdkFunctionWrapper, StaticPackageManager, SubgraphSdkFactory, SubgraphSdkRegistry, TypedGraphQLDocument, type UseDispatchResult, type UseDocumentOperationsOptions, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isAuthRefusalClose, isGraphQLReactorClient, isOperationCache, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
|
|
5
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { $r as isAuthRefusalClose, J as useAttachmentService, Qr as viewFilterInputFromViewFilter, Xr as GraphQLReactorClient, Zr as isGraphQLReactorClient, ai as subgraphUrlFromGraphqlUrl, ci as resolveDocumentModelModule, di as stampAction, ei as makeAuthConnectionParams, fi as MutateDocumentWithOperationsDocument, gi as revisionMapFromRevisionsList, hi as phDocumentFromMutation, i as useSwitchboardClient, ii as describeGraphQLDocument, k as useReactorClient, li as prepareSignedActions, mi as phDocumentFromGetDocument, n as GraphQLReactorProvider, ni as subscriptionsUrlFromGraphqlUrl, oi as StaticPackageManager, pi as ReactorOperationFieldsFragmentDoc, r as ensurePHEventHandlers, ri as SubgraphSdkRegistry, si as packageFromDocumentModels, t as useDocumentOperations, ti as startDocumentChangesSubscription, ui as signStampedAction, w as setReactorClient } from "../../document-operations-
|
|
1
|
+
import { a as useDocumentCache, c as useGetDocument, d as DocumentCache, f as IDLE_OPERATIONS_ENTRY, h as readPromiseState, i as useDocument, l as useGetDocumentAsync, m as isOperationCache, o as useDocumentSafe, p as addPromiseState, r as setDocumentCache, s as useDocuments, t as useDispatch, u as useGetDocuments } from "../../dispatch-DDynSeBk.js";
|
|
2
|
+
import { B as makeAuthMiddleware, n as useDocumentModelModules, t as useDocumentModelModuleById, z as ambientRenownTokenProvider } from "../../document-model-modules-gE3Yh6Na.js";
|
|
3
|
+
import { $r as isAuthRefusalClose, J as useAttachmentService, Qr as viewFilterInputFromViewFilter, Xr as GraphQLReactorClient, Zr as isGraphQLReactorClient, ai as subgraphUrlFromGraphqlUrl, ci as resolveDocumentModelModule, di as stampAction, ei as makeAuthConnectionParams, fi as MutateDocumentWithOperationsDocument, gi as revisionMapFromRevisionsList, hi as phDocumentFromMutation, i as useSwitchboardClient, ii as describeGraphQLDocument, k as useReactorClient, li as prepareSignedActions, mi as phDocumentFromGetDocument, n as GraphQLReactorProvider, ni as subscriptionsUrlFromGraphqlUrl, oi as StaticPackageManager, pi as ReactorOperationFieldsFragmentDoc, r as ensurePHEventHandlers, ri as SubgraphSdkRegistry, si as packageFromDocumentModels, t as useDocumentOperations, ti as startDocumentChangesSubscription, ui as signStampedAction, w as setReactorClient } from "../../document-operations-CwA7L3ef.js";
|
|
4
4
|
export { DocumentCache, GraphQLReactorClient, GraphQLReactorProvider, IDLE_OPERATIONS_ENTRY, MutateDocumentWithOperationsDocument, ReactorOperationFieldsFragmentDoc, StaticPackageManager, SubgraphSdkRegistry, addPromiseState, ambientRenownTokenProvider, describeGraphQLDocument, ensurePHEventHandlers, isAuthRefusalClose, isGraphQLReactorClient, isOperationCache, makeAuthConnectionParams, makeAuthMiddleware, packageFromDocumentModels, phDocumentFromGetDocument, phDocumentFromMutation, prepareSignedActions, readPromiseState, resolveDocumentModelModule, revisionMapFromRevisionsList, setDocumentCache, setReactorClient, signStampedAction, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, useAttachmentService, useDispatch, useDocument, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOperations, useDocumentSafe, useDocuments, useGetDocument, useGetDocumentAsync, useGetDocuments, useReactorClient, useSwitchboardClient, viewFilterInputFromViewFilter };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { n as LiveQueryResults, t as LiveNamespace } from "../../index-
|
|
1
|
+
import { n as LiveQueryResults, t as LiveNamespace } from "../../index-rtDmzViP.js";
|
|
2
2
|
import { CompiledQuery } from "kysely";
|
|
3
3
|
import { QueryCallbackReturnType as QueryCallbackReturnType$1, useRelationalQueryOptions as useRelationalQueryOptions$1 } from "@powerhousedao/reactor-browser";
|
|
4
4
|
import { IRelationalDb, IRelationalQueryBuilder, RelationalDbProcessorClass } from "@powerhousedao/shared/processors";
|
|
5
|
-
|
|
6
5
|
//#region src/relational/hooks/useRelationalDb.d.ts
|
|
7
|
-
type RelationalDbWithLive<Schema> = IRelationalDb<Schema> & {
|
|
6
|
+
export type RelationalDbWithLive<Schema> = IRelationalDb<Schema> & {
|
|
8
7
|
live: LiveNamespace;
|
|
9
8
|
};
|
|
10
9
|
interface IRelationalDbState<Schema> {
|
|
@@ -12,24 +11,24 @@ interface IRelationalDbState<Schema> {
|
|
|
12
11
|
isLoading: boolean;
|
|
13
12
|
error: Error | null;
|
|
14
13
|
}
|
|
15
|
-
declare const useRelationalDb: <Schema>() => IRelationalDbState<Schema>;
|
|
14
|
+
export declare const useRelationalDb: <Schema>() => IRelationalDbState<Schema>;
|
|
16
15
|
//#endregion
|
|
17
16
|
//#region src/relational/hooks/useRelationalQuery.d.ts
|
|
18
|
-
type QueryCallbackReturnType = {
|
|
17
|
+
export type QueryCallbackReturnType = {
|
|
19
18
|
sql: string;
|
|
20
19
|
parameters?: readonly unknown[];
|
|
21
20
|
};
|
|
22
|
-
type useRelationalQueryOptions = {
|
|
21
|
+
export type useRelationalQueryOptions = {
|
|
23
22
|
hashNamespace?: boolean;
|
|
24
23
|
};
|
|
25
|
-
declare function useRelationalQuery<Schema, T = unknown, TParams = undefined>(ProcessorClass: RelationalDbProcessorClass<Schema>, driveId: string, queryCallback: (db: IRelationalQueryBuilder<Schema>, parameters?: TParams) => QueryCallbackReturnType, parameters?: TParams, _options?: useRelationalQueryOptions): {
|
|
24
|
+
export declare function useRelationalQuery<Schema, T = unknown, TParams = undefined>(ProcessorClass: RelationalDbProcessorClass<Schema>, driveId: string, queryCallback: (db: IRelationalQueryBuilder<Schema>, parameters?: TParams) => QueryCallbackReturnType, parameters?: TParams, _options?: useRelationalQueryOptions): {
|
|
26
25
|
readonly isLoading: boolean;
|
|
27
26
|
readonly error: Error | null;
|
|
28
27
|
readonly result: LiveQueryResults<T> | null;
|
|
29
28
|
};
|
|
30
29
|
//#endregion
|
|
31
30
|
//#region src/relational/utils/createProcessorQuery.d.ts
|
|
32
|
-
declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProcessorClass<TSchema>): {
|
|
31
|
+
export declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProcessorClass<TSchema>): {
|
|
33
32
|
<TQueryBuilder extends (db: IRelationalQueryBuilder<TSchema>) => QueryCallbackReturnType$1>(driveId: string, queryCallback: TQueryBuilder): {
|
|
34
33
|
isLoading: boolean;
|
|
35
34
|
error: Error | null;
|
|
@@ -42,5 +41,5 @@ declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProce
|
|
|
42
41
|
};
|
|
43
42
|
};
|
|
44
43
|
//#endregion
|
|
45
|
-
export {
|
|
44
|
+
export {};
|
|
46
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/relational/hooks/useRelationalDb.ts","../../../src/relational/hooks/useRelationalQuery.ts","../../../src/relational/utils/createProcessorQuery.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/relational/hooks/useRelationalDb.ts","../../../src/relational/hooks/useRelationalQuery.ts","../../../src/relational/utils/createProcessorQuery.ts"],"mappings":";;;;;YAUY,qBAAqB,UAAU,cAAkB;EAC3D,MAAM;;UAGE,mBAAmB;EAC3B,IAAI,qBAAqB;EACzB;EACA,OAAO;;qBAoBI,kBAAmB,aAAW,mBAAmB;;;YC7BlD;EACV;EACA;;YAGU;EAEV;;wBAwBc,mBAAmB,QAAQ,aAAa,qBACtD,gBAAgB,2BAA2B,SAC3C,iBACA,gBACE,IAAI,wBAAwB,SAC5B,aAAa,YACV,yBACL,aAAa,SACb,WAAW;;;;;;;wBCrBG,qBAAqB,SACnC,gBAAgB,2BAA2B;GAIzC,uBACE,IAAI,wBAAwB,aACzB,2BAAuB,iBAEb,eACA;IAEf;IACA,OAAO;IACP,QAAQ,iBACN,WAAW,uBAAuB,oBAAoB,KAAK;;GAM7D,SACA,uBACE,IAAI,wBAAwB,UAC5B,YAAY,YACT,2BAAuB,iBAEb,eACA,eAAa,YAChB,SAAO,UACT;IAEV;IACA,OAAO;IACP,QAAQ,iBACN,WAAW,uBAAuB,oBAAoB,KAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from "../../relational-
|
|
1
|
+
import { n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from "../../relational-ChC_AWAK.js";
|
|
2
2
|
export { createProcessorQuery, useRelationalDb, useRelationalQuery };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { A as RENOWN_RETURN_URL_STRIPPED_PARAMS, B as UserIcon, C as CREDENTIAL_SCHEMA_EIP712_TYPE, D as ISSUER_TYPE, E as DOMAIN_TYPE, F as ChevronDownIcon, G as RenownLoginButtonProps, H as RenownUserButtonMenuItem, I as CopyIcon, K as RenownAuthButton, L as DisconnectIcon, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as initConnectCrypto, O as RENOWN_CHAIN_ID, P as initRenownCrypto, Q as useRenown, R as RenownLogo, S as useRenownInitialUser, T as CREDENTIAL_TYPES, U as RenownUserButtonProps, V as RenownUserButton, W as RenownLoginButton, _ as RENOWN_INITIAL_UNKNOWN, a as RenownWalletProviderProps, at as RenownAuthResolution, b as RenownInitialUserProviderProps, c as Renown, ct as useRenownAuthAsync, d as useRenownInit, f as RenownSessionCookieOptions, g as RENOWN_INITIAL_ANONYMOUS, h as useRenownSessionSynced, i as RenownWalletProvider, it as RenownAuthAsync, j as RENOWN_URL, k as RENOWN_NETWORK_ID, l as RenownProps, m as useRenownSessionCookie, n as RenownLoginMethod, nt as openRenown, o as RenownProvider, ot as RenownAuthStatus, p as RenownSessionCookieState, q as RenownAuthButtonProps, r as useRenownLoginMethods, rt as RenownAuth, s as RenownProviderProps, st as useRenownAuth, t as useRenownWalletAdapter, u as RenownInitOptions, v as RenownInitialAuth, w as CREDENTIAL_SUBJECT_TYPE, x as useRenownInitialAuth, y as RenownInitialUserProvider, z as SpinnerIcon } from "../../index-
|
|
2
|
-
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, Renown, RenownAuth, RenownAuthAsync, RenownAuthButton, RenownAuthButtonProps, RenownAuthResolution, RenownAuthStatus, RenownInitOptions, RenownInitialAuth, RenownInitialUserProvider, RenownInitialUserProviderProps, RenownLoginButton, RenownLoginButtonProps, RenownLoginMethod, RenownLogo, RenownProps, RenownProvider, RenownProviderProps, RenownSessionCookieOptions, RenownSessionCookieState, RenownUserButton, RenownUserButtonMenuItem, RenownUserButtonProps, RenownWalletProvider, RenownWalletProviderProps, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
|
|
1
|
+
import { A as RENOWN_RETURN_URL_STRIPPED_PARAMS, B as UserIcon, C as CREDENTIAL_SCHEMA_EIP712_TYPE, D as ISSUER_TYPE, E as DOMAIN_TYPE, F as ChevronDownIcon, G as RenownLoginButtonProps, H as RenownUserButtonMenuItem, I as CopyIcon, K as RenownAuthButton, L as DisconnectIcon, M as VERIFIABLE_CREDENTIAL_EIP712_TYPE, N as initConnectCrypto, O as RENOWN_CHAIN_ID, P as initRenownCrypto, Q as useRenown, R as RenownLogo, S as useRenownInitialUser, T as CREDENTIAL_TYPES, U as RenownUserButtonProps, V as RenownUserButton, W as RenownLoginButton, _ as RENOWN_INITIAL_UNKNOWN, a as RenownWalletProviderProps, at as RenownAuthResolution, b as RenownInitialUserProviderProps, c as Renown, ct as useRenownAuthAsync, d as useRenownInit, f as RenownSessionCookieOptions, g as RENOWN_INITIAL_ANONYMOUS, h as useRenownSessionSynced, i as RenownWalletProvider, it as RenownAuthAsync, j as RENOWN_URL, k as RENOWN_NETWORK_ID, l as RenownProps, m as useRenownSessionCookie, n as RenownLoginMethod, nt as openRenown, o as RenownProvider, ot as RenownAuthStatus, p as RenownSessionCookieState, q as RenownAuthButtonProps, r as useRenownLoginMethods, rt as RenownAuth, s as RenownProviderProps, st as useRenownAuth, t as useRenownWalletAdapter, u as RenownInitOptions, v as RenownInitialAuth, w as CREDENTIAL_SUBJECT_TYPE, x as useRenownInitialAuth, y as RenownInitialUserProvider, z as SpinnerIcon } from "../../index-ERZ7o77d.js";
|
|
2
|
+
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, Renown, type RenownAuth, type RenownAuthAsync, RenownAuthButton, type RenownAuthButtonProps, type RenownAuthResolution, type RenownAuthStatus, type RenownInitOptions, type RenownInitialAuth, RenownInitialUserProvider, type RenownInitialUserProviderProps, RenownLoginButton, type RenownLoginButtonProps, type RenownLoginMethod, RenownLogo, type RenownProps, RenownProvider, type RenownProviderProps, type RenownSessionCookieOptions, type RenownSessionCookieState, RenownUserButton, type RenownUserButtonMenuItem, type RenownUserButtonProps, RenownWalletProvider, type RenownWalletProviderProps, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
|
|
3
|
+
export {};
|
package/dist/src/renown/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-
|
|
2
|
-
import { A as RENOWN_CHAIN_ID, D as CREDENTIAL_TYPES, E as CREDENTIAL_SUBJECT_TYPE, M as RENOWN_RETURN_URL_STRIPPED_PARAMS, N as RENOWN_URL, O as DOMAIN_TYPE, P as VERIFIABLE_CREDENTIAL_EIP712_TYPE, T as CREDENTIAL_SCHEMA_EIP712_TYPE, _ as RenownLogo, a as Renown, b as useRenownAuth, c as useRenownSessionSynced, d as RenownAuthButton, f as RenownUserButton, g as DisconnectIcon, h as CopyIcon, i as RenownWalletProvider, j as RENOWN_NETWORK_ID, k as ISSUER_TYPE, l as initConnectCrypto, m as ChevronDownIcon, n as useRenownLoginMethods, o as useRenownInit, p as RenownLoginButton, r as RenownProvider, s as useRenownSessionCookie, t as useRenownWalletAdapter, u as initRenownCrypto, v as SpinnerIcon, w as openRenown, x as useRenownAuthAsync, y as UserIcon } from "../../renown-
|
|
1
|
+
import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, l as RenownInitialUserProvider, s as RENOWN_INITIAL_ANONYMOUS, u as useRenownInitialAuth } from "../../renown-Def5iO8k.js";
|
|
2
|
+
import { A as RENOWN_CHAIN_ID, D as CREDENTIAL_TYPES, E as CREDENTIAL_SUBJECT_TYPE, M as RENOWN_RETURN_URL_STRIPPED_PARAMS, N as RENOWN_URL, O as DOMAIN_TYPE, P as VERIFIABLE_CREDENTIAL_EIP712_TYPE, T as CREDENTIAL_SCHEMA_EIP712_TYPE, _ as RenownLogo, a as Renown, b as useRenownAuth, c as useRenownSessionSynced, d as RenownAuthButton, f as RenownUserButton, g as DisconnectIcon, h as CopyIcon, i as RenownWalletProvider, j as RENOWN_NETWORK_ID, k as ISSUER_TYPE, l as initConnectCrypto, m as ChevronDownIcon, n as useRenownLoginMethods, o as useRenownInit, p as RenownLoginButton, r as RenownProvider, s as useRenownSessionCookie, t as useRenownWalletAdapter, u as initRenownCrypto, v as SpinnerIcon, w as openRenown, x as useRenownAuthAsync, y as UserIcon } from "../../renown-C9pYZRqf.js";
|
|
3
3
|
export { CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChevronDownIcon, CopyIcon, DOMAIN_TYPE, DisconnectIcon, ISSUER_TYPE, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SpinnerIcon, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, initConnectCrypto, initRenownCrypto, openRenown, useRenown, useRenownAuth, useRenownAuthAsync, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownSessionCookie, useRenownSessionSynced, useRenownWalletAdapter };
|
package/dist/src/rpc/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { r as PGliteWithLive } from "../../index-
|
|
2
|
-
import { C as RpcMessage, E as WorkerMigrationState, S as RpcLiveUnsub, T as WorkerInspectorInfo, _ as RPC_PROTOCOL_VERSION, a as MessageRouter, b as RpcLiveEvent, c as RpcCorrelator, d as ClientMessage, f as CorrelationId, g as OwnerMessage, h as OpKind, i as createWorkerAdminClient, l as RpcPoster, m as MethodCallMessage, n as createInspectorProxy, o as IRpcTransport, p as ErrorInfo, r as IWorkerAdminClient, s as createPortTransport, t as IInspectorProxy, u as RpcRequestOptions, v as ReactorIdentity, w as VersionFingerprint, x as RpcLiveSubscribe, y as RpcDbOp } from "../../inspector-proxy-
|
|
1
|
+
import { r as PGliteWithLive } from "../../index-rtDmzViP.js";
|
|
2
|
+
import { C as RpcMessage, E as WorkerMigrationState, S as RpcLiveUnsub, T as WorkerInspectorInfo, _ as RPC_PROTOCOL_VERSION, a as MessageRouter, b as RpcLiveEvent, c as RpcCorrelator, d as ClientMessage, f as CorrelationId, g as OwnerMessage, h as OpKind, i as createWorkerAdminClient, l as RpcPoster, m as MethodCallMessage, n as createInspectorProxy, o as IRpcTransport, p as ErrorInfo, r as IWorkerAdminClient, s as createPortTransport, t as IInspectorProxy, u as RpcRequestOptions, v as ReactorIdentity, w as VersionFingerprint, x as RpcLiveSubscribe, y as RpcDbOp } from "../../inspector-proxy-B2qjCMEv.js";
|
|
3
3
|
import { ChannelConfig, DriveCollectionId, IDocumentModelLoader, IDocumentModelRegistry, IEventBus, IReactorClient, ISyncManager, Remote, RemoteFilter, RemoteOptions, ShutdownStatus, SyncStatus, SyncStatusChangeCallback, Unsubscribe } from "@powerhousedao/reactor";
|
|
4
4
|
import { DocumentModelModule } from "@powerhousedao/shared/document-model";
|
|
5
|
-
|
|
6
5
|
//#region src/rpc/client-proxy.d.ts
|
|
7
6
|
type ReactorClientProxyOptions = {
|
|
8
|
-
onReload?: (reason: string, workerGen?: string) => void;
|
|
7
|
+
onReload?: (reason: string, workerGen?: string) => void;
|
|
8
|
+
/** Tab-local registry for module lookups (reducers/editors can't cross the worker boundary). */
|
|
9
9
|
registry?: IDocumentModelRegistry;
|
|
10
10
|
};
|
|
11
|
-
declare function createReactorClientProxy(router: MessageRouter, options?: ReactorClientProxyOptions): IReactorClient;
|
|
11
|
+
export declare function createReactorClientProxy(router: MessageRouter, options?: ReactorClientProxyOptions): IReactorClient;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/rpc/op-channel.d.ts
|
|
14
|
-
declare const RPC_DEFAULT_TIMEOUT_MS = 30000;
|
|
15
|
-
declare function toVoid(promise: Promise<unknown>): Promise<void>;
|
|
14
|
+
export declare const RPC_DEFAULT_TIMEOUT_MS = 30000;
|
|
15
|
+
export declare function toVoid(promise: Promise<unknown>): Promise<void>;
|
|
16
16
|
interface IOpChannel {
|
|
17
17
|
call(method: string, args?: unknown[]): Promise<unknown>;
|
|
18
18
|
callVoid(method: string, args?: unknown[]): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
declare function opChannel(router: MessageRouter, kind: OpKind, timeoutMs?: number): IOpChannel;
|
|
20
|
+
export declare function opChannel(router: MessageRouter, kind: OpKind, timeoutMs?: number): IOpChannel;
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/rpc/host-reply.d.ts
|
|
23
23
|
interface IHostResponder {
|
|
@@ -26,23 +26,23 @@ interface IHostResponder {
|
|
|
26
26
|
errForKind(message: ClientMessage, error: unknown): void;
|
|
27
27
|
run(id: CorrelationId, body: () => Promise<unknown>, mapOk?: (value: unknown) => unknown): Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
declare function hostResponder(transport: IRpcTransport): IHostResponder;
|
|
29
|
+
export declare function hostResponder(transport: IRpcTransport): IHostResponder;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/rpc/listeners.d.ts
|
|
32
|
-
declare class KeyedListeners<K, A extends unknown[] = []> {
|
|
32
|
+
export declare class KeyedListeners<K, A extends unknown[] = []> {
|
|
33
33
|
private readonly map;
|
|
34
34
|
add(key: K, fn: (...a: A) => void): () => void;
|
|
35
35
|
emit(key: K, ...a: A): void;
|
|
36
36
|
emitAll(...a: A): void;
|
|
37
37
|
}
|
|
38
|
-
declare class Listeners<A extends unknown[] = []> {
|
|
38
|
+
export declare class Listeners<A extends unknown[] = []> {
|
|
39
39
|
private readonly keyed;
|
|
40
40
|
add(fn: (...a: A) => void): () => void;
|
|
41
41
|
emit(...a: A): void;
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/rpc/subscription.d.ts
|
|
45
|
-
declare class SubscriptionStore {
|
|
45
|
+
export declare class SubscriptionStore {
|
|
46
46
|
private readonly map;
|
|
47
47
|
set(id: CorrelationId, unsubscribe: () => void): void;
|
|
48
48
|
get(id: CorrelationId): (() => void) | undefined;
|
|
@@ -65,7 +65,7 @@ interface CorrelatedConfig<Sub, EK extends OwnerMessage["k"], ErrK extends Owner
|
|
|
65
65
|
}>) => void;
|
|
66
66
|
close: (id: CorrelationId) => ClientMessage;
|
|
67
67
|
}
|
|
68
|
-
declare function createCorrelatedSubscriptions<Sub, EK extends OwnerMessage["k"], ErrK extends OwnerMessage["k"]>(router: MessageRouter, config: CorrelatedConfig<Sub, EK, ErrK>): ICorrelatedSubscriptions<Sub>;
|
|
68
|
+
export declare function createCorrelatedSubscriptions<Sub, EK extends OwnerMessage["k"], ErrK extends OwnerMessage["k"]>(router: MessageRouter, config: CorrelatedConfig<Sub, EK, ErrK>): ICorrelatedSubscriptions<Sub>;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/rpc/live-query-proxy.d.ts
|
|
71
71
|
type LiveQueryResultsCallback = (results: unknown) => void;
|
|
@@ -73,25 +73,25 @@ type LiveQueryErrorCallback = (error: unknown) => void;
|
|
|
73
73
|
interface ILiveQueryProxy {
|
|
74
74
|
query(sql: string, params: unknown[], onResults: LiveQueryResultsCallback, onError?: LiveQueryErrorCallback): () => void;
|
|
75
75
|
}
|
|
76
|
-
declare function createLiveQueryProxy(router: MessageRouter): ILiveQueryProxy;
|
|
76
|
+
export declare function createLiveQueryProxy(router: MessageRouter): ILiveQueryProxy;
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region src/rpc/relational-db-proxy.d.ts
|
|
79
|
-
declare function createRelationalPgliteProxy(router: MessageRouter): PGliteWithLive;
|
|
79
|
+
export declare function createRelationalPgliteProxy(router: MessageRouter): PGliteWithLive;
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/rpc/event-bus-proxy.d.ts
|
|
82
82
|
/** Tab-side IEventBus over bus-event; emit() is unsupported (the worker emits). */
|
|
83
|
-
declare class ReactorEventBusProxy implements IEventBus {
|
|
83
|
+
export declare class ReactorEventBusProxy implements IEventBus {
|
|
84
84
|
private readonly forwardedTypes;
|
|
85
85
|
private readonly subscribers;
|
|
86
86
|
constructor(router: MessageRouter);
|
|
87
87
|
subscribe<K>(type: number, subscriber: (type: number, event: K) => void | Promise<void>): Unsubscribe;
|
|
88
88
|
emit(): Promise<void>;
|
|
89
89
|
}
|
|
90
|
-
declare function createReactorEventBusProxy(router: MessageRouter): IEventBus;
|
|
90
|
+
export declare function createReactorEventBusProxy(router: MessageRouter): IEventBus;
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/rpc/forwarded-events.d.ts
|
|
93
|
-
declare const FORWARDED_EVENT_TYPES: (20001 | 20002 | 20003 | 20004 | 20005
|
|
94
|
-
declare const FORWARDED_BUS_EVENT_TYPES: number[];
|
|
93
|
+
export declare const FORWARDED_EVENT_TYPES: (10008 | 20001 | 20002 | 20003 | 20004 | 20005)[];
|
|
94
|
+
export declare const FORWARDED_BUS_EVENT_TYPES: number[];
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/rpc/connect-reactor.d.ts
|
|
97
97
|
type ReactorHello = {
|
|
@@ -99,11 +99,11 @@ type ReactorHello = {
|
|
|
99
99
|
construct?: unknown;
|
|
100
100
|
packages?: string[];
|
|
101
101
|
};
|
|
102
|
-
declare function connectReactorClient(router: MessageRouter, hello: ReactorHello, onReload?: (reason: string, workerGen?: string) => void, registry?: IDocumentModelRegistry): IReactorClient;
|
|
103
|
-
declare function postReactorIdentity(router: MessageRouter, user: ReactorIdentity | null): void;
|
|
102
|
+
export declare function connectReactorClient(router: MessageRouter, hello: ReactorHello, onReload?: (reason: string, workerGen?: string) => void, registry?: IDocumentModelRegistry): IReactorClient;
|
|
103
|
+
export declare function postReactorIdentity(router: MessageRouter, user: ReactorIdentity | null): void;
|
|
104
104
|
//#endregion
|
|
105
105
|
//#region src/rpc/host-server.d.ts
|
|
106
|
-
declare class ReactorHostServer {
|
|
106
|
+
export declare class ReactorHostServer {
|
|
107
107
|
private readonly client;
|
|
108
108
|
private readonly transport;
|
|
109
109
|
private readonly reply;
|
|
@@ -142,7 +142,7 @@ type ReactorHostOptions = {
|
|
|
142
142
|
onAdminClearStorage?: () => Promise<void>;
|
|
143
143
|
onAdminMigrate?: () => Promise<void>;
|
|
144
144
|
};
|
|
145
|
-
declare class ReactorHost {
|
|
145
|
+
export declare class ReactorHost {
|
|
146
146
|
private readonly options;
|
|
147
147
|
private readonly disposers;
|
|
148
148
|
private readonly clients;
|
|
@@ -171,12 +171,12 @@ declare class ReactorHost {
|
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/rpc/sync-manager-proxy.d.ts
|
|
174
|
-
declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
174
|
+
export declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
175
175
|
type SyncStatusChangedBusEvent = {
|
|
176
176
|
documentId: string;
|
|
177
177
|
status: SyncStatus;
|
|
178
178
|
};
|
|
179
|
-
declare class SyncManagerProxy implements ISyncManager {
|
|
179
|
+
export declare class SyncManagerProxy implements ISyncManager {
|
|
180
180
|
private readonly ops;
|
|
181
181
|
private readonly connectionStates;
|
|
182
182
|
private readonly connectionListeners;
|
|
@@ -203,7 +203,7 @@ declare class SyncManagerProxy implements ISyncManager {
|
|
|
203
203
|
private refreshRemotes;
|
|
204
204
|
private ensureSeeded;
|
|
205
205
|
}
|
|
206
|
-
declare function createSyncManagerProxy(router: MessageRouter, busProxy: IEventBus): ISyncManager;
|
|
206
|
+
export declare function createSyncManagerProxy(router: MessageRouter, busProxy: IEventBus): ISyncManager;
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/rpc/worker-package-loader.d.ts
|
|
209
209
|
type PackageImporter = (url: string) => Promise<Record<string, unknown>>;
|
|
@@ -223,7 +223,7 @@ type PackageLoadFailure = {
|
|
|
223
223
|
url: string;
|
|
224
224
|
error: unknown;
|
|
225
225
|
};
|
|
226
|
-
declare class WorkerPackageLoader implements IDocumentModelLoader {
|
|
226
|
+
export declare class WorkerPackageLoader implements IDocumentModelLoader {
|
|
227
227
|
private readonly cdnUrl;
|
|
228
228
|
private readonly importPackage;
|
|
229
229
|
private readonly resolvePackages;
|
|
@@ -244,8 +244,9 @@ declare class WorkerPackageLoader implements IDocumentModelLoader {
|
|
|
244
244
|
}
|
|
245
245
|
//#endregion
|
|
246
246
|
//#region src/rpc/error-info.d.ts
|
|
247
|
-
declare function toErrorInfo(err: unknown, depth?: number): ErrorInfo;
|
|
248
|
-
declare function fromErrorInfo(info: ErrorInfo): Error;
|
|
247
|
+
export declare function toErrorInfo(err: unknown, depth?: number): ErrorInfo;
|
|
248
|
+
export declare function fromErrorInfo(info: ErrorInfo): Error;
|
|
249
249
|
//#endregion
|
|
250
|
-
export { type ClientMessage, type CorrelationId, type ErrorInfo,
|
|
250
|
+
export { type ClientMessage, type CorrelationId, type ErrorInfo, type ICorrelatedSubscriptions, type IHostResponder, type IInspectorProxy, type ILiveQueryProxy, type IOpChannel, type IRpcTransport, type IWorkerAdminClient, MessageRouter, type MethodCallMessage, type OpKind, type OwnerMessage, type PackageImporter, RPC_PROTOCOL_VERSION, type ReactorHello, type ReactorIdentity, RpcCorrelator, type RpcDbOp, type RpcLiveEvent, type RpcLiveSubscribe, type RpcLiveUnsub, type RpcMessage, type RpcPoster, type RpcRequestOptions, type SyncStatusChangedBusEvent, type VersionFingerprint, type WorkerInspectorInfo, type WorkerMigrationState, type WorkerPackageLoaderOptions, createInspectorProxy, createPortTransport, createWorkerAdminClient };
|
|
251
|
+
export {};
|
|
251
252
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/client-proxy.ts","../../../src/rpc/op-channel.ts","../../../src/rpc/host-reply.ts","../../../src/rpc/listeners.ts","../../../src/rpc/subscription.ts","../../../src/rpc/live-query-proxy.ts","../../../src/rpc/relational-db-proxy.ts","../../../src/rpc/event-bus-proxy.ts","../../../src/rpc/forwarded-events.ts","../../../src/rpc/connect-reactor.ts","../../../src/rpc/host-server.ts","../../../src/rpc/reactor-host.ts","../../../src/rpc/sync-manager-proxy.ts","../../../src/rpc/worker-package-loader.ts","../../../src/rpc/error-info.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/client-proxy.ts","../../../src/rpc/op-channel.ts","../../../src/rpc/host-reply.ts","../../../src/rpc/listeners.ts","../../../src/rpc/subscription.ts","../../../src/rpc/live-query-proxy.ts","../../../src/rpc/relational-db-proxy.ts","../../../src/rpc/event-bus-proxy.ts","../../../src/rpc/forwarded-events.ts","../../../src/rpc/connect-reactor.ts","../../../src/rpc/host-server.ts","../../../src/rpc/reactor-host.ts","../../../src/rpc/sync-manager-proxy.ts","../../../src/rpc/worker-package-loader.ts","../../../src/rpc/error-info.ts"],"mappings":";;;;;KAgCY;EACV,YAAY,gBAAgB;;EAE5B,WAAW;;wBAGG,yBACd,QAAQ,eACR,UAAS,4BACR;;;qBCtCU;wBAEG,OAAO,SAAS,mBAAmB;UAIlC;EACf,KAAK,gBAAgB,mBAAmB;EACxC,SAAS,gBAAgB,mBAAmB;;wBAG9B,UACd,QAAQ,eACR,MAAM,QACN,qBACC;;;UCbc;EACf,GAAG,IAAI,eAAe;EACtB,IAAI,IAAI,eAAe;EACvB,WAAW,SAAS,eAAe;EACnC,IACE,IAAI,eACJ,YAAY,kBACZ,SAAS,6BACR;;wBAKW,cAAc,WAAW,gBAAgB;;;qBClB5C,eAAe,GAAG;mBACZ;EAEjB,IAAI,KAAK,GAAG,QAAQ,GAAG;EAmBvB,KAAK,KAAK,MAAM,GAAG;EAUnB,WAAW,GAAG;;qBASH,UAAU;mBACJ;EAEjB,IAAI,QAAQ,GAAG;EAIf,QAAQ,GAAG;;;;qBC7CA;mBACM;EAEjB,IAAI,IAAI,eAAe;EAIvB,IAAI,IAAI;EAIR,OAAO,IAAI;EAIX,IAAI,IAAI;EAQR;;UAQe,yBAAyB;EACxC,UAAU,KAAK,KAAK,OAAO,IAAI,kBAAkB;;UAGlC,iBACf,KACA,WAAW,mBACX,aAAa;EAEb;EACA,WAAW;EACX,SAAS;EACT,UAAU,KAAK,KAAK,SAAS,QAAQ;IAAgB,GAAG;;EACxD,UAAU,KAAK,KAAK,SAAS,QAAQ;IAAgB,GAAG;;EACxD,QAAQ,IAAI,kBAAkB;;wBAGhB,8BACd,KACA,WAAW,mBACX,aAAa,mBAEb,QAAQ,eACR,QAAQ,iBAAiB,KAAK,IAAI,QACjC,yBAAyB;;;KCtDhB,4BAA4B;KAC5B,0BAA0B;UAErB;EACf,MACE,aACA,mBACA,WAAW,0BACX,UAAU;;wBASE,qBAAqB,QAAQ,gB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AAa;EAQf,IACJ,cACA,cAAc,mBACd,eAAe,eACf,SAAS,cACT,UAAU,gBACT,QAAQ;EAYL,WAAW,YAAY,uBAAuB;EAKpD,YAAY;EAMN,OAAO,eAAe;EAK5B,QAAQ;EAIR,eAAe;EAMf,cAAc,qBAAqB;EAInC,mBAAmB,UAAU;UAIrB;UAIA;UAQA;UA8BM;UAoBN;;wBAeM,uBACd,QAAQ,eACR,UAAU,YACT;;;KCrTS,mBAAmB,gBAAgB,QAAQ;KAE3C;EACV;EACA,eAAe;EACf,mBAAmB,yBAAyB;;;EAG5C,gBAAgB;;;EAGhB,gBAAgB,mBAAmB,QAAQ;;KAGjC;EACV;EACA;EACA;;qBA0BW,+BAA+B;mBACzB;mBACA;mBACA;mBACA;mBACA;mBAKA;mBACA;mBACA;EAEjB,YAAY,SAAS;EAYf,aAAa,kBAAkB,QAAQ;EAQvC,KAAK,uBAAuB,QAAQ;MAqBtC,UAAU;MAIV,gBAAgB;;UAKZ;UAaA;UAuBM;;;;wBC/IA,YAAY,cAAc,iBAAY;wBAmDtC,cAAc,MAAM,YAAY"}
|
package/dist/src/rpc/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RegistryClient } from "../../client-
|
|
1
|
+
import { t as RegistryClient } from "../../client-BiJAJ9dW.js";
|
|
2
2
|
import { DriveCollectionId, ReactorEventTypes, SyncEventTypes } from "@powerhousedao/reactor";
|
|
3
3
|
import { normalizeDocumentModelVersion } from "@powerhousedao/shared/document-model";
|
|
4
4
|
import { rewritePackageSource } from "@powerhousedao/shared/connect";
|
|
@@ -81,7 +81,7 @@ function createWorkerAdminClient(router) {
|
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/rpc/error-info.ts
|
|
84
|
-
const MAX_STACK_LENGTH =
|
|
84
|
+
const MAX_STACK_LENGTH = 8192;
|
|
85
85
|
const MAX_CAUSE_DEPTH = 8;
|
|
86
86
|
function toErrorInfo(err, depth = 0) {
|
|
87
87
|
if (depth > MAX_CAUSE_DEPTH) return {
|
|
@@ -507,7 +507,7 @@ var SyncManagerProxy = class {
|
|
|
507
507
|
return;
|
|
508
508
|
} catch (error) {
|
|
509
509
|
lastError = error;
|
|
510
|
-
if (attempt <
|
|
510
|
+
if (attempt < 2) await new Promise((resolve) => setTimeout(resolve, SEED_RETRY_DELAY_MS));
|
|
511
511
|
}
|
|
512
512
|
throw lastError;
|
|
513
513
|
}
|
|
@@ -1181,6 +1181,8 @@ var WorkerPackageLoader = class {
|
|
|
1181
1181
|
* res/err settlement, and per-request timeout/transform/cleanup.
|
|
1182
1182
|
*/
|
|
1183
1183
|
var RpcCorrelator = class {
|
|
1184
|
+
poster;
|
|
1185
|
+
prefix;
|
|
1184
1186
|
counter = 0;
|
|
1185
1187
|
pending = /* @__PURE__ */ new Map();
|
|
1186
1188
|
constructor(poster, prefix = "r") {
|