@candidstartup/simple-spreadsheet-data 0.12.0 → 0.13.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SpreadsheetData, Result, StorageError, ItemOffsetMapping, CellValue, ResultAsync, SpreadsheetDataError, ValidationError, LogEntry, EventLog, SequenceId, AddEntryError, LogMetadata, MetadataError, QueryValue, QueryError, TruncateError } from '@candidstartup/infinisheet-types';
1
+ import { SpreadsheetData, Result, StorageError, ItemOffsetMapping, CellValue, CellFormat, ResultAsync, SpreadsheetDataError, ValidationError, SpreadsheetViewport, LogEntry, EventLog, PostMessageWorkerHost, PendingWorkflowMessage, SequenceId, AddEntryValue, AddEntryError, LogMetadata, MetadataError, QueryValue, QueryError, TruncateError, BlobDir, BlobName, ReadBlobError, WriteBlobError, RemoveBlobError, GetDirError, BlobDirEntries, DirQueryError, RemoveAllBlobDirError, BlobStore, GetRootDirError, WorkerMessage, InfiniSheetWorker, MessageHandler } from '@candidstartup/infinisheet-types';
2
2
 
3
3
  /**
4
4
  * Branding Enum. Used by {@link SimpleSnapshot} to ensure that
@@ -36,9 +36,11 @@ declare class SimpleSpreadsheetData implements SpreadsheetData<SimpleSnapshot> {
36
36
  getColumnCount(snapshot: SimpleSnapshot): number;
37
37
  getColumnItemOffsetMapping(_snapshot: SimpleSnapshot): ItemOffsetMapping;
38
38
  getCellValue(snapshot: SimpleSnapshot, row: number, column: number): CellValue;
39
- getCellFormat(snapshot: SimpleSnapshot, row: number, column: number): string | undefined;
40
- setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): ResultAsync<void, SpreadsheetDataError>;
41
- isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void, ValidationError>;
39
+ getCellFormat(snapshot: SimpleSnapshot, row: number, column: number): CellFormat;
40
+ setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void, SpreadsheetDataError>;
41
+ isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): Result<void, ValidationError>;
42
+ setViewport(viewport: SpreadsheetViewport | undefined): void;
43
+ getViewport(snapshot: SimpleSnapshot): SpreadsheetViewport | undefined;
42
44
  private notifyListeners;
43
45
  private listeners;
44
46
  private content;
@@ -96,9 +98,11 @@ declare class LayeredSpreadsheetData<BaseData extends SpreadsheetData<BaseSnapsh
96
98
  getColumnCount(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): number;
97
99
  getColumnItemOffsetMapping(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): ItemOffsetMapping;
98
100
  getCellValue(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): CellValue;
99
- getCellFormat(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): string | undefined;
100
- setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): ResultAsync<void, SpreadsheetDataError>;
101
- isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void, ValidationError>;
101
+ getCellFormat(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): CellFormat;
102
+ setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void, SpreadsheetDataError>;
103
+ isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): Result<void, ValidationError>;
104
+ setViewport(viewport: SpreadsheetViewport | undefined): void;
105
+ getViewport(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): SpreadsheetViewport | undefined;
102
106
  private base;
103
107
  private edit;
104
108
  private content;
@@ -113,17 +117,24 @@ declare class LayeredSpreadsheetData<BaseData extends SpreadsheetData<BaseSnapsh
113
117
  * for simple sample apps. Simplest possible implementation, no attempt at optimization.
114
118
  */
115
119
  declare class SimpleEventLog<T extends LogEntry> implements EventLog<T> {
116
- constructor();
117
- addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void, AddEntryError>;
120
+ constructor(workerHost?: PostMessageWorkerHost<PendingWorkflowMessage>);
121
+ /** Worker host used to process pending workflows */
122
+ workerHost?: PostMessageWorkerHost<PendingWorkflowMessage> | undefined;
123
+ addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue, AddEntryError>;
118
124
  setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void, MetadataError>;
119
- query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>, QueryError>;
125
+ query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>, QueryError>;
120
126
  truncate(start: SequenceId): ResultAsync<void, TruncateError>;
127
+ private sendPendingWorkflowMessage;
128
+ private findSnapshot;
121
129
  private findSnapshotIndex;
122
130
  private startSequenceId;
123
131
  private endSequenceId;
124
132
  private entries;
125
133
  }
126
134
 
135
+ /** Creates a promise that provides value after a delay (in ms) */
136
+ declare function delayPromise<T>(value: T, delay: number): Promise<T>;
137
+ declare function delayResult<T, E>(result: ResultAsync<T, E>, delay: number): ResultAsync<T, E>;
127
138
  /**
128
139
  * Wrapper around an {@link EventLog} that injects latency
129
140
  *
@@ -133,12 +144,86 @@ declare class DelayEventLog<T extends LogEntry> implements EventLog<T> {
133
144
  constructor(base: EventLog<T>, delay?: number);
134
145
  /** Delay in milliseconds to add to response from each API call */
135
146
  delay: number;
136
- addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void, AddEntryError>;
147
+ addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue, AddEntryError>;
137
148
  setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void, MetadataError>;
138
- query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>, QueryError>;
149
+ query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>, QueryError>;
139
150
  truncate(start: SequenceId): ResultAsync<void, TruncateError>;
140
151
  private base;
141
152
  }
142
153
 
143
- export { DelayEventLog, LayeredSpreadsheetData, SimpleEventLog, SimpleSpreadsheetData, _LayeredSnapshotBrand, _SimpleSnapshotBrand };
144
- export type { LayeredSnapshot, SimpleSnapshot, SnapshotType };
154
+ /**
155
+ * Branding Enum. Used by {@link SimpleBlobStore} to ensure that
156
+ * you'll get a type error if you pass some random object where a `SimpleBlobStoreContinuation`
157
+ * is expected.
158
+ * @internal
159
+ */
160
+ declare enum _SimpleBlobStoreBrand {
161
+ _DO_NOT_USE = ""
162
+ }
163
+ /**
164
+ * Opaque type representing a {@link SimpleSpreadsheetData} snapshot. All the
165
+ * internal implementation details are hidden from the exported API.
166
+ */
167
+ interface SimpleBlobStoreContinuation {
168
+ /** @internal */
169
+ _brand: _SimpleBlobStoreBrand;
170
+ }
171
+ /**
172
+ * Reference implementation of {@link BlobDir}
173
+ *
174
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
175
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
176
+ */
177
+ declare class SimpleBlobDir implements BlobDir<SimpleBlobStoreContinuation> {
178
+ constructor();
179
+ readBlob(name: BlobName): ResultAsync<Uint8Array, ReadBlobError>;
180
+ writeBlob(name: BlobName, content: Uint8Array): ResultAsync<void, WriteBlobError>;
181
+ removeBlob(name: BlobName): ResultAsync<void, RemoveBlobError>;
182
+ getDir(name: BlobName): ResultAsync<BlobDir<SimpleBlobStoreContinuation>, GetDirError>;
183
+ query(continuation?: SimpleBlobStoreContinuation): ResultAsync<BlobDirEntries<SimpleBlobStoreContinuation>, DirQueryError>;
184
+ removeAll(): ResultAsync<void, RemoveAllBlobDirError>;
185
+ private map;
186
+ }
187
+ /**
188
+ * Reference implementation of {@link BlobStore}
189
+ *
190
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
191
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
192
+ */
193
+ declare class SimpleBlobStore implements BlobStore<SimpleBlobStoreContinuation> {
194
+ constructor();
195
+ getRootDir(): ResultAsync<SimpleBlobDir, GetRootDirError>;
196
+ private root;
197
+ }
198
+
199
+ /**
200
+ * Reference implementation of {@link InfiniSheetWorker}
201
+ *
202
+ * In-process event loop based workers
203
+ *
204
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
205
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
206
+ */
207
+ declare class SimpleWorker<T extends WorkerMessage> implements InfiniSheetWorker<T> {
208
+ constructor();
209
+ onReceiveMessage: MessageHandler<T> | undefined;
210
+ }
211
+ /**
212
+ * Reference implementation of {@link PostMessageWorkerHost}
213
+ *
214
+ * In-process event loop based workers
215
+ *
216
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
217
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
218
+ */
219
+ declare class SimpleWorkerHost<T extends WorkerMessage> implements PostMessageWorkerHost<T> {
220
+ constructor(worker: SimpleWorker<T>, delay?: number);
221
+ /** @internal */
222
+ isHost(): this is PostMessageWorkerHost<T>;
223
+ postMessage(message: T): void;
224
+ private worker;
225
+ private delay;
226
+ }
227
+
228
+ export { DelayEventLog, LayeredSpreadsheetData, SimpleBlobDir, SimpleBlobStore, SimpleEventLog, SimpleSpreadsheetData, SimpleWorker, SimpleWorkerHost, _LayeredSnapshotBrand, _SimpleBlobStoreBrand, _SimpleSnapshotBrand, delayPromise, delayResult };
229
+ export type { LayeredSnapshot, SimpleBlobStoreContinuation, SimpleSnapshot, SnapshotType };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { FixedSizeItemOffsetMapping, ok, rowColCoordsToRef, okAsync, errAsync, conflictError, infinisheetRangeError, ResultAsync } from '@candidstartup/infinisheet-types';
1
+ import { FixedSizeItemOffsetMapping, ok, rowColCoordsToRef, okAsync, equalViewports, errAsync, conflictError, infinisheetRangeError, ResultAsync, invalidBlobNameError, storageError, notBlobError, notBlobDirError, noContinuationError } from '@candidstartup/infinisheet-types';
2
2
 
3
3
  /**
4
4
  * Branding Enum. Used by {@link SimpleSnapshot} to ensure that
@@ -33,7 +33,8 @@ class SimpleSpreadsheetData {
33
33
  this.content = {
34
34
  values: {},
35
35
  rowCount: 0,
36
- colCount: 0
36
+ colCount: 0,
37
+ viewport: undefined
37
38
  };
38
39
  }
39
40
  subscribe(onDataChange) {
@@ -78,13 +79,24 @@ class SimpleSpreadsheetData {
78
79
  this.content = {
79
80
  values: { ...curr.values, [ref]: { value, format } },
80
81
  rowCount: Math.max(curr.rowCount, row + 1),
81
- colCount: Math.max(curr.colCount, column + 1)
82
+ colCount: Math.max(curr.colCount, column + 1),
83
+ viewport: curr.viewport
82
84
  };
83
85
  return okAsync().andTee(() => this.notifyListeners());
84
86
  }
85
87
  isValidCellValueAndFormat(_row, _column, _value, _format) {
86
88
  return ok();
87
89
  }
90
+ setViewport(viewport) {
91
+ const curr = this.content;
92
+ if (equalViewports(curr.viewport, viewport))
93
+ return;
94
+ this.content = { ...curr, viewport };
95
+ this.notifyListeners();
96
+ }
97
+ getViewport(snapshot) {
98
+ return asContent$1(snapshot).viewport;
99
+ }
88
100
  notifyListeners() {
89
101
  for (const listener of this.listeners)
90
102
  listener();
@@ -190,12 +202,20 @@ class LayeredSpreadsheetData {
190
202
  const result = this.base.isValidCellValueAndFormat(row, column, value, format);
191
203
  return result.andThen(() => this.edit.isValidCellValueAndFormat(row, column, value, format));
192
204
  }
205
+ setViewport(viewport) {
206
+ this.base.setViewport(viewport);
207
+ this.edit.setViewport(viewport);
208
+ }
209
+ getViewport(snapshot) {
210
+ const content = asContent(snapshot);
211
+ return this.edit.getViewport(content.edit);
212
+ }
193
213
  base;
194
214
  edit;
195
215
  content;
196
216
  }
197
217
 
198
- const QUERY_PAGE_SIZE = 10;
218
+ const QUERY_PAGE_SIZE$1 = 10;
199
219
  /**
200
220
  * Reference implementation of {@link EventLog}
201
221
  *
@@ -205,17 +225,28 @@ const QUERY_PAGE_SIZE = 10;
205
225
  * for simple sample apps. Simplest possible implementation, no attempt at optimization.
206
226
  */
207
227
  class SimpleEventLog {
208
- constructor() {
228
+ constructor(workerHost) {
229
+ this.workerHost = workerHost;
209
230
  this.startSequenceId = 0n;
210
231
  this.endSequenceId = 0n;
211
232
  this.entries = [];
212
233
  }
213
- addEntry(entry, sequenceId) {
234
+ /** Worker host used to process pending workflows */
235
+ workerHost;
236
+ addEntry(entry, sequenceId, snapshotId) {
214
237
  if (sequenceId !== this.endSequenceId)
215
238
  return errAsync(conflictError("sequenceId is not next sequence id", this.endSequenceId));
216
239
  this.entries.push(entry);
217
240
  this.endSequenceId++;
218
- return okAsync();
241
+ if (entry.pending)
242
+ this.sendPendingWorkflowMessage(entry.pending, sequenceId);
243
+ const value = {};
244
+ if (snapshotId !== undefined) {
245
+ const snapshot = this.findSnapshot();
246
+ if (snapshot && snapshot.sequenceId !== snapshotId)
247
+ value.lastSnapshot = snapshot;
248
+ }
249
+ return okAsync(value);
219
250
  }
220
251
  setMetadata(sequenceId, metadata) {
221
252
  if (sequenceId < this.startSequenceId || sequenceId >= this.endSequenceId)
@@ -226,11 +257,14 @@ class SimpleEventLog {
226
257
  entry.snapshot = metadata.snapshot;
227
258
  if ("history" in metadata)
228
259
  entry.history = metadata.history;
229
- if ("pending" in metadata)
260
+ if ("pending" in metadata) {
230
261
  entry.pending = metadata.pending;
262
+ if (entry.pending)
263
+ this.sendPendingWorkflowMessage(entry.pending, sequenceId);
264
+ }
231
265
  return okAsync();
232
266
  }
233
- query(start, end) {
267
+ query(start, end, snapshotId) {
234
268
  if (start === 'start')
235
269
  start = this.startSequenceId;
236
270
  else if (start === 'snapshot')
@@ -240,8 +274,8 @@ class SimpleEventLog {
240
274
  if (end === 'end')
241
275
  end = this.endSequenceId;
242
276
  const num = end - start;
243
- const isComplete = num <= BigInt(QUERY_PAGE_SIZE);
244
- let numToReturn = isComplete ? Number(num) : QUERY_PAGE_SIZE;
277
+ const isComplete = num <= BigInt(QUERY_PAGE_SIZE$1);
278
+ let numToReturn = isComplete ? Number(num) : QUERY_PAGE_SIZE$1;
245
279
  const firstIndex = Number(start - this.startSequenceId);
246
280
  if (firstIndex + numToReturn > this.entries.length)
247
281
  numToReturn = this.entries.length - firstIndex;
@@ -251,6 +285,11 @@ class SimpleEventLog {
251
285
  isComplete,
252
286
  entries: this.entries.slice(firstIndex, firstIndex + numToReturn)
253
287
  };
288
+ if (snapshotId !== undefined) {
289
+ const snapshot = this.findSnapshot();
290
+ if (snapshot && snapshot.sequenceId !== snapshotId)
291
+ value.lastSnapshot = snapshot;
292
+ }
254
293
  return okAsync(value);
255
294
  }
256
295
  truncate(start) {
@@ -271,6 +310,21 @@ class SimpleEventLog {
271
310
  this.entries.splice(0, Number(numToRemove));
272
311
  return okAsync();
273
312
  }
313
+ sendPendingWorkflowMessage(workflow, sequenceId) {
314
+ if (this.workerHost) {
315
+ const message = { type: 'PendingWorkflowMessage', sequenceId, workflow };
316
+ this.workerHost.postMessage(message);
317
+ }
318
+ }
319
+ findSnapshot() {
320
+ for (let i = this.entries.length - 1; i > 0; i--) {
321
+ const entry = this.entries[i];
322
+ if (entry.snapshot) {
323
+ return { sequenceId: this.startSequenceId + BigInt(i), blobId: entry.snapshot };
324
+ }
325
+ }
326
+ return undefined;
327
+ }
274
328
  findSnapshotIndex() {
275
329
  for (let i = this.entries.length - 1; i > 0; i--) {
276
330
  const entry = this.entries[i];
@@ -285,11 +339,13 @@ class SimpleEventLog {
285
339
  entries;
286
340
  }
287
341
 
342
+ /** Creates a promise that provides value after a delay (in ms) */
288
343
  function delayPromise(value, delay) {
289
344
  return new Promise((resolve) => {
290
345
  setTimeout(() => resolve(value), delay);
291
346
  });
292
347
  }
348
+ // Utility method that completes a `ResultAsync` after a delay (in ms)
293
349
  function delayResult(result, delay) {
294
350
  const promiseLike = result.then((r) => delayPromise(r, delay));
295
351
  return new ResultAsync(Promise.resolve(promiseLike));
@@ -306,14 +362,14 @@ class DelayEventLog {
306
362
  }
307
363
  /** Delay in milliseconds to add to response from each API call */
308
364
  delay;
309
- addEntry(entry, sequenceId) {
310
- return delayResult(this.base.addEntry(entry, sequenceId), this.delay);
365
+ addEntry(entry, sequenceId, snapshotId) {
366
+ return delayResult(this.base.addEntry(entry, sequenceId, snapshotId), this.delay);
311
367
  }
312
368
  setMetadata(sequenceId, metadata) {
313
369
  return delayResult(this.base.setMetadata(sequenceId, metadata), this.delay);
314
370
  }
315
- query(start, end) {
316
- return delayResult(this.base.query(start, end), this.delay);
371
+ query(start, end, snapshotId) {
372
+ return delayResult(this.base.query(start, end, snapshotId), this.delay);
317
373
  }
318
374
  truncate(start) {
319
375
  return delayResult(this.base.truncate(start), this.delay);
@@ -321,5 +377,187 @@ class DelayEventLog {
321
377
  base;
322
378
  }
323
379
 
324
- export { DelayEventLog, LayeredSpreadsheetData, SimpleEventLog, SimpleSpreadsheetData, _LayeredSnapshotBrand, _SimpleSnapshotBrand };
380
+ const QUERY_PAGE_SIZE = 10;
381
+ /**
382
+ * Branding Enum. Used by {@link SimpleBlobStore} to ensure that
383
+ * you'll get a type error if you pass some random object where a `SimpleBlobStoreContinuation`
384
+ * is expected.
385
+ * @internal
386
+ */
387
+ var _SimpleBlobStoreBrand;
388
+ (function (_SimpleBlobStoreBrand) {
389
+ _SimpleBlobStoreBrand["_DO_NOT_USE"] = "";
390
+ })(_SimpleBlobStoreBrand || (_SimpleBlobStoreBrand = {}));
391
+ function asIter(continuation) {
392
+ return continuation;
393
+ }
394
+ function asContinuation(iter) {
395
+ return iter;
396
+ }
397
+ /**
398
+ * Reference implementation of {@link BlobDir}
399
+ *
400
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
401
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
402
+ */
403
+ class SimpleBlobDir {
404
+ constructor() {
405
+ this.map = new Map;
406
+ }
407
+ // Logically directories only exist if they have entries. To simplify implementation we
408
+ // create on demand and treat empty dir the same as non-existent dir.
409
+ readBlob(name) {
410
+ if (!name)
411
+ return errAsync(invalidBlobNameError());
412
+ const value = this.map.get(name);
413
+ if (!value || (value instanceof SimpleBlobDir && value.map.size == 0))
414
+ return errAsync(storageError("Blob does not exist", 404));
415
+ if (value instanceof Uint8Array) {
416
+ return okAsync(value);
417
+ }
418
+ else {
419
+ return errAsync(notBlobError());
420
+ }
421
+ }
422
+ writeBlob(name, content) {
423
+ if (!name)
424
+ return errAsync(invalidBlobNameError());
425
+ const value = this.map.get(name);
426
+ if (value instanceof SimpleBlobDir && value.map.size > 0)
427
+ return errAsync(notBlobError());
428
+ this.map.set(name, new Uint8Array(content));
429
+ return okAsync();
430
+ }
431
+ removeBlob(name) {
432
+ if (!name)
433
+ return errAsync(invalidBlobNameError());
434
+ const value = this.map.get(name);
435
+ if (value instanceof SimpleBlobDir && value.map.size > 0)
436
+ return errAsync(notBlobError());
437
+ this.map.delete(name);
438
+ return okAsync();
439
+ }
440
+ getDir(name) {
441
+ if (!name)
442
+ return errAsync(invalidBlobNameError());
443
+ const value = this.map.get(name);
444
+ if (!value) {
445
+ const dir = new SimpleBlobDir();
446
+ this.map.set(name, dir);
447
+ return okAsync(dir);
448
+ }
449
+ if (value instanceof SimpleBlobDir)
450
+ return okAsync(value);
451
+ return errAsync(notBlobDirError());
452
+ }
453
+ query(continuation) {
454
+ let iter;
455
+ if (continuation) {
456
+ const sbsIter = asIter(continuation);
457
+ if (sbsIter.dir !== this)
458
+ return errAsync(noContinuationError("Invalid continuation"));
459
+ iter = sbsIter.iter;
460
+ if (!iter)
461
+ return errAsync(noContinuationError("Can't reuse continuation"));
462
+ // Iterator is mutated so can't reuse continuation to retry query
463
+ sbsIter.iter = undefined;
464
+ }
465
+ else {
466
+ iter = this.map.entries();
467
+ }
468
+ const entries = { blobs: [], dirs: [] };
469
+ for (let i = 0; i < QUERY_PAGE_SIZE; i++) {
470
+ const result = iter.next();
471
+ if (result.done)
472
+ return okAsync(entries);
473
+ const [name, value] = result.value;
474
+ if (value instanceof SimpleBlobDir) {
475
+ if (value.map.size > 0)
476
+ entries.dirs.push(name);
477
+ }
478
+ else {
479
+ entries.blobs.push(name);
480
+ }
481
+ }
482
+ entries.continuation = asContinuation({ dir: this, iter });
483
+ return okAsync(entries);
484
+ }
485
+ removeAll() {
486
+ this.map.clear();
487
+ return okAsync();
488
+ }
489
+ map;
490
+ }
491
+ /**
492
+ * Reference implementation of {@link BlobStore}
493
+ *
494
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
495
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
496
+ */
497
+ class SimpleBlobStore {
498
+ constructor() {
499
+ this.root = undefined;
500
+ }
501
+ getRootDir() {
502
+ if (!this.root)
503
+ this.root = new SimpleBlobDir;
504
+ return okAsync(this.root);
505
+ }
506
+ root;
507
+ }
508
+
509
+ /**
510
+ * Reference implementation of {@link InfiniSheetWorker}
511
+ *
512
+ * In-process event loop based workers
513
+ *
514
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
515
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
516
+ */
517
+ class SimpleWorker {
518
+ constructor() {
519
+ }
520
+ onReceiveMessage;
521
+ }
522
+ /**
523
+ * Reference implementation of {@link PostMessageWorkerHost}
524
+ *
525
+ * In-process event loop based workers
526
+ *
527
+ * Intended for use as a mock, to compare with an optimized implementation when testing and
528
+ * for simple sample apps. Simplest possible implementation, no attempt at optimization.
529
+ */
530
+ class SimpleWorkerHost {
531
+ constructor(worker, delay = 0) {
532
+ this.worker = worker;
533
+ this.delay = delay;
534
+ }
535
+ /** @internal */
536
+ isHost() { return true; }
537
+ postMessage(message) {
538
+ const handler = this.worker.onReceiveMessage;
539
+ if (handler) {
540
+ // Using setTimeout ensures message is delivered via the event loop
541
+ setTimeout(() => {
542
+ const result = handler(message);
543
+ result.orElse(
544
+ // Intentionally results in an unhandled exception in event handler
545
+ // Should never use SimplerWorkers with workflow that can result in error
546
+ // Can't be unit tested as blows up the test
547
+ /* istanbul ignore next */
548
+ (error) => {
549
+ console.log(`SimpleWorker returned error ${JSON.stringify(error)}`);
550
+ throw Error("SimpleWorker returned error", { cause: error });
551
+ });
552
+ }, this.delay);
553
+ }
554
+ else {
555
+ throw Error("Worker has no message handler");
556
+ }
557
+ }
558
+ worker;
559
+ delay;
560
+ }
561
+
562
+ export { DelayEventLog, LayeredSpreadsheetData, SimpleBlobDir, SimpleBlobStore, SimpleEventLog, SimpleSpreadsheetData, SimpleWorker, SimpleWorkerHost, _LayeredSnapshotBrand, _SimpleBlobStoreBrand, _SimpleSnapshotBrand, delayPromise, delayResult };
325
563
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/SimpleSpreadsheetData.ts","../src/LayeredSpreadsheetData.ts","../src/SimpleEventLog.ts","../src/DelayEventLog.ts"],"sourcesContent":["import type { CellValue, SpreadsheetData, RowColRef, ItemOffsetMapping, Result, ResultAsync,\n SpreadsheetDataError, ValidationError, StorageError } from \"@candidstartup/infinisheet-types\";\nimport { FixedSizeItemOffsetMapping, rowColCoordsToRef, ok, okAsync } from \"@candidstartup/infinisheet-types\";\n\ninterface CellContent {\n value: CellValue;\n format: string|undefined;\n}\n\ninterface SimpleSnapshotContent {\n values: Record<RowColRef,CellContent>;\n rowCount: number;\n colCount: number;\n}\n\n/** \n * Branding Enum. Used by {@link SimpleSnapshot} to ensure that\n * you'll get a type error if you pass some random object where a `SimpleSnapshot`\n * is expected.\n * @internal\n */\nexport enum _SimpleSnapshotBrand { _DO_NOT_USE=\"\" };\n\n/**\n * Opaque type representing a {@link SimpleSpreadsheetData} snapshot. All the\n * internal implementation details are hidden from the exported API.\n */\nexport interface SimpleSnapshot {\n /** @internal */\n _brand: _SimpleSnapshotBrand;\n}\n\nconst rowItemOffsetMapping = new FixedSizeItemOffsetMapping(30);\nconst columnItemOffsetMapping = new FixedSizeItemOffsetMapping(100);\n\nfunction asContent(snapshot: SimpleSnapshot) {\n return snapshot as unknown as SimpleSnapshotContent;\n}\n\nfunction asSnapshot(snapshot: SimpleSnapshotContent) {\n return snapshot as unknown as SimpleSnapshot;\n}\n\n/**\n * Reference implementation of {@link SpreadsheetData}\n * \n * Editable in-memory spreadsheet data container. Starts out empty. Use the API to fill\n * with data!\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleSpreadsheetData implements SpreadsheetData<SimpleSnapshot> {\n constructor () {\n this.listeners = [];\n this.content = {\n values: {},\n rowCount: 0,\n colCount: 0\n }\n }\n\n subscribe(onDataChange: () => void): () => void {\n this.listeners = [...this.listeners, onDataChange];\n return () => {\n this.listeners = this.listeners.filter(l => l !== onDataChange);\n }\n }\n\n getSnapshot(): SimpleSnapshot {\n return asSnapshot(this.content);\n }\n\n getLoadStatus(_snapshot: SimpleSnapshot): Result<boolean,StorageError> {\n return ok(true);\n }\n\n getRowCount(snapshot: SimpleSnapshot): number {\n return asContent(snapshot).rowCount;\n }\n\n getRowItemOffsetMapping(_snapshot: SimpleSnapshot): ItemOffsetMapping {\n return rowItemOffsetMapping;\n }\n\n getColumnCount(snapshot: SimpleSnapshot): number {\n return asContent(snapshot).colCount;\n }\n\n getColumnItemOffsetMapping(_snapshot: SimpleSnapshot): ItemOffsetMapping {\n return columnItemOffsetMapping\n }\n\n getCellValue(snapshot: SimpleSnapshot, row: number, column: number): CellValue {\n const ref = rowColCoordsToRef(row, column);\n return asContent(snapshot).values[ref]?.value;\n }\n\n getCellFormat(snapshot: SimpleSnapshot, row: number, column: number): string | undefined {\n const ref = rowColCoordsToRef(row, column);\n return asContent(snapshot).values[ref]?.format;\n }\n\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): ResultAsync<void,SpreadsheetDataError> {\n const curr = this.content;\n const ref = rowColCoordsToRef(row, column);\n\n // Snapshot semantics preserved by treating SimpleSnapshot as an immutable data structure which is \n // replaced with a modified copy on every update. Yes, this is horribly inefficient. \n // For simplicity, setting a value to undefined stores it explicitly rather than removing it. Functional\n // behavior is the same.\n this.content = {\n values: { ...curr.values, [ref]: { value, format }},\n rowCount: Math.max(curr.rowCount, row+1),\n colCount: Math.max(curr.colCount, column+1)\n }\n\n return okAsync().andTee(() => this.notifyListeners());\n }\n\n isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void,ValidationError> {\n return ok(); \n }\n\n private notifyListeners() {\n for (const listener of this.listeners)\n listener();\n }\n\n private listeners: (() => void)[];\n private content: SimpleSnapshotContent;\n}\n","import type { CellValue, SpreadsheetData, ItemOffsetMapping, Result, ResultAsync,\n SpreadsheetDataError, ValidationError, StorageError } from \"@candidstartup/infinisheet-types\";\n\ninterface LayeredSnapshotContent<BaseSnapshot, EditSnapshot> {\n base: BaseSnapshot,\n edit: EditSnapshot\n}\n\n/** \n * Branding Enum. Used by {@link LayeredSnapshot} to ensure that\n * you'll get a type error if you pass some random object where a `LayeredSnapshot`\n * is expected.\n * @internal\n */\nexport enum _LayeredSnapshotBrand { _DO_NOT_USE=\"\" };\n\n/**\n * Opaque type representing a {@link LayeredSpreadsheetData} snapshot. All the\n * internal implementation details are hidden from the exported API.\n */\nexport interface LayeredSnapshot<BaseSnapshot,EditSnapshot> {\n /** @internal */\n _brand: [ _LayeredSnapshotBrand, BaseSnapshot, EditSnapshot ]\n}\n\nfunction asContent<Base,Edit>(snapshot: LayeredSnapshot<Base,Edit>) {\n return snapshot as unknown as LayeredSnapshotContent<Base,Edit>;\n}\n\nfunction asSnapshot<Base,Edit>(snapshot: LayeredSnapshotContent<Base,Edit>) {\n return snapshot as unknown as LayeredSnapshot<Base,Edit>;\n}\n\n/**\n * Extracts the snapshot type from a {@link SpreadsheetData} instance\n */\nexport type SnapshotType<T> = T extends SpreadsheetData<infer TResult> ? TResult : never;\n\n/**\n * Implementation of {@link SpreadsheetData} that layers two other `SpreadsheetData` instances on top of each other.\n * \n * There's an \"edit\" layer on top where any changes are stored, with a \"base\" layer underneath. If a value is `undefined` in the edit layer, \n * the corresponding value is returned from the base layer instead.\n * \n * Common use case is a read only reference data source as the base layer with an initially empty edit layer that accepts changes.\n * \n * @typeParam BaseData - Type of base layer `SpreadsheetData` instance\n * @typeParam EditData - Type of edit layer `SpreadsheetData` instance\n * @typeParam BaseSnapshot - Type of snapshot used by `BaseData`. By default, inferred from `BaseData`.\n * @typeParam EditSnapshot - Type of snapshot used by `EditData`. By default, inferred from `EditData`.\n */\nexport class LayeredSpreadsheetData<BaseData extends SpreadsheetData<BaseSnapshot>, \n EditData extends SpreadsheetData<EditSnapshot>, BaseSnapshot = SnapshotType<BaseData>, EditSnapshot = SnapshotType<EditData>>\n implements SpreadsheetData<LayeredSnapshot<BaseSnapshot, EditSnapshot>> {\n\n /**\n * Creates a `LayeredSpreadsheetData` instance from two existing `SpreadsheetData` instances.\n * \n * All type parameters can be inferred from the constructor arguments.\n * \n * @param base - `SpreadsheetData` instance to use for the base layer\n * @param edit - `SpreadsheetData` instance to use for the edit layer\n */\n constructor(base: BaseData, edit: EditData) {\n this.base = base;\n this.edit = edit;\n }\n\n subscribe(onDataChange: () => void): () => void {\n const unsubscribeBase = this.base.subscribe(onDataChange);\n const unsubscribeEdit = this.edit.subscribe(onDataChange);\n return () => {\n unsubscribeBase();\n unsubscribeEdit();\n }\n }\n\n getSnapshot(): LayeredSnapshot<BaseSnapshot, EditSnapshot> {\n const baseSnapshot = this.base.getSnapshot();\n const editSnapshot = this.edit.getSnapshot();\n\n if (!this.content || this.content.base != baseSnapshot || this.content.edit != editSnapshot) {\n this.content = { base: baseSnapshot, edit: editSnapshot } ;\n }\n\n return asSnapshot(this.content);\n }\n\n getLoadStatus(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): Result<boolean,StorageError> {\n const content = asContent(snapshot);\n return this.base.getLoadStatus(content.base).andThen((t1) => this.edit.getLoadStatus(content.edit).map((t2) => t1 && t2));\n }\n\n getRowCount(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): number {\n const content = asContent(snapshot);\n return Math.max(this.base.getRowCount(content.base), this.edit.getRowCount(content.edit));\n }\n\n getRowItemOffsetMapping(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): ItemOffsetMapping {\n return this.base.getRowItemOffsetMapping(asContent(snapshot).base);\n }\n\n getColumnCount(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): number {\n const content = asContent(snapshot);\n return Math.max(this.base.getColumnCount(content.base), this.edit.getColumnCount(content.edit));\n }\n\n getColumnItemOffsetMapping(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): ItemOffsetMapping {\n return this.base.getColumnItemOffsetMapping(asContent(snapshot).base);\n }\n\n getCellValue(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): CellValue {\n const content = asContent(snapshot);\n const editValue = this.edit.getCellValue(content.edit, row, column);\n if (editValue !== undefined)\n return editValue;\n\n return this.base.getCellValue(content.base, row, column);\n }\n\n getCellFormat(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): string | undefined {\n const content = asContent(snapshot);\n const editValue = this.edit.getCellValue(content.edit, row, column);\n return (editValue === undefined) ? this.base.getCellFormat(content.base, row, column) : this.edit.getCellFormat(content.edit, row, column);\n }\n\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): ResultAsync<void,SpreadsheetDataError> {\n const result = this.base.isValidCellValueAndFormat(row, column, value, format);\n return result.asyncAndThen(() => this.edit.setCellValueAndFormat(row, column, value, format));\n }\n\n // Must be valid for both layers\n isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void,ValidationError> {\n const result = this.base.isValidCellValueAndFormat(row, column, value, format);\n return result.andThen(() => this.edit.isValidCellValueAndFormat(row,column,value,format));\n }\n\n private base: BaseData;\n private edit: EditData;\n private content: LayeredSnapshotContent<BaseSnapshot, EditSnapshot> | undefined;\n}\n","import type { EventLog, LogEntry, LogMetadata, SequenceId, ResultAsync, QueryValue, \n AddEntryError, QueryError, TruncateError, MetadataError } from \"@candidstartup/infinisheet-types\";\nimport { okAsync, errAsync, conflictError, infinisheetRangeError } from \"@candidstartup/infinisheet-types\";\n\nconst QUERY_PAGE_SIZE = 10;\n\n/**\n * Reference implementation of {@link EventLog}\n * \n * In-memory event log\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleEventLog<T extends LogEntry> implements EventLog<T> {\n constructor() {\n this.startSequenceId = 0n;\n this.endSequenceId = 0n;\n this.entries = [];\n }\n\n addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void,AddEntryError> {\n if (sequenceId !== this.endSequenceId)\n return errAsync(conflictError(\"sequenceId is not next sequence id\", this.endSequenceId));\n\n this.entries.push(entry);\n this.endSequenceId ++;\n return okAsync();\n }\n\n setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void,MetadataError> {\n if (sequenceId < this.startSequenceId || sequenceId >= this.endSequenceId)\n return errAsync(infinisheetRangeError(`Log entry with sequenceId ${sequenceId} does not exist`));\n\n const index = Number(sequenceId - this.startSequenceId);\n const entry = this.entries[index]!;\n if (\"snapshot\" in metadata)\n entry.snapshot = metadata.snapshot;\n if (\"history\" in metadata)\n entry.history = metadata.history;\n if (\"pending\" in metadata)\n entry.pending = metadata.pending;\n\n return okAsync();\n }\n\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>,QueryError> {\n if (start === 'start')\n start = this.startSequenceId;\n else if (start === 'snapshot')\n start = this.startSequenceId + BigInt(this.findSnapshotIndex());\n else if (start < this.startSequenceId || start > this.endSequenceId)\n return errAsync(infinisheetRangeError(\"start index out of range\"));\n\n if (end === 'end')\n end = this.endSequenceId;\n\n const num = end - start;\n const isComplete = num <= BigInt(QUERY_PAGE_SIZE);\n let numToReturn = isComplete ? Number(num) : QUERY_PAGE_SIZE;\n const firstIndex = Number(start - this.startSequenceId);\n if (firstIndex + numToReturn > this.entries.length)\n numToReturn = this.entries.length - firstIndex;\n\n const value: QueryValue<T> = {\n startSequenceId: start,\n endSequenceId: start + BigInt(numToReturn),\n isComplete,\n entries: this.entries.slice(firstIndex, firstIndex + numToReturn)\n }\n\n return okAsync(value);\n }\n\n truncate(start: SequenceId): ResultAsync<void,TruncateError> {\n if (start < this.startSequenceId)\n return errAsync(infinisheetRangeError(\"start before start entry in the log\"));\n\n if (start === this.startSequenceId)\n return okAsync();\n \n if (start === this.endSequenceId) {\n this.startSequenceId = start;\n this.endSequenceId = start;\n this.entries = [];\n return okAsync();\n }\n\n if (start > this.endSequenceId)\n return errAsync(infinisheetRangeError(\"start after end entry in the log\"));\n\n const numToRemove = start - this.startSequenceId;\n this.startSequenceId = start;\n this.entries.splice(0, Number(numToRemove));\n return okAsync();\n }\n\n private findSnapshotIndex(): number {\n for (let i = this.entries.length - 1; i > 0; i--) {\n const entry = this.entries[i]!;\n if (entry.snapshot)\n return i;\n }\n\n // If no other entry has a snapshot use the first (whether it has a snapshot or not)\n return 0;\n }\n\n private startSequenceId: SequenceId;\n private endSequenceId: SequenceId;\n private entries: T[];\n}","import type { EventLog, LogEntry, LogMetadata, SequenceId, Result, QueryValue, \n AddEntryError, QueryError, TruncateError, MetadataError } from \"@candidstartup/infinisheet-types\";\nimport { ResultAsync } from \"@candidstartup/infinisheet-types\";\n\nfunction delayPromise<T>(value: T, delay: number): Promise<T> {\n return new Promise<T>((resolve) => {\n setTimeout(() => resolve(value), delay);\n })\n}\n\nfunction delayResult<T,E>(result: ResultAsync<T,E>, delay: number): ResultAsync<T,E> {\n const promiseLike = result.then<Result<T,E>,never>((r) => delayPromise(r, delay));\n return new ResultAsync(Promise.resolve(promiseLike));\n}\n\n/**\n * Wrapper around an {@link EventLog} that injects latency\n * \n * Intended for use when simulating the effects of latency in a real implementation\n */\nexport class DelayEventLog<T extends LogEntry> implements EventLog<T> {\n constructor(base: EventLog<T>, delay: number=0) {\n this.base = base;\n this.delay = delay;\n }\n\n /** Delay in milliseconds to add to response from each API call */\n delay: number;\n\n addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void,AddEntryError> {\n return delayResult(this.base.addEntry(entry, sequenceId), this.delay);\n }\n\n setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void,MetadataError> {\n return delayResult(this.base.setMetadata(sequenceId, metadata), this.delay);\n }\n\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>,QueryError> {\n return delayResult(this.base.query(start, end), this.delay);\n }\n\n truncate(start: SequenceId): ResultAsync<void,TruncateError> {\n return delayResult(this.base.truncate(start), this.delay);\n }\n\n private base: EventLog<T>;\n}"],"names":["asContent","asSnapshot"],"mappings":";;AAeA;;;;;AAKG;IACS;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAAG,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,EAAc;AAAC,CAAC,EAAvC,oBAAoB,KAApB,oBAAoB,GAAmB,EAAA,CAAA,CAAA;AAWnD,MAAM,oBAAoB,GAAG,IAAI,0BAA0B,CAAC,EAAE,CAAC;AAC/D,MAAM,uBAAuB,GAAG,IAAI,0BAA0B,CAAC,GAAG,CAAC;AAEnE,SAASA,WAAS,CAAC,QAAwB,EAAA;AACzC,IAAA,OAAO,QAA4C;AACrD;AAEA,SAASC,YAAU,CAAC,QAA+B,EAAA;AACjD,IAAA,OAAO,QAAqC;AAC9C;AAEA;;;;;;;;AAQG;MACU,qBAAqB,CAAA;AAChC,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,GAAG;AACb,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,QAAQ,EAAE;SACX;;AAGH,IAAA,SAAS,CAAC,YAAwB,EAAA;QAChC,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,YAA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AAIpB,IAAA,KAAK;IAEL,QAAQ,CAAC,KAAQ,EAAE,UAAsB,EAAA;AACvC,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;;IAGvE,WAAW,CAAC,UAAsB,EAAE,QAAqB,EAAA;AACvD,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;;IAG7E,KAAK,CAAC,KAAwC,EAAE,GAAuB,EAAA;AACrE,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;;AAG7D,IAAA,QAAQ,CAAC,KAAiB,EAAA;AACxB,QAAA,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;;AAGnD,IAAA,IAAI;AACb;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/SimpleSpreadsheetData.ts","../src/LayeredSpreadsheetData.ts","../src/SimpleEventLog.ts","../src/DelayEventLog.ts","../src/SimpleBlobStore.ts","../src/SimpleWorkers.ts"],"sourcesContent":["import type { CellValue, CellFormat, SpreadsheetData, RowColRef, ItemOffsetMapping, Result, ResultAsync,\n SpreadsheetDataError, ValidationError, StorageError, SpreadsheetViewport } from \"@candidstartup/infinisheet-types\";\nimport { FixedSizeItemOffsetMapping, rowColCoordsToRef, ok, okAsync, equalViewports } from \"@candidstartup/infinisheet-types\";\n\ninterface CellContent {\n value: CellValue;\n format: string|undefined;\n}\n\ninterface SimpleSnapshotContent {\n values: Record<RowColRef,CellContent>;\n rowCount: number;\n colCount: number;\n viewport: SpreadsheetViewport | undefined;\n}\n\n/** \n * Branding Enum. Used by {@link SimpleSnapshot} to ensure that\n * you'll get a type error if you pass some random object where a `SimpleSnapshot`\n * is expected.\n * @internal\n */\nexport enum _SimpleSnapshotBrand { _DO_NOT_USE=\"\" };\n\n/**\n * Opaque type representing a {@link SimpleSpreadsheetData} snapshot. All the\n * internal implementation details are hidden from the exported API.\n */\nexport interface SimpleSnapshot {\n /** @internal */\n _brand: _SimpleSnapshotBrand;\n}\n\nconst rowItemOffsetMapping = new FixedSizeItemOffsetMapping(30);\nconst columnItemOffsetMapping = new FixedSizeItemOffsetMapping(100);\n\nfunction asContent(snapshot: SimpleSnapshot) {\n return snapshot as unknown as SimpleSnapshotContent;\n}\n\nfunction asSnapshot(snapshot: SimpleSnapshotContent) {\n return snapshot as unknown as SimpleSnapshot;\n}\n\n/**\n * Reference implementation of {@link SpreadsheetData}\n * \n * Editable in-memory spreadsheet data container. Starts out empty. Use the API to fill\n * with data!\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleSpreadsheetData implements SpreadsheetData<SimpleSnapshot> {\n constructor () {\n this.listeners = [];\n this.content = {\n values: {},\n rowCount: 0,\n colCount: 0,\n viewport: undefined\n }\n }\n\n subscribe(onDataChange: () => void): () => void {\n this.listeners = [...this.listeners, onDataChange];\n return () => {\n this.listeners = this.listeners.filter(l => l !== onDataChange);\n }\n }\n\n getSnapshot(): SimpleSnapshot {\n return asSnapshot(this.content);\n }\n\n getLoadStatus(_snapshot: SimpleSnapshot): Result<boolean,StorageError> {\n return ok(true);\n }\n\n getRowCount(snapshot: SimpleSnapshot): number {\n return asContent(snapshot).rowCount;\n }\n\n getRowItemOffsetMapping(_snapshot: SimpleSnapshot): ItemOffsetMapping {\n return rowItemOffsetMapping;\n }\n\n getColumnCount(snapshot: SimpleSnapshot): number {\n return asContent(snapshot).colCount;\n }\n\n getColumnItemOffsetMapping(_snapshot: SimpleSnapshot): ItemOffsetMapping {\n return columnItemOffsetMapping\n }\n\n getCellValue(snapshot: SimpleSnapshot, row: number, column: number): CellValue {\n const ref = rowColCoordsToRef(row, column);\n return asContent(snapshot).values[ref]?.value;\n }\n\n getCellFormat(snapshot: SimpleSnapshot, row: number, column: number): CellFormat {\n const ref = rowColCoordsToRef(row, column);\n return asContent(snapshot).values[ref]?.format;\n }\n\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void,SpreadsheetDataError> {\n const curr = this.content;\n const ref = rowColCoordsToRef(row, column);\n\n // Snapshot semantics preserved by treating SimpleSnapshot as an immutable data structure which is \n // replaced with a modified copy on every update. Yes, this is horribly inefficient. \n // For simplicity, setting a value to undefined stores it explicitly rather than removing it. Functional\n // behavior is the same.\n this.content = {\n values: { ...curr.values, [ref]: { value, format }},\n rowCount: Math.max(curr.rowCount, row+1),\n colCount: Math.max(curr.colCount, column+1),\n viewport: curr.viewport\n }\n\n return okAsync().andTee(() => this.notifyListeners());\n }\n\n isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): Result<void,ValidationError> {\n return ok(); \n }\n\n setViewport(viewport: SpreadsheetViewport | undefined): void { \n const curr = this.content;\n if (equalViewports(curr.viewport, viewport))\n return;\n\n this.content = { ...curr, viewport };\n this.notifyListeners();\n }\n\n getViewport(snapshot: SimpleSnapshot): SpreadsheetViewport | undefined { \n return asContent(snapshot).viewport; \n }\n\n private notifyListeners() {\n for (const listener of this.listeners)\n listener();\n }\n\n private listeners: (() => void)[];\n private content: SimpleSnapshotContent;\n}\n","import type { CellValue, CellFormat, SpreadsheetData, ItemOffsetMapping, Result, ResultAsync,\n SpreadsheetDataError, ValidationError, StorageError, SpreadsheetViewport } from \"@candidstartup/infinisheet-types\";\n\ninterface LayeredSnapshotContent<BaseSnapshot, EditSnapshot> {\n base: BaseSnapshot,\n edit: EditSnapshot\n}\n\n/** \n * Branding Enum. Used by {@link LayeredSnapshot} to ensure that\n * you'll get a type error if you pass some random object where a `LayeredSnapshot`\n * is expected.\n * @internal\n */\nexport enum _LayeredSnapshotBrand { _DO_NOT_USE=\"\" };\n\n/**\n * Opaque type representing a {@link LayeredSpreadsheetData} snapshot. All the\n * internal implementation details are hidden from the exported API.\n */\nexport interface LayeredSnapshot<BaseSnapshot,EditSnapshot> {\n /** @internal */\n _brand: [ _LayeredSnapshotBrand, BaseSnapshot, EditSnapshot ]\n}\n\nfunction asContent<Base,Edit>(snapshot: LayeredSnapshot<Base,Edit>) {\n return snapshot as unknown as LayeredSnapshotContent<Base,Edit>;\n}\n\nfunction asSnapshot<Base,Edit>(snapshot: LayeredSnapshotContent<Base,Edit>) {\n return snapshot as unknown as LayeredSnapshot<Base,Edit>;\n}\n\n/**\n * Extracts the snapshot type from a {@link SpreadsheetData} instance\n */\nexport type SnapshotType<T> = T extends SpreadsheetData<infer TResult> ? TResult : never;\n\n/**\n * Implementation of {@link SpreadsheetData} that layers two other `SpreadsheetData` instances on top of each other.\n * \n * There's an \"edit\" layer on top where any changes are stored, with a \"base\" layer underneath. If a value is `undefined` in the edit layer, \n * the corresponding value is returned from the base layer instead.\n * \n * Common use case is a read only reference data source as the base layer with an initially empty edit layer that accepts changes.\n * \n * @typeParam BaseData - Type of base layer `SpreadsheetData` instance\n * @typeParam EditData - Type of edit layer `SpreadsheetData` instance\n * @typeParam BaseSnapshot - Type of snapshot used by `BaseData`. By default, inferred from `BaseData`.\n * @typeParam EditSnapshot - Type of snapshot used by `EditData`. By default, inferred from `EditData`.\n */\nexport class LayeredSpreadsheetData<BaseData extends SpreadsheetData<BaseSnapshot>, \n EditData extends SpreadsheetData<EditSnapshot>, BaseSnapshot = SnapshotType<BaseData>, EditSnapshot = SnapshotType<EditData>>\n implements SpreadsheetData<LayeredSnapshot<BaseSnapshot, EditSnapshot>> {\n\n /**\n * Creates a `LayeredSpreadsheetData` instance from two existing `SpreadsheetData` instances.\n * \n * All type parameters can be inferred from the constructor arguments.\n * \n * @param base - `SpreadsheetData` instance to use for the base layer\n * @param edit - `SpreadsheetData` instance to use for the edit layer\n */\n constructor(base: BaseData, edit: EditData) {\n this.base = base;\n this.edit = edit;\n }\n\n subscribe(onDataChange: () => void): () => void {\n const unsubscribeBase = this.base.subscribe(onDataChange);\n const unsubscribeEdit = this.edit.subscribe(onDataChange);\n return () => {\n unsubscribeBase();\n unsubscribeEdit();\n }\n }\n\n getSnapshot(): LayeredSnapshot<BaseSnapshot, EditSnapshot> {\n const baseSnapshot = this.base.getSnapshot();\n const editSnapshot = this.edit.getSnapshot();\n\n if (!this.content || this.content.base != baseSnapshot || this.content.edit != editSnapshot) {\n this.content = { base: baseSnapshot, edit: editSnapshot } ;\n }\n\n return asSnapshot(this.content);\n }\n\n getLoadStatus(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): Result<boolean,StorageError> {\n const content = asContent(snapshot);\n return this.base.getLoadStatus(content.base).andThen((t1) => this.edit.getLoadStatus(content.edit).map((t2) => t1 && t2));\n }\n\n getRowCount(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): number {\n const content = asContent(snapshot);\n return Math.max(this.base.getRowCount(content.base), this.edit.getRowCount(content.edit));\n }\n\n getRowItemOffsetMapping(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): ItemOffsetMapping {\n return this.base.getRowItemOffsetMapping(asContent(snapshot).base);\n }\n\n getColumnCount(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): number {\n const content = asContent(snapshot);\n return Math.max(this.base.getColumnCount(content.base), this.edit.getColumnCount(content.edit));\n }\n\n getColumnItemOffsetMapping(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): ItemOffsetMapping {\n return this.base.getColumnItemOffsetMapping(asContent(snapshot).base);\n }\n\n getCellValue(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): CellValue {\n const content = asContent(snapshot);\n const editValue = this.edit.getCellValue(content.edit, row, column);\n if (editValue !== undefined)\n return editValue;\n\n return this.base.getCellValue(content.base, row, column);\n }\n\n getCellFormat(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>, row: number, column: number): CellFormat {\n const content = asContent(snapshot);\n const editValue = this.edit.getCellValue(content.edit, row, column);\n return (editValue === undefined) ? this.base.getCellFormat(content.base, row, column) : this.edit.getCellFormat(content.edit, row, column);\n }\n\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void,SpreadsheetDataError> {\n const result = this.base.isValidCellValueAndFormat(row, column, value, format);\n return result.asyncAndThen(() => this.edit.setCellValueAndFormat(row, column, value, format));\n }\n\n // Must be valid for both layers\n isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): Result<void,ValidationError> {\n const result = this.base.isValidCellValueAndFormat(row, column, value, format);\n return result.andThen(() => this.edit.isValidCellValueAndFormat(row,column,value,format));\n }\n\n setViewport(viewport: SpreadsheetViewport | undefined): void { \n this.base.setViewport(viewport);\n this.edit.setViewport(viewport);\n }\n getViewport(snapshot: LayeredSnapshot<BaseSnapshot, EditSnapshot>): SpreadsheetViewport | undefined { \n const content = asContent(snapshot);\n return this.edit.getViewport(content.edit);\n }\n\n private base: BaseData;\n private edit: EditData;\n private content: LayeredSnapshotContent<BaseSnapshot, EditSnapshot> | undefined;\n}\n","import type { EventLog, LogEntry, LogMetadata, SequenceId, ResultAsync, QueryValue, WorkflowId, AddEntryValue, \n AddEntryError, QueryError, TruncateError, MetadataError, PendingWorkflowMessage, SnapshotValue } from \"@candidstartup/infinisheet-types\";\nimport { okAsync, errAsync, conflictError, infinisheetRangeError, PostMessageWorkerHost } from \"@candidstartup/infinisheet-types\";\n\nconst QUERY_PAGE_SIZE = 10;\n\n/**\n * Reference implementation of {@link EventLog}\n * \n * In-memory event log\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleEventLog<T extends LogEntry> implements EventLog<T> {\n constructor(workerHost?: PostMessageWorkerHost<PendingWorkflowMessage>) {\n this.workerHost = workerHost;\n this.startSequenceId = 0n;\n this.endSequenceId = 0n;\n this.entries = [];\n }\n\n /** Worker host used to process pending workflows */\n workerHost?: PostMessageWorkerHost<PendingWorkflowMessage> | undefined;\n\n addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue,AddEntryError> {\n if (sequenceId !== this.endSequenceId)\n return errAsync(conflictError(\"sequenceId is not next sequence id\", this.endSequenceId));\n\n this.entries.push(entry);\n this.endSequenceId ++;\n\n if (entry.pending)\n this.sendPendingWorkflowMessage(entry.pending, sequenceId);\n\n const value: AddEntryValue = {};\n if (snapshotId !== undefined) {\n const snapshot = this.findSnapshot();\n if (snapshot && snapshot.sequenceId !== snapshotId)\n value.lastSnapshot = snapshot;\n }\n \n return okAsync(value);\n }\n\n setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void,MetadataError> {\n if (sequenceId < this.startSequenceId || sequenceId >= this.endSequenceId)\n return errAsync(infinisheetRangeError(`Log entry with sequenceId ${sequenceId} does not exist`));\n\n const index = Number(sequenceId - this.startSequenceId);\n const entry = this.entries[index]!;\n if (\"snapshot\" in metadata)\n entry.snapshot = metadata.snapshot;\n if (\"history\" in metadata)\n entry.history = metadata.history;\n if (\"pending\" in metadata) {\n entry.pending = metadata.pending;\n if (entry.pending)\n this.sendPendingWorkflowMessage(entry.pending, sequenceId);\n }\n\n return okAsync();\n }\n\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>,QueryError> {\n if (start === 'start')\n start = this.startSequenceId;\n else if (start === 'snapshot')\n start = this.startSequenceId + BigInt(this.findSnapshotIndex());\n else if (start < this.startSequenceId || start > this.endSequenceId)\n return errAsync(infinisheetRangeError(\"start index out of range\"));\n\n if (end === 'end')\n end = this.endSequenceId;\n\n const num = end - start;\n const isComplete = num <= BigInt(QUERY_PAGE_SIZE);\n let numToReturn = isComplete ? Number(num) : QUERY_PAGE_SIZE;\n const firstIndex = Number(start - this.startSequenceId);\n if (firstIndex + numToReturn > this.entries.length)\n numToReturn = this.entries.length - firstIndex;\n\n \n const value: QueryValue<T> = {\n startSequenceId: start,\n endSequenceId: start + BigInt(numToReturn),\n isComplete,\n entries: this.entries.slice(firstIndex, firstIndex + numToReturn)\n }\n\n if (snapshotId !== undefined) {\n const snapshot = this.findSnapshot();\n if (snapshot && snapshot.sequenceId !== snapshotId)\n value.lastSnapshot = snapshot;\n }\n\n return okAsync(value);\n }\n\n truncate(start: SequenceId): ResultAsync<void,TruncateError> {\n if (start < this.startSequenceId)\n return errAsync(infinisheetRangeError(\"start before start entry in the log\"));\n\n if (start === this.startSequenceId)\n return okAsync();\n \n if (start === this.endSequenceId) {\n this.startSequenceId = start;\n this.endSequenceId = start;\n this.entries = [];\n return okAsync();\n }\n\n if (start > this.endSequenceId)\n return errAsync(infinisheetRangeError(\"start after end entry in the log\"));\n\n const numToRemove = start - this.startSequenceId;\n this.startSequenceId = start;\n this.entries.splice(0, Number(numToRemove));\n return okAsync();\n }\n\n private sendPendingWorkflowMessage(workflow: WorkflowId, sequenceId: SequenceId) {\n if (this.workerHost) {\n const message: PendingWorkflowMessage = { type: 'PendingWorkflowMessage', sequenceId, workflow }\n this.workerHost.postMessage(message);\n }\n }\n\n private findSnapshot(): SnapshotValue | undefined {\n for (let i = this.entries.length - 1; i > 0; i--) {\n const entry = this.entries[i]!;\n if (entry.snapshot) {\n return { sequenceId: this.startSequenceId + BigInt(i), blobId: entry.snapshot }\n }\n }\n\n return undefined;\n }\n\n private findSnapshotIndex(): number {\n for (let i = this.entries.length - 1; i > 0; i--) {\n const entry = this.entries[i]!;\n if (entry.snapshot)\n return i;\n }\n\n // If no other entry has a snapshot use the first (whether it has a snapshot or not)\n return 0;\n }\n\n private startSequenceId: SequenceId;\n private endSequenceId: SequenceId;\n private entries: T[];\n}","import type { EventLog, LogEntry, LogMetadata, SequenceId, Result, QueryValue, \n AddEntryError, QueryError, TruncateError, MetadataError, \n AddEntryValue} from \"@candidstartup/infinisheet-types\";\nimport { ResultAsync } from \"@candidstartup/infinisheet-types\";\n\n/** Creates a promise that provides value after a delay (in ms) */\nexport function delayPromise<T>(value: T, delay: number): Promise<T> {\n return new Promise<T>((resolve) => {\n setTimeout(() => resolve(value), delay);\n })\n}\n\n// Utility method that completes a `ResultAsync` after a delay (in ms)\nexport function delayResult<T,E>(result: ResultAsync<T,E>, delay: number): ResultAsync<T,E> {\n const promiseLike = result.then<Result<T,E>,never>((r) => delayPromise(r, delay));\n return new ResultAsync(Promise.resolve(promiseLike));\n}\n\n/**\n * Wrapper around an {@link EventLog} that injects latency\n * \n * Intended for use when simulating the effects of latency in a real implementation\n */\nexport class DelayEventLog<T extends LogEntry> implements EventLog<T> {\n constructor(base: EventLog<T>, delay: number=0) {\n this.base = base;\n this.delay = delay;\n }\n\n /** Delay in milliseconds to add to response from each API call */\n delay: number;\n\n addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue,AddEntryError> {\n return delayResult(this.base.addEntry(entry, sequenceId, snapshotId), this.delay);\n }\n\n setMetadata(sequenceId: SequenceId, metadata: LogMetadata): ResultAsync<void,MetadataError> {\n return delayResult(this.base.setMetadata(sequenceId, metadata), this.delay);\n }\n\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>,QueryError> {\n return delayResult(this.base.query(start, end, snapshotId), this.delay);\n }\n\n truncate(start: SequenceId): ResultAsync<void,TruncateError> {\n return delayResult(this.base.truncate(start), this.delay);\n }\n\n private base: EventLog<T>;\n}","import type { BlobStore, BlobDir, BlobName, ResultAsync, \n GetRootDirError, ReadBlobError, WriteBlobError, RemoveBlobError, BlobDirEntries, \n GetDirError, DirQueryError, RemoveAllBlobDirError } from \"@candidstartup/infinisheet-types\";\nimport { errAsync, okAsync, storageError, notBlobError, notBlobDirError, invalidBlobNameError, noContinuationError } from \"@candidstartup/infinisheet-types\";\n\nconst QUERY_PAGE_SIZE = 10;\n\ninterface SimpleBlobStoreIter {\n dir: SimpleBlobDir;\n iter: MapIterator<[BlobName, BlobDir<SimpleBlobStoreContinuation>|Uint8Array]> | undefined;\n}\n\n/** \n * Branding Enum. Used by {@link SimpleBlobStore} to ensure that\n * you'll get a type error if you pass some random object where a `SimpleBlobStoreContinuation`\n * is expected.\n * @internal\n */\nexport enum _SimpleBlobStoreBrand { _DO_NOT_USE=\"\" };\n\n/**\n * Opaque type representing a {@link SimpleSpreadsheetData} snapshot. All the\n * internal implementation details are hidden from the exported API.\n */\nexport interface SimpleBlobStoreContinuation {\n /** @internal */\n _brand: _SimpleBlobStoreBrand;\n}\n\nfunction asIter(continuation: SimpleBlobStoreContinuation) {\n return continuation as unknown as SimpleBlobStoreIter;\n}\n\nfunction asContinuation(iter: SimpleBlobStoreIter) {\n return iter as unknown as SimpleBlobStoreContinuation;\n}\n\n/**\n * Reference implementation of {@link BlobDir}\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleBlobDir implements BlobDir<SimpleBlobStoreContinuation> {\n constructor () {\n this.map = new Map;\n }\n\n // Logically directories only exist if they have entries. To simplify implementation we\n // create on demand and treat empty dir the same as non-existent dir.\n\n readBlob(name: BlobName): ResultAsync<Uint8Array,ReadBlobError> {\n if (!name)\n return errAsync(invalidBlobNameError());\n const value = this.map.get(name);\n if (!value || (value instanceof SimpleBlobDir && value.map.size == 0))\n return errAsync(storageError(\"Blob does not exist\", 404));\n\n if (value instanceof Uint8Array) {\n return okAsync(value);\n } else {\n return errAsync(notBlobError())\n }\n }\n\n writeBlob(name: BlobName, content: Uint8Array): ResultAsync<void,WriteBlobError> {\n if (!name)\n return errAsync(invalidBlobNameError());\n const value = this.map.get(name);\n if (value instanceof SimpleBlobDir && value.map.size > 0)\n return errAsync(notBlobError());\n\n this.map.set(name,new Uint8Array(content));\n return okAsync();\n }\n\n removeBlob(name: BlobName): ResultAsync<void,RemoveBlobError> {\n if (!name)\n return errAsync(invalidBlobNameError());\n const value = this.map.get(name);\n if (value instanceof SimpleBlobDir && value.map.size > 0)\n return errAsync(notBlobError());\n\n this.map.delete(name);\n return okAsync();\n }\n\n getDir(name: BlobName): ResultAsync<BlobDir<SimpleBlobStoreContinuation>,GetDirError> {\n if (!name)\n return errAsync(invalidBlobNameError());\n\n const value = this.map.get(name);\n if (!value) {\n const dir = new SimpleBlobDir();\n this.map.set(name,dir);\n return okAsync(dir);\n }\n\n if (value instanceof SimpleBlobDir)\n return okAsync(value);\n\n return errAsync(notBlobDirError());\n }\n\n query(continuation?: SimpleBlobStoreContinuation): ResultAsync<BlobDirEntries<SimpleBlobStoreContinuation>,DirQueryError> {\n let iter;\n if (continuation) {\n const sbsIter = asIter(continuation);\n if (sbsIter.dir !== this)\n return errAsync(noContinuationError(\"Invalid continuation\"));\n iter = sbsIter.iter;\n if (!iter)\n return errAsync(noContinuationError(\"Can't reuse continuation\"));\n\n // Iterator is mutated so can't reuse continuation to retry query\n sbsIter.iter = undefined;\n } else {\n iter = this.map.entries();\n }\n const entries: BlobDirEntries<SimpleBlobStoreContinuation> = { blobs: [], dirs: [] }\n\n for (let i = 0; i < QUERY_PAGE_SIZE; i ++) {\n const result = iter.next();\n if (result.done)\n return okAsync(entries);\n\n const [name, value] = result.value;\n if (value instanceof SimpleBlobDir) {\n if (value.map.size > 0)\n entries.dirs.push(name);\n } else {\n entries.blobs.push(name);\n }\n }\n\n entries.continuation = asContinuation({ dir: this, iter });\n return okAsync(entries);\n }\n\n removeAll(): ResultAsync<void,RemoveAllBlobDirError> {\n this.map.clear();\n return okAsync();\n }\n \n private map: Map<BlobName,BlobDir<SimpleBlobStoreContinuation>|Uint8Array>\n}\n\n/**\n * Reference implementation of {@link BlobStore}\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleBlobStore implements BlobStore<SimpleBlobStoreContinuation> {\n constructor () {\n this.root = undefined;\n }\n\n getRootDir(): ResultAsync<SimpleBlobDir,GetRootDirError> {\n if (!this.root)\n this.root = new SimpleBlobDir;\n return okAsync(this.root);\n }\n\n private root: SimpleBlobDir | undefined;\n}\n","import type { WorkerMessage, MessageHandler } from \"@candidstartup/infinisheet-types\";\nimport { InfiniSheetWorker, PostMessageWorkerHost } from \"@candidstartup/infinisheet-types\";\n\n/**\n * Reference implementation of {@link InfiniSheetWorker}\n * \n * In-process event loop based workers\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleWorker<T extends WorkerMessage> implements InfiniSheetWorker<T> {\n constructor() {\n }\n\n onReceiveMessage: MessageHandler<T> | undefined;\n}\n\n/**\n * Reference implementation of {@link PostMessageWorkerHost}\n * \n * In-process event loop based workers\n * \n * Intended for use as a mock, to compare with an optimized implementation when testing and\n * for simple sample apps. Simplest possible implementation, no attempt at optimization.\n */\nexport class SimpleWorkerHost<T extends WorkerMessage> implements PostMessageWorkerHost<T> {\n constructor(worker: SimpleWorker<T>, delay: number = 0) {\n this.worker = worker;\n this.delay = delay;\n }\n\n /** @internal */\n isHost(): this is PostMessageWorkerHost<T> { return true; }\n\n postMessage(message: T): void {\n const handler = this.worker.onReceiveMessage;\n if (handler) {\n // Using setTimeout ensures message is delivered via the event loop\n setTimeout(() => { \n const result = handler(message);\n result.orElse(\n // Intentionally results in an unhandled exception in event handler\n // Should never use SimplerWorkers with workflow that can result in error\n // Can't be unit tested as blows up the test\n /* istanbul ignore next */\n (error) => {\n console.log(`SimpleWorker returned error ${JSON.stringify(error)}`);\n throw Error(\"SimpleWorker returned error\", { cause: error });\n }\n )\n }, this.delay);\n } else {\n throw Error(\"Worker has no message handler\");\n }\n }\n\n private worker: SimpleWorker<T>;\n private delay: number;\n}\n"],"names":["asContent","asSnapshot","QUERY_PAGE_SIZE"],"mappings":";;AAgBA;;;;;AAKG;IACS;AAAZ,CAAA,UAAY,oB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AI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA,CAAE,CAAC;oBACnE,MAAM,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC9D,gBAAA,CAAC,CACF;AACH,YAAA,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;QAChB;aAAO;AACL,YAAA,MAAM,KAAK,CAAC,+BAA+B,CAAC;QAC9C;IACF;AAEQ,IAAA,MAAM;AACN,IAAA,KAAK;AACd;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@candidstartup/simple-spreadsheet-data",
3
3
  "private": false,
4
- "version": "0.12.0",
4
+ "version": "0.13.0",
5
5
  "description": "Reference implementations of SpreadsheetData",
6
6
  "author": "Tim Wiegand <tim.wiegand@thecandidstartup.org>",
7
7
  "license": "BSD-3-Clause",
@@ -49,7 +49,7 @@
49
49
  "test": "vitest"
50
50
  },
51
51
  "dependencies": {
52
- "@candidstartup/infinisheet-types": "^0.12.0"
52
+ "@candidstartup/infinisheet-types": "^0.13.0"
53
53
  },
54
- "gitHead": "03b639807d367f0c167dc5b6653b3935412cbde8"
54
+ "gitHead": "ca46dae5575a3011416803e2b159457ecb59eaee"
55
55
  }