cojson 0.7.0-alpha.5 → 0.7.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 (113) hide show
  1. package/.eslintrc.cjs +3 -2
  2. package/.prettierrc.js +9 -0
  3. package/.turbo/turbo-build.log +3 -30
  4. package/.turbo/turbo-lint.log +4 -0
  5. package/.turbo/turbo-test.log +1106 -0
  6. package/CHANGELOG.md +104 -0
  7. package/README.md +3 -1
  8. package/dist/base64url.test.js +25 -0
  9. package/dist/base64url.test.js.map +1 -0
  10. package/dist/coValueCore.js +60 -37
  11. package/dist/coValueCore.js.map +1 -1
  12. package/dist/coValues/account.js +16 -15
  13. package/dist/coValues/account.js.map +1 -1
  14. package/dist/coValues/coList.js +1 -1
  15. package/dist/coValues/coList.js.map +1 -1
  16. package/dist/coValues/coMap.js +17 -8
  17. package/dist/coValues/coMap.js.map +1 -1
  18. package/dist/coValues/group.js +13 -14
  19. package/dist/coValues/group.js.map +1 -1
  20. package/dist/coreToCoValue.js.map +1 -1
  21. package/dist/crypto/PureJSCrypto.js +89 -0
  22. package/dist/crypto/PureJSCrypto.js.map +1 -0
  23. package/dist/crypto/WasmCrypto.js +127 -0
  24. package/dist/crypto/WasmCrypto.js.map +1 -0
  25. package/dist/crypto/crypto.js +151 -0
  26. package/dist/crypto/crypto.js.map +1 -0
  27. package/dist/ids.js +4 -2
  28. package/dist/ids.js.map +1 -1
  29. package/dist/index.js +6 -8
  30. package/dist/index.js.map +1 -1
  31. package/dist/jsonStringify.js.map +1 -1
  32. package/dist/localNode.js +41 -38
  33. package/dist/localNode.js.map +1 -1
  34. package/dist/permissions.js +6 -6
  35. package/dist/permissions.js.map +1 -1
  36. package/dist/storage/FileSystem.js +61 -0
  37. package/dist/storage/FileSystem.js.map +1 -0
  38. package/dist/storage/chunksAndKnownStates.js +97 -0
  39. package/dist/storage/chunksAndKnownStates.js.map +1 -0
  40. package/dist/storage/index.js +265 -0
  41. package/dist/storage/index.js.map +1 -0
  42. package/dist/sync.js +29 -25
  43. package/dist/sync.js.map +1 -1
  44. package/dist/tests/account.test.js +58 -0
  45. package/dist/tests/account.test.js.map +1 -0
  46. package/dist/tests/coList.test.js +76 -0
  47. package/dist/tests/coList.test.js.map +1 -0
  48. package/dist/tests/coMap.test.js +136 -0
  49. package/dist/tests/coMap.test.js.map +1 -0
  50. package/dist/tests/coStream.test.js +172 -0
  51. package/dist/tests/coStream.test.js.map +1 -0
  52. package/dist/tests/coValueCore.test.js +114 -0
  53. package/dist/tests/coValueCore.test.js.map +1 -0
  54. package/dist/tests/crypto.test.js +118 -0
  55. package/dist/tests/crypto.test.js.map +1 -0
  56. package/dist/tests/cryptoImpl.test.js +113 -0
  57. package/dist/tests/cryptoImpl.test.js.map +1 -0
  58. package/dist/tests/group.test.js +34 -0
  59. package/dist/tests/group.test.js.map +1 -0
  60. package/dist/tests/permissions.test.js +1060 -0
  61. package/dist/tests/permissions.test.js.map +1 -0
  62. package/dist/tests/sync.test.js +816 -0
  63. package/dist/tests/sync.test.js.map +1 -0
  64. package/dist/tests/testUtils.js +12 -11
  65. package/dist/tests/testUtils.js.map +1 -1
  66. package/dist/typeUtils/accountOrAgentIDfromSessionID.js.map +1 -1
  67. package/dist/typeUtils/isAccountID.js.map +1 -1
  68. package/dist/typeUtils/isCoValue.js.map +1 -1
  69. package/package.json +14 -27
  70. package/src/base64url.test.ts +6 -5
  71. package/src/coValue.ts +1 -1
  72. package/src/coValueCore.ts +179 -126
  73. package/src/coValues/account.ts +30 -32
  74. package/src/coValues/coList.ts +11 -11
  75. package/src/coValues/coMap.ts +27 -17
  76. package/src/coValues/coStream.ts +17 -17
  77. package/src/coValues/group.ts +93 -109
  78. package/src/coreToCoValue.ts +5 -2
  79. package/src/crypto/PureJSCrypto.ts +200 -0
  80. package/src/crypto/WasmCrypto.ts +259 -0
  81. package/src/crypto/crypto.ts +336 -0
  82. package/src/ids.ts +8 -7
  83. package/src/index.ts +24 -24
  84. package/src/jsonStringify.ts +6 -4
  85. package/src/jsonValue.ts +2 -2
  86. package/src/localNode.ts +103 -109
  87. package/src/media.ts +3 -3
  88. package/src/permissions.ts +19 -21
  89. package/src/storage/FileSystem.ts +152 -0
  90. package/src/storage/chunksAndKnownStates.ts +139 -0
  91. package/src/storage/index.ts +479 -0
  92. package/src/streamUtils.ts +12 -12
  93. package/src/sync.ts +79 -63
  94. package/src/tests/account.test.ts +15 -15
  95. package/src/tests/coList.test.ts +94 -0
  96. package/src/tests/coMap.test.ts +162 -0
  97. package/src/tests/coStream.test.ts +246 -0
  98. package/src/tests/coValueCore.test.ts +36 -37
  99. package/src/tests/crypto.test.ts +66 -72
  100. package/src/tests/cryptoImpl.test.ts +183 -0
  101. package/src/tests/group.test.ts +16 -17
  102. package/src/tests/permissions.test.ts +269 -283
  103. package/src/tests/sync.test.ts +122 -123
  104. package/src/tests/testUtils.ts +24 -21
  105. package/src/typeUtils/accountOrAgentIDfromSessionID.ts +1 -2
  106. package/src/typeUtils/expectGroup.ts +1 -1
  107. package/src/typeUtils/isAccountID.ts +0 -1
  108. package/src/typeUtils/isCoValue.ts +1 -2
  109. package/tsconfig.json +0 -1
  110. package/dist/crypto.js +0 -254
  111. package/dist/crypto.js.map +0 -1
  112. package/src/crypto.ts +0 -484
  113. package/src/tests/coValue.test.ts +0 -497
@@ -2,25 +2,23 @@ import { CoValueCore, CoValueHeader } from "../coValueCore.js";
2
2
  import { CoID, RawCoValue } from "../coValue.js";
3
3
  import {
4
4
  AgentSecret,
5
+ CryptoProvider,
5
6
  SealerID,
6
7
  SealerSecret,
7
8
  SignerID,
8
9
  SignerSecret,
9
- getAgentID,
10
- getAgentSealerID,
11
- getAgentSealerSecret,
12
- getAgentSignerID,
13
- getAgentSignerSecret,
14
- } from "../crypto.js";
10
+ } from "../crypto/crypto.js";
15
11
  import { AgentID } from "../ids.js";
16
12
  import { RawCoMap } from "./coMap.js";
17
13
  import { RawGroup, InviteSecret } from "./group.js";
18
14
  import { LocalNode } from "../index.js";
15
+ import { JsonObject } from "../jsonValue.js";
19
16
 
20
17
  export function accountHeaderForInitialAgentSecret(
21
- agentSecret: AgentSecret
18
+ agentSecret: AgentSecret,
19
+ crypto: CryptoProvider,
22
20
  ): CoValueHeader {
23
- const agent = getAgentID(agentSecret);
21
+ const agent = crypto.getAgentID(agentSecret);
24
22
  return {
25
23
  type: "comap",
26
24
  ruleset: { type: "group", initialAdmin: agent },
@@ -33,16 +31,16 @@ export function accountHeaderForInitialAgentSecret(
33
31
  }
34
32
 
35
33
  export class RawAccount<
36
- Meta extends AccountMeta = AccountMeta
34
+ Meta extends AccountMeta = AccountMeta,
37
35
  > extends RawGroup<Meta> {
38
36
  currentAgentID(): AgentID {
39
37
  const agents = this.keys().filter((k): k is AgentID =>
40
- k.startsWith("sealer_")
38
+ k.startsWith("sealer_"),
41
39
  );
42
40
 
43
41
  if (agents.length !== 1) {
44
42
  throw new Error(
45
- "Expected exactly one agent in account, got " + agents.length
43
+ "Expected exactly one agent in account, got " + agents.length,
46
44
  );
47
45
  }
48
46
 
@@ -67,11 +65,13 @@ export class RawControlledAccount<Meta extends AccountMeta = AccountMeta>
67
65
  implements ControlledAccountOrAgent
68
66
  {
69
67
  agentSecret: AgentSecret;
68
+ crypto: CryptoProvider;
70
69
 
71
70
  constructor(core: CoValueCore, agentSecret: AgentSecret) {
72
71
  super(core);
73
72
 
74
73
  this.agentSecret = agentSecret;
74
+ this.crypto = core.node.crypto;
75
75
  }
76
76
 
77
77
  /**
@@ -84,62 +84,61 @@ export class RawControlledAccount<Meta extends AccountMeta = AccountMeta>
84
84
 
85
85
  async acceptInvite<T extends RawCoValue>(
86
86
  groupOrOwnedValueID: CoID<T>,
87
- inviteSecret: InviteSecret
87
+ inviteSecret: InviteSecret,
88
88
  ): Promise<void> {
89
89
  return this.core.node.acceptInvite(groupOrOwnedValueID, inviteSecret);
90
90
  }
91
91
 
92
92
  currentAgentID(): AgentID {
93
- return getAgentID(this.agentSecret);
93
+ return this.crypto.getAgentID(this.agentSecret);
94
94
  }
95
95
 
96
96
  currentSignerID(): SignerID {
97
- return getAgentSignerID(this.currentAgentID());
97
+ return this.crypto.getAgentSignerID(this.currentAgentID());
98
98
  }
99
99
 
100
100
  currentSignerSecret(): SignerSecret {
101
- return getAgentSignerSecret(this.agentSecret);
101
+ return this.crypto.getAgentSignerSecret(this.agentSecret);
102
102
  }
103
103
 
104
104
  currentSealerID(): SealerID {
105
- return getAgentSealerID(this.currentAgentID());
105
+ return this.crypto.getAgentSealerID(this.currentAgentID());
106
106
  }
107
107
 
108
108
  currentSealerSecret(): SealerSecret {
109
- return getAgentSealerSecret(this.agentSecret);
109
+ return this.crypto.getAgentSealerSecret(this.agentSecret);
110
110
  }
111
111
  }
112
112
 
113
113
  /** @hidden */
114
114
  export class ControlledAgent implements ControlledAccountOrAgent {
115
- agentSecret: AgentSecret;
116
-
117
- constructor(agentSecret: AgentSecret) {
118
- this.agentSecret = agentSecret;
119
- }
115
+ constructor(
116
+ public agentSecret: AgentSecret,
117
+ public crypto: CryptoProvider,
118
+ ) {}
120
119
 
121
120
  get id(): AgentID {
122
- return getAgentID(this.agentSecret);
121
+ return this.crypto.getAgentID(this.agentSecret);
123
122
  }
124
123
 
125
124
  currentAgentID(): AgentID {
126
- return getAgentID(this.agentSecret);
125
+ return this.crypto.getAgentID(this.agentSecret);
127
126
  }
128
127
 
129
128
  currentSignerID(): SignerID {
130
- return getAgentSignerID(this.currentAgentID());
129
+ return this.crypto.getAgentSignerID(this.currentAgentID());
131
130
  }
132
131
 
133
132
  currentSignerSecret(): SignerSecret {
134
- return getAgentSignerSecret(this.agentSecret);
133
+ return this.crypto.getAgentSignerSecret(this.agentSecret);
135
134
  }
136
135
 
137
136
  currentSealerID(): SealerID {
138
- return getAgentSealerID(this.currentAgentID());
137
+ return this.crypto.getAgentSealerID(this.currentAgentID());
139
138
  }
140
139
 
141
140
  currentSealerSecret(): SealerSecret {
142
- return getAgentSealerSecret(this.agentSecret);
141
+ return this.crypto.getAgentSealerSecret(this.agentSecret);
143
142
  }
144
143
  }
145
144
 
@@ -149,15 +148,14 @@ export type AccountID = CoID<RawAccount>;
149
148
  export type ProfileShape = {
150
149
  name: string;
151
150
  };
152
- export type ProfileMeta = { type: "profile" };
153
151
 
154
152
  export class RawProfile<
155
153
  Shape extends ProfileShape = ProfileShape,
156
- Meta extends ProfileMeta = ProfileMeta
154
+ Meta extends JsonObject | null = JsonObject | null,
157
155
  > extends RawCoMap<Shape, Meta> {}
158
156
 
159
157
  export type RawAccountMigration<Meta extends AccountMeta = AccountMeta> = (
160
158
  account: RawControlledAccount<Meta>,
161
- profile: RawCoMap,
162
- localNode: LocalNode
159
+ localNode: LocalNode,
160
+ creationProps?: { name: string },
163
161
  ) => void | Promise<void>;
@@ -196,7 +196,7 @@ export class RawCoListView<
196
196
  } else {
197
197
  throw new Error(
198
198
  "Unknown list operation " +
199
- (change as { op: unknown }).op
199
+ (change as { op: unknown }).op,
200
200
  );
201
201
  }
202
202
  }
@@ -285,7 +285,7 @@ export class RawCoListView<
285
285
  value: Item;
286
286
  madeAt: number;
287
287
  opID: OpID;
288
- }[]
288
+ }[],
289
289
  ) {
290
290
  const entry =
291
291
  this.insertions[opID.sessionID]?.[opID.txIndex]?.[opID.changeIdx];
@@ -372,7 +372,7 @@ export class RawCoListView<
372
372
  for (const deletion of changeEntry || []) {
373
373
  const madeAt = new Date(deletion.madeAt);
374
374
  const by = accountOrAgentIDfromSessionID(
375
- deletion.deletionID.sessionID
375
+ deletion.deletionID.sessionID,
376
376
  );
377
377
  edits.push({
378
378
  by,
@@ -413,7 +413,7 @@ export class RawCoList<
413
413
  append(
414
414
  item: Item,
415
415
  after?: number,
416
- privacy: "private" | "trusting" = "private"
416
+ privacy: "private" | "trusting" = "private",
417
417
  ) {
418
418
  const entries = this.entries();
419
419
  after =
@@ -421,7 +421,7 @@ export class RawCoList<
421
421
  ? entries.length > 0
422
422
  ? entries.length - 1
423
423
  : 0
424
- : 0;
424
+ : after;
425
425
  let opIDBefore;
426
426
  if (entries.length > 0) {
427
427
  const entryBefore = entries[after];
@@ -443,7 +443,7 @@ export class RawCoList<
443
443
  after: opIDBefore,
444
444
  },
445
445
  ],
446
- privacy
446
+ privacy,
447
447
  );
448
448
 
449
449
  const listAfter = new RawCoList(this.core) as this;
@@ -467,7 +467,7 @@ export class RawCoList<
467
467
  prepend(
468
468
  item: Item,
469
469
  before?: number,
470
- privacy: "private" | "trusting" = "private"
470
+ privacy: "private" | "trusting" = "private",
471
471
  ) {
472
472
  const entries = this.entries();
473
473
  before = before === undefined ? 0 : before;
@@ -496,7 +496,7 @@ export class RawCoList<
496
496
  before: opIDAfter,
497
497
  },
498
498
  ],
499
- privacy
499
+ privacy,
500
500
  );
501
501
 
502
502
  const listAfter = new RawCoList(this.core) as this;
@@ -529,7 +529,7 @@ export class RawCoList<
529
529
  insertion: entry.opID,
530
530
  },
531
531
  ],
532
- privacy
532
+ privacy,
533
533
  );
534
534
 
535
535
  const listAfter = new RawCoList(this.core) as this;
@@ -544,7 +544,7 @@ export class RawCoList<
544
544
  replace(
545
545
  at: number,
546
546
  newItem: Item,
547
- privacy: "private" | "trusting" = "private"
547
+ privacy: "private" | "trusting" = "private",
548
548
  ) {
549
549
  const entries = this.entries();
550
550
  const entry = entries[at];
@@ -564,7 +564,7 @@ export class RawCoList<
564
564
  insertion: entry.opID,
565
565
  },
566
566
  ],
567
- privacy
567
+ privacy,
568
568
  );
569
569
  const listAfter = new RawCoList(this.core) as this;
570
570
 
@@ -50,14 +50,14 @@ export class RawCoMapView<
50
50
  /** @internal */
51
51
  constructor(
52
52
  core: CoValueCore,
53
- options?: { ignorePrivateTransactions: true }
53
+ options?: { ignorePrivateTransactions: true },
54
54
  ) {
55
55
  this.id = core.id as CoID<this>;
56
56
  this.core = core;
57
57
  this.ops = {};
58
58
 
59
59
  for (const { txID, changes, madeAt } of core.getValidSortedTransactions(
60
- options
60
+ options,
61
61
  )) {
62
62
  for (const [changeIdx, changeUntyped] of changes.entries()) {
63
63
  const change = changeUntyped as MapOpPayload<
@@ -105,11 +105,11 @@ export class RawCoMapView<
105
105
 
106
106
  /** @internal */
107
107
  timeFilteredOps<K extends keyof Shape & string>(
108
- key: K
108
+ key: K,
109
109
  ): MapOp<K, Shape[K]>[] | undefined {
110
110
  if (this.atTimeFilter) {
111
111
  return this.ops[key]?.filter(
112
- (op) => op.madeAt <= this.atTimeFilter!
112
+ (op) => op.madeAt <= this.atTimeFilter!,
113
113
  );
114
114
  } else {
115
115
  return this.ops[key];
@@ -121,13 +121,23 @@ export class RawCoMapView<
121
121
  *
122
122
  * @category 1. Reading */
123
123
  keys<K extends keyof Shape & string = keyof Shape & string>(): K[] {
124
- const keys = Object.keys(this.ops) as K[];
124
+ return (Object.keys(this.ops) as K[]).filter((key) => {
125
+ const ops = this.ops[key];
126
+ if (!ops) {
127
+ return undefined;
128
+ }
125
129
 
126
- if (this.atTimeFilter) {
127
- return keys.filter((key) => this.timeFilteredOps(key)?.length);
128
- } else {
129
- return keys;
130
- }
130
+ const includeUntil = this.atTimeFilter;
131
+ const lastEntry = includeUntil
132
+ ? ops.findLast((entry) => entry.madeAt <= includeUntil)
133
+ : ops[ops.length - 1]!;
134
+
135
+ if (lastEntry?.op === "del") {
136
+ return false;
137
+ } else {
138
+ return true;
139
+ }
140
+ });
131
141
  }
132
142
 
133
143
  /**
@@ -136,7 +146,7 @@ export class RawCoMapView<
136
146
  * @category 1. Reading
137
147
  **/
138
148
  get<K extends keyof Shape & string>(key: K): Shape[K] | undefined {
139
- const ops = this.timeFilteredOps(key);
149
+ const ops = this.ops[key];
140
150
  if (!ops) {
141
151
  return undefined;
142
152
  }
@@ -183,7 +193,7 @@ export class RawCoMapView<
183
193
  /** @category 5. Edit history */
184
194
  nthEditAt<K extends keyof Shape & string>(
185
195
  key: K,
186
- n: number
196
+ n: number,
187
197
  ):
188
198
  | {
189
199
  by: AccountID | AgentID;
@@ -213,7 +223,7 @@ export class RawCoMapView<
213
223
 
214
224
  /** @category 5. Edit history */
215
225
  lastEditAt<K extends keyof Shape & string>(
216
- key: K
226
+ key: K,
217
227
  ):
218
228
  | {
219
229
  by: AccountID | AgentID;
@@ -270,7 +280,7 @@ export class RawCoMap<
270
280
  set<K extends keyof Shape & string>(
271
281
  key: K,
272
282
  value: Shape[K],
273
- privacy: "private" | "trusting" = "private"
283
+ privacy: "private" | "trusting" = "private",
274
284
  ): void {
275
285
  this.core.makeTransaction(
276
286
  [
@@ -280,7 +290,7 @@ export class RawCoMap<
280
290
  value: isCoValue(value) ? value.id : value,
281
291
  },
282
292
  ],
283
- privacy
293
+ privacy,
284
294
  );
285
295
 
286
296
  const after = new RawCoMap(this.core) as this;
@@ -298,7 +308,7 @@ export class RawCoMap<
298
308
  **/
299
309
  delete(
300
310
  key: keyof Shape & string,
301
- privacy: "private" | "trusting" = "private"
311
+ privacy: "private" | "trusting" = "private",
302
312
  ) {
303
313
  this.core.makeTransaction(
304
314
  [
@@ -307,7 +317,7 @@ export class RawCoMap<
307
317
  key,
308
318
  },
309
319
  ],
310
- privacy
320
+ privacy,
311
321
  );
312
322
 
313
323
  const after = new RawCoMap(this.core) as this;
@@ -43,7 +43,7 @@ export type CoStreamItem<Item extends JsonValue> = {
43
43
 
44
44
  export class RawCoStreamView<
45
45
  Item extends JsonValue = JsonValue,
46
- Meta extends JsonObject | null = JsonObject | null
46
+ Meta extends JsonObject | null = JsonObject | null,
47
47
  > implements RawCoValue
48
48
  {
49
49
  id: CoID<this>;
@@ -100,7 +100,7 @@ export class RawCoStreamView<
100
100
  return undefined;
101
101
  } else if (Object.keys(this.items).length !== 1) {
102
102
  throw new Error(
103
- "CoStream.getSingleStream() can only be called when there is exactly one stream"
103
+ "CoStream.getSingleStream() can only be called when there is exactly one stream",
104
104
  );
105
105
  }
106
106
 
@@ -115,13 +115,13 @@ export class RawCoStreamView<
115
115
  return new Set(
116
116
  this.sessions()
117
117
  .map(accountOrAgentIDfromSessionID)
118
- .filter(isAccountID)
118
+ .filter(isAccountID),
119
119
  );
120
120
  }
121
121
 
122
122
  nthItemIn(
123
123
  sessionID: SessionID,
124
- n: number
124
+ n: number,
125
125
  ):
126
126
  | {
127
127
  by: AccountID | AgentID;
@@ -214,7 +214,7 @@ export class RawCoStreamView<
214
214
  in: sessionID as SessionID,
215
215
  ...item,
216
216
  }))
217
- : []
217
+ : [],
218
218
  ),
219
219
  ];
220
220
 
@@ -232,7 +232,7 @@ export class RawCoStreamView<
232
232
  Object.entries(this.items).map(([sessionID, items]) => [
233
233
  sessionID,
234
234
  items.map((item) => item.value),
235
- ])
235
+ ]),
236
236
  );
237
237
  }
238
238
 
@@ -245,7 +245,7 @@ export class RawCoStreamView<
245
245
 
246
246
  export class RawCoStream<
247
247
  Item extends JsonValue = JsonValue,
248
- Meta extends JsonObject | null = JsonObject | null
248
+ Meta extends JsonObject | null = JsonObject | null,
249
249
  >
250
250
  extends RawCoStreamView<Item, Meta>
251
251
  implements RawCoValue
@@ -259,13 +259,13 @@ export class RawCoStream<
259
259
  const binary_U_prefixLength = 8; // "binary_U".length;
260
260
 
261
261
  export class RawBinaryCoStreamView<
262
- Meta extends BinaryCoStreamMeta = { type: "binary" }
262
+ Meta extends BinaryCoStreamMeta = { type: "binary" },
263
263
  >
264
264
  extends RawCoStreamView<BinaryStreamItem, Meta>
265
265
  implements RawCoValue
266
266
  {
267
267
  getBinaryChunks(
268
- allowUnfinished?: boolean
268
+ allowUnfinished?: boolean,
269
269
  ):
270
270
  | (BinaryStreamInfo & { chunks: Uint8Array[]; finished: boolean })
271
271
  | undefined {
@@ -304,7 +304,7 @@ export class RawBinaryCoStreamView<
304
304
  }
305
305
 
306
306
  const chunk = base64URLtoBytes(
307
- item.chunk.slice(binary_U_prefixLength)
307
+ item.chunk.slice(binary_U_prefixLength),
308
308
  );
309
309
  // totalLength += chunk.length;
310
310
  chunks.push(chunk);
@@ -331,7 +331,7 @@ export class RawBinaryCoStreamView<
331
331
  }
332
332
 
333
333
  export class RawBinaryCoStream<
334
- Meta extends BinaryCoStreamMeta = { type: "binary" }
334
+ Meta extends BinaryCoStreamMeta = { type: "binary" },
335
335
  >
336
336
  extends RawBinaryCoStreamView<Meta>
337
337
  implements RawCoValue
@@ -340,7 +340,7 @@ export class RawBinaryCoStream<
340
340
  push(
341
341
  item: BinaryStreamItem,
342
342
  privacy: "private" | "trusting" = "private",
343
- updateView: boolean = true
343
+ updateView: boolean = true,
344
344
  ): void {
345
345
  this.core.makeTransaction([item], privacy);
346
346
  if (updateView) {
@@ -350,7 +350,7 @@ export class RawBinaryCoStream<
350
350
 
351
351
  startBinaryStream(
352
352
  settings: BinaryStreamInfo,
353
- privacy: "private" | "trusting" = "private"
353
+ privacy: "private" | "trusting" = "private",
354
354
  ): void {
355
355
  this.push(
356
356
  {
@@ -358,13 +358,13 @@ export class RawBinaryCoStream<
358
358
  ...settings,
359
359
  } satisfies BinaryStreamStart,
360
360
  privacy,
361
- false
361
+ false,
362
362
  );
363
363
  }
364
364
 
365
365
  pushBinaryStreamChunk(
366
366
  chunk: Uint8Array,
367
- privacy: "private" | "trusting" = "private"
367
+ privacy: "private" | "trusting" = "private",
368
368
  ): void {
369
369
  // const before = performance.now();
370
370
  this.push(
@@ -373,7 +373,7 @@ export class RawBinaryCoStream<
373
373
  chunk: `binary_U${bytesToBase64url(chunk)}`,
374
374
  } satisfies BinaryStreamChunk,
375
375
  privacy,
376
- false
376
+ false,
377
377
  );
378
378
  // const after = performance.now();
379
379
  // console.log(
@@ -388,7 +388,7 @@ export class RawBinaryCoStream<
388
388
  type: "end",
389
389
  } satisfies BinaryStreamEnd,
390
390
  privacy,
391
- true
391
+ true,
392
392
  );
393
393
  }
394
394
  }