MCPcopy
hub / github.com/tinyplex/tinybase / createStore

Function createStore

src/store/index.ts:239–2381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237): boolean => objIsEqual(tables1, tables2) && objIsEqual(values1, values2);
238
239export const createStore: typeof createStoreDecl = (): Store => {
240 let hasTablesSchema: boolean;
241 let hasValuesSchema: boolean;
242 let hadTables = false;
243 let hadValues = false;
244 let transactions = 0;
245 let middleware: [
246 willSetContent?: (content: Content) => Content | undefined,
247 willSetTables?: (tables: Tables) => Tables | undefined,
248 willSetTable?: (tableId: Id, table: Table) => Table | undefined,
249 willSetRow?: (tableId: Id, rowId: Id, row: Row) => Row | undefined,
250 willSetCell?: (
251 tableId: Id,
252 rowId: Id,
253 cellId: Id,
254 cell: Cell,
255 ) => CellOrUndefined,
256 willSetValues?: (values: Values) => Values | undefined,
257 willSetValue?: (valueId: Id, value: Value) => ValueOrUndefined,
258 willDelTables?: () => boolean,
259 willDelTable?: (tableId: Id) => boolean,
260 willDelRow?: (tableId: Id, rowId: Id) => boolean,
261 willDelCell?: (tableId: Id, rowId: Id, cellId: Id) => boolean,
262 willDelValues?: () => boolean,
263 willDelValue?: (valueId: Id) => boolean,
264 willApplyChanges?: (changes: Changes) => Changes | undefined,
265 hasWillSetRowCallbacks?: () => boolean,
266 ] = [];
267 let internalListeners: [
268 preStartTransaction?: () => void,
269 preFinishTransaction?: () => void,
270 postFinishTransaction?: () => void,
271 cellChanged?: (
272 tableId: Id,
273 rowId: Id,
274 cellId: Id,
275 newCell: CellOrUndefined,
276 mutating: 0 | 1,
277 defaulted: 0 | 1,
278 ) => void,
279 valueChanged?: (
280 valueId: Id,
281 newValue: ValueOrUndefined,
282 mutating: 0 | 1,
283 defaulted: 0 | 1,
284 ) => void,
285 ] = [];
286 let mutating: 0 | 1 = 0;
287 const changedTableIds: ChangedIdsMap = mapNew();
288 const changedTableCellIds: ChangedIdsMap2 = mapNew();
289 const changedRowCount: IdMap<number> = mapNew();
290 const changedRowIds: ChangedIdsMap2 = mapNew();
291 const changedCellIds: ChangedIdsMap3 = mapNew();
292 const changedCells: IdMap3<ChangedCell> = mapNew();
293 const defaultedCells: IdSet3 = mapNew();
294 const changedValueIds: ChangedIdsMap = mapNew();
295 const changedValues: IdMap<ChangedValue> = mapNew();
296 const defaultedValues: IdSet = setNew();

Callers 15

index.tsFile · 0.90
searchLoadFunction · 0.90
metrics.tsFile · 0.50
GettersFunction · 0.50
MetricsFunction · 0.50
IndexesFunction · 0.50
RelationshipsFunction · 0.50
QueriesFunction · 0.50
CheckpointsFunction · 0.50
PersisterFunction · 0.50
AppFunction · 0.50
GettersFunction · 0.50

Calls 15

mapNewFunction · 0.90
setNewFunction · 0.90
pairNewMapFunction · 0.90
getListenerFunctionsFunction · 0.90
objMapFunction · 0.90
pairNewFunction · 0.90
sliceFunction · 0.90
hasTablesFunction · 0.70
hasTableFunction · 0.70
hasTableCellFunction · 0.70
hasRowFunction · 0.70
hasCellFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…