cojson 0.2.2 → 0.3.0-alpha.0

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 (85) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/dist/account.d.ts +8 -8
  3. package/dist/account.js +2 -2
  4. package/dist/account.js.map +1 -1
  5. package/dist/coValue.d.ts +22 -27
  6. package/dist/coValue.js +21 -0
  7. package/dist/coValue.js.map +1 -1
  8. package/dist/coValueCore.d.ts +7 -7
  9. package/dist/coValueCore.js +11 -14
  10. package/dist/coValueCore.js.map +1 -1
  11. package/dist/coValues/coList.d.ts +107 -42
  12. package/dist/coValues/coList.js +163 -72
  13. package/dist/coValues/coList.js.map +1 -1
  14. package/dist/coValues/coMap.d.ts +109 -50
  15. package/dist/coValues/coMap.js +161 -109
  16. package/dist/coValues/coMap.js.map +1 -1
  17. package/dist/coValues/coStream.d.ts +78 -33
  18. package/dist/coValues/coStream.js +134 -53
  19. package/dist/coValues/coStream.js.map +1 -1
  20. package/dist/crypto.d.ts +8 -3
  21. package/dist/crypto.js +6 -6
  22. package/dist/crypto.js.map +1 -1
  23. package/dist/group.d.ts +59 -23
  24. package/dist/group.js +83 -25
  25. package/dist/group.js.map +1 -1
  26. package/dist/index.d.ts +14 -11
  27. package/dist/index.js +8 -8
  28. package/dist/index.js.map +1 -1
  29. package/dist/{node.d.ts → localNode.d.ts} +23 -11
  30. package/dist/{node.js → localNode.js} +80 -42
  31. package/dist/localNode.js.map +1 -0
  32. package/dist/media.d.ts +1 -2
  33. package/dist/permissions.js +6 -3
  34. package/dist/permissions.js.map +1 -1
  35. package/dist/queriedCoValues/queriedCoList.d.ts +66 -0
  36. package/dist/queriedCoValues/queriedCoList.js +120 -0
  37. package/dist/queriedCoValues/queriedCoList.js.map +1 -0
  38. package/dist/queriedCoValues/queriedCoMap.d.ts +47 -0
  39. package/dist/queriedCoValues/queriedCoMap.js +83 -0
  40. package/dist/queriedCoValues/queriedCoMap.js.map +1 -0
  41. package/dist/queriedCoValues/queriedCoStream.d.ts +40 -0
  42. package/dist/queriedCoValues/queriedCoStream.js +72 -0
  43. package/dist/queriedCoValues/queriedCoStream.js.map +1 -0
  44. package/dist/queries.d.ts +31 -0
  45. package/dist/queries.js +77 -0
  46. package/dist/queries.js.map +1 -0
  47. package/dist/sync.d.ts +1 -1
  48. package/dist/sync.js +1 -1
  49. package/dist/sync.js.map +1 -1
  50. package/dist/{testUtils.d.ts → tests/testUtils.d.ts} +9 -9
  51. package/dist/{testUtils.js → tests/testUtils.js} +9 -7
  52. package/dist/tests/testUtils.js.map +1 -0
  53. package/package.json +2 -2
  54. package/src/account.ts +6 -6
  55. package/src/coValue.ts +65 -34
  56. package/src/coValueCore.ts +18 -22
  57. package/src/coValues/coList.ts +272 -122
  58. package/src/coValues/coMap.ts +349 -152
  59. package/src/coValues/coStream.ts +258 -94
  60. package/src/crypto.ts +37 -24
  61. package/src/group.ts +112 -46
  62. package/src/index.ts +42 -30
  63. package/src/{node.ts → localNode.ts} +117 -66
  64. package/src/media.ts +1 -2
  65. package/src/permissions.ts +15 -18
  66. package/src/queriedCoValues/queriedCoList.ts +248 -0
  67. package/src/queriedCoValues/queriedCoMap.ts +180 -0
  68. package/src/queriedCoValues/queriedCoStream.ts +125 -0
  69. package/src/queries.ts +142 -0
  70. package/src/sync.ts +2 -2
  71. package/src/{account.test.ts → tests/account.test.ts} +6 -9
  72. package/src/{coValue.test.ts → tests/coValue.test.ts} +120 -114
  73. package/src/{coValueCore.test.ts → tests/coValueCore.test.ts} +7 -7
  74. package/src/{crypto.test.ts → tests/crypto.test.ts} +19 -21
  75. package/src/{group.test.ts → tests/group.test.ts} +2 -2
  76. package/src/{permissions.test.ts → tests/permissions.test.ts} +260 -247
  77. package/src/tests/queries.test.ts +318 -0
  78. package/src/{sync.test.ts → tests/sync.test.ts} +39 -39
  79. package/src/{testUtils.ts → tests/testUtils.ts} +10 -8
  80. package/dist/coValues/static.d.ts +0 -14
  81. package/dist/coValues/static.js +0 -20
  82. package/dist/coValues/static.js.map +0 -1
  83. package/dist/node.js.map +0 -1
  84. package/dist/testUtils.js.map +0 -1
  85. package/src/coValues/static.ts +0 -31
@@ -1,9 +1,10 @@
1
+ import { isCoValue } from "../coValue.js";
1
2
  import { accountOrAgentIDfromSessionID } from "../coValueCore.js";
2
- import { isAccountID } from "../account.js";
3
3
  import { parseJSON } from "../jsonStringify.js";
4
- export class CoList {
4
+ export class CoListView {
5
5
  /** @internal */
6
6
  constructor(core) {
7
+ /** @category 6. Meta */
7
8
  this.type = "colist";
8
9
  this.id = core.id;
9
10
  this.core = core;
@@ -11,16 +12,6 @@ export class CoList {
11
12
  this.beforeEnd = [];
12
13
  this.insertions = {};
13
14
  this.deletionsByInsertion = {};
14
- this.fillOpsFromCoValue();
15
- }
16
- get meta() {
17
- return this.core.header.meta;
18
- }
19
- get group() {
20
- return this.core.getGroup();
21
- }
22
- /** @internal */
23
- fillOpsFromCoValue() {
24
15
  this.insertions = {};
25
16
  this.deletionsByInsertion = {};
26
17
  this.afterStart = [];
@@ -117,7 +108,27 @@ export class CoList {
117
108
  }
118
109
  }
119
110
  }
120
- /** Get the item currently at `idx`. */
111
+ /** @category 6. Meta */
112
+ get meta() {
113
+ return this.core.header.meta;
114
+ }
115
+ /** @category 6. Meta */
116
+ get group() {
117
+ return this.core.getGroup();
118
+ }
119
+ /**
120
+ * Not yet implemented
121
+ *
122
+ * @category 4. Time travel
123
+ */
124
+ atTime(_time) {
125
+ throw new Error("Not yet implemented");
126
+ }
127
+ /**
128
+ * Get the item currently at `idx`.
129
+ *
130
+ * @category 1. Reading
131
+ */
121
132
  get(idx) {
122
133
  const entry = this.entries()[idx];
123
134
  if (!entry) {
@@ -125,10 +136,15 @@ export class CoList {
125
136
  }
126
137
  return entry.value;
127
138
  }
128
- /** Returns the current items in the CoList as an array. */
139
+ /**
140
+ * Returns the current items in the CoList as an array.
141
+ *
142
+ * @category 1. Reading
143
+ **/
129
144
  asArray() {
130
145
  return this.entries().map((entry) => entry.value);
131
146
  }
147
+ /** @internal */
132
148
  entries() {
133
149
  const arr = [];
134
150
  for (const opID of this.afterStart) {
@@ -160,58 +176,80 @@ export class CoList {
160
176
  this.fillArrayFromOpID(successor, arr);
161
177
  }
162
178
  }
163
- /** Returns the accountID of the account that inserted value at the given index. */
164
- whoInserted(idx) {
179
+ /**
180
+ * Returns the current items in the CoList as an array. (alias of `asArray`)
181
+ *
182
+ * @category 1. Reading
183
+ */
184
+ toJSON() {
185
+ return this.asArray();
186
+ }
187
+ /** @category 5. Edit history */
188
+ editAt(idx) {
165
189
  const entry = this.entries()[idx];
166
190
  if (!entry) {
167
191
  return undefined;
168
192
  }
169
- const accountID = accountOrAgentIDfromSessionID(entry.opID.sessionID);
170
- if (isAccountID(accountID)) {
171
- return accountID;
172
- }
173
- else {
174
- return undefined;
175
- }
176
- }
177
- /** Returns the current items in the CoList as an array. (alias of `asArray`) */
178
- toJSON() {
179
- return this.asArray();
180
- }
181
- map(mapper) {
182
- return this.entries().map((entry, idx) => mapper(entry.value, idx));
183
- }
184
- filter(predicate) {
185
- return this.entries()
186
- .filter((entry, idx) => predicate(entry.value, idx))
187
- .map((entry) => entry.value);
193
+ const madeAt = new Date(entry.madeAt);
194
+ const by = accountOrAgentIDfromSessionID(entry.opID.sessionID);
195
+ const value = entry.value;
196
+ return {
197
+ by,
198
+ tx: {
199
+ sessionID: entry.opID.sessionID,
200
+ txIndex: entry.opID.txIndex,
201
+ },
202
+ at: madeAt,
203
+ value,
204
+ };
188
205
  }
189
- reduce(reducer, initialValue) {
190
- return this.entries().reduce((accumulator, entry, idx) => reducer(accumulator, entry.value, idx), initialValue);
206
+ /** @category 5. Edit history */
207
+ deletionEdits() {
208
+ const edits = [];
209
+ for (const sessionID in this.deletionsByInsertion) {
210
+ const sessionEntry = this.deletionsByInsertion[sessionID];
211
+ for (const txIdx in sessionEntry) {
212
+ const txEntry = sessionEntry[Number(txIdx)];
213
+ for (const changeIdx in txEntry) {
214
+ const changeEntry = txEntry[Number(changeIdx)];
215
+ for (const deletion of changeEntry || []) {
216
+ const madeAt = new Date(deletion.madeAt);
217
+ const by = accountOrAgentIDfromSessionID(deletion.deletionID.sessionID);
218
+ edits.push({
219
+ by,
220
+ tx: deletion.deletionID,
221
+ at: madeAt,
222
+ });
223
+ }
224
+ }
225
+ }
226
+ }
227
+ return edits;
191
228
  }
229
+ /** @category 3. Subscription */
192
230
  subscribe(listener) {
193
231
  return this.core.subscribe((content) => {
194
232
  listener(content);
195
233
  });
196
234
  }
197
- edit(changer) {
198
- const editable = new WriteableCoList(this.core);
199
- changer(editable);
200
- return new CoList(this.core);
201
- }
202
235
  }
203
- export class WriteableCoList extends CoList {
204
- /** @internal */
205
- edit(_changer) {
206
- throw new Error("Already editing.");
207
- }
208
- /** Appends a new item after index `after`.
236
+ export class CoList extends CoListView {
237
+ /** Returns a new version of this CoList with `item` appended after the item currently at index `after`.
238
+ *
239
+ * If `privacy` is `"private"` **(default)**, `item` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
209
240
  *
210
- * If `privacy` is `"private"` **(default)**, both `value` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
241
+ * If `privacy` is `"trusting"`, `item` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
211
242
  *
212
- * If `privacy` is `"trusting"`, both `value` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. */
213
- append(after, value, privacy = "private") {
243
+ * @category 2. Editing
244
+ **/
245
+ append(item, after, privacy = "private") {
214
246
  const entries = this.entries();
247
+ after =
248
+ after === undefined
249
+ ? entries.length > 0
250
+ ? entries.length - 1
251
+ : 0
252
+ : 0;
215
253
  let opIDBefore;
216
254
  if (entries.length > 0) {
217
255
  const entryBefore = entries[after];
@@ -229,31 +267,24 @@ export class WriteableCoList extends CoList {
229
267
  this.core.makeTransaction([
230
268
  {
231
269
  op: "app",
232
- value,
270
+ value: isCoValue(item) ? item.id : item,
233
271
  after: opIDBefore,
234
272
  },
235
273
  ], privacy);
236
- this.fillOpsFromCoValue();
237
- }
238
- /** Pushes a new item to the end of the list.
239
- *
240
- * If `privacy` is `"private"` **(default)**, both `value` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
241
- *
242
- * If `privacy` is `"trusting"`, both `value` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. */
243
- push(value, privacy = "private") {
244
- // TODO: optimize
245
- const entries = this.entries();
246
- this.append(entries.length > 0 ? entries.length - 1 : 0, value, privacy);
274
+ return new CoList(this.core);
247
275
  }
248
276
  /**
249
- * Prepends a new item before index `before`.
277
+ * Returns a new version of this CoList with `item` prepended before the item currently at index `before`.
250
278
  *
251
- * If `privacy` is `"private"` **(default)**, both `value` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
279
+ * If `privacy` is `"private"` **(default)**, `item` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
252
280
  *
253
- * If `privacy` is `"trusting"`, both `value` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
281
+ * If `privacy` is `"trusting"`, `item` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
282
+ *
283
+ * @category 2. Editing
254
284
  */
255
- prepend(before, value, privacy = "private") {
285
+ prepend(item, before, privacy = "private") {
256
286
  const entries = this.entries();
287
+ before = before === undefined ? 0 : before;
257
288
  let opIDAfter;
258
289
  if (entries.length > 0) {
259
290
  const entryAfter = entries[before];
@@ -276,17 +307,20 @@ export class WriteableCoList extends CoList {
276
307
  this.core.makeTransaction([
277
308
  {
278
309
  op: "pre",
279
- value,
310
+ value: isCoValue(item) ? item.id : item,
280
311
  before: opIDAfter,
281
312
  },
282
313
  ], privacy);
283
- this.fillOpsFromCoValue();
314
+ return new CoList(this.core);
284
315
  }
285
- /** Deletes the item at index `at` from the list.
316
+ /** Returns a new version of this CoList with the item at index `at` deleted from the list.
286
317
  *
287
318
  * If `privacy` is `"private"` **(default)**, the fact of this deletion is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
288
319
  *
289
- * If `privacy` is `"trusting"`, the fact of this deletion is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. */
320
+ * If `privacy` is `"trusting"`, the fact of this deletion is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
321
+ *
322
+ * @category 2. Editing
323
+ **/
290
324
  delete(at, privacy = "private") {
291
325
  const entries = this.entries();
292
326
  const entry = entries[at];
@@ -299,7 +333,64 @@ export class WriteableCoList extends CoList {
299
333
  insertion: entry.opID,
300
334
  },
301
335
  ], privacy);
302
- this.fillOpsFromCoValue();
336
+ return new CoList(this.core);
337
+ }
338
+ /** @category 2. Editing */
339
+ mutate(mutator) {
340
+ const mutable = new MutableCoList(this.core);
341
+ mutator(mutable);
342
+ return new CoList(this.core);
343
+ }
344
+ /** @deprecated Use `mutate` instead. */
345
+ edit(mutator) {
346
+ return this.mutate(mutator);
347
+ }
348
+ }
349
+ export class MutableCoList extends CoListView {
350
+ /** Appends `item` after the item currently at index `after`.
351
+ *
352
+ * If `privacy` is `"private"` **(default)**, `item` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
353
+ *
354
+ * If `privacy` is `"trusting"`, `item` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
355
+ *
356
+ * @category 2. Mutating
357
+ **/
358
+ append(item, after, privacy = "private") {
359
+ const listAfter = CoList.prototype.append.call(this, item, after, privacy);
360
+ this.afterStart = listAfter.afterStart;
361
+ this.beforeEnd = listAfter.beforeEnd;
362
+ this.insertions = listAfter.insertions;
363
+ this.deletionsByInsertion = listAfter.deletionsByInsertion;
364
+ }
365
+ /** Prepends `item` before the item currently at index `before`.
366
+ *
367
+ * If `privacy` is `"private"` **(default)**, `item` is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
368
+ *
369
+ * If `privacy` is `"trusting"`, `item` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
370
+ *
371
+ * * @category 2. Mutating
372
+ **/
373
+ prepend(item, before, privacy = "private") {
374
+ const listAfter = CoList.prototype.prepend.call(this, item, before, privacy);
375
+ this.afterStart = listAfter.afterStart;
376
+ this.beforeEnd = listAfter.beforeEnd;
377
+ this.insertions = listAfter.insertions;
378
+ this.deletionsByInsertion = listAfter.deletionsByInsertion;
379
+ }
380
+ /** Deletes the item at index `at` from the list.
381
+ *
382
+ * If `privacy` is `"private"` **(default)**, the fact of this deletion is encrypted in the transaction, only readable by other members of the group this `CoList` belongs to. Not even sync servers can see the content in plaintext.
383
+ *
384
+ * If `privacy` is `"trusting"`, the fact of this deletion is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
385
+ *
386
+ * * @category 2. Mutating
387
+ **/
388
+ delete(at, privacy = "private") {
389
+ const listAfter = CoList.prototype.delete.call(this, at, privacy);
390
+ this.afterStart = listAfter.afterStart;
391
+ this.beforeEnd = listAfter.beforeEnd;
392
+ this.insertions = listAfter.insertions;
393
+ this.deletionsByInsertion = listAfter.deletionsByInsertion;
303
394
  }
304
395
  }
305
396
  //# sourceMappingURL=coList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAAa,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAoChD,MAAM,OAAO,MAAM;IA2Bf,gBAAgB;IAChB,YAAY,IAAiB;QAxB7B,SAAI,GAAG,QAAiB,CAAC;QAyBrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAA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AAU,GAAG,SAAS,CAAC,UAAU,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC,oBAAoB,CAAC;IAC/D,CAAC;CACJ"}
@@ -1,82 +1,141 @@
1
- import { JsonObject, JsonValue } from '../jsonValue.js';
2
- import { TransactionID } from '../ids.js';
3
- import { CoID, ReadableCoValue, WriteableCoValue } from '../coValue.js';
4
- import { CoValueCore } from '../coValueCore.js';
5
- import { AccountID } from '../account.js';
6
- import { Group } from '../group.js';
7
- type MapOp<K extends string, V extends JsonValue | undefined> = {
1
+ import { JsonObject, JsonValue } from "../jsonValue.js";
2
+ import { AgentID, TransactionID } from "../ids.js";
3
+ import { CoID, CoValue } from "../coValue.js";
4
+ import { CoValueCore } from "../coValueCore.js";
5
+ import { AccountID } from "../account.js";
6
+ import { Group } from "../group.js";
7
+ type MapOp<K extends string, V extends JsonValue | CoValue | undefined> = {
8
8
  txID: TransactionID;
9
9
  madeAt: number;
10
10
  changeIdx: number;
11
11
  } & MapOpPayload<K, V>;
12
- export type MapOpPayload<K extends string, V extends JsonValue | undefined> = {
12
+ export type MapOpPayload<K extends string, V extends JsonValue | CoValue | undefined> = {
13
13
  op: "set";
14
14
  key: K;
15
- value: V;
15
+ value: V extends CoValue ? CoID<V> : Exclude<V, CoValue>;
16
16
  } | {
17
17
  op: "del";
18
18
  key: K;
19
19
  };
20
- export type MapK<M extends {
21
- [key: string]: JsonValue | undefined;
22
- }> = keyof M & string;
23
- export type MapV<M extends {
24
- [key: string]: JsonValue | undefined;
25
- }> = M[MapK<M>];
26
- /** A collaborative map with precise shape `M` and optional static metadata `Meta` */
27
- export declare class CoMap<M extends {
28
- [key: string]: JsonValue | undefined;
29
- }, Meta extends JsonObject | null = null> implements ReadableCoValue {
30
- id: CoID<CoMap<M, Meta>>;
20
+ export declare class CoMapView<Shape extends {
21
+ [key: string]: JsonValue | CoValue | undefined;
22
+ }, Meta extends JsonObject | null = null> implements CoValue {
23
+ /** @category 6. Meta */
24
+ id: CoID<this>;
25
+ /** @category 6. Meta */
31
26
  type: "comap";
27
+ /** @category 6. Meta */
32
28
  core: CoValueCore;
33
29
  /** @internal */
34
30
  ops: {
35
- [KK in MapK<M>]?: MapOp<KK, M[KK]>[];
31
+ [Key in keyof Shape & string]?: MapOp<Key, Shape[Key]>[];
36
32
  };
37
33
  /** @internal */
34
+ atTimeFilter?: number;
35
+ /** @category 6. Meta */
36
+ readonly _shape: Shape;
37
+ /** @internal */
38
38
  constructor(core: CoValueCore);
39
+ /** @category 6. Meta */
39
40
  get meta(): Meta;
41
+ /** @category 6. Meta */
40
42
  get group(): Group;
43
+ /** @category 4. Time travel */
44
+ atTime(time: number): this;
41
45
  /** @internal */
42
- protected fillOpsFromCoValue(): void;
43
- keys(): MapK<M>[];
44
- /** Returns the current value for the given key. */
45
- get<K extends MapK<M>>(key: K): M[K] | undefined;
46
- getAtTime<K extends MapK<M>>(key: K, time: number): M[K] | undefined;
47
- /** Returns the accountID of the last account to modify the value for the given key. */
48
- whoEdited<K extends MapK<M>>(key: K): AccountID | undefined;
49
- getLastTxID<K extends MapK<M>>(key: K): TransactionID | undefined;
50
- getLastEntry<K extends MapK<M>>(key: K): {
51
- at: number;
52
- txID: TransactionID;
53
- value: M[K];
46
+ timeFilteredOps<K extends keyof Shape & string>(key: K): MapOp<K, Shape[K]>[] | undefined;
47
+ /**
48
+ * Get all keys currently in the map.
49
+ *
50
+ * @category 1. Reading */
51
+ keys(): (keyof Shape & string)[];
52
+ /**
53
+ * Returns the current value for the given key.
54
+ *
55
+ * @category 1. Reading
56
+ **/
57
+ get<K extends keyof Shape & string>(key: K): (Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>) | undefined;
58
+ /** @category 1. Reading */
59
+ asObject(): {
60
+ [K in keyof Shape & string]: Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>;
61
+ };
62
+ /** @category 1. Reading */
63
+ toJSON(): {
64
+ [K in keyof Shape & string]: Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>;
65
+ };
66
+ /** @category 5. Edit history */
67
+ nthEditAt<K extends keyof Shape & string>(key: K, n: number): {
68
+ by: AccountID | AgentID;
69
+ tx: TransactionID;
70
+ at: Date;
71
+ value?: Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>;
54
72
  } | undefined;
55
- getHistory<K extends MapK<M>>(key: K): {
56
- at: number;
57
- txID: TransactionID;
58
- value: M[K] | undefined;
59
- }[];
60
- toJSON(): JsonObject;
61
- subscribe(listener: (coMap: CoMap<M, Meta>) => void): () => void;
62
- edit(changer: (editable: WriteableCoMap<M, Meta>) => void): CoMap<M, Meta>;
73
+ /** @category 5. Edit history */
74
+ lastEditAt<K extends keyof Shape & string>(key: K): {
75
+ by: AccountID | AgentID;
76
+ tx: TransactionID;
77
+ at: Date;
78
+ value?: Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>;
79
+ } | undefined;
80
+ /** @category 5. Edit history */
81
+ editsAt<K extends keyof Shape & string>(key: K): Generator<{
82
+ by: `sealer_z${string}/signer_z${string}` | AccountID;
83
+ tx: TransactionID;
84
+ at: Date;
85
+ value?: (Shape[K] extends CoValue ? CoID<Shape[K]> : Exclude<Shape[K], CoValue>) | undefined;
86
+ }, void, unknown>;
87
+ /** @category 3. Subscription */
88
+ subscribe(listener: (coMap: this) => void): () => void;
63
89
  }
64
- export declare class WriteableCoMap<M extends {
65
- [key: string]: JsonValue | undefined;
66
- }, Meta extends JsonObject | null = null> extends CoMap<M, Meta> implements WriteableCoValue {
67
- /** @internal */
68
- edit(_changer: (editable: WriteableCoMap<M, Meta>) => void): CoMap<M, Meta>;
90
+ /** A collaborative map with precise shape `Shape` and optional static metadata `Meta` */
91
+ export declare class CoMap<Shape extends {
92
+ [key: string]: JsonValue | CoValue | undefined;
93
+ }, Meta extends JsonObject | null = null> extends CoMapView<Shape, Meta> implements CoValue {
94
+ /** Returns a new version of this CoMap with a new value for the given key.
95
+ *
96
+ * If `privacy` is `"private"` **(default)**, both `key` and `value` are encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext.
97
+ *
98
+ * If `privacy` is `"trusting"`, both `key` and `value` are stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
99
+ *
100
+ * @category 2. Editing
101
+ **/
102
+ set<K extends keyof Shape & string>(key: K, value: Shape[K] extends CoValue ? Shape[K] | CoID<Shape[K]> : Shape[K], privacy?: "private" | "trusting"): this;
103
+ set(kv: {
104
+ [K in keyof Shape & string]?: Shape[K] extends CoValue ? Shape[K] | CoID<Shape[K]> : Shape[K];
105
+ }, privacy?: "private" | "trusting"): this;
106
+ /** Returns a new version of this CoMap with the given key deleted (setting it to undefined).
107
+ *
108
+ * If `privacy` is `"private"` **(default)**, `key` is encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext.
109
+ *
110
+ * If `privacy` is `"trusting"`, `key` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
111
+ *
112
+ * @category 2. Editing
113
+ **/
114
+ delete(key: keyof Shape & string, privacy?: "private" | "trusting"): this;
115
+ /** @category 2. Editing */
116
+ mutate(mutator: (mutable: MutableCoMap<Shape, Meta>) => void): this;
117
+ /** @deprecated Use `mutate` instead. */
118
+ edit(mutator: (mutable: MutableCoMap<Shape, Meta>) => void): this;
119
+ }
120
+ export declare class MutableCoMap<Shape extends {
121
+ [key: string]: JsonValue | CoValue | undefined;
122
+ }, Meta extends JsonObject | null = null> extends CoMapView<Shape, Meta> implements CoValue {
69
123
  /** Sets a new value for the given key.
70
124
  *
71
125
  * If `privacy` is `"private"` **(default)**, both `key` and `value` are encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext.
72
126
  *
73
- * If `privacy` is `"trusting"`, both `key` and `value` are stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. */
74
- set<K extends MapK<M>>(key: K, value: M[K], privacy?: "private" | "trusting"): void;
127
+ * If `privacy` is `"trusting"`, both `key` and `value` are stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
128
+ *
129
+ * @category 2. Mutation
130
+ */
131
+ set<K extends keyof Shape & string>(key: K, value: Shape[K] extends CoValue ? Shape[K] | CoID<Shape[K]> : Shape[K], privacy?: "private" | "trusting"): void;
75
132
  /** Deletes the value for the given key (setting it to undefined).
76
133
  *
77
134
  * If `privacy` is `"private"` **(default)**, `key` is encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext.
78
135
  *
79
- * If `privacy` is `"trusting"`, `key` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. */
80
- delete(key: MapK<M>, privacy?: "private" | "trusting"): void;
136
+ * If `privacy` is `"trusting"`, `key` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers.
137
+ * @category 2. Mutation
138
+ */
139
+ delete(key: keyof Shape & string, privacy?: "private" | "trusting"): void;
81
140
  }
82
141
  export {};