Skip to main content

usePowerSyncInspector()

function usePowerSyncInspector(): {
diagnosticsSchema: Schema<{
local_bucket_data: Table<{
download_size: BaseColumnType<null | number>;
downloaded_operations: BaseColumnType<null | number>;
downloading: BaseColumnType<null | number>;
last_op: BaseColumnType<null | string>;
total_operations: BaseColumnType<null | number>;
}>;
local_schema: Table<{
data: BaseColumnType<null | string>;
}>;
}>;
getCurrentSchemaManager: () => DynamicSchemaManager;
RecordingStorageAdapter: typeof RecordingStorageAdapter;
}

A composable for setting up PowerSync Inspector functionality.

This composable provides utilities for schema management and diagnostics setup. It exposes the diagnostics schema and internal utilities needed for the inspector.

Returns

{
diagnosticsSchema: Schema<{
local_bucket_data: Table<{
download_size: BaseColumnType<null | number>;
downloaded_operations: BaseColumnType<null | number>;
downloading: BaseColumnType<null | number>;
last_op: BaseColumnType<null | string>;
total_operations: BaseColumnType<null | number>;
}>;
local_schema: Table<{
data: BaseColumnType<null | string>;
}>;
}>;
getCurrentSchemaManager: () => DynamicSchemaManager;
RecordingStorageAdapter: typeof RecordingStorageAdapter;
}

An object containing:

  • diagnosticsSchema - The schema for diagnostics data collection. Use this to extend your app schema with diagnostic tables.
  • RecordingStorageAdapter - Used internally. Storage adapter class that records operations for diagnostic purposes.
  • getCurrentSchemaManager() - Used internally. Gets the current schema manager instance for dynamic schema operations.
NameType
diagnosticsSchemaSchema<{ local_bucket_data: Table<{ download_size: BaseColumnType<null | number>; downloaded_operations: BaseColumnType<null | number>; downloading: BaseColumnType<null | number>; last_op: BaseColumnType<null | string>; total_operations: BaseColumnType<null | number>; }>; local_schema: Table<{ data: BaseColumnType<null | string>; }>; }>
getCurrentSchemaManager() => DynamicSchemaManager
RecordingStorageAdaptertypeof RecordingStorageAdapter

Example

const { diagnosticsSchema } = usePowerSyncInspector()

// Combine with your app schema
const combinedSchema = new Schema([
...yourAppSchema.tables,
...diagnosticsSchema.tables,
])