@storacha/clawracha 0.0.1 → 0.0.2
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.
- package/dist/handlers/apply.d.ts +18 -0
- package/dist/handlers/apply.d.ts.map +1 -0
- package/dist/handlers/apply.js +50 -0
- package/dist/handlers/process.d.ts +15 -0
- package/dist/handlers/process.d.ts.map +1 -0
- package/dist/handlers/process.js +82 -0
- package/dist/handlers/remote.d.ts +15 -0
- package/dist/handlers/remote.d.ts.map +1 -0
- package/dist/handlers/remote.js +48 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/mdsync/index.d.ts +45 -0
- package/dist/mdsync/index.d.ts.map +1 -0
- package/dist/mdsync/index.js +365 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +224 -26
- package/dist/sync.d.ts +12 -5
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +82 -157
- package/dist/types/index.d.ts +58 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/utils/client.d.ts +14 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +38 -0
- package/dist/utils/differ.d.ts +29 -0
- package/dist/utils/differ.d.ts.map +1 -0
- package/dist/utils/differ.js +47 -0
- package/dist/utils/encoder.d.ts +16 -0
- package/dist/utils/encoder.d.ts.map +1 -0
- package/dist/utils/encoder.js +51 -0
- package/dist/utils/tempcar.d.ts +22 -0
- package/dist/utils/tempcar.d.ts.map +1 -0
- package/dist/utils/tempcar.js +44 -0
- package/dist/watcher.d.ts +1 -1
- package/dist/watcher.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure function to apply pending pail operations (puts/dels) and publish.
|
|
3
|
+
*
|
|
4
|
+
* Cycle: operation → publish → return value.
|
|
5
|
+
* Bootstraps with v0Put when no current value exists.
|
|
6
|
+
*/
|
|
7
|
+
import type { ClockConnection, NameView, ValueView } from "@storacha/ucn/pail/api";
|
|
8
|
+
import type { Block } from "multiformats";
|
|
9
|
+
import type { PailOp } from "../types/index.js";
|
|
10
|
+
import type { WorkspaceBlockstore } from "../blockstore/index.js";
|
|
11
|
+
export interface ApplyResult {
|
|
12
|
+
current: ValueView | null;
|
|
13
|
+
revisionBlocks: Block[];
|
|
14
|
+
}
|
|
15
|
+
export declare function applyPendingOps(blocks: WorkspaceBlockstore, name: NameView, current: ValueView | null, pendingOps: PailOp[], options?: {
|
|
16
|
+
remotes?: ClockConnection[];
|
|
17
|
+
}): Promise<ApplyResult>;
|
|
18
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/handlers/apply.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,KAAK,EAAE,CAAC;CACzB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,GACxC,OAAO,CAAC,WAAW,CAAC,CA+CtB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure function to apply pending pail operations (puts/dels) and publish.
|
|
3
|
+
*
|
|
4
|
+
* Cycle: operation → publish → return value.
|
|
5
|
+
* Bootstraps with v0Put when no current value exists.
|
|
6
|
+
*/
|
|
7
|
+
import { Revision } from "@storacha/ucn/pail";
|
|
8
|
+
import * as Batch from "@storacha/ucn/pail/batch";
|
|
9
|
+
import { MemoryBlockstore, withCache } from "@storacha/ucn/block";
|
|
10
|
+
export async function applyPendingOps(blocks, name, current, pendingOps, options) {
|
|
11
|
+
const revisionBlocks = [];
|
|
12
|
+
let ops = [...pendingOps];
|
|
13
|
+
// Local cache so each step can read blocks produced by previous steps
|
|
14
|
+
const cache = new MemoryBlockstore();
|
|
15
|
+
const fetcher = withCache(blocks, cache);
|
|
16
|
+
const accumulate = (additions) => {
|
|
17
|
+
for (const block of additions) {
|
|
18
|
+
cache.put(block);
|
|
19
|
+
}
|
|
20
|
+
revisionBlocks.push(...additions);
|
|
21
|
+
};
|
|
22
|
+
if (!current) {
|
|
23
|
+
const firstPut = ops.find((op) => op.type === "put" && op.value);
|
|
24
|
+
if (firstPut?.value) {
|
|
25
|
+
const result = await Revision.v0Put(fetcher, firstPut.key, firstPut.value);
|
|
26
|
+
accumulate(result.additions);
|
|
27
|
+
const pubResult = await Revision.publish(fetcher, name, result.revision, { remotes: options?.remotes });
|
|
28
|
+
accumulate(pubResult.additions);
|
|
29
|
+
current = pubResult.value;
|
|
30
|
+
ops = ops.filter((op) => op !== firstPut);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (ops.length > 0 && current) {
|
|
34
|
+
const batcher = await Batch.create(fetcher, current);
|
|
35
|
+
for (const op of ops) {
|
|
36
|
+
if (op.type === "put" && op.value) {
|
|
37
|
+
await batcher.put(op.key, op.value);
|
|
38
|
+
}
|
|
39
|
+
else if (op.type === "del") {
|
|
40
|
+
await batcher.del(op.key);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const result = await batcher.commit();
|
|
44
|
+
accumulate(result.additions);
|
|
45
|
+
const pubResult = await Revision.publish(fetcher, name, result.revision, { remotes: options?.remotes });
|
|
46
|
+
accumulate(pubResult.additions);
|
|
47
|
+
current = pubResult.value;
|
|
48
|
+
}
|
|
49
|
+
return { current, revisionBlocks };
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure function to diff file changes against pail state and produce ops.
|
|
3
|
+
*
|
|
4
|
+
* Markdown files (.md) are handled via mdsync — CRDT merge rather than
|
|
5
|
+
* whole-file UnixFS replacement. Regular files go through encodeFiles.
|
|
6
|
+
*/
|
|
7
|
+
import type { BlockFetcher, ValueView } from "@storacha/ucn/pail/api";
|
|
8
|
+
import type { Block } from "multiformats";
|
|
9
|
+
import type { FileChange, PailOp } from "../types/index.js";
|
|
10
|
+
/** Callback to persist a block to the CAR file for upload. */
|
|
11
|
+
export type BlockSink = (block: Block) => Promise<void>;
|
|
12
|
+
/** Callback to persist a block to the local blockstore for future reads. */
|
|
13
|
+
export type BlockStore = (block: Block) => Promise<void>;
|
|
14
|
+
export declare function processChanges(changes: FileChange[], workspace: string, current: ValueView | null, blocks: BlockFetcher, sink: BlockSink, store?: BlockStore): Promise<PailOp[]>;
|
|
15
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +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,CAiFnB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure function to diff file changes against pail state and produce ops.
|
|
3
|
+
*
|
|
4
|
+
* Markdown files (.md) are handled via mdsync — CRDT merge rather than
|
|
5
|
+
* whole-file UnixFS replacement. Regular files go through encodeFiles.
|
|
6
|
+
*/
|
|
7
|
+
import { Revision } from "@storacha/ucn/pail";
|
|
8
|
+
import { encodeFiles } from "../utils/encoder.js";
|
|
9
|
+
import * as mdsync from "../mdsync/index.js";
|
|
10
|
+
import * as fs from "node:fs/promises";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
const isMarkdown = (filePath) => filePath.endsWith(".md");
|
|
13
|
+
export async function processChanges(changes, workspace, current, blocks, sink, store) {
|
|
14
|
+
const pendingOps = [];
|
|
15
|
+
const mdChanges = changes.filter((c) => isMarkdown(c.path));
|
|
16
|
+
const regularChanges = changes.filter((c) => !isMarkdown(c.path));
|
|
17
|
+
// --- Regular files (UnixFS encode) ---
|
|
18
|
+
const toEncode = regularChanges
|
|
19
|
+
.filter((c) => c.type !== "unlink")
|
|
20
|
+
.map((c) => c.path);
|
|
21
|
+
const encoded = await encodeFiles(workspace, toEncode);
|
|
22
|
+
const files = [];
|
|
23
|
+
for (const file of encoded) {
|
|
24
|
+
let root = null;
|
|
25
|
+
const reader = file.blocks.getReader();
|
|
26
|
+
while (true) {
|
|
27
|
+
const { done, value } = await reader.read();
|
|
28
|
+
if (done)
|
|
29
|
+
break;
|
|
30
|
+
root = value.cid;
|
|
31
|
+
await sink(value);
|
|
32
|
+
}
|
|
33
|
+
if (!root) {
|
|
34
|
+
throw new Error(`Failed to encode file: ${file.path}`);
|
|
35
|
+
}
|
|
36
|
+
files.push({ path: file.path, rootCID: root });
|
|
37
|
+
}
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
const existing = current
|
|
40
|
+
? await Revision.get(blocks, current, file.path)
|
|
41
|
+
: null;
|
|
42
|
+
if (!existing || !existing.equals(file.rootCID)) {
|
|
43
|
+
pendingOps.push({
|
|
44
|
+
type: "put",
|
|
45
|
+
key: file.path,
|
|
46
|
+
value: file.rootCID,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// --- Markdown files (CRDT merge via mdsync) ---
|
|
51
|
+
const mdPuts = mdChanges.filter((c) => c.type !== "unlink");
|
|
52
|
+
for (const change of mdPuts) {
|
|
53
|
+
const content = await fs.readFile(path.join(workspace, change.path), "utf-8");
|
|
54
|
+
const { mdEntryCid, additions } = current
|
|
55
|
+
? await mdsync.put(blocks, current, change.path, content)
|
|
56
|
+
: await mdsync.v0Put(content);
|
|
57
|
+
// Sink blocks to CAR for upload, and store locally for future resolveValue calls.
|
|
58
|
+
for (const block of additions) {
|
|
59
|
+
await sink(block);
|
|
60
|
+
if (store)
|
|
61
|
+
await store(block);
|
|
62
|
+
}
|
|
63
|
+
pendingOps.push({
|
|
64
|
+
type: "put",
|
|
65
|
+
key: change.path,
|
|
66
|
+
value: mdEntryCid,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// --- Deletes (both regular and markdown) ---
|
|
70
|
+
const toDelete = changes
|
|
71
|
+
.filter((c) => c.type === "unlink")
|
|
72
|
+
.map((c) => c.path);
|
|
73
|
+
for (const deletePath of toDelete) {
|
|
74
|
+
const existing = current
|
|
75
|
+
? await Revision.get(blocks, current, deletePath)
|
|
76
|
+
: null;
|
|
77
|
+
if (existing) {
|
|
78
|
+
pendingOps.push({ type: "del", key: deletePath });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return pendingOps;
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply remote changes to local filesystem.
|
|
3
|
+
*
|
|
4
|
+
* Regular files are fetched from the IPFS gateway (handles UnixFS reassembly).
|
|
5
|
+
* Markdown files (.md) are resolved via mdsync CRDT merge — the tiered
|
|
6
|
+
* blockstore's gateway layer handles fetching any missing blocks.
|
|
7
|
+
*/
|
|
8
|
+
import type { CID } from "multiformats/cid";
|
|
9
|
+
import type { BlockFetcher, ValueView } from "@storacha/ucn/pail/api";
|
|
10
|
+
export declare function applyRemoteChanges(changedPaths: string[], entries: Map<string, CID>, workspace: string, options?: {
|
|
11
|
+
gateway?: string;
|
|
12
|
+
blocks?: BlockFetcher;
|
|
13
|
+
current?: ValueView;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/handlers/remote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAOtE,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,GACA,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply remote changes to local filesystem.
|
|
3
|
+
*
|
|
4
|
+
* Regular files are fetched from the IPFS gateway (handles UnixFS reassembly).
|
|
5
|
+
* Markdown files (.md) are resolved via mdsync CRDT merge — the tiered
|
|
6
|
+
* blockstore's gateway layer handles fetching any missing blocks.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from "node:fs/promises";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import * as mdsync from "../mdsync/index.js";
|
|
11
|
+
const DEFAULT_GATEWAY = "https://storacha.link";
|
|
12
|
+
const isMarkdown = (filePath) => filePath.endsWith(".md");
|
|
13
|
+
export async function applyRemoteChanges(changedPaths, entries, workspace, options) {
|
|
14
|
+
const gateway = options?.gateway ?? DEFAULT_GATEWAY;
|
|
15
|
+
for (const relativePath of changedPaths) {
|
|
16
|
+
const cid = entries.get(relativePath);
|
|
17
|
+
const fullPath = path.join(workspace, relativePath);
|
|
18
|
+
if (!cid) {
|
|
19
|
+
// Deleted remotely
|
|
20
|
+
try {
|
|
21
|
+
await fs.unlink(fullPath);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (err.code !== "ENOENT")
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (isMarkdown(relativePath) && options?.blocks && options?.current) {
|
|
29
|
+
// Markdown: resolve via mdsync CRDT merge.
|
|
30
|
+
// The blockstore's lowest tier is a gateway fetcher, so any blocks
|
|
31
|
+
// we don't have locally will be fetched transparently.
|
|
32
|
+
const content = await mdsync.get(options.blocks, options.current, relativePath);
|
|
33
|
+
if (content != null) {
|
|
34
|
+
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
35
|
+
await fs.writeFile(fullPath, content);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Regular file: fetch full file from gateway (handles UnixFS reassembly)
|
|
40
|
+
const res = await fetch(`${gateway}/ipfs/${cid}`);
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
throw new Error(`Gateway fetch failed for ${cid}: ${res.status}`);
|
|
43
|
+
}
|
|
44
|
+
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
45
|
+
await fs.writeFile(fullPath, new Uint8Array(await res.arrayBuffer()));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @storacha/clawracha - OpenClaw plugin for Storacha workspace sync
|
|
3
3
|
*/
|
|
4
|
-
export * from "./types.js";
|
|
4
|
+
export * from "./types/index.js";
|
|
5
5
|
export * from "./blockstore/index.js";
|
|
6
|
-
export { encodeWorkspaceFile, encodeFiles } from "./encoder.js";
|
|
7
|
-
export { diffEntries,
|
|
6
|
+
export { encodeWorkspaceFile, encodeFiles } from "./utils/encoder.js";
|
|
7
|
+
export { diffEntries, diffRemoteChanges } from "./utils/differ.js";
|
|
8
8
|
export { SyncEngine } from "./sync.js";
|
|
9
9
|
export { FileWatcher } from "./watcher.js";
|
|
10
10
|
export { default as plugin } from "./plugin.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @storacha/clawracha - OpenClaw plugin for Storacha workspace sync
|
|
3
3
|
*/
|
|
4
|
-
export * from "./types.js";
|
|
4
|
+
export * from "./types/index.js";
|
|
5
5
|
export * from "./blockstore/index.js";
|
|
6
|
-
export { encodeWorkspaceFile, encodeFiles } from "./encoder.js";
|
|
7
|
-
export { diffEntries,
|
|
6
|
+
export { encodeWorkspaceFile, encodeFiles } from "./utils/encoder.js";
|
|
7
|
+
export { diffEntries, diffRemoteChanges } from "./utils/differ.js";
|
|
8
8
|
export { SyncEngine } from "./sync.js";
|
|
9
9
|
export { FileWatcher } from "./watcher.js";
|
|
10
10
|
// Re-export plugin definition (default export)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mdsync — CRDT markdown storage on top of UCN Pail.
|
|
3
|
+
*
|
|
4
|
+
* Stores RGA-backed markdown trees at Pail keys. Each key's value is a
|
|
5
|
+
* MarkdownEntry containing:
|
|
6
|
+
* - The current RGA tree (full document state)
|
|
7
|
+
* - An RGA of MarkdownEvents (causal history scoped to this key)
|
|
8
|
+
* - The last changeset applied (for incremental replay during merge)
|
|
9
|
+
*
|
|
10
|
+
* On read, if the Pail has multiple heads (concurrent writes), we resolve
|
|
11
|
+
* by walking from the common ancestor forward, replaying each branch's
|
|
12
|
+
* changesets and merging event RGAs — analogous to how Pail itself resolves
|
|
13
|
+
* concurrent root updates.
|
|
14
|
+
*/
|
|
15
|
+
import { BlockFetcher, ValueView } from "@storacha/ucn/pail/api";
|
|
16
|
+
import { Block, CID } from "multiformats";
|
|
17
|
+
interface MarkdownResult {
|
|
18
|
+
mdEntryCid: CID;
|
|
19
|
+
additions: Block[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* First put into an empty Pail (v0 = no existing revision).
|
|
23
|
+
* Returns the markdown entry CID and blocks to store. Caller is
|
|
24
|
+
* responsible for creating the Pail revision via Revision.v0Put.
|
|
25
|
+
*/
|
|
26
|
+
export declare const v0Put: (newMarkdown: string) => Promise<MarkdownResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Put markdown content at a key in an existing Pail.
|
|
29
|
+
*
|
|
30
|
+
* If the key doesn't exist, creates an initial entry. If it does exist,
|
|
31
|
+
* resolves the current value (merging concurrent heads if needed), computes
|
|
32
|
+
* an RGA changeset against the resolved tree, applies it, and stores the
|
|
33
|
+
* updated entry.
|
|
34
|
+
*
|
|
35
|
+
* Returns the markdown entry CID and blocks to store. Caller is
|
|
36
|
+
* responsible for creating the Pail revision via Revision.put.
|
|
37
|
+
*/
|
|
38
|
+
export declare const put: (blocks: BlockFetcher, current: ValueView, key: string, newMarkdown: string) => Promise<MarkdownResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the current markdown string for a key, resolving concurrent heads.
|
|
41
|
+
* Returns undefined if the key doesn't exist.
|
|
42
|
+
*/
|
|
43
|
+
export declare const get: (blocks: BlockFetcher, current: ValueView, key: string) => Promise<string | undefined>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAoJ1C,UAAU,cAAc;IACtB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,KAAK,EAAE,CAAC;CACpB;AAyBD;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,CAExB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,EACX,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,CA+BxB,CAAC;AA6RF;;;GAGG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,KACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAC"}
|