cojson 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/sync.test.ts CHANGED
@@ -77,12 +77,12 @@ test("Node replies with initial tx and header to empty subscribe", async () => {
77
77
  uniqueness: map.coValue.header.uniqueness,
78
78
  },
79
79
  new: {
80
- [node.ownSessionID]: {
80
+ [node.currentSessionID]: {
81
81
  after: 0,
82
82
  newTransactions: [
83
83
  {
84
84
  privacy: "trusting" as const,
85
- madeAt: map.coValue.sessions[node.ownSessionID]!
85
+ madeAt: map.coValue.sessions[node.currentSessionID]!
86
86
  .transactions[0]!.madeAt,
87
87
  changes: [
88
88
  {
@@ -94,7 +94,7 @@ test("Node replies with initial tx and header to empty subscribe", async () => {
94
94
  },
95
95
  ],
96
96
  lastSignature:
97
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
97
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
98
98
  },
99
99
  },
100
100
  } satisfies SyncMessage);
@@ -130,7 +130,7 @@ test("Node replies with only new tx to subscribe with some known state", async (
130
130
  id: map.coValue.id,
131
131
  header: true,
132
132
  sessions: {
133
- [node.ownSessionID]: 1,
133
+ [node.currentSessionID]: 1,
134
134
  },
135
135
  });
136
136
 
@@ -155,12 +155,12 @@ test("Node replies with only new tx to subscribe with some known state", async (
155
155
  id: map.coValue.id,
156
156
  header: undefined,
157
157
  new: {
158
- [node.ownSessionID]: {
158
+ [node.currentSessionID]: {
159
159
  after: 1,
160
160
  newTransactions: [
161
161
  {
162
162
  privacy: "trusting" as const,
163
- madeAt: map.coValue.sessions[node.ownSessionID]!
163
+ madeAt: map.coValue.sessions[node.currentSessionID]!
164
164
  .transactions[1]!.madeAt,
165
165
  changes: [
166
166
  {
@@ -172,7 +172,7 @@ test("Node replies with only new tx to subscribe with some known state", async (
172
172
  },
173
173
  ],
174
174
  lastSignature:
175
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
175
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
176
176
  },
177
177
  },
178
178
  } satisfies SyncMessage);
@@ -207,7 +207,7 @@ test("After subscribing, node sends own known state and new txs to peer", async
207
207
  id: map.coValue.id,
208
208
  header: false,
209
209
  sessions: {
210
- [node.ownSessionID]: 0,
210
+ [node.currentSessionID]: 0,
211
211
  },
212
212
  });
213
213
 
@@ -244,12 +244,12 @@ test("After subscribing, node sends own known state and new txs to peer", async
244
244
  action: "content",
245
245
  id: map.coValue.id,
246
246
  new: {
247
- [node.ownSessionID]: {
247
+ [node.currentSessionID]: {
248
248
  after: 0,
249
249
  newTransactions: [
250
250
  {
251
251
  privacy: "trusting" as const,
252
- madeAt: map.coValue.sessions[node.ownSessionID]!
252
+ madeAt: map.coValue.sessions[node.currentSessionID]!
253
253
  .transactions[0]!.madeAt,
254
254
  changes: [
255
255
  {
@@ -261,7 +261,7 @@ test("After subscribing, node sends own known state and new txs to peer", async
261
261
  },
262
262
  ],
263
263
  lastSignature:
264
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
264
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
265
265
  },
266
266
  },
267
267
  } satisfies SyncMessage);
@@ -276,12 +276,12 @@ test("After subscribing, node sends own known state and new txs to peer", async
276
276
  action: "content",
277
277
  id: map.coValue.id,
278
278
  new: {
279
- [node.ownSessionID]: {
279
+ [node.currentSessionID]: {
280
280
  after: 1,
281
281
  newTransactions: [
282
282
  {
283
283
  privacy: "trusting" as const,
284
- madeAt: map.coValue.sessions[node.ownSessionID]!
284
+ madeAt: map.coValue.sessions[node.currentSessionID]!
285
285
  .transactions[1]!.madeAt,
286
286
  changes: [
287
287
  {
@@ -293,7 +293,7 @@ test("After subscribing, node sends own known state and new txs to peer", async
293
293
  },
294
294
  ],
295
295
  lastSignature:
296
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
296
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
297
297
  },
298
298
  },
299
299
  } satisfies SyncMessage);
@@ -332,7 +332,7 @@ test("Client replies with known new content to tellKnownState from server", asyn
332
332
  id: map.coValue.id,
333
333
  header: false,
334
334
  sessions: {
335
- [node.ownSessionID]: 0,
335
+ [node.currentSessionID]: 0,
336
336
  },
337
337
  });
338
338
 
@@ -355,12 +355,12 @@ test("Client replies with known new content to tellKnownState from server", asyn
355
355
  id: map.coValue.id,
356
356
  header: map.coValue.header,
357
357
  new: {
358
- [node.ownSessionID]: {
358
+ [node.currentSessionID]: {
359
359
  after: 0,
360
360
  newTransactions: [
361
361
  {
362
362
  privacy: "trusting" as const,
363
- madeAt: map.coValue.sessions[node.ownSessionID]!
363
+ madeAt: map.coValue.sessions[node.currentSessionID]!
364
364
  .transactions[0]!.madeAt,
365
365
  changes: [
366
366
  {
@@ -372,7 +372,7 @@ test("Client replies with known new content to tellKnownState from server", asyn
372
372
  },
373
373
  ],
374
374
  lastSignature:
375
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
375
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
376
376
  },
377
377
  },
378
378
  } satisfies SyncMessage);
@@ -403,7 +403,7 @@ test("No matter the optimistic known state, node respects invalid known state me
403
403
  id: map.coValue.id,
404
404
  header: false,
405
405
  sessions: {
406
- [node.ownSessionID]: 0,
406
+ [node.currentSessionID]: 0,
407
407
  },
408
408
  });
409
409
 
@@ -447,7 +447,7 @@ test("No matter the optimistic known state, node respects invalid known state me
447
447
  id: map.coValue.id,
448
448
  header: true,
449
449
  sessions: {
450
- [node.ownSessionID]: 1,
450
+ [node.currentSessionID]: 1,
451
451
  },
452
452
  } satisfies SyncMessage);
453
453
 
@@ -458,12 +458,12 @@ test("No matter the optimistic known state, node respects invalid known state me
458
458
  id: map.coValue.id,
459
459
  header: undefined,
460
460
  new: {
461
- [node.ownSessionID]: {
461
+ [node.currentSessionID]: {
462
462
  after: 1,
463
463
  newTransactions: [
464
464
  {
465
465
  privacy: "trusting" as const,
466
- madeAt: map.coValue.sessions[node.ownSessionID]!
466
+ madeAt: map.coValue.sessions[node.currentSessionID]!
467
467
  .transactions[1]!.madeAt,
468
468
  changes: [
469
469
  {
@@ -475,7 +475,7 @@ test("No matter the optimistic known state, node respects invalid known state me
475
475
  },
476
476
  ],
477
477
  lastSignature:
478
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
478
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
479
479
  },
480
480
  },
481
481
  } satisfies SyncMessage);
@@ -561,12 +561,12 @@ test("If we add a server peer, all updates to all coValues are sent to it, even
561
561
  id: map.coValue.id,
562
562
  header: map.coValue.header,
563
563
  new: {
564
- [node.ownSessionID]: {
564
+ [node.currentSessionID]: {
565
565
  after: 0,
566
566
  newTransactions: [
567
567
  {
568
568
  privacy: "trusting" as const,
569
- madeAt: map.coValue.sessions[node.ownSessionID]!
569
+ madeAt: map.coValue.sessions[node.currentSessionID]!
570
570
  .transactions[0]!.madeAt,
571
571
  changes: [
572
572
  {
@@ -578,7 +578,7 @@ test("If we add a server peer, all updates to all coValues are sent to it, even
578
578
  },
579
579
  ],
580
580
  lastSignature:
581
- map.coValue.sessions[node.ownSessionID]!.lastSignature!,
581
+ map.coValue.sessions[node.currentSessionID]!.lastSignature!,
582
582
  },
583
583
  },
584
584
  } satisfies SyncMessage);
@@ -697,7 +697,7 @@ test("When receiving a subscribe with a known state that is ahead of our own, pe
697
697
  id: map.coValue.id,
698
698
  header: true,
699
699
  sessions: {
700
- [node.ownSessionID]: 1,
700
+ [node.currentSessionID]: 1,
701
701
  },
702
702
  });
703
703
 
package/tsconfig.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "forceConsistentCasingInFileNames": true,
11
11
  "noUncheckedIndexedAccess": true,
12
12
  "esModuleInterop": true,
13
+ "stripInternal": true
13
14
  },
14
15
  "include": ["./src/**/*"],
15
16
  "exclude": ["./src/**/*.test.*"],