@storacha/clawracha 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/handlers/process.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAEZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM5D,8DAA8D;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzD,wBAAsB,cAAc,CAClC,OAAO,EAAE,UAAU,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/handlers/process.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAEZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM5D,8DAA8D;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzD,wBAAsB,cAAc,CAClC,OAAO,EAAE,UAAU,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAoFnB"}
|
package/dist/handlers/process.js
CHANGED
|
@@ -12,7 +12,6 @@ import * as path from "node:path";
|
|
|
12
12
|
const isMarkdown = (filePath) => filePath.endsWith(".md");
|
|
13
13
|
export async function processChanges(changes, workspace, current, blocks, sink, store) {
|
|
14
14
|
const pendingOps = [];
|
|
15
|
-
console.log("Processing changes:", JSON.stringify(changes, null, 2));
|
|
16
15
|
const mdChanges = changes.filter((c) => isMarkdown(c.path));
|
|
17
16
|
const regularChanges = changes.filter((c) => !isMarkdown(c.path));
|
|
18
17
|
// --- Regular files (UnixFS encode) ---
|
|
@@ -52,9 +51,13 @@ export async function processChanges(changes, workspace, current, blocks, sink,
|
|
|
52
51
|
const mdPuts = mdChanges.filter((c) => c.type !== "unlink");
|
|
53
52
|
for (const change of mdPuts) {
|
|
54
53
|
const content = await fs.readFile(path.join(workspace, change.path), "utf-8");
|
|
55
|
-
const
|
|
54
|
+
const newEntry = current
|
|
56
55
|
? await mdsync.put(blocks, current, change.path, content)
|
|
57
56
|
: await mdsync.v0Put(content);
|
|
57
|
+
if (!newEntry) {
|
|
58
|
+
continue; // No change detected, skip writing a new entry.
|
|
59
|
+
}
|
|
60
|
+
const { mdEntryCid, additions } = newEntry;
|
|
58
61
|
// Sink blocks to CAR for upload, and store locally for future resolveValue calls.
|
|
59
62
|
for (const block of additions) {
|
|
60
63
|
await sink(block);
|
package/dist/mdsync/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const v0Put: (newMarkdown: string) => Promise<MarkdownResult>;
|
|
|
35
35
|
* Returns the markdown entry CID and blocks to store. Caller is
|
|
36
36
|
* responsible for creating the Pail revision via Revision.put.
|
|
37
37
|
*/
|
|
38
|
-
export declare const put: (blocks: BlockFetcher, current: ValueView, key: string, newMarkdown: string) => Promise<MarkdownResult>;
|
|
38
|
+
export declare const put: (blocks: BlockFetcher, current: ValueView, key: string, newMarkdown: string) => Promise<MarkdownResult | null>;
|
|
39
39
|
/**
|
|
40
40
|
* Get the current markdown string for a key, resolving concurrent heads.
|
|
41
41
|
* Returns undefined if the key doesn't exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdsync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,YAAY,EAGZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdsync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,YAAY,EAGZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAsJ1C,UAAU,cAAc;IACtB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,KAAK,EAAE,CAAC;CACpB;AAyBD;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,cAAc,CAEvE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,EACX,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,GAAG,IAAI,CAkC/B,CAAC;AA0RF;;;GAGG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,KACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAC"}
|
package/dist/mdsync/index.js
CHANGED
|
@@ -131,6 +131,9 @@ export const put = async (blocks, current, key, newMarkdown) => {
|
|
|
131
131
|
eventRGA.insert(orderedNodes[orderedNodes.length - 1].id, mdEvent, mdEvent);
|
|
132
132
|
// Diff the current tree against the new markdown and apply.
|
|
133
133
|
const changeset = computeChangeSet(rgaRoot, newMarkdown, mdEvent);
|
|
134
|
+
if (changeset.changes.length === 0) {
|
|
135
|
+
return null; // No changes to apply, skip writing a new entry.
|
|
136
|
+
}
|
|
134
137
|
const comparator = makeComparator(eventRGA);
|
|
135
138
|
const newRoot = applyRGAChangeSet(rgaRoot, changeset, comparator);
|
|
136
139
|
return serializeMarkdownEntry({
|
package/dist/watcher.js
CHANGED