MCPcopy
hub / github.com/audreyt/ethercalc / fetch

Method fetch

packages/client-multi/src/Foldr.ts:90–106  ·  view source on GitHub ↗

* Load TOC from the CSV-as-JSON endpoint. Resolves when the Foldr is ready.

(id: string)

Source from the content-addressed store, hash-verified

88 * Load TOC from the CSV-as-JSON endpoint. Resolves when the Foldr is ready.
89 */
90 async fetch(id: string): Promise<this> {
91 this.id = id;
92 const body = await this.loadTocJson();
93 if (Array.isArray(body) && body.length > 0) {
94 this.rows = parseTocBody(body);
95 } else {
96 this.wasNonExistent = true;
97 }
98
99 if (this.rows.length === 0) {
100 this.wasEmpty = true;
101 const seed: FoldrRow = { link: `/${this.id}.1`, title: 'Sheet1', row: 2 };
102 this.rows = [];
103 await this.push(seed);
104 }
105 return this;
106 }
107
108 /**
109 * Re-fetch the TOC without seeding or touching init flags. Returns `true`

Callers 1

bootFunction · 0.95

Calls 3

loadTocJsonMethod · 0.95
pushMethod · 0.95
parseTocBodyFunction · 0.85

Tested by

no test coverage detected