@automerge/automerge-repo 2.0.0-alpha.2 → 2.0.0-alpha.22

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.
Files changed (76) hide show
  1. package/README.md +5 -6
  2. package/dist/AutomergeUrl.d.ts +17 -5
  3. package/dist/AutomergeUrl.d.ts.map +1 -1
  4. package/dist/AutomergeUrl.js +71 -24
  5. package/dist/DocHandle.d.ts +89 -20
  6. package/dist/DocHandle.d.ts.map +1 -1
  7. package/dist/DocHandle.js +189 -28
  8. package/dist/FindProgress.d.ts +30 -0
  9. package/dist/FindProgress.d.ts.map +1 -0
  10. package/dist/FindProgress.js +1 -0
  11. package/dist/RemoteHeadsSubscriptions.d.ts +4 -5
  12. package/dist/RemoteHeadsSubscriptions.d.ts.map +1 -1
  13. package/dist/RemoteHeadsSubscriptions.js +4 -1
  14. package/dist/Repo.d.ts +44 -6
  15. package/dist/Repo.d.ts.map +1 -1
  16. package/dist/Repo.js +226 -87
  17. package/dist/entrypoints/fullfat.d.ts +1 -0
  18. package/dist/entrypoints/fullfat.d.ts.map +1 -1
  19. package/dist/entrypoints/fullfat.js +1 -2
  20. package/dist/helpers/abortable.d.ts +39 -0
  21. package/dist/helpers/abortable.d.ts.map +1 -0
  22. package/dist/helpers/abortable.js +45 -0
  23. package/dist/helpers/bufferFromHex.d.ts +3 -0
  24. package/dist/helpers/bufferFromHex.d.ts.map +1 -0
  25. package/dist/helpers/bufferFromHex.js +13 -0
  26. package/dist/helpers/headsAreSame.d.ts +2 -2
  27. package/dist/helpers/headsAreSame.d.ts.map +1 -1
  28. package/dist/helpers/mergeArrays.d.ts +1 -1
  29. package/dist/helpers/mergeArrays.d.ts.map +1 -1
  30. package/dist/helpers/tests/network-adapter-tests.d.ts.map +1 -1
  31. package/dist/helpers/tests/network-adapter-tests.js +13 -13
  32. package/dist/helpers/tests/storage-adapter-tests.d.ts +2 -2
  33. package/dist/helpers/tests/storage-adapter-tests.d.ts.map +1 -1
  34. package/dist/helpers/tests/storage-adapter-tests.js +25 -48
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/storage/StorageSubsystem.d.ts +11 -1
  39. package/dist/storage/StorageSubsystem.d.ts.map +1 -1
  40. package/dist/storage/StorageSubsystem.js +20 -4
  41. package/dist/synchronizer/CollectionSynchronizer.d.ts +17 -3
  42. package/dist/synchronizer/CollectionSynchronizer.d.ts.map +1 -1
  43. package/dist/synchronizer/CollectionSynchronizer.js +43 -18
  44. package/dist/synchronizer/DocSynchronizer.d.ts +10 -2
  45. package/dist/synchronizer/DocSynchronizer.d.ts.map +1 -1
  46. package/dist/synchronizer/DocSynchronizer.js +30 -8
  47. package/dist/synchronizer/Synchronizer.d.ts +11 -0
  48. package/dist/synchronizer/Synchronizer.d.ts.map +1 -1
  49. package/dist/types.d.ts +4 -1
  50. package/dist/types.d.ts.map +1 -1
  51. package/fuzz/fuzz.ts +3 -3
  52. package/package.json +3 -3
  53. package/src/AutomergeUrl.ts +101 -26
  54. package/src/DocHandle.ts +256 -38
  55. package/src/FindProgress.ts +48 -0
  56. package/src/RemoteHeadsSubscriptions.ts +11 -9
  57. package/src/Repo.ts +310 -95
  58. package/src/entrypoints/fullfat.ts +1 -2
  59. package/src/helpers/abortable.ts +61 -0
  60. package/src/helpers/bufferFromHex.ts +14 -0
  61. package/src/helpers/headsAreSame.ts +2 -2
  62. package/src/helpers/tests/network-adapter-tests.ts +14 -13
  63. package/src/helpers/tests/storage-adapter-tests.ts +44 -86
  64. package/src/index.ts +2 -0
  65. package/src/storage/StorageSubsystem.ts +29 -4
  66. package/src/synchronizer/CollectionSynchronizer.ts +56 -19
  67. package/src/synchronizer/DocSynchronizer.ts +34 -9
  68. package/src/synchronizer/Synchronizer.ts +14 -0
  69. package/src/types.ts +4 -1
  70. package/test/AutomergeUrl.test.ts +130 -0
  71. package/test/CollectionSynchronizer.test.ts +4 -4
  72. package/test/DocHandle.test.ts +189 -29
  73. package/test/DocSynchronizer.test.ts +10 -3
  74. package/test/Repo.test.ts +377 -191
  75. package/test/StorageSubsystem.test.ts +17 -0
  76. package/test/remoteHeads.test.ts +27 -12
package/README.md CHANGED
@@ -40,9 +40,9 @@ A `Repo` exposes these methods:
40
40
 
41
41
  - `create<T>(initialValue: T?)`
42
42
  Creates a new `Automerge.Doc` and returns a `DocHandle` for it. Accepts an optional initial value for the document. Produces an empty document (potentially violating the type!) otherwise.
43
- - `find<T>(docId: DocumentId)`
43
+ - `find<T>(docId: DocumentId): Promise<DocHandle<T>>`
44
44
  Looks up a given document either on the local machine or (if necessary) over any configured
45
- networks.
45
+ networks. Returns a promise that resolves when the document is loaded or throws if load fails.
46
46
  - `delete(docId: DocumentId)`
47
47
  Deletes the local copy of a document from the local cache and local storage. _This does not currently delete the document from any other peers_.
48
48
  - `import(binary: Uint8Array)`
@@ -57,10 +57,9 @@ A `Repo` exposes these methods:
57
57
  A `DocHandle` is a wrapper around an `Automerge.Doc`. Its primary function is to dispatch changes to
58
58
  the document.
59
59
 
60
- - `handle.doc()` or `handle.docSync()`
61
- Returns a `Promise<Doc<T>>` that will contain the current value of the document.
62
- it waits until the document has finished loading and/or synchronizing over the network before
63
- returning a value.
60
+ - `handle.doc()`
61
+ Returns a `Doc<T>` that will contain the current value of the document.
62
+ Throws an error if the document is deleted.
64
63
  - `handle.change((doc: T) => void)`
65
64
  Calls the provided callback with an instrumented mutable object
66
65
  representing the document. Any changes made to the document will be recorded and distributed to
@@ -1,17 +1,26 @@
1
- import type { LegacyDocumentId, AutomergeUrl, BinaryDocumentId, DocumentId, AnyDocumentId } from "./types.js";
1
+ import type { LegacyDocumentId, AutomergeUrl, BinaryDocumentId, DocumentId, AnyDocumentId, UrlHeads } from "./types.js";
2
+ import type { Heads as AutomergeHeads } from "@automerge/automerge/slim";
2
3
  export declare const urlPrefix = "automerge:";
3
- /** Given an Automerge URL, returns the DocumentId in both base58check-encoded form and binary form */
4
- export declare const parseAutomergeUrl: (url: AutomergeUrl) => {
4
+ interface ParsedAutomergeUrl {
5
5
  /** unencoded DocumentId */
6
6
  binaryDocumentId: BinaryDocumentId;
7
- /** encoded DocumentId */
7
+ /** bs58 encoded DocumentId */
8
8
  documentId: DocumentId;
9
- };
9
+ /** Optional array of heads, if specified in URL */
10
+ heads?: UrlHeads;
11
+ /** Optional hex array of heads, in Automerge core format */
12
+ hexHeads?: string[];
13
+ }
14
+ /** Given an Automerge URL, returns the DocumentId in both base58check-encoded form and binary form */
15
+ export declare const parseAutomergeUrl: (url: AutomergeUrl) => ParsedAutomergeUrl;
10
16
  /**
11
17
  * Given a documentId in either binary or base58check-encoded form, returns an Automerge URL.
12
18
  * Throws on invalid input.
13
19
  */
14
20
  export declare const stringifyAutomergeUrl: (arg: UrlOptions | DocumentId | BinaryDocumentId) => AutomergeUrl;
21
+ /** Helper to extract just the heads from a URL if they exist */
22
+ export declare const getHeadsFromUrl: (url: AutomergeUrl) => string[] | undefined;
23
+ export declare const anyDocumentIdToAutomergeUrl: (id: AnyDocumentId) => AutomergeUrl | undefined;
15
24
  /**
16
25
  * Given a string, returns true if it is a valid Automerge URL. This function also acts as a type
17
26
  * discriminator in Typescript.
@@ -25,6 +34,8 @@ export declare const isValidUuid: (str: unknown) => str is LegacyDocumentId;
25
34
  export declare const generateAutomergeUrl: () => AutomergeUrl;
26
35
  export declare const documentIdToBinary: (docId: DocumentId) => BinaryDocumentId | undefined;
27
36
  export declare const binaryToDocumentId: (docId: BinaryDocumentId) => DocumentId;
37
+ export declare const encodeHeads: (heads: AutomergeHeads) => UrlHeads;
38
+ export declare const decodeHeads: (heads: UrlHeads) => AutomergeHeads;
28
39
  export declare const parseLegacyUUID: (str: string) => AutomergeUrl | undefined;
29
40
  /**
30
41
  * Given any valid expression of a document ID, returns a DocumentId in base58check-encoded form.
@@ -40,6 +51,7 @@ export declare const parseLegacyUUID: (str: string) => AutomergeUrl | undefined;
40
51
  export declare const interpretAsDocumentId: (id: AnyDocumentId) => DocumentId;
41
52
  type UrlOptions = {
42
53
  documentId: DocumentId | BinaryDocumentId;
54
+ heads?: UrlHeads;
43
55
  };
44
56
  export {};
45
57
  //# sourceMappingURL=AutomergeUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutomergeUrl.d.ts","sourceRoot":"","sources":["../src/AutomergeUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,aAAa,EACd,MAAM,YAAY,CAAA;AAInB,eAAO,MAAM,SAAS,eAAe,CAAA;AAErC,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,QAAS,YAAY;IAQ/C,2BAA2B;;IAE3B,yBAAyB;;CAG5B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAC3B,UAAU,GAAG,UAAU,GAAG,gBAAgB,KAmBL,YAC3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAS,OAAO,KAAG,GAAG,IAAI,YAUzD,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAS,OAAO,KAAG,GAAG,IAAI,UASvD,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,GAAG,IAAI,gBACH,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAO,YAGvC,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAW,UAAU,KACjB,gBAAgB,GAAG,SAAS,CAAA;AAE/D,eAAO,MAAM,kBAAkB,UAAW,gBAAgB,KAC7B,UAAU,CAAA;AAEvC,eAAO,MAAM,eAAe,QAAS,MAAM,6BAI1C,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,OAAQ,aAAa,eAqBtD,CAAA;AAID,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,UAAU,GAAG,gBAAgB,CAAA;CAC1C,CAAA"}
1
+ {"version":3,"file":"AutomergeUrl.d.ts","sourceRoot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,WAAW,UAAW,cAAc,KAAG,QACsB,CAAA;AAE1E,eAAO,MAAM,WAAW,UAAW,QAAQ,KAAG,cACgC,CAAA;AAE9E,eAAO,MAAM,eAAe,QAAS,MAAM,6BAI1C,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,OAAQ,aAAa,eAqBtD,CAAA;AAID,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,UAAU,GAAG,gBAAgB,CAAA;IACzC,KAAK,CAAC,EAAE,QAAQ,CAAA;CACjB,CAAA"}
@@ -1,53 +1,98 @@
1
1
  import * as Uuid from "uuid";
2
2
  import bs58check from "bs58check";
3
+ import { uint8ArrayFromHexString, uint8ArrayToHexString, } from "./helpers/bufferFromHex.js";
3
4
  export const urlPrefix = "automerge:";
4
5
  /** Given an Automerge URL, returns the DocumentId in both base58check-encoded form and binary form */
5
6
  export const parseAutomergeUrl = (url) => {
7
+ const [baseUrl, headsSection, ...rest] = url.split("#");
8
+ if (rest.length > 0) {
9
+ throw new Error("Invalid URL: contains multiple heads sections");
10
+ }
6
11
  const regex = new RegExp(`^${urlPrefix}(\\w+)$`);
7
- const [, docMatch] = url.match(regex) || [];
12
+ const [, docMatch] = baseUrl.match(regex) || [];
8
13
  const documentId = docMatch;
9
14
  const binaryDocumentId = documentIdToBinary(documentId);
10
15
  if (!binaryDocumentId)
11
16
  throw new Error("Invalid document URL: " + url);
12
- return {
13
- /** unencoded DocumentId */
14
- binaryDocumentId,
15
- /** encoded DocumentId */
16
- documentId,
17
- };
17
+ if (headsSection === undefined)
18
+ return { binaryDocumentId, documentId };
19
+ const heads = (headsSection === "" ? [] : headsSection.split("|"));
20
+ const hexHeads = heads.map(head => {
21
+ try {
22
+ return uint8ArrayToHexString(bs58check.decode(head));
23
+ }
24
+ catch (e) {
25
+ throw new Error(`Invalid head in URL: ${head}`);
26
+ }
27
+ });
28
+ return { binaryDocumentId, hexHeads, documentId, heads };
18
29
  };
19
30
  /**
20
31
  * Given a documentId in either binary or base58check-encoded form, returns an Automerge URL.
21
32
  * Throws on invalid input.
22
33
  */
23
34
  export const stringifyAutomergeUrl = (arg) => {
24
- const documentId = arg instanceof Uint8Array || typeof arg === "string"
25
- ? arg
26
- : "documentId" in arg
27
- ? arg.documentId
28
- : undefined;
35
+ if (arg instanceof Uint8Array || typeof arg === "string") {
36
+ return (urlPrefix +
37
+ (arg instanceof Uint8Array
38
+ ? binaryToDocumentId(arg)
39
+ : arg));
40
+ }
41
+ const { documentId, heads = undefined } = arg;
42
+ if (documentId === undefined)
43
+ throw new Error("Invalid documentId: " + documentId);
29
44
  const encodedDocumentId = documentId instanceof Uint8Array
30
45
  ? binaryToDocumentId(documentId)
31
- : typeof documentId === "string"
32
- ? documentId
33
- : undefined;
34
- if (encodedDocumentId === undefined)
35
- throw new Error("Invalid documentId: " + documentId);
36
- return (urlPrefix + encodedDocumentId);
46
+ : documentId;
47
+ let url = `${urlPrefix}${encodedDocumentId}`;
48
+ if (heads !== undefined) {
49
+ heads.forEach(head => {
50
+ try {
51
+ bs58check.decode(head);
52
+ }
53
+ catch (e) {
54
+ throw new Error(`Invalid head: ${head}`);
55
+ }
56
+ });
57
+ url += "#" + heads.join("|");
58
+ }
59
+ return url;
60
+ };
61
+ /** Helper to extract just the heads from a URL if they exist */
62
+ export const getHeadsFromUrl = (url) => {
63
+ const { heads } = parseAutomergeUrl(url);
64
+ return heads;
37
65
  };
66
+ export const anyDocumentIdToAutomergeUrl = (id) => isValidAutomergeUrl(id)
67
+ ? id
68
+ : isValidDocumentId(id)
69
+ ? stringifyAutomergeUrl({ documentId: id })
70
+ : isValidUuid(id)
71
+ ? parseLegacyUUID(id)
72
+ : undefined;
38
73
  /**
39
74
  * Given a string, returns true if it is a valid Automerge URL. This function also acts as a type
40
75
  * discriminator in Typescript.
41
76
  */
42
77
  export const isValidAutomergeUrl = (str) => {
43
- if (typeof str !== "string")
44
- return false;
45
- if (!str || !str.startsWith(urlPrefix))
78
+ if (typeof str !== "string" || !str || !str.startsWith(urlPrefix))
46
79
  return false;
47
- const automergeUrl = str;
48
80
  try {
49
- const { documentId } = parseAutomergeUrl(automergeUrl);
50
- return isValidDocumentId(documentId);
81
+ const { documentId, heads } = parseAutomergeUrl(str);
82
+ if (!isValidDocumentId(documentId))
83
+ return false;
84
+ if (heads &&
85
+ !heads.every(head => {
86
+ try {
87
+ bs58check.decode(head);
88
+ return true;
89
+ }
90
+ catch {
91
+ return false;
92
+ }
93
+ }))
94
+ return false;
95
+ return true;
51
96
  }
52
97
  catch {
53
98
  return false;
@@ -74,6 +119,8 @@ export const generateAutomergeUrl = () => {
74
119
  };
75
120
  export const documentIdToBinary = (docId) => bs58check.decodeUnsafe(docId);
76
121
  export const binaryToDocumentId = (docId) => bs58check.encode(docId);
122
+ export const encodeHeads = (heads) => heads.map(h => bs58check.encode(uint8ArrayFromHexString(h)));
123
+ export const decodeHeads = (heads) => heads.map(h => uint8ArrayToHexString(bs58check.decode(h)));
77
124
  export const parseLegacyUUID = (str) => {
78
125
  if (!Uuid.validate(str))
79
126
  return undefined;
@@ -1,6 +1,6 @@
1
1
  import * as A from "@automerge/automerge/slim/next";
2
2
  import { EventEmitter } from "eventemitter3";
3
- import type { AutomergeUrl, DocumentId, PeerId } from "./types.js";
3
+ import type { AutomergeUrl, DocumentId, PeerId, UrlHeads } from "./types.js";
4
4
  import { StorageId } from "./storage/types.js";
5
5
  /**
6
6
  * A DocHandle is a wrapper around a single Automerge document that lets us listen for changes and
@@ -30,6 +30,13 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
30
30
  * peers. We do not currently have an equivalent `whenSynced()`.
31
31
  */
32
32
  isReady: () => boolean;
33
+ /**
34
+ * @returns true if the document has been unloaded.
35
+ *
36
+ * Unloaded documents are freed from memory but not removed from local storage. It's not currently
37
+ * possible at runtime to reload an unloaded document.
38
+ */
39
+ isUnloaded: () => boolean;
33
40
  /**
34
41
  * @returns true if the document has been marked as deleted.
35
42
  *
@@ -48,7 +55,7 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
48
55
  */
49
56
  inState: (states: HandleState[]) => boolean;
50
57
  /** @hidden */
51
- get state(): "idle" | "loading" | "requesting" | "ready" | "unavailable" | "deleted";
58
+ get state(): "idle" | "loading" | "requesting" | "ready" | "unavailable" | "unloaded" | "deleted";
52
59
  /**
53
60
  * @returns a promise that resolves when the document is in one of the given states (if no states
54
61
  * are passed, when the document is ready)
@@ -63,29 +70,81 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
63
70
  * This is the recommended way to access a handle's document. Note that this waits for the handle
64
71
  * to be ready if necessary. If loading (or synchronization) fails, this will never resolve.
65
72
  */
66
- doc(
73
+ legacyAsyncDoc(
67
74
  /** states to wait for, such as "LOADING". mostly for internal use. */
68
75
  awaitStates?: HandleState[]): Promise<A.Doc<T> | undefined>;
69
76
  /**
70
- * Synchronously returns the current state of the Automerge document this handle manages, or
71
- * undefined. Consider using `await handle.doc()` instead. Check `isReady()`, or use `whenReady()`
72
- * if you want to make sure loading is complete first.
77
+ * Returns the current state of the Automerge document this handle manages.
73
78
  *
74
- * Not to be confused with the SyncState of the document, which describes the state of the
75
- * synchronization process.
79
+ * @returns the current document
80
+ * @throws on deleted and unavailable documents
76
81
  *
77
- * Note that `undefined` is not a valid Automerge document, so the return from this function is
78
- * unambigous.
79
- *
80
- * @returns the current document, or undefined if the document is not ready.
81
82
  */
82
- docSync(): A.Doc<T> | undefined;
83
+ doc(): A.Doc<T>;
84
+ /**
85
+ *
86
+ * @deprecated */
87
+ docSync(): A.Doc<T>;
83
88
  /**
84
89
  * Returns the current "heads" of the document, akin to a git commit.
85
90
  * This precisely defines the state of a document.
86
91
  * @returns the current document's heads, or undefined if the document is not ready
87
92
  */
88
- heads(): A.Heads | undefined;
93
+ heads(): UrlHeads;
94
+ begin(): void;
95
+ /**
96
+ * Returns an array of all past "heads" for the document in topological order.
97
+ *
98
+ * @remarks
99
+ * A point-in-time in an automerge document is an *array* of heads since there may be
100
+ * concurrent edits. This API just returns a topologically sorted history of all edits
101
+ * so every previous entry will be (in some sense) before later ones, but the set of all possible
102
+ * history views would be quite large under concurrency (every thing in each branch against each other).
103
+ * There might be a clever way to think about this, but we haven't found it yet, so for now at least
104
+ * we present a single traversable view which excludes concurrency.
105
+ * @returns UrlHeads[] - The individual heads for every change in the document. Each item is a tagged string[1].
106
+ */
107
+ history(): UrlHeads[] | undefined;
108
+ /**
109
+ * Creates a fixed "view" of an automerge document at the given point in time represented
110
+ * by the `heads` passed in. The return value is the same type as doc() and will return
111
+ * undefined if the object hasn't finished loading.
112
+ *
113
+ * @remarks
114
+ * Note that our Typescript types do not consider change over time and the current version
115
+ * of Automerge doesn't check types at runtime, so if you go back to an old set of heads
116
+ * that doesn't match the heads here, Typescript will not save you.
117
+ *
118
+ * @argument heads - The heads to view the document at. See history().
119
+ * @returns DocHandle<T> at the time of `heads`
120
+ */
121
+ view(heads: UrlHeads): DocHandle<T>;
122
+ /**
123
+ * Returns a set of Patch operations that will move a materialized document from one state to another
124
+ * if applied.
125
+ *
126
+ * @remarks
127
+ * We allow specifying either:
128
+ * - Two sets of heads to compare directly
129
+ * - A single set of heads to compare against our current heads
130
+ * - Another DocHandle to compare against (which must share history with this document)
131
+ *
132
+ * @throws Error if the documents don't share history or if either document is not ready
133
+ * @returns Automerge patches that go from one document state to the other
134
+ */
135
+ diff(first: UrlHeads | DocHandle<T>, second?: UrlHeads): A.Patch[];
136
+ /**
137
+ * `metadata(head?)` allows you to look at the metadata for a change
138
+ * this can be used to build history graphs to find commit messages and edit times.
139
+ * this interface.
140
+ *
141
+ * @remarks
142
+ * I'm really not convinced this is the right way to surface this information so
143
+ * I'm leaving this API "hidden".
144
+ *
145
+ * @hidden
146
+ */
147
+ metadata(change?: string): A.DecodedChange | undefined;
89
148
  /**
90
149
  * `update` is called any time we have a new document state; could be
91
150
  * from a local change, a remote change, or a new document from storage.
@@ -103,9 +162,9 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
103
162
  * Called by the repo either when a doc handle changes or we receive new remote heads.
104
163
  * @hidden
105
164
  */
106
- setRemoteHeads(storageId: StorageId, heads: A.Heads): void;
165
+ setRemoteHeads(storageId: StorageId, heads: UrlHeads): void;
107
166
  /** Returns the heads of the storageId. */
108
- getRemoteHeads(storageId: StorageId): A.Heads | undefined;
167
+ getRemoteHeads(storageId: StorageId): UrlHeads | undefined;
109
168
  /**
110
169
  * All changes to an Automerge document should be made through this method.
111
170
  * Inside the callback, the document should be treated as mutable: all edits will be recorded
@@ -127,7 +186,7 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
127
186
  *
128
187
  * @returns A set of heads representing the concurrent change that was made.
129
188
  */
130
- changeAt(heads: A.Heads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): string[] | undefined;
189
+ changeAt(heads: UrlHeads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): UrlHeads[] | undefined;
131
190
  /**
132
191
  * Merges another document into this document. Any peers we are sharing changes with will be
133
192
  * notified of the changes resulting from the merge.
@@ -148,6 +207,10 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
148
207
  * @hidden
149
208
  * */
150
209
  request(): void;
210
+ /** Called by the repo to free memory used by the document. */
211
+ unload(): void;
212
+ /** Called by the repo to reuse an unloaded handle. */
213
+ reload(): void;
151
214
  /** Called by the repo when the document is deleted. */
152
215
  delete(): void;
153
216
  /**
@@ -158,6 +221,10 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
158
221
  * must have a unique PeerId.
159
222
  */
160
223
  broadcast(message: unknown): void;
224
+ metrics(): {
225
+ numOps: number;
226
+ numChanges: number;
227
+ };
161
228
  }
162
229
  /** @hidden */
163
230
  export type DocHandleOptions<T> = {
@@ -167,6 +234,7 @@ export type DocHandleOptions<T> = {
167
234
  initialValue?: T;
168
235
  } | {
169
236
  isNew?: false;
237
+ heads?: UrlHeads;
170
238
  /** The number of milliseconds before we mark this document as unavailable if we don't have it and nobody shares it with us. */
171
239
  timeoutDelay?: number;
172
240
  };
@@ -175,7 +243,6 @@ export interface DocHandleEvents<T> {
175
243
  "heads-changed": (payload: DocHandleEncodedChangePayload<T>) => void;
176
244
  change: (payload: DocHandleChangePayload<T>) => void;
177
245
  delete: (payload: DocHandleDeletePayload<T>) => void;
178
- unavailable: (payload: DocHandleUnavailablePayload<T>) => void;
179
246
  "ephemeral-message": (payload: DocHandleEphemeralMessagePayload<T>) => void;
180
247
  "ephemeral-message-outbound": (payload: DocHandleOutboundEphemeralMessagePayload<T>) => void;
181
248
  "remote-heads": (payload: DocHandleRemoteHeadsPayload) => void;
@@ -218,7 +285,7 @@ export interface DocHandleOutboundEphemeralMessagePayload<T> {
218
285
  /** Emitted when we have new remote heads for this document */
219
286
  export interface DocHandleRemoteHeadsPayload {
220
287
  storageId: StorageId;
221
- heads: A.Heads;
288
+ heads: UrlHeads;
222
289
  }
223
290
  /**
224
291
  * Possible internal states for a DocHandle
@@ -232,11 +299,13 @@ export declare const HandleState: {
232
299
  readonly REQUESTING: "requesting";
233
300
  /** The document is available */
234
301
  readonly READY: "ready";
302
+ /** The document has been unloaded from the handle, to free memory usage */
303
+ readonly UNLOADED: "unloaded";
235
304
  /** The document has been deleted from the repo */
236
305
  readonly DELETED: "deleted";
237
306
  /** The document was not available in storage or from any connected peers */
238
307
  readonly UNAVAILABLE: "unavailable";
239
308
  };
240
309
  export type HandleState = (typeof HandleState)[keyof typeof HandleState];
241
- export declare const IDLE: "idle", LOADING: "loading", REQUESTING: "requesting", READY: "ready", DELETED: "deleted", UNAVAILABLE: "unavailable";
310
+ export declare const IDLE: "idle", LOADING: "loading", REQUESTING: "requesting", READY: "ready", UNLOADED: "unloaded", DELETED: "deleted", UNAVAILABLE: "unavailable";
242
311
  //# sourceMappingURL=DocHandle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocHandle.d.ts","sourceRoot":"","sources":["../src/DocHandle.ts"],"names":[],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