MCPcopy Create free account
hub / github.com/instantdb/instant / syncSubToStorage

Function syncSubToStorage

client/packages/core/src/SyncTable.ts:125–139  ·  view source on GitHub ↗
(_k: string, sub: Sub)

Source from the content-addressed store, hash-verified

123}
124
125function syncSubToStorage(_k: string, sub: Sub): SubInStorage {
126 if (sub.values) {
127 const entities: SubEntityInStorage[] = [];
128 for (const e of sub.values?.entities) {
129 const store = s.toJSON(e.store);
130 entities.push({ ...e, store });
131 }
132 return {
133 ...sub,
134 values: { attrsStore: sub.values.attrsStore.toJSON(), entities },
135 };
136 } else {
137 return sub as unknown as SubInStorage;
138 }
139}
140
141function onMergeSub(
142 _key: string,

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
toJSONMethod · 0.65

Tested by

no test coverage detected