@automerge/automerge-repo 2.0.0-alpha.7 → 2.0.0-beta.1

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 (79) hide show
  1. package/README.md +8 -8
  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 +68 -45
  6. package/dist/DocHandle.d.ts.map +1 -1
  7. package/dist/DocHandle.js +166 -69
  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 +46 -6
  15. package/dist/Repo.d.ts.map +1 -1
  16. package/dist/Repo.js +252 -67
  17. package/dist/helpers/abortable.d.ts +39 -0
  18. package/dist/helpers/abortable.d.ts.map +1 -0
  19. package/dist/helpers/abortable.js +45 -0
  20. package/dist/helpers/arraysAreEqual.d.ts.map +1 -1
  21. package/dist/helpers/bufferFromHex.d.ts +3 -0
  22. package/dist/helpers/bufferFromHex.d.ts.map +1 -0
  23. package/dist/helpers/bufferFromHex.js +13 -0
  24. package/dist/helpers/debounce.d.ts.map +1 -1
  25. package/dist/helpers/eventPromise.d.ts.map +1 -1
  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/pause.d.ts.map +1 -1
  31. package/dist/helpers/tests/network-adapter-tests.d.ts.map +1 -1
  32. package/dist/helpers/tests/network-adapter-tests.js +13 -13
  33. package/dist/helpers/tests/storage-adapter-tests.d.ts +2 -2
  34. package/dist/helpers/tests/storage-adapter-tests.d.ts.map +1 -1
  35. package/dist/helpers/tests/storage-adapter-tests.js +25 -48
  36. package/dist/helpers/throttle.d.ts.map +1 -1
  37. package/dist/helpers/withTimeout.d.ts.map +1 -1
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/network/messages.d.ts.map +1 -1
  42. package/dist/storage/StorageSubsystem.d.ts +15 -1
  43. package/dist/storage/StorageSubsystem.d.ts.map +1 -1
  44. package/dist/storage/StorageSubsystem.js +50 -14
  45. package/dist/synchronizer/CollectionSynchronizer.d.ts +4 -3
  46. package/dist/synchronizer/CollectionSynchronizer.d.ts.map +1 -1
  47. package/dist/synchronizer/CollectionSynchronizer.js +34 -15
  48. package/dist/synchronizer/DocSynchronizer.d.ts +3 -2
  49. package/dist/synchronizer/DocSynchronizer.d.ts.map +1 -1
  50. package/dist/synchronizer/DocSynchronizer.js +51 -27
  51. package/dist/synchronizer/Synchronizer.d.ts +11 -0
  52. package/dist/synchronizer/Synchronizer.d.ts.map +1 -1
  53. package/dist/types.d.ts +4 -1
  54. package/dist/types.d.ts.map +1 -1
  55. package/fuzz/fuzz.ts +3 -3
  56. package/package.json +3 -4
  57. package/src/AutomergeUrl.ts +101 -26
  58. package/src/DocHandle.ts +235 -82
  59. package/src/FindProgress.ts +48 -0
  60. package/src/RemoteHeadsSubscriptions.ts +11 -9
  61. package/src/Repo.ts +364 -74
  62. package/src/helpers/abortable.ts +61 -0
  63. package/src/helpers/bufferFromHex.ts +14 -0
  64. package/src/helpers/headsAreSame.ts +2 -2
  65. package/src/helpers/tests/network-adapter-tests.ts +14 -13
  66. package/src/helpers/tests/storage-adapter-tests.ts +44 -86
  67. package/src/index.ts +7 -0
  68. package/src/storage/StorageSubsystem.ts +66 -16
  69. package/src/synchronizer/CollectionSynchronizer.ts +37 -16
  70. package/src/synchronizer/DocSynchronizer.ts +59 -32
  71. package/src/synchronizer/Synchronizer.ts +14 -0
  72. package/src/types.ts +4 -1
  73. package/test/AutomergeUrl.test.ts +130 -0
  74. package/test/CollectionSynchronizer.test.ts +4 -4
  75. package/test/DocHandle.test.ts +181 -38
  76. package/test/DocSynchronizer.test.ts +10 -3
  77. package/test/Repo.test.ts +376 -203
  78. package/test/StorageSubsystem.test.ts +80 -1
  79. 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
@@ -233,14 +232,14 @@ Now import it and add it to your list of network adapters:
233
232
 
234
233
  ```ts
235
234
  // main.tsx
236
- import { BrowserWebSocketClientAdapter } from "@automerge/automerge-repo-network-websocket" // <-- add this line
235
+ import { WebSocketClientAdapter } from "@automerge/automerge-repo-network-websocket" // <-- add this line
237
236
 
238
237
  // ...
239
238
 
240
239
  const repo = new Repo({
241
240
  network: [
242
241
  new BroadcastChannelNetworkAdapter(),
243
- new BrowserWebSocketClientAdapter("ws://localhost:3030"), // <-- add this line
242
+ new WebSocketClientAdapter("ws://localhost:3030"), // <-- add this line
244
243
  ],
245
244
  storage: new IndexedDBStorageAdapter(),
246
245
  })
@@ -262,3 +261,4 @@ With gratitude for contributions by:
262
261
  - Jeremy Rose
263
262
  - Alex Currie-Clark
264
263
  - Dylan Mackenzie
264
+ - Maciek Sakrejda
@@ -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,MA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,qBAAqB,GAChC,KAAK,UAAU,GAAG,UAAU,GAAG,gBAAgB,KAC9C,YAgCF,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,eAAe,GAAI,KAAK,YAAY,KAAG,MAAM,EAAE,GAAG,SAG9D,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,IAAI,aAAa,6BAO9C,CAAA;AAEf;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,YAsBzD,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,UASvD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,gBACH,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAO,YAGvC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,UAAU,KACjB,gBAAgB,GAAG,SAAS,CAAA;AAE/D,eAAO,MAAM,kBAAkB,GAAI,OAAO,gBAAgB,KAC7B,UAAU,CAAA;AAEvC,eAAO,MAAM,WAAW,GAAI,OAAO,cAAc,KAAG,QACsB,CAAA;AAE1E,eAAO,MAAM,WAAW,GAAI,OAAO,QAAQ,KAAG,cACgC,CAAA;AAE9E,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,6BAI1C,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,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)
@@ -58,38 +65,26 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
58
65
  */
59
66
  whenReady(awaitStates?: HandleState[]): Promise<void>;
60
67
  /**
61
- * @returns the current state of this handle's Automerge document.
68
+ * Returns the current state of the Automerge document this handle manages.
69
+ *
70
+ * @returns the current document
71
+ * @throws on deleted and unavailable documents
62
72
  *
63
- * This is the recommended way to access a handle's document. Note that this waits for the handle
64
- * to be ready if necessary. If loading (or synchronization) fails, this will never resolve.
65
73
  */
66
- doc(
67
- /** states to wait for, such as "LOADING". mostly for internal use. */
68
- awaitStates?: HandleState[]): Promise<A.Doc<T> | undefined>;
74
+ doc(): A.Doc<T>;
69
75
  /**
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.
73
- *
74
- * Not to be confused with the SyncState of the document, which describes the state of the
75
- * synchronization process.
76
- *
77
- * Note that `undefined` is not a valid Automerge document, so the return from this function is
78
- * unambigous.
79
76
  *
80
- * @returns the current document, or undefined if the document is not ready.
81
- */
82
- docSync(): A.Doc<T> | undefined;
77
+ * @deprecated */
78
+ docSync(): A.Doc<T>;
83
79
  /**
84
80
  * Returns the current "heads" of the document, akin to a git commit.
85
81
  * This precisely defines the state of a document.
86
82
  * @returns the current document's heads, or undefined if the document is not ready
87
83
  */
88
- heads(): A.Heads | undefined;
84
+ heads(): UrlHeads;
85
+ begin(): void;
89
86
  /**
90
- * Creates a fixed "view" of an automerge document at the given point in time represented
91
- * by the `heads` passed in. The return value is the same type as docSync() and will return
92
- * undefined if the object hasn't finished loading.
87
+ * Returns an array of all past "heads" for the document in topological order.
93
88
  *
94
89
  * @remarks
95
90
  * A point-in-time in an automerge document is an *array* of heads since there may be
@@ -98,28 +93,49 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
98
93
  * history views would be quite large under concurrency (every thing in each branch against each other).
99
94
  * There might be a clever way to think about this, but we haven't found it yet, so for now at least
100
95
  * we present a single traversable view which excludes concurrency.
101
- * @returns The individual heads for every change in the document.
96
+ * @returns UrlHeads[] - The individual heads for every change in the document. Each item is a tagged string[1].
102
97
  */
103
- history(): A.Heads[] | undefined;
98
+ history(): UrlHeads[] | undefined;
104
99
  /**
105
100
  * Creates a fixed "view" of an automerge document at the given point in time represented
106
- * by the `heads` passed in. The return value is the same type as docSync() and will return
101
+ * by the `heads` passed in. The return value is the same type as doc() and will return
107
102
  * undefined if the object hasn't finished loading.
108
- * @returns
103
+ *
104
+ * @remarks
105
+ * Note that our Typescript types do not consider change over time and the current version
106
+ * of Automerge doesn't check types at runtime, so if you go back to an old set of heads
107
+ * that doesn't match the heads here, Typescript will not save you.
108
+ *
109
+ * @argument heads - The heads to view the document at. See history().
110
+ * @returns DocHandle<T> at the time of `heads`
109
111
  */
110
- view(heads: A.Heads): A.Doc<T> | undefined;
112
+ view(heads: UrlHeads): DocHandle<T>;
111
113
  /**
112
- * Creates a fixed "view" of an automerge document at the given point in time represented
113
- * by the `heads` passed in. The return value is the same type as docSync() and will return
114
- * undefined if the object hasn't finished loading.
114
+ * Returns a set of Patch operations that will move a materialized document from one state to another
115
+ * if applied.
116
+ *
117
+ * @remarks
118
+ * We allow specifying either:
119
+ * - Two sets of heads to compare directly
120
+ * - A single set of heads to compare against our current heads
121
+ * - Another DocHandle to compare against (which must share history with this document)
122
+ *
123
+ * @throws Error if the documents don't share history or if either document is not ready
124
+ * @returns Automerge patches that go from one document state to the other
125
+ */
126
+ diff(first: UrlHeads | DocHandle<T>, second?: UrlHeads): A.Patch[];
127
+ /**
128
+ * `metadata(head?)` allows you to look at the metadata for a change
129
+ * this can be used to build history graphs to find commit messages and edit times.
130
+ * this interface.
115
131
  *
116
132
  * @remarks
117
- * We allow specifying both a from/to heads or just a single comparison point, in which case
118
- * the base will be the current document heads.
133
+ * I'm really not convinced this is the right way to surface this information so
134
+ * I'm leaving this API "hidden".
119
135
  *
120
- * @returns Automerge patches that go from one document state to the other. Use view() to get the full state.
136
+ * @hidden
121
137
  */
122
- diff(first: A.Heads, second?: A.Heads): A.Patch[] | undefined;
138
+ metadata(change?: string): A.DecodedChange | undefined;
123
139
  /**
124
140
  * `update` is called any time we have a new document state; could be
125
141
  * from a local change, a remote change, or a new document from storage.
@@ -134,12 +150,12 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
134
150
  */
135
151
  doneLoading(): void;
136
152
  /**
137
- * Called by the repo either when a doc handle changes or we receive new remote heads.
153
+ * Called by the repo when a doc handle changes or we receive new remote heads.
138
154
  * @hidden
139
155
  */
140
- setRemoteHeads(storageId: StorageId, heads: A.Heads): void;
156
+ setRemoteHeads(storageId: StorageId, heads: UrlHeads): void;
141
157
  /** Returns the heads of the storageId. */
142
- getRemoteHeads(storageId: StorageId): A.Heads | undefined;
158
+ getRemoteHeads(storageId: StorageId): UrlHeads | undefined;
143
159
  /**
144
160
  * All changes to an Automerge document should be made through this method.
145
161
  * Inside the callback, the document should be treated as mutable: all edits will be recorded
@@ -161,7 +177,7 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
161
177
  *
162
178
  * @returns A set of heads representing the concurrent change that was made.
163
179
  */
164
- changeAt(heads: A.Heads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): string[] | undefined;
180
+ changeAt(heads: UrlHeads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): UrlHeads[] | undefined;
165
181
  /**
166
182
  * Merges another document into this document. Any peers we are sharing changes with will be
167
183
  * notified of the changes resulting from the merge.
@@ -174,14 +190,19 @@ export declare class DocHandle<T> extends EventEmitter<DocHandleEvents<T>> {
174
190
  /** the handle of the document to merge into this one */
175
191
  otherHandle: DocHandle<T>): void;
176
192
  /**
177
- * Used in testing to mark this document as unavailable.
193
+ * Updates the internal state machine to mark the document unavailable.
178
194
  * @hidden
179
195
  */
180
196
  unavailable(): void;
181
- /** Called by the repo when the document is not found in storage.
197
+ /**
198
+ * Called by the repo either when the document is not found in storage.
182
199
  * @hidden
183
200
  * */
184
201
  request(): void;
202
+ /** Called by the repo to free memory used by the document. */
203
+ unload(): void;
204
+ /** Called by the repo to reuse an unloaded handle. */
205
+ reload(): void;
185
206
  /** Called by the repo when the document is deleted. */
186
207
  delete(): void;
187
208
  /**
@@ -205,6 +226,7 @@ export type DocHandleOptions<T> = {
205
226
  initialValue?: T;
206
227
  } | {
207
228
  isNew?: false;
229
+ heads?: UrlHeads;
208
230
  /** The number of milliseconds before we mark this document as unavailable if we don't have it and nobody shares it with us. */
209
231
  timeoutDelay?: number;
210
232
  };
@@ -213,7 +235,6 @@ export interface DocHandleEvents<T> {
213
235
  "heads-changed": (payload: DocHandleEncodedChangePayload<T>) => void;
214
236
  change: (payload: DocHandleChangePayload<T>) => void;
215
237
  delete: (payload: DocHandleDeletePayload<T>) => void;
216
- unavailable: (payload: DocHandleUnavailablePayload<T>) => void;
217
238
  "ephemeral-message": (payload: DocHandleEphemeralMessagePayload<T>) => void;
218
239
  "ephemeral-message-outbound": (payload: DocHandleOutboundEphemeralMessagePayload<T>) => void;
219
240
  "remote-heads": (payload: DocHandleRemoteHeadsPayload) => void;
@@ -256,7 +277,7 @@ export interface DocHandleOutboundEphemeralMessagePayload<T> {
256
277
  /** Emitted when we have new remote heads for this document */
257
278
  export interface DocHandleRemoteHeadsPayload {
258
279
  storageId: StorageId;
259
- heads: A.Heads;
280
+ heads: UrlHeads;
260
281
  }
261
282
  /**
262
283
  * Possible internal states for a DocHandle
@@ -270,11 +291,13 @@ export declare const HandleState: {
270
291
  readonly REQUESTING: "requesting";
271
292
  /** The document is available */
272
293
  readonly READY: "ready";
294
+ /** The document has been unloaded from the handle, to free memory usage */
295
+ readonly UNLOADED: "unloaded";
273
296
  /** The document has been deleted from the repo */
274
297
  readonly DELETED: "deleted";
275
298
  /** The document was not available in storage or from any connected peers */
276
299
  readonly UNAVAILABLE: "unavailable";
277
300
  };
278
301
  export type HandleState = (typeof HandleState)[keyof typeof HandleState];
279
- export declare const IDLE: "idle", LOADING: "loading", REQUESTING: "requesting", READY: "ready", DELETED: "deleted", UNAVAILABLE: "unavailable";
302
+ export declare const IDLE: "idle", LOADING: "loading", REQUESTING: "requesting", READY: "ready", UNLOADED: "unloaded", DELETED: "deleted", UNAVAILABLE: "unavailable";
280
303
  //# sourceMappingURL=DocHandle.d.ts.map
@@ -1 +1 @@
1
- {"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