@@ -34,7 +34,9 @@ Chrome extension that adds a DevTools panel to manage IndexedDB data.
3434 likely contain the same properties for each key, making displaying the data in a table viable.
3535- Only the following datatypes for table columns are supported: string, number, bigint, boolean, date and JSON. Other
3636 datatypes like sets, maps, typed arrays, ... are not supported, and the corresponding table columns will be marked as
37- such and hidden by default.
37+ such and hidden by default. Also, once a column has a specific datatype, values that do not match that datatype will
38+ be displayed as ` undefined ` . That means the extension is not the best for dealing with the same property storing
39+ different datatypes (e.g. mixing numbers and dates).
3840- The extension is designed to display data for small to medium-sized object stores. Data load will be slower for large
3941 object stores with hundreds of thousands of objects. You can still limit the number of objects to load from the "Table
4042 Settings" popover.
@@ -88,6 +90,44 @@ So, here I am creating this extension with the hope it may help others as it is
8890 - On the extension side, once the operation is triggered, the extension will start polling a specific property on the
8991 window object of the inspected page to check for the operation results.
9092 - The polling will stop once the results are found or after a set timeout.
93+ - Keeping track of possible datatypes handled by different parts of the code can get hard. So, here's a reference in the
94+ hope of simplifying/improving it in the future or to help with adding new datatypes. This reference will highlight
95+ the possible datatypes from getting data from an object store in the inspected page to displaying it in the table in
96+ the extension's devtools panel:
97+ - [ inspected page] Get data from the object store: the datatypes here correspond to anything supported by IndexedDB
98+ (i.e. any type supported by ` structuredClone ` )
99+ - [ inspected page] Auto-detect the supported datatypes:
100+ - primitive types: string, number, boolean, bigint
101+ - date objects
102+ - timestamp: added datatype to represent integers that are milliseconds since epoch. Values are later formatted as
103+ dates to make them easier to read. A value is auto-detected as timestamp if it's an integer greater than or equal
104+ to ` 631152000000 ` (Jan 1st, 1990).
105+ - JSON data: values are JSON-compliant objects or arrays.
106+ - [ inspected page] A datatype is auto-detected when 80% of the non-nullish values in the first 100 objects are of that
107+ type. Otherwise, default to the "Unsupported" datatype (all values will be set as ` undefined ` )
108+ - [ inspected page] Passing the data between the inspected page and the extension using ` eval ` requires the data to be
109+ JSON-compliant. So, date objects are converted to ISO-formatted strings and bigints to strings.
110+ - [ extension] Data received from the inspected page using ` eval ` and passed as is to AG-Grid's ` rowData ` .
111+ - [ extension] The ` valueGetter ` of each table column converts the value from ` rowData ` to the one that the table uses
112+ for sorting and per-column filtering:
113+ - for date columns, ISO-formatted date strings are converted back to date objects
114+ - for bigint columns, bigint strings are converted back to bigint objects
115+ - for timestamp columns, integers are converted to date objects
116+ - for JSON columns, JSON objects/arrays are converted to JSON strings
117+ - for any datatype, values that do not correspond to the datatype in question are set as ` undefined `
118+ - [ extension] The ` valueFormatter ` converts what's returned by the ` valueGetter ` to strings that are displayed to the
119+ user.
120+ - [ extension] ` getQuickFilterText ` converts what's returned by the ` valueGetter ` to strings used during the full table
121+ search. It returns the same value as ` valueFormatter ` .
122+ - [ extension] During the cell value update flow, the cell editor parses, validates and converts the values to match
123+ the column datatype. The ` onCellEditRequest ` first saves the value to IndexedDB, and if that's successful, saves the
124+ value to ` rowData ` afterward.
125+ - [ extension] Saving the updated value to IndexedDB includes converting the value to a JSON-compliant value to be
126+ passed to the inspected page (date objects to date strings, bigint objects to bigint strings, date objects from
127+ timestamp columns to integers, JSON strings to JSON objects). Next, the inspected page will receive that value and
128+ convert it to the original datatype for storage in IndexedDB (date strings to date objects and bigint strings to
129+ bigint objects). After successfully storing the value, the extension will store the JSON-compliant value in
130+ ` rowData ` .
91131
92132## Running the project locally
93133
0 commit comments