@candidstartup/infinisheet-types 0.11.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
@@ -187,8 +187,15 @@ interface StorageError extends InfinisheetError {
187
187
  /** Convenience method that creates a {@link StorageError} */
188
188
  declare function storageError(message: string, statusCode?: number): StorageError;
189
189
 
190
+ /** Identifier for a blob of data in a blob store */
190
191
  type BlobId = string;
192
+ /** Identifier for a workflow triggered writing to {@link LogMetadata.pending} */
191
193
  type WorkflowId = string;
194
+ /**
195
+ * Identifier for an entry in an {@link EventLog}.
196
+ *
197
+ * Incrementing integer.
198
+ */
192
199
  type SequenceId = bigint;
193
200
  /**
194
201
  * Metadata stored in an {@link EventLog} entry
@@ -243,6 +250,13 @@ type QueryError = InfinisheetRangeError | StorageError;
243
250
  type TruncateError = InfinisheetRangeError | StorageError;
244
251
  /** Errors that can be returned by {@link EventLog} `setMetadata` method */
245
252
  type MetadataError = InfinisheetRangeError | StorageError;
253
+ /** Value of a snapshot stored at a specific sequence id in the log */
254
+ interface SnapshotValue {
255
+ /** Sequence id of log entry that stores this snapshot */
256
+ sequenceId: SequenceId;
257
+ /** Content of snapshot in the `BlobStore` */
258
+ blobId: BlobId;
259
+ }
246
260
  /** A range of {@link LogEntry} values returned by querying an {@link EventLog} */
247
261
  interface QueryValue<T extends LogEntry> {
248
262
  /** Sequence id corresponding to the first entry in `entries`
@@ -265,9 +279,24 @@ interface QueryValue<T extends LogEntry> {
265
279
  * from `nextSequenceId`.
266
280
  */
267
281
  isComplete: boolean;
282
+ /** Most recent snapshot
283
+ *
284
+ * Returned if query includes `snapshotId` argument and
285
+ * most recent snapshot is different.
286
+ */
287
+ lastSnapshot?: SnapshotValue | undefined;
268
288
  /** The {@link LogEntry} records returned by the query */
269
289
  entries: T[];
270
290
  }
291
+ /** Result of calling {@link EventLog.addEntry} */
292
+ interface AddEntryValue {
293
+ /** Most recent snapshot
294
+ *
295
+ * Returned if query includes `snapshotId` argument and
296
+ * most recent snapshot is different.
297
+ */
298
+ lastSnapshot?: SnapshotValue | undefined;
299
+ }
271
300
  /** Abstract interface representing an event log
272
301
  *
273
302
  *
@@ -276,11 +305,16 @@ interface EventLog<T extends LogEntry> {
276
305
  /**
277
306
  * Add an entry to the log with the given sequence id
278
307
  *
279
- * The `sequenceId` must be the next available sequence id in the log. This is returned as `endSequenceId` when
280
- * making a query for the `last` entry in the log. Returns a {@link ConflictError} if not the next available id.
308
+ * @param sequenceId - The next available sequence id in the log.
309
+ * This is returned as `endSequenceId` when making a query for the `last` entry in the log.
310
+ * Returns a {@link ConflictError} if not the next available id.
311
+ *
312
+ * @param snapshotId - The sequence id for the most recent snapshot that the client is aware of.
313
+ * If there's a more recent snapshot, it's id will be returned in `AddEntryValue`.
314
+ *
281
315
  * Any other problem with serializing the entry will return a {@link StorageError}.
282
316
  */
283
- addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void, AddEntryError>;
317
+ addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue, AddEntryError>;
284
318
  /**
285
319
  * Set some or all of a log entry's metadata fields
286
320
  *
@@ -298,11 +332,141 @@ interface EventLog<T extends LogEntry> {
298
332
  * @param end - `SequenceId` one after the last entry to return.
299
333
  * Use `'end'` to query everything to the end of the log.
300
334
  */
301
- query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>, QueryError>;
335
+ query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>, QueryError>;
302
336
  /** All entries prior to `start` are removed from the log. */
303
337
  truncate(start: SequenceId): ResultAsync<void, TruncateError>;
304
338
  }
305
339
 
340
+ /**
341
+ * Name of a blob or directory within a {@link BlobDir}
342
+ *
343
+ * Names MUST NOT be longer than 100 characters
344
+ */
345
+ type BlobName = string;
346
+ /**
347
+ * Invalid {@link BlobName} error
348
+ *
349
+ * Occurs when trying to pass a `BlobName` that is too long or contains invalid characters
350
+ */
351
+ interface InvalidBlobNameError extends InfinisheetError {
352
+ /** Discriminated union tag */
353
+ type: 'InvalidBlobNameError';
354
+ }
355
+ declare function invalidBlobNameError(message?: string): InvalidBlobNameError;
356
+ /**
357
+ * Error when trying to access a blob as a directory or vice versa
358
+ *
359
+ * Occurs when trying to access a blob/directory with a
360
+ * {@link BlobName} that refers to a directory/blob
361
+ */
362
+ interface BlobWrongKindError extends InfinisheetError {
363
+ /** Discriminated union tag */
364
+ type: 'BlobWrongKindError';
365
+ }
366
+ declare function notBlobError(): BlobWrongKindError;
367
+ declare function notBlobDirError(): BlobWrongKindError;
368
+ /**
369
+ * Invalid {@link BlobName} error
370
+ *
371
+ * Occurs when trying to pass a `BlobName` that is too long or contains invalid characters
372
+ */
373
+ interface NoContinuationError extends InfinisheetError {
374
+ /** Discriminated union tag */
375
+ type: 'NoContinuationError';
376
+ }
377
+ declare function noContinuationError(message?: string): NoContinuationError;
378
+ /** Errors that can be returned by {@link BlobDir.readBlob} */
379
+ type ReadBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;
380
+ /** Errors that can be returned by {@link BlobDir.writeBlob} */
381
+ type WriteBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;
382
+ /** Errors that can be returned by {@link BlobDir.removeBlob} */
383
+ type RemoveBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;
384
+ /** Errors that can be returned by {@link BlobDir.getDir} */
385
+ type GetDirError = BlobWrongKindError | InvalidBlobNameError | StorageError;
386
+ /** Errors that can be returned by {@link BlobDir.query} */
387
+ type DirQueryError = StorageError | NoContinuationError;
388
+ /** Errors that can be returned by {@link BlobDir.removeAll} */
389
+ type RemoveAllBlobDirError = StorageError;
390
+ interface BlobDirEntries<ContinuationT> {
391
+ /** Names of blobs returned by {@link BlobDir.query} */
392
+ blobs: BlobName[];
393
+ /** Names of directories returned by {@link BlobDir.query} */
394
+ dirs: BlobName[];
395
+ /** Continuation token to pass to {@link BlobDir.query} if there are more entries to retrieve */
396
+ continuation?: ContinuationT | undefined;
397
+ }
398
+ /**
399
+ * Directory that contains blobs and other directories within a {@link BlobStore}
400
+ */
401
+ interface BlobDir<ContinuationT> {
402
+ /** Read the content of a blob with the specified name.
403
+ *
404
+ * The returned content array is read only and immutable.
405
+ */
406
+ readBlob(name: BlobName): ResultAsync<Uint8Array, ReadBlobError>;
407
+ /** Write the specified content to a blob with the specified name.
408
+ *
409
+ * Any existing blob with that name is overwritten, otherwise a new blob is created.
410
+ * The content array is treated as read only and must be immutable until the operation completes.
411
+ */
412
+ writeBlob(name: BlobName, content: Uint8Array): ResultAsync<void, WriteBlobError>;
413
+ /** Remove blob with the specified name. */
414
+ removeBlob(name: BlobName): ResultAsync<void, RemoveBlobError>;
415
+ /** Get a {@link BlobDir} corresponding to the subdirectory with the specified name
416
+ *
417
+ * Subdirectories are "created" on demand
418
+ */
419
+ getDir(name: BlobName): ResultAsync<BlobDir<ContinuationT>, GetDirError>;
420
+ /** Query for blobs and sub-directories within this directory
421
+ *
422
+ * The order of entries returned is undefined.
423
+ *
424
+ * Can optionally pass a continuation token returned by the previous call to retrieve additional entries.
425
+ */
426
+ query(continuation?: ContinuationT): ResultAsync<BlobDirEntries<ContinuationT>, DirQueryError>;
427
+ /** Remove this directory and it's contents, recursively */
428
+ removeAll(): ResultAsync<void, RemoveAllBlobDirError>;
429
+ }
430
+ /** Errors that can be returned by {@link BlobStore.getRootDir} */
431
+ type GetRootDirError = StorageError;
432
+ /** Abstract interface representing a Blob store
433
+ *
434
+ * Modeled as a hierarchy of directories and blobs
435
+ */
436
+ interface BlobStore<ContinuationT> {
437
+ /** Returns the root {@link BlobDir} for the store*/
438
+ getRootDir(): ResultAsync<BlobDir<ContinuationT>, GetRootDirError>;
439
+ }
440
+
441
+ interface WorkerMessage {
442
+ /** Used as a discriminated union tag by implementations */
443
+ type: string;
444
+ }
445
+ interface PendingWorkflowMessage extends WorkerMessage {
446
+ type: "PendingWorkflowMessage";
447
+ /** Workflow requested */
448
+ workflow: WorkflowId;
449
+ /** Sequence id of log entry that requested workflow */
450
+ sequenceId: SequenceId;
451
+ }
452
+ /** Type of handler function for {@link InfiniSheetWorker.onReceiveMessage} */
453
+ type MessageHandler<MessageT extends WorkerMessage> = (message: MessageT) => ResultAsync<void, InfinisheetError>;
454
+ interface WorkerHost<MessageT extends WorkerMessage> {
455
+ /**
456
+ * Place holder until we have some real implementation. Need something concrete
457
+ * to stop TypeScript moaning about the unused generic parameter and implementations
458
+ * without any properties in common with the interface they're implementing.
459
+ * @internal
460
+ */
461
+ isHost(): this is WorkerHost<MessageT>;
462
+ }
463
+ interface PostMessageWorkerHost<MessageT extends WorkerMessage> extends WorkerHost<MessageT> {
464
+ postMessage(message: MessageT): void;
465
+ }
466
+ interface InfiniSheetWorker<MessageT extends WorkerMessage> {
467
+ onReceiveMessage: MessageHandler<MessageT> | undefined;
468
+ }
469
+
306
470
  /**
307
471
  * Interface used to determine the size and positioning offset for items in a single dimension.
308
472
  */
@@ -324,7 +488,6 @@ interface ItemOffsetMapping {
324
488
  * Implementation of {@link ItemOffsetMapping} for use when all items have a fixed size
325
489
  */
326
490
  declare class FixedSizeItemOffsetMapping implements ItemOffsetMapping {
327
- #private;
328
491
  /**
329
492
  * @param itemSize - Size to use for all items
330
493
  */
@@ -332,13 +495,13 @@ declare class FixedSizeItemOffsetMapping implements ItemOffsetMapping {
332
495
  itemSize(_itemIndex: number): number;
333
496
  itemOffset(itemIndex: number): number;
334
497
  offsetToItem(offset: number): [itemIndex: number, startOffset: number];
498
+ private fixedItemSize;
335
499
  }
336
500
 
337
501
  /**
338
502
  * Implementation of {@link ItemOffsetMapping} for use when initial items have variable sizes.
339
503
  */
340
504
  declare class VariableSizeItemOffsetMapping implements ItemOffsetMapping {
341
- #private;
342
505
  /**
343
506
  * @param defaultItemSize - Size to use for all other items
344
507
  * @param sizes - Array of sizes to use for the initial items, one size per item
@@ -347,6 +510,8 @@ declare class VariableSizeItemOffsetMapping implements ItemOffsetMapping {
347
510
  itemSize(itemIndex: number): number;
348
511
  itemOffset(itemIndex: number): number;
349
512
  offsetToItem(offset: number): [itemIndex: number, startOffset: number];
513
+ private defaultItemSize;
514
+ private sizes;
350
515
  }
351
516
 
352
517
  /** Possible spreadsheet error values
@@ -375,6 +540,30 @@ interface CellError {
375
540
  * explicitly marked as empty.
376
541
  */
377
542
  type CellValue = string | number | boolean | null | undefined | CellError;
543
+ /** Format of cell typically used when displaying numbers */
544
+ type CellFormat = string | undefined;
545
+ /** Data stored in a spreadsheet cell */
546
+ interface CellData {
547
+ /** Value of cell */
548
+ value: CellValue;
549
+ /** Format of cell */
550
+ format?: CellFormat;
551
+ }
552
+ /** A viewport onto the spreadsheet. Usually the portion of the spreadsheet visible on-screen. */
553
+ interface SpreadsheetViewport {
554
+ /** Offset down the rows to the start of the viewport (using {@link ItemOffsetMapping} offsets) */
555
+ rowMinOffset: number;
556
+ /** Offset along the columns to the start of the viewport (using {@link ItemOffsetMapping} offsets) */
557
+ columnMinOffset: number;
558
+ /** Viewport width */
559
+ width: number;
560
+ /** Viewport height */
561
+ height: number;
562
+ }
563
+ /** Are two viewports equal by value? */
564
+ declare function equalViewports(a: SpreadsheetViewport | undefined, b: SpreadsheetViewport | undefined): boolean;
565
+ /** Creates an empty viewport */
566
+ declare function emptyViewport(): SpreadsheetViewport;
378
567
  /** Types of error that can be returned by {@link SpreadsheetData} methods */
379
568
  type SpreadsheetDataError = ValidationError | StorageError;
380
569
  /**
@@ -392,6 +581,13 @@ interface SpreadsheetData<Snapshot> {
392
581
  subscribe(onDataChange: () => void): () => void;
393
582
  /** Return a snapshot to use when accessing values at a consistent point in time */
394
583
  getSnapshot(): Snapshot;
584
+ /**
585
+ * Return load status at the time the snapshot was created
586
+ *
587
+ * On Success returns true if load has completed, false if still in progress
588
+ * On Err returns most recent error reported by the storage system
589
+ */
590
+ getLoadStatus(snapshot: Snapshot): Result<boolean, StorageError>;
395
591
  /** Number of rows in the spreadsheet */
396
592
  getRowCount(snapshot: Snapshot): number;
397
593
  /** {@link ItemOffsetMapping} which describes sizes and offsets to start of rows */
@@ -403,29 +599,45 @@ interface SpreadsheetData<Snapshot> {
403
599
  /** Value of specified cell using 0-based row and column indexes */
404
600
  getCellValue(snapshot: Snapshot, row: number, column: number): CellValue;
405
601
  /** Format of specified cell using 0-based row and column indexes */
406
- getCellFormat(snapshot: Snapshot, row: number, column: number): string | undefined;
602
+ getCellFormat(snapshot: Snapshot, row: number, column: number): CellFormat;
407
603
  /** Set value and format of specified cell
408
604
  *
409
605
  * @returns `Ok` if the change was successfully applied
410
606
  */
411
- setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void, SpreadsheetDataError>;
607
+ setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void, SpreadsheetDataError>;
412
608
  /** Check whether value and format are valid to set for specified cell
413
609
  *
414
610
  * @returns `Ok` if the value and format are valid
415
611
  */
416
- isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void, ValidationError>;
612
+ isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): Result<void, ValidationError>;
613
+ /** Set viewport of interest
614
+ *
615
+ * Can be used by `SpreadsheetData` implementations to optimize data retrieval and memory usage.
616
+ * Queries for cells outside the viewport *may* return `undefined`. Clients should not rely on any particular behavior
617
+ * for queries outside the viewport.
618
+ *
619
+ * Set to undefined (the default) if the client needs access to the entire spreadsheet
620
+ */
621
+ setViewport(viewport: SpreadsheetViewport | undefined): void;
622
+ /** Return the viewport in force (if any) */
623
+ getViewport(snapshot: Snapshot): SpreadsheetViewport | undefined;
417
624
  }
418
625
  declare class EmptySpreadsheetData implements SpreadsheetData<number> {
626
+ constructor();
419
627
  subscribe(_onDataChange: () => void): () => void;
420
628
  getSnapshot(): number;
629
+ getLoadStatus(_snapshot: number): Result<boolean, StorageError>;
421
630
  getRowCount(_snapshot: number): number;
422
631
  getRowItemOffsetMapping(_snapshot: number): ItemOffsetMapping;
423
632
  getColumnCount(_snapshot: number): number;
424
633
  getColumnItemOffsetMapping(_snapshot: number): ItemOffsetMapping;
425
634
  getCellValue(_snapshot: number, _row: number, _column: number): CellValue;
426
635
  getCellFormat(_snapshot: number, _row: number, _column: number): string | undefined;
427
- setCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void, SpreadsheetDataError>;
428
- isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void, ValidationError>;
636
+ setCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): ResultAsync<void, SpreadsheetDataError>;
637
+ isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): Result<void, ValidationError>;
638
+ setViewport(viewport: SpreadsheetViewport | undefined): void;
639
+ getViewport(_snapshot: number): SpreadsheetViewport | undefined;
640
+ private viewport;
429
641
  }
430
642
 
431
643
  /** Classic Spreadsheet reference to Column (e.g "A") */
@@ -445,4 +657,5 @@ declare function rowColRefToCoords(ref: RowColRef): RowColCoords;
445
657
  /** Converts {@link RowColCoords} to a {@link RowColRef} */
446
658
  declare function rowColCoordsToRef(row: number | undefined, col: number | undefined): RowColRef;
447
659
 
448
- export { type AddEntryError, type BlobId, type CellError, type CellErrorValue, type CellValue, type ColRef, type ConflictError, EmptySpreadsheetData, type Err, type EventLog, FixedSizeItemOffsetMapping, type InfinisheetError, type InfinisheetRangeError, type ItemOffsetMapping, type LogEntry, type LogMetadata, type MetadataError, type Ok, type QueryError, type QueryValue, type Result, ResultAsync, type RowColCoords, type RowColRef, type SequenceId, type SpreadsheetData, type SpreadsheetDataError, type StorageError, type TruncateError, type ValidationError, VariableSizeItemOffsetMapping, type WorkflowId, colRefToIndex, conflictError, err, errAsync, indexToColRef, infinisheetRangeError, ok, okAsync, rowColCoordsToRef, rowColRefToCoords, splitRowColRef, storageError, validationError };
660
+ export { EmptySpreadsheetData, FixedSizeItemOffsetMapping, ResultAsync, VariableSizeItemOffsetMapping, colRefToIndex, conflictError, emptyViewport, equalViewports, err, errAsync, indexToColRef, infinisheetRangeError, invalidBlobNameError, noContinuationError, notBlobDirError, notBlobError, ok, okAsync, rowColCoordsToRef, rowColRefToCoords, splitRowColRef, storageError, validationError };
661
+ export type { AddEntryError, AddEntryValue, BlobDir, BlobDirEntries, BlobId, BlobName, BlobStore, BlobWrongKindError, CellData, CellError, CellErrorValue, CellFormat, CellValue, ColRef, ConflictError, DirQueryError, Err, EventLog, GetDirError, GetRootDirError, InfiniSheetWorker, InfinisheetError, InfinisheetRangeError, InvalidBlobNameError, ItemOffsetMapping, LogEntry, LogMetadata, MessageHandler, MetadataError, NoContinuationError, Ok, PendingWorkflowMessage, PostMessageWorkerHost, QueryError, QueryValue, ReadBlobError, RemoveAllBlobDirError, RemoveBlobError, Result, RowColCoords, RowColRef, SequenceId, SnapshotValue, SpreadsheetData, SpreadsheetDataError, SpreadsheetViewport, StorageError, TruncateError, ValidationError, WorkerHost, WorkerMessage, WorkflowId, WriteBlobError };
package/dist/index.js CHANGED
@@ -48,6 +48,15 @@ function conflictError(message, nextSequenceId) {
48
48
  return { type: 'ConflictError', message, nextSequenceId };
49
49
  }
50
50
 
51
+ function invalidBlobNameError(message) {
52
+ return { type: 'InvalidBlobNameError', message: message ? message : "Invalid Blob Name" };
53
+ }
54
+ function notBlobError() { return { type: 'BlobWrongKindError', message: "Not a blob" }; }
55
+ function notBlobDirError() { return { type: 'BlobWrongKindError', message: "Not a blob dir" }; }
56
+ function noContinuationError(message) {
57
+ return { type: 'NoContinuationError', message: message ? message : "Can't continue query, start again" };
58
+ }
59
+
51
60
  /**
52
61
  * Implementation of {@link ItemOffsetMapping} for use when all items have a fixed size
53
62
  */
@@ -56,20 +65,20 @@ class FixedSizeItemOffsetMapping {
56
65
  * @param itemSize - Size to use for all items
57
66
  */
58
67
  constructor(itemSize) {
59
- this.#fixedItemSize = itemSize;
68
+ this.fixedItemSize = itemSize;
60
69
  }
61
70
  itemSize(_itemIndex) {
62
- return this.#fixedItemSize;
71
+ return this.fixedItemSize;
63
72
  }
64
73
  itemOffset(itemIndex) {
65
- return itemIndex * this.#fixedItemSize;
74
+ return itemIndex * this.fixedItemSize;
66
75
  }
67
76
  offsetToItem(offset) {
68
- const itemIndex = Math.floor(offset / this.#fixedItemSize);
69
- const startOffset = itemIndex * this.#fixedItemSize;
77
+ const itemIndex = Math.floor(offset / this.fixedItemSize);
78
+ const startOffset = itemIndex * this.fixedItemSize;
70
79
  return [itemIndex, startOffset];
71
80
  }
72
- #fixedItemSize;
81
+ fixedItemSize;
73
82
  }
74
83
 
75
84
  /**
@@ -81,57 +90,79 @@ class VariableSizeItemOffsetMapping {
81
90
  * @param sizes - Array of sizes to use for the initial items, one size per item
82
91
  */
83
92
  constructor(defaultItemSize, sizes) {
84
- this.#defaultItemSize = defaultItemSize;
85
- this.#sizes = sizes;
93
+ this.defaultItemSize = defaultItemSize;
94
+ this.sizes = sizes;
86
95
  }
87
96
  itemSize(itemIndex) {
88
- return (itemIndex < this.#sizes.length) ? this.#sizes[itemIndex] : this.#defaultItemSize;
97
+ return (itemIndex < this.sizes.length) ? this.sizes[itemIndex] : this.defaultItemSize;
89
98
  }
90
99
  itemOffset(itemIndex) {
91
100
  let offset = 0;
92
- let length = this.#sizes.length;
101
+ let length = this.sizes.length;
93
102
  if (itemIndex > length) {
94
103
  const numDefaultSize = itemIndex - length;
95
- offset = numDefaultSize * this.#defaultItemSize;
104
+ offset = numDefaultSize * this.defaultItemSize;
96
105
  }
97
106
  else {
98
107
  length = itemIndex;
99
108
  }
100
109
  for (let i = 0; i < length; i++) {
101
- offset += this.#sizes[i];
110
+ offset += this.sizes[i];
102
111
  }
103
112
  return offset;
104
113
  }
105
114
  offsetToItem(offset) {
106
115
  let startOffset = 0;
107
- for (const [i, size] of this.#sizes.entries()) {
116
+ for (const [i, size] of this.sizes.entries()) {
108
117
  if (startOffset + size > offset) {
109
118
  return [i, startOffset];
110
119
  }
111
120
  startOffset += size;
112
121
  }
113
- const itemIndex = Math.floor((offset - startOffset) / this.#defaultItemSize);
114
- startOffset += itemIndex * this.#defaultItemSize;
115
- const length = this.#sizes.length;
122
+ const itemIndex = Math.floor((offset - startOffset) / this.defaultItemSize);
123
+ startOffset += itemIndex * this.defaultItemSize;
124
+ const length = this.sizes.length;
116
125
  return [itemIndex + length, startOffset];
117
126
  }
118
- #defaultItemSize;
119
- #sizes;
127
+ defaultItemSize;
128
+ sizes;
120
129
  }
121
130
 
131
+ /** Are two viewports equal by value? */
132
+ function equalViewports(a, b) {
133
+ if (a === b)
134
+ return true;
135
+ if (!a || !b)
136
+ return false;
137
+ return a.rowMinOffset === b.rowMinOffset &&
138
+ a.columnMinOffset === b.columnMinOffset &&
139
+ a.width === b.width &&
140
+ a.height === b.height;
141
+ }
142
+ /** Creates an empty viewport */
143
+ function emptyViewport() {
144
+ return { rowMinOffset: 0, columnMinOffset: 0, width: 0, height: 0 };
145
+ }
122
146
  const rowItemOffsetMapping = new FixedSizeItemOffsetMapping(30);
123
147
  const columnItemOffsetMapping = new FixedSizeItemOffsetMapping(100);
124
148
  class EmptySpreadsheetData {
149
+ constructor() {
150
+ this.viewport = undefined;
151
+ }
125
152
  subscribe(_onDataChange) { return () => { }; }
126
153
  getSnapshot() { return 0; }
154
+ getLoadStatus(_snapshot) { return ok(true); }
127
155
  getRowCount(_snapshot) { return 0; }
128
156
  getRowItemOffsetMapping(_snapshot) { return rowItemOffsetMapping; }
129
157
  getColumnCount(_snapshot) { return 0; }
130
158
  getColumnItemOffsetMapping(_snapshot) { return columnItemOffsetMapping; }
131
159
  getCellValue(_snapshot, _row, _column) { return null; }
132
160
  getCellFormat(_snapshot, _row, _column) { return undefined; }
133
- setCellValueAndFormat(_row, _column, _value, _format) { return err(storageError("Not implemented", 501)); }
161
+ setCellValueAndFormat(_row, _column, _value, _format) { return errAsync(storageError("Not implemented", 501)); }
134
162
  isValidCellValueAndFormat(_row, _column, _value, _format) { return ok(); }
163
+ setViewport(viewport) { this.viewport = viewport; }
164
+ getViewport(_snapshot) { return this.viewport; }
165
+ viewport;
135
166
  }
136
167
 
137
168
  /** Converts a {@link ColRef} to the 0-based index of the column */
@@ -189,5 +220,5 @@ function rowColCoordsToRef(row, col) {
189
220
  }
190
221
  }
191
222
 
192
- export { EmptySpreadsheetData, FixedSizeItemOffsetMapping, ResultAsync, VariableSizeItemOffsetMapping, colRefToIndex, conflictError, err, errAsync, indexToColRef, infinisheetRangeError, ok, okAsync, rowColCoordsToRef, rowColRefToCoords, splitRowColRef, storageError, validationError };
223
+ export { EmptySpreadsheetData, FixedSizeItemOffsetMapping, ResultAsync, VariableSizeItemOffsetMapping, colRefToIndex, conflictError, emptyViewport, equalViewports, err, errAsync, indexToColRef, infinisheetRangeError, invalidBlobNameError, noContinuationError, notBlobDirError, notBlobError, ok, okAsync, rowColCoordsToRef, rowColRefToCoords, splitRowColRef, storageError, validationError };
193
224
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/Result.ts","../src/ResultAsync.ts","../src/Error.ts","../src/EventLog.ts","../src/FixedSizeItemOffsetMapping.ts","../src/VariableSizeItemOffsetMapping.ts","../src/SpreadsheetData.ts","../src/RowColRef.ts"],"sourcesContent":["import type { Ok as neverthrow_Ok, Err as neverthrow_Err } from \"neverthrow\";\nimport { err as neverthrow_err, ok as neverthrow_ok } from \"neverthrow\";\n\n/**\n * An `Ok` instance is the *successful* variant of the {@link Result} type, \n * representing a successful outcome from an operation which may fail.\n * \n * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport interface Ok<T,E> extends neverthrow_Ok<T,E> {}\n\n/**\n * An `Err` instance is the failure variant of the {@link Result} type, \n * representing a failure outcome from an operation which may fail.\n * \n * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport interface Err<T,E> extends neverthrow_Err<T,E> {}\n\n/**\n * A `Result` represents success ({@link Ok}) or failure ({@link Err}).\n * \n * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport type Result<T,E> = Ok<T,E> | Err<T,E>;\n\n/**\n * Create an instance of {@link Ok}.\n *\n * If you need to create an instance with a specific type (as you do whenever you\n * are not constructing immediately for a function return or as an argument to a\n * function), you can use a type parameter:\n *\n * ```ts\n * const yayNumber = ok<number, string>(12);\n * ```\n *\n * Note: passing nothing will produce a `Result<void, E>`, passing `undefined` will\n * produce a `Result<undefined, E>` which is compatible with `Result<void, E>`.\n *\n * ```ts\n * const normalResult = ok<number, string>(42);\n * const explicitUndefined = ok<undefined, string>(undefined);\n * const implicitVoid = ok<void, string>();\n * ```\n *\n * In the context of an immediate function return, or an arrow function with a\n * single expression value, you do not have to specify the types, so this can be\n * quite convenient.\n *\n * ```ts\n * const arrowValidate = (data: SomeData): Result<void, string> =>\n * isValid(data) ? ok() : err('something was wrong!');\n *\n * function fnValidate(data: someData): Result<void, string> {\n * return isValid(data) ? ok() : err('something was wrong');\n * }\n * ```\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param value - The value to wrap in a `Result.Ok`.\n */\nexport function ok<T, E = never>(value: T): Ok<T, E>\nexport function ok<_T extends void = void, E = never>(value: void): Ok<void, E>\nexport function ok<T, E = never>(value: T): Ok<T, E> {\n return neverthrow_ok<T,E>(value); \n}\n\n/**\n * Create an instance of {@link Err}.\n *\n * If you need to create an instance with a specific type (as you do whenever you\n * are not constructing immediately for a function return or as an argument to a\n * function), you can use a type parameter:\n *\n * ```ts\n * const notString = err<number, string>('something went wrong');\n * ```\n *\n * Note: passing nothing will produce a `Result<T, void>`, passing `undefined` will\n * produce a `Result<T, undefined>` which is compatible with `Result<T, void>`.\n *\n * ```ts\n * const normalResult = err<number, string>('oh no');\n * const explicitUndefined = err<number, undefined>(undefined);\n * const implicitVoid = err<number, void>();\n * ```\n *\n * In the context of an immediate function return, or an arrow function with a\n * single expression value, you do not have to specify the types, so this can be\n * quite convenient.\n *\n * ```ts\n * const arrowValidate = (data: SomeData): Result<number, string> =>\n * isValid(data) ? ok(42) : err('something went wrong');\n *\n * function fnValidate(data: someData): Result<number, string> {\n * return isValid(data) ? ok(42) : err('something went wrong');\n * }\n * ```\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param err - The value to wrap in a `Result.Err`.\n */\nexport function err<T = never, E extends string = string>(err: E): Err<T, E>\nexport function err<T = never, E = unknown>(err: E): Err<T, E>\nexport function err<T = never, _E extends void = void>(err: void): Err<T, void>\nexport function err<T = never, E = unknown>(err: E): Err<T, E> {\n return neverthrow_err<T,E>(err)\n}\n","import { errAsync as neverthrow_errAsync, okAsync as neverthrow_okAsync, ResultAsync as neverthrow_ResultAsync } from \"neverthrow\";\n\n// Needed for Intellisense links\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Result, Ok, Err } from \"./Result\"\n\n/**\n * `ResultAsync` allows you to work with asynchronous Results in a type safe way\n * \n * `ResultAsync<T,E>` is a wrapper around `Promise<Result<T,E>>` which provides the same methods for chaining different\n * `Result` and `ResultAsync` together as {@link Result}, while also chaining the asynchronous operations together using\n * `Promise.then`.\n * \n * `ResultAsync` is *thenable* (implements `PromiseLike<T>`) so can be used in most places that a `Promise` can, including with `await`.\n * \n * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `ResultAsync` for the success case\n * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case\n */\nexport class ResultAsync<T,E> extends neverthrow_ResultAsync<T,E> {}\n\n/**\n * Create an instance of `ResultAsync` containing an {@link Ok} variant of {@link Result}\n *\n * Equivalent to `new ResultAsync(Promise.resolve(new Ok(value)))`\n *\n * @typeParam T - The type of the value contained in the `ResultAsync` for the success case\n * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case\n * @param value - The value to wrap in a `Result.Ok`.\n */\nexport function okAsync<T, E = never>(value: T): ResultAsync<T, E>\nexport function okAsync<_T extends void = void, E = never>(value: void): ResultAsync<void, E>\nexport function okAsync<T, E = never>(value: T): ResultAsync<T, E> {\n return neverthrow_okAsync(value);\n}\n\n/**\n * Create an instance of `ResultAsync` containing an {@link Err} variant of {@link Result}\n *\n * Equivalent to `new ResultAsync(Promise.resolve(new Err(err)))`\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param err - The value to wrap in a `Result.Err`.\n */\nexport function errAsync<T = never, E = unknown>(err: E): ResultAsync<T, E>\nexport function errAsync<T = never, _E extends void = void>(err: void): ResultAsync<T, void>\nexport function errAsync<T = never, E = unknown>(err: E): ResultAsync<T, E> {\n return neverthrow_errAsync<T,E>(err)\n}\n","/** Common properties for Infinisheet errors */\nexport interface InfinisheetError {\n /** Discriminated union tag */\n type: string,\n\n /** End user message describing the problem */\n message: string,\n}\n\n/** \n * Attempt to access data that is outside the available range\n * \n */\nexport interface InfinisheetRangeError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'InfinisheetRangeError',\n\n};\n\n/** Convenience method that creates an {@link InfinisheetRangeError} */\nexport function infinisheetRangeError(message: string): InfinisheetRangeError {\n return { type: 'InfinisheetRangeError', message };\n}\n\n/** Type that represents an error when validating data passed to an API */\nexport interface ValidationError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'ValidationError'\n};\n\n/** Convenience method that creates a {@link ValidationError} */\nexport function validationError(message: string): ValidationError {\n return { type: 'ValidationError', message };\n}\n\n/** Type that represents an error when accessing data in persistent storage */\nexport interface StorageError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'StorageError',\n\n /** HTTP style status code\n * \n * Describes the type of problem encountered. Expected to be a 4XX or 5XX code.\n */\n statusCode?: number | undefined,\n};\n\n/** Convenience method that creates a {@link StorageError} */\nexport function storageError(message: string, statusCode?: number): StorageError {\n return { type: 'StorageError', message, statusCode };\n}","import { ResultAsync } from \"./ResultAsync\";\nimport { StorageError, InfinisheetError, InfinisheetRangeError } from \"./Error\"\n\nexport type BlobId = string;\nexport type WorkflowId = string;\nexport type SequenceId = bigint;\n\n/**\n * Metadata stored in an {@link EventLog} entry\n */\nexport interface LogMetadata {\n /** Stores a reference to a snapshot of the complete log up to and including this entry */\n snapshot?: BlobId | undefined;\n\n /** Stores a reference to an external history of the event log up to and including the previous entry */\n history?: BlobId | undefined;\n\n /** Indicates that a background workflow is pending */\n pending?: WorkflowId | undefined;\n}\n\n/** \n * Type that represents an entry in an {@link EventLog}\n * \n * Base interface that clients will typically implement multiple times.\n * Each concrete implementation will define its own data properties that\n * need to be serialized into the event log.\n * \n * Properties defined here are common metadata which require special handling\n * by any `EventLog` implementation.\n * \n * All data properties are immutable once an entry has been added to the log. Metadata\n * properties (apart from `type`) may change over time.\n */\nexport interface LogEntry extends LogMetadata {\n /** Used as a discriminated union tag by implementations */\n type: string;\n};\n\n/** \n * Type that represents a consistency conflict when adding a {@link LogEntry} to an {@link EventLog}\n * \n * Occurs when an attempt is made to add an entry with a sequence id that is not\n * the next available in the log.\n * \n * Typically happens when another client makes a change since you last read the log.\n * Sync with the additional log entries and then try again.\n */\nexport interface ConflictError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'ConflictError',\n\n /** Next available sequence id */\n nextSequenceId: SequenceId;\n};\n\n/** Convenience method that creates a {@link ConflictError} */\nexport function conflictError(message: string, nextSequenceId: SequenceId): ConflictError {\n return { type: 'ConflictError', message, nextSequenceId };\n}\n\n/** Errors that can be returned by {@link EventLog} `addEntry` method */\nexport type AddEntryError = ConflictError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `query` method */\nexport type QueryError = InfinisheetRangeError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `truncate` method */\nexport type TruncateError = InfinisheetRangeError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `setMetadata` method */\nexport type MetadataError = InfinisheetRangeError | StorageError;\n\n/** A range of {@link LogEntry} values returned by querying an {@link EventLog} */\nexport interface QueryValue<T extends LogEntry> {\n /** Sequence id corresponding to the first entry in `entries`\n * \n * All other entries have consecutive ascending sequence ids\n */\n startSequenceId: SequenceId;\n\n /** \n * Sequence id after the final entry in `entries`\n * \n * If query was up to the `end` sequence id AND\n * `isComplete` is true, this is the next available\n * sequence id for `addEntry`. \n */\n endSequenceId: SequenceId;\n\n /** True if all the requested entries have been returned\n * \n * Queries may return fewer entries than requested. If \n * `isComplete` is `false`, repeat the query starting\n * from `nextSequenceId`.\n */\n isComplete: boolean;\n\n /** The {@link LogEntry} records returned by the query */\n entries: T[];\n}\n\n/** Abstract interface representing an event log\n * \n * \n */\nexport interface EventLog<T extends LogEntry> {\n /** \n * Add an entry to the log with the given sequence id\n * \n * The `sequenceId` must be the next available sequence id in the log. This is returned as `endSequenceId` when\n * making a query for the `last` entry in the log. Returns a {@link ConflictError} if not the next available id.\n * Any other problem with serializing the entry will return a {@link StorageError}.\n */\n addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void,AddEntryError>;\n\n /**\n * Set some or all of a log entry's metadata fields\n *\n * Changes are atomic. Either all of the specified fields are updated or none are.\n */\n setMetadata(sequenceId: SequenceId, metaData: LogMetadata): ResultAsync<void,MetadataError>;\n\n /** Return a range of entries from `first` to `last` inclusive \n * \n * The event log may return fewer entries than requested. If so, repeat the query starting from `nextSequenceId`.\n * \n * @param start - `SequenceId` of first entry to return. \n * Use `'start'` to query from the first entry in the log. \n * Use `'snapshot'` to query from the most recent entry with a snapshot, or the first if no snapshot is defined.\n * \n * @param end - `SequenceId` one after the last entry to return.\n * Use `'end'` to query everything to the end of the log.\n */\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>,QueryError>;\n\n /** All entries prior to `start` are removed from the log. */\n truncate(start: SequenceId): ResultAsync<void,TruncateError>\n}","import type { ItemOffsetMapping } from './ItemOffsetMapping';\n\n/**\n * Implementation of {@link ItemOffsetMapping} for use when all items have a fixed size\n */\nexport class FixedSizeItemOffsetMapping implements ItemOffsetMapping {\n /**\n * @param itemSize - Size to use for all items\n */\n constructor (itemSize: number) {\n this.#fixedItemSize = itemSize;\n }\n\n itemSize(_itemIndex: number): number {\n return this.#fixedItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n return itemIndex * this.#fixedItemSize;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n const itemIndex = Math.floor(offset / this.#fixedItemSize);\n const startOffset = itemIndex * this.#fixedItemSize;\n\n return [itemIndex, startOffset];\n }\n\n #fixedItemSize: number;\n}\n\n","import type { ItemOffsetMapping } from './ItemOffsetMapping';\n\n/**\n * Implementation of {@link ItemOffsetMapping} for use when initial items have variable sizes.\n */\nexport class VariableSizeItemOffsetMapping implements ItemOffsetMapping {\n /**\n * @param defaultItemSize - Size to use for all other items\n * @param sizes - Array of sizes to use for the initial items, one size per item\n */\n constructor (defaultItemSize: number, sizes: number[]) {\n this.#defaultItemSize = defaultItemSize;\n this.#sizes = sizes;\n }\n\n itemSize(itemIndex: number): number {\n return (itemIndex < this.#sizes.length) ? this.#sizes[itemIndex]! : this.#defaultItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n let offset = 0;\n let length = this.#sizes.length;\n if (itemIndex > length) {\n const numDefaultSize = itemIndex - length;\n offset = numDefaultSize * this.#defaultItemSize;\n } else {\n length = itemIndex;\n }\n \n for (let i = 0; i < length; i ++)\n {\n offset += this.#sizes[i]!;\n }\n\n return offset;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n let startOffset = 0;\n for (const [i,size] of this.#sizes.entries()) {\n if (startOffset + size > offset) {\n return [i, startOffset];\n }\n startOffset += size;\n }\n\n const itemIndex = Math.floor((offset - startOffset) / this.#defaultItemSize);\n startOffset += itemIndex * this.#defaultItemSize;\n\n const length = this.#sizes.length;\n return [itemIndex+length, startOffset];\n }\n\n #defaultItemSize: number;\n #sizes: number[];\n}\n","import type { ItemOffsetMapping } from \"./ItemOffsetMapping\";\nimport { FixedSizeItemOffsetMapping } from \"./FixedSizeItemOffsetMapping\";\nimport { Result, err, ok } from \"./Result\";\nimport { ValidationError, StorageError, storageError } from \"./Error\";\n\n/** Possible spreadsheet error values\n * \n * Includes those that can be returned by `ERROR.TYPE` and additional values\n * introduced by more recent versions of Excel.\n*/\nexport type CellErrorValue = '#NULL!' | \n '#DIV/0!' |\n '#VALUE!' |\n '#REF!' |\n '#NAME?' |\n '#NUM!' |\n '#N/A' |\n '#GETTING_DATA' |\n '#SPILL!' |\n '#UNKNOWN!' |\n '#FIELD!' |\n '#CALC!';\n\n/** Type that represents an error value stored in a cell\n * \n * Defined as a discriminated union so that additional cell value types\n * can be added in future.\n */\nexport interface CellError {\n /** Discriminated union tag */\n type: 'CellError',\n\n /** {@link CellErrorValue | Error Value} */\n value: CellErrorValue;\n};\n\n/** Possible types for a cell value \n * \n * The native JavaScript types string, number and boolean represent the *Text*, *Number* and *Logical*\n * spreadsheet data types. {@link CellError} represents an *Error Value*.\n * \n * Undefined is used to represent a cell with no defined value. Null represents a cell that has been\n * explicitly marked as empty. \n*/\nexport type CellValue = string | number | boolean | null | undefined | CellError\n\n/** Types of error that can be returned by {@link SpreadsheetData} methods */\nexport type SpreadsheetDataError = ValidationError | StorageError;\n\n/**\n * Interface used to access the data in a spreadsheet\n * \n * The data exposed through the interface may change over time outside of any changes made through the interface. The caller\n * can use the {@link subscribe} method to be notified when the data changes. When reading data, the caller must first request\n * a snapshot using {@link getSnapshot}. All values returned by gettors are relative to a specified snapshot. The values will be\n * consistent with each other as long as the same snapshot is used.\n * \n * @typeParam Snapshot - Type of snapshot. Implementations are free to use whatever type makes sense for them.\n */\nexport interface SpreadsheetData<Snapshot> {\n /** Subscribe to data changes */\n subscribe(onDataChange: () => void): () => void,\n\n /** Return a snapshot to use when accessing values at a consistent point in time */\n getSnapshot(): Snapshot,\n\n /** Number of rows in the spreadsheet */\n getRowCount(snapshot: Snapshot): number,\n\n /** {@link ItemOffsetMapping} which describes sizes and offsets to start of rows */\n getRowItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping,\n\n /** Number of columns in the spreadsheet */\n getColumnCount(snapshot: Snapshot): number,\n\n /** {@link ItemOffsetMapping} which describes sizes and offsets to start of columns */\n getColumnItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping,\n\n /** Value of specified cell using 0-based row and column indexes */\n getCellValue(snapshot: Snapshot, row: number, column: number): CellValue;\n\n /** Format of specified cell using 0-based row and column indexes */\n getCellFormat(snapshot: Snapshot, row: number, column: number): string | undefined;\n\n /** Set value and format of specified cell\n * \n * @returns `Ok` if the change was successfully applied\n */\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void,SpreadsheetDataError>\n\n /** Check whether value and format are valid to set for specified cell\n * \n * @returns `Ok` if the value and format are valid\n */\n isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void,ValidationError>\n}\n\nconst rowItemOffsetMapping = new FixedSizeItemOffsetMapping(30);\nconst columnItemOffsetMapping = new FixedSizeItemOffsetMapping(100);\n\nexport class EmptySpreadsheetData implements SpreadsheetData<number> {\n subscribe(_onDataChange: () => void) { return () => {}; }\n getSnapshot() { return 0; }\n \n getRowCount(_snapshot: number) { return 0; }\n getRowItemOffsetMapping(_snapshot: number): ItemOffsetMapping { return rowItemOffsetMapping; }\n getColumnCount(_snapshot: number) { return 0; }\n getColumnItemOffsetMapping(_snapshot: number): ItemOffsetMapping { return columnItemOffsetMapping; }\n getCellValue(_snapshot: number, _row: number, _column: number): CellValue { return null; }\n getCellFormat(_snapshot: number, _row: number, _column: number): string|undefined { return undefined; }\n setCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void,SpreadsheetDataError> \n { return err(storageError(\"Not implemented\", 501)); }\n isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): Result<void,ValidationError> \n { return ok(); }\n}\n\n","/** Classic Spreadsheet reference to Column (e.g \"A\") */\nexport type ColRef = string;\n\n/** Classic Spreadsheet reference to Cell (e.g. \"A1\"), Row (e.g. \"1\") or Column (e.g \"A\") */\nexport type RowColRef = string;\n\n/** Equivalent to {@link RowColRef} as coordinate pair. \"A1\" has coords [0,0], \"1\" is [0,undefined] and \"A\" is [undefined,0] */\nexport type RowColCoords = [row: number|undefined, col: number|undefined];\n\n/** Converts a {@link ColRef} to the 0-based index of the column */\nexport function colRefToIndex(col: ColRef): number {\n let n = 0;\n for (let i = 0; i < col.length; i ++) {\n n = col.charCodeAt(i) - 64 + n * 26;\n }\n return n-1;\n}\n\n/** Converts a 0-based column index to a {@link ColRef} */\nexport function indexToColRef(index: number): ColRef {\n let ret = \"\";\n index ++;\n while (index > 0) {\n index --;\n const remainder = index % 26;\n index = Math.floor(index / 26);\n ret = String.fromCharCode(65+remainder) + ret;\n }\n return ret;\n}\n\n/** Splits a RowColRef into a 0-based row index and a {@link ColRef} */\nexport function splitRowColRef(ref: RowColRef): [row: number|undefined, col: ColRef|undefined] {\n const re = /^([A-Z]*)(\\d*)$/;\n const found = ref.match(re);\n if (!found)\n return [undefined,undefined];\n\n const col = found[1];\n const row = found[2] ? parseInt(found[2]) : 0;\n return [(row>0) ? row-1 : undefined, col ? col : undefined];\n}\n\n/** Converts a {@link RowColRef} to {@link RowColCoords} */\nexport function rowColRefToCoords(ref: RowColRef): RowColCoords {\n const [row,col] = splitRowColRef(ref);\n return [row, col ? colRefToIndex(col) : undefined];\n}\n\n/** Converts {@link RowColCoords} to a {@link RowColRef} */\nexport function rowColCoordsToRef(row: number|undefined, col: number|undefined): RowColRef {\n if (row !== undefined) {\n if (col !== undefined) {\n return indexToColRef(col) + (row+1);\n } else {\n return (row+1).toString();\n }\n } else {\n if (col !== undefined) {\n return indexToColRef(col);\n } else {\n return \"\";\n }\n }\n}"],"names":["neverthrow_ok","neverthrow_err","neverthrow_ResultAsync","neverthrow_okAsync","neverthrow_errAsync"],"mappings":";;AA0EM,SAAU,EAAE,CAAe,KAAQ,EAAA;AACvC,IAAA,OAAOA,IAAa,CAAM,KAAK,CAAC;AAClC;AA0CM,SAAU,GAAG,CAAyB,GAAM,EAAA;AAChD,IAAA,OAAOC,KAAc,CAAM,GAAG,CAAC;AACjC;;AClHA;;;;;;;;;;;;;AAaG;AACG,MAAO,WAAiB,SAAQC,aAA2B,CAAA;AAAG;AAa9D,SAAU,OAAO,CAAe,KAAQ,EAAA;AAC5C,IAAA,OAAOC,SAAkB,CAAC,KAAK,CAAC;AAClC;AAaM,SAAU,QAAQ,CAAyB,GAAM,EAAA;AACrD,IAAA,OAAOC,UAAmB,CAAM,GAAG,CAAC;AACtC;;AC/BA;AACM,SAAU,qBAAqB,CAAC,OAAe,EAAA;AACnD,IAAA,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE;AACnD;AAQA;AACM,SAAU,eAAe,CAAC,OAAe,EAAA;AAC7C,IAAA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE;AAC7C;AAcA;AACgB,SAAA,YAAY,CAAC,OAAe,EAAE,UAAmB,EAAA;IAC/D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE;AACtD;;ACMA;AACgB,SAAA,aAAa,CAAC,OAAe,EAAE,cAA0B,EAAA;IACvE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE;AAC3D;;ACzDA;;AAEG;MACU,0BAA0B,CAAA;AACrC;;AAEG;AACH,IAAA,WAAA,CAAa,QAAgB,EAAA;AAC3B,QAAA,IAAI,CAAC,cAAc,GAAG,QAAQ;;AAGhC,IAAA,QAAQ,CA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AS,EAAC,SAAS,CAAC;AAE9B,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;IACpB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7C,OAAO,CAAC,CAAC,GAAG,GAAC,CAAC,IAAI,GAAG,GAAC,CAAC,GAAG,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;AAC7D;AAEA;AACM,SAAU,iBAAiB,CAAC,GAAc,EAAA;IAC9C,MAAM,CAAC,GAAG,EAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC;AACrC,IAAA,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AACpD;AAEA;AACgB,SAAA,iBAAiB,CAAC,GAAqB,EAAE,GAAqB,EAAA;AAC5E,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACrB,QAAA,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,GAAC,CAAC,CAAC;;aAC9B;YACL,OAAO,CAAC,GAAG,GAAC,CAAC,EAAE,QAAQ,EAAE;;;SAEtB;AACL,QAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACrB,YAAA,OAAO,aAAa,CAAC,GAAG,CAAC;;aACpB;AACL,YAAA,OAAO,EAAE;;;AAGf;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/Result.ts","../src/ResultAsync.ts","../src/Error.ts","../src/EventLog.ts","../src/BlobStore.ts","../src/FixedSizeItemOffsetMapping.ts","../src/VariableSizeItemOffsetMapping.ts","../src/SpreadsheetData.ts","../src/RowColRef.ts"],"sourcesContent":["import type { Ok as neverthrow_Ok, Err as neverthrow_Err } from \"neverthrow\";\nimport { err as neverthrow_err, ok as neverthrow_ok } from \"neverthrow\";\n\n/**\n * An `Ok` instance is the *successful* variant of the {@link Result} type, \n * representing a successful outcome from an operation which may fail.\n * \n * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport interface Ok<T,E> extends neverthrow_Ok<T,E> {}\n\n/**\n * An `Err` instance is the failure variant of the {@link Result} type, \n * representing a failure outcome from an operation which may fail.\n * \n * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport interface Err<T,E> extends neverthrow_Err<T,E> {}\n\n/**\n * A `Result` represents success ({@link Ok}) or failure ({@link Err}).\n * \n * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n */\nexport type Result<T,E> = Ok<T,E> | Err<T,E>;\n\n/**\n * Create an instance of {@link Ok}.\n *\n * If you need to create an instance with a specific type (as you do whenever you\n * are not constructing immediately for a function return or as an argument to a\n * function), you can use a type parameter:\n *\n * ```ts\n * const yayNumber = ok<number, string>(12);\n * ```\n *\n * Note: passing nothing will produce a `Result<void, E>`, passing `undefined` will\n * produce a `Result<undefined, E>` which is compatible with `Result<void, E>`.\n *\n * ```ts\n * const normalResult = ok<number, string>(42);\n * const explicitUndefined = ok<undefined, string>(undefined);\n * const implicitVoid = ok<void, string>();\n * ```\n *\n * In the context of an immediate function return, or an arrow function with a\n * single expression value, you do not have to specify the types, so this can be\n * quite convenient.\n *\n * ```ts\n * const arrowValidate = (data: SomeData): Result<void, string> =>\n * isValid(data) ? ok() : err('something was wrong!');\n *\n * function fnValidate(data: someData): Result<void, string> {\n * return isValid(data) ? ok() : err('something was wrong');\n * }\n * ```\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param value - The value to wrap in a `Result.Ok`.\n */\nexport function ok<T, E = never>(value: T): Ok<T, E>\nexport function ok<_T extends void = void, E = never>(value: void): Ok<void, E>\nexport function ok<T, E = never>(value: T): Ok<T, E> {\n return neverthrow_ok<T,E>(value); \n}\n\n/**\n * Create an instance of {@link Err}.\n *\n * If you need to create an instance with a specific type (as you do whenever you\n * are not constructing immediately for a function return or as an argument to a\n * function), you can use a type parameter:\n *\n * ```ts\n * const notString = err<number, string>('something went wrong');\n * ```\n *\n * Note: passing nothing will produce a `Result<T, void>`, passing `undefined` will\n * produce a `Result<T, undefined>` which is compatible with `Result<T, void>`.\n *\n * ```ts\n * const normalResult = err<number, string>('oh no');\n * const explicitUndefined = err<number, undefined>(undefined);\n * const implicitVoid = err<number, void>();\n * ```\n *\n * In the context of an immediate function return, or an arrow function with a\n * single expression value, you do not have to specify the types, so this can be\n * quite convenient.\n *\n * ```ts\n * const arrowValidate = (data: SomeData): Result<number, string> =>\n * isValid(data) ? ok(42) : err('something went wrong');\n *\n * function fnValidate(data: someData): Result<number, string> {\n * return isValid(data) ? ok(42) : err('something went wrong');\n * }\n * ```\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param err - The value to wrap in a `Result.Err`.\n */\nexport function err<T = never, E extends string = string>(err: E): Err<T, E>\nexport function err<T = never, E = unknown>(err: E): Err<T, E>\nexport function err<T = never, _E extends void = void>(err: void): Err<T, void>\nexport function err<T = never, E = unknown>(err: E): Err<T, E> {\n return neverthrow_err<T,E>(err)\n}\n","import { errAsync as neverthrow_errAsync, okAsync as neverthrow_okAsync, ResultAsync as neverthrow_ResultAsync } from \"neverthrow\";\n\n// Needed for Intellisense links\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Result, Ok, Err } from \"./Result\"\n\n/**\n * `ResultAsync` allows you to work with asynchronous Results in a type safe way\n * \n * `ResultAsync<T,E>` is a wrapper around `Promise<Result<T,E>>` which provides the same methods for chaining different\n * `Result` and `ResultAsync` together as {@link Result}, while also chaining the asynchronous operations together using\n * `Promise.then`.\n * \n * `ResultAsync` is *thenable* (implements `PromiseLike<T>`) so can be used in most places that a `Promise` can, including with `await`.\n * \n * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)\n * \n * @typeParam T - The type of the value contained in the `ResultAsync` for the success case\n * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case\n */\nexport class ResultAsync<T,E> extends neverthrow_ResultAsync<T,E> {}\n\n/**\n * Create an instance of `ResultAsync` containing an {@link Ok} variant of {@link Result}\n *\n * Equivalent to `new ResultAsync(Promise.resolve(new Ok(value)))`\n *\n * @typeParam T - The type of the value contained in the `ResultAsync` for the success case\n * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case\n * @param value - The value to wrap in a `Result.Ok`.\n */\nexport function okAsync<T, E = never>(value: T): ResultAsync<T, E>\nexport function okAsync<_T extends void = void, E = never>(value: void): ResultAsync<void, E>\nexport function okAsync<T, E = never>(value: T): ResultAsync<T, E> {\n return neverthrow_okAsync(value);\n}\n\n/**\n * Create an instance of `ResultAsync` containing an {@link Err} variant of {@link Result}\n *\n * Equivalent to `new ResultAsync(Promise.resolve(new Err(err)))`\n *\n * @typeParam T - The type of the value contained in the `Result` for the success case\n * @typeParam E - The type of the error contained in the `Result` for the failure case\n * @param err - The value to wrap in a `Result.Err`.\n */\nexport function errAsync<T = never, E = unknown>(err: E): ResultAsync<T, E>\nexport function errAsync<T = never, _E extends void = void>(err: void): ResultAsync<T, void>\nexport function errAsync<T = never, E = unknown>(err: E): ResultAsync<T, E> {\n return neverthrow_errAsync<T,E>(err)\n}\n","/** Common properties for Infinisheet errors */\nexport interface InfinisheetError {\n /** Discriminated union tag */\n type: string,\n\n /** End user message describing the problem */\n message: string,\n}\n\n/** \n * Attempt to access data that is outside the available range\n * \n */\nexport interface InfinisheetRangeError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'InfinisheetRangeError',\n\n};\n\n/** Convenience method that creates an {@link InfinisheetRangeError} */\nexport function infinisheetRangeError(message: string): InfinisheetRangeError {\n return { type: 'InfinisheetRangeError', message };\n}\n\n/** Type that represents an error when validating data passed to an API */\nexport interface ValidationError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'ValidationError'\n};\n\n/** Convenience method that creates a {@link ValidationError} */\nexport function validationError(message: string): ValidationError {\n return { type: 'ValidationError', message };\n}\n\n/** Type that represents an error when accessing data in persistent storage */\nexport interface StorageError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'StorageError',\n\n /** HTTP style status code\n * \n * Describes the type of problem encountered. Expected to be a 4XX or 5XX code.\n */\n statusCode?: number | undefined,\n};\n\n/** Convenience method that creates a {@link StorageError} */\nexport function storageError(message: string, statusCode?: number): StorageError {\n return { type: 'StorageError', message, statusCode };\n}","import { ResultAsync } from \"./ResultAsync\";\nimport { StorageError, InfinisheetError, InfinisheetRangeError } from \"./Error\"\n\n/** Identifier for a blob of data in a blob store */\nexport type BlobId = string;\n\n/** Identifier for a workflow triggered writing to {@link LogMetadata.pending} */\nexport type WorkflowId = string;\n\n/** \n * Identifier for an entry in an {@link EventLog}.\n * \n * Incrementing integer.\n*/\nexport type SequenceId = bigint;\n\n/**\n * Metadata stored in an {@link EventLog} entry\n */\nexport interface LogMetadata {\n /** Stores a reference to a snapshot of the complete log up to and including this entry */\n snapshot?: BlobId | undefined;\n\n /** Stores a reference to an external history of the event log up to and including the previous entry */\n history?: BlobId | undefined;\n\n /** Indicates that a background workflow is pending */\n pending?: WorkflowId | undefined;\n}\n\n/** \n * Type that represents an entry in an {@link EventLog}\n * \n * Base interface that clients will typically implement multiple times.\n * Each concrete implementation will define its own data properties that\n * need to be serialized into the event log.\n * \n * Properties defined here are common metadata which require special handling\n * by any `EventLog` implementation.\n * \n * All data properties are immutable once an entry has been added to the log. Metadata\n * properties (apart from `type`) may change over time.\n */\nexport interface LogEntry extends LogMetadata {\n /** Used as a discriminated union tag by implementations */\n type: string;\n};\n\n/** \n * Type that represents a consistency conflict when adding a {@link LogEntry} to an {@link EventLog}\n * \n * Occurs when an attempt is made to add an entry with a sequence id that is not\n * the next available in the log.\n * \n * Typically happens when another client makes a change since you last read the log.\n * Sync with the additional log entries and then try again.\n */\nexport interface ConflictError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'ConflictError',\n\n /** Next available sequence id */\n nextSequenceId: SequenceId;\n};\n\n/** Convenience method that creates a {@link ConflictError} */\nexport function conflictError(message: string, nextSequenceId: SequenceId): ConflictError {\n return { type: 'ConflictError', message, nextSequenceId };\n}\n\n/** Errors that can be returned by {@link EventLog} `addEntry` method */\nexport type AddEntryError = ConflictError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `query` method */\nexport type QueryError = InfinisheetRangeError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `truncate` method */\nexport type TruncateError = InfinisheetRangeError | StorageError;\n\n/** Errors that can be returned by {@link EventLog} `setMetadata` method */\nexport type MetadataError = InfinisheetRangeError | StorageError;\n\n/** Value of a snapshot stored at a specific sequence id in the log */\nexport interface SnapshotValue {\n /** Sequence id of log entry that stores this snapshot */\n sequenceId: SequenceId;\n\n /** Content of snapshot in the `BlobStore` */\n blobId: BlobId;\n}\n\n/** A range of {@link LogEntry} values returned by querying an {@link EventLog} */\nexport interface QueryValue<T extends LogEntry> {\n /** Sequence id corresponding to the first entry in `entries`\n * \n * All other entries have consecutive ascending sequence ids\n */\n startSequenceId: SequenceId;\n\n /** \n * Sequence id after the final entry in `entries`\n * \n * If query was up to the `end` sequence id AND\n * `isComplete` is true, this is the next available\n * sequence id for `addEntry`. \n */\n endSequenceId: SequenceId;\n\n /** True if all the requested entries have been returned\n * \n * Queries may return fewer entries than requested. If \n * `isComplete` is `false`, repeat the query starting\n * from `nextSequenceId`.\n */\n isComplete: boolean;\n\n /** Most recent snapshot\n * \n * Returned if query includes `snapshotId` argument and\n * most recent snapshot is different. \n */\n lastSnapshot?: SnapshotValue | undefined;\n\n /** The {@link LogEntry} records returned by the query */\n entries: T[];\n}\n\n/** Result of calling {@link EventLog.addEntry} */\nexport interface AddEntryValue {\n /** Most recent snapshot\n * \n * Returned if query includes `snapshotId` argument and\n * most recent snapshot is different. \n */\n lastSnapshot?: SnapshotValue | undefined;\n}\n\n/** Abstract interface representing an event log\n * \n * \n */\nexport interface EventLog<T extends LogEntry> {\n /** \n * Add an entry to the log with the given sequence id\n * \n * @param sequenceId - The next available sequence id in the log. \n * This is returned as `endSequenceId` when making a query for the `last` entry in the log. \n * Returns a {@link ConflictError} if not the next available id.\n * \n * @param snapshotId - The sequence id for the most recent snapshot that the client is aware of.\n * If there's a more recent snapshot, it's id will be returned in `AddEntryValue`. \n * \n * Any other problem with serializing the entry will return a {@link StorageError}.\n */\n addEntry(entry: T, sequenceId: SequenceId, snapshotId?: SequenceId): ResultAsync<AddEntryValue,AddEntryError>;\n\n /**\n * Set some or all of a log entry's metadata fields\n *\n * Changes are atomic. Either all of the specified fields are updated or none are.\n */\n setMetadata(sequenceId: SequenceId, metaData: LogMetadata): ResultAsync<void,MetadataError>;\n\n /** Return a range of entries from `first` to `last` inclusive \n * \n * The event log may return fewer entries than requested. If so, repeat the query starting from `nextSequenceId`.\n * \n * @param start - `SequenceId` of first entry to return. \n * Use `'start'` to query from the first entry in the log. \n * Use `'snapshot'` to query from the most recent entry with a snapshot, or the first if no snapshot is defined.\n * \n * @param end - `SequenceId` one after the last entry to return.\n * Use `'end'` to query everything to the end of the log.\n */\n query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end', snapshotId?: SequenceId): ResultAsync<QueryValue<T>,QueryError>;\n\n /** All entries prior to `start` are removed from the log. */\n truncate(start: SequenceId): ResultAsync<void,TruncateError>\n}","import { ResultAsync } from \"./ResultAsync\";\nimport { StorageError, InfinisheetError } from \"./Error\"\n\n/** \n * Name of a blob or directory within a {@link BlobDir}\n * \n * Names MUST NOT be longer than 100 characters\n */\nexport type BlobName = string;\n\n/** \n * Invalid {@link BlobName} error\n * \n * Occurs when trying to pass a `BlobName` that is too long or contains invalid characters\n */\nexport interface InvalidBlobNameError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'InvalidBlobNameError',\n};\n\nexport function invalidBlobNameError(message?: string): InvalidBlobNameError { \n return { type: 'InvalidBlobNameError', message: message ? message : \"Invalid Blob Name\" }; \n}\n\n/** \n * Error when trying to access a blob as a directory or vice versa\n * \n * Occurs when trying to access a blob/directory with a\n * {@link BlobName} that refers to a directory/blob\n */\nexport interface BlobWrongKindError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'BlobWrongKindError',\n};\n\nexport function notBlobError(): BlobWrongKindError { return { type: 'BlobWrongKindError', message: \"Not a blob\"} }\nexport function notBlobDirError(): BlobWrongKindError { return { type: 'BlobWrongKindError', message: \"Not a blob dir\"} }\n\n/** \n * Invalid {@link BlobName} error\n * \n * Occurs when trying to pass a `BlobName` that is too long or contains invalid characters\n */\nexport interface NoContinuationError extends InfinisheetError {\n /** Discriminated union tag */\n type: 'NoContinuationError',\n};\n\nexport function noContinuationError(message?: string): NoContinuationError { \n return { type: 'NoContinuationError', message: message ? message : \"Can't continue query, start again\" }; \n}\n\n/** Errors that can be returned by {@link BlobDir.readBlob} */\nexport type ReadBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;\n\n/** Errors that can be returned by {@link BlobDir.writeBlob} */\nexport type WriteBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;\n\n/** Errors that can be returned by {@link BlobDir.removeBlob} */\nexport type RemoveBlobError = BlobWrongKindError | InvalidBlobNameError | StorageError;\n\n/** Errors that can be returned by {@link BlobDir.getDir} */\nexport type GetDirError = BlobWrongKindError | InvalidBlobNameError | StorageError;\n\n/** Errors that can be returned by {@link BlobDir.query} */\nexport type DirQueryError = StorageError | NoContinuationError;\n\n/** Errors that can be returned by {@link BlobDir.removeAll} */\nexport type RemoveAllBlobDirError = StorageError;\n\nexport interface BlobDirEntries<ContinuationT> {\n /** Names of blobs returned by {@link BlobDir.query} */\n blobs: BlobName[];\n\n /** Names of directories returned by {@link BlobDir.query} */\n dirs: BlobName[];\n\n /** Continuation token to pass to {@link BlobDir.query} if there are more entries to retrieve */\n continuation?: ContinuationT | undefined;\n}\n\n/**\n * Directory that contains blobs and other directories within a {@link BlobStore}\n */\nexport interface BlobDir<ContinuationT> {\n /** Read the content of a blob with the specified name. \n * \n * The returned content array is read only and immutable. \n */\n readBlob(name: BlobName): ResultAsync<Uint8Array,ReadBlobError>;\n\n /** Write the specified content to a blob with the specified name. \n * \n * Any existing blob with that name is overwritten, otherwise a new blob is created.\n * The content array is treated as read only and must be immutable until the operation completes.\n */\n writeBlob(name: BlobName, content: Uint8Array): ResultAsync<void,WriteBlobError>;\n\n /** Remove blob with the specified name. */\n removeBlob(name: BlobName): ResultAsync<void,RemoveBlobError>;\n\n /** Get a {@link BlobDir} corresponding to the subdirectory with the specified name \n * \n * Subdirectories are \"created\" on demand\n */\n getDir(name: BlobName): ResultAsync<BlobDir<ContinuationT>,GetDirError>;\n\n /** Query for blobs and sub-directories within this directory \n * \n * The order of entries returned is undefined. \n * \n * Can optionally pass a continuation token returned by the previous call to retrieve additional entries.\n */\n query(continuation?: ContinuationT): ResultAsync<BlobDirEntries<ContinuationT>,DirQueryError>;\n\n /** Remove this directory and it's contents, recursively */\n removeAll(): ResultAsync<void,RemoveAllBlobDirError>;\n}\n\n/** Errors that can be returned by {@link BlobStore.getRootDir} */\nexport type GetRootDirError = StorageError;\n\n/** Abstract interface representing a Blob store\n * \n * Modeled as a hierarchy of directories and blobs\n */\nexport interface BlobStore<ContinuationT> {\n /** Returns the root {@link BlobDir} for the store*/\n getRootDir(): ResultAsync<BlobDir<ContinuationT>,GetRootDirError>;\n}\n","import type { ItemOffsetMapping } from './ItemOffsetMapping';\n\n/**\n * Implementation of {@link ItemOffsetMapping} for use when all items have a fixed size\n */\nexport class FixedSizeItemOffsetMapping implements ItemOffsetMapping {\n /**\n * @param itemSize - Size to use for all items\n */\n constructor (itemSize: number) {\n this.fixedItemSize = itemSize;\n }\n\n itemSize(_itemIndex: number): number {\n return this.fixedItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n return itemIndex * this.fixedItemSize;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n const itemIndex = Math.floor(offset / this.fixedItemSize);\n const startOffset = itemIndex * this.fixedItemSize;\n\n return [itemIndex, startOffset];\n }\n\n private fixedItemSize: number;\n}\n\n","import type { ItemOffsetMapping } from './ItemOffsetMapping';\n\n/**\n * Implementation of {@link ItemOffsetMapping} for use when initial items have variable sizes.\n */\nexport class VariableSizeItemOffsetMapping implements ItemOffsetMapping {\n /**\n * @param defaultItemSize - Size to use for all other items\n * @param sizes - Array of sizes to use for the initial items, one size per item\n */\n constructor (defaultItemSize: number, sizes: number[]) {\n this.defaultItemSize = defaultItemSize;\n this.sizes = sizes;\n }\n\n itemSize(itemIndex: number): number {\n return (itemIndex < this.sizes.length) ? this.sizes[itemIndex]! : this.defaultItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n let offset = 0;\n let length = this.sizes.length;\n if (itemIndex > length) {\n const numDefaultSize = itemIndex - length;\n offset = numDefaultSize * this.defaultItemSize;\n } else {\n length = itemIndex;\n }\n \n for (let i = 0; i < length; i ++)\n {\n offset += this.sizes[i]!;\n }\n\n return offset;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n let startOffset = 0;\n for (const [i,size] of this.sizes.entries()) {\n if (startOffset + size > offset) {\n return [i, startOffset];\n }\n startOffset += size;\n }\n\n const itemIndex = Math.floor((offset - startOffset) / this.defaultItemSize);\n startOffset += itemIndex * this.defaultItemSize;\n\n const length = this.sizes.length;\n return [itemIndex+length, startOffset];\n }\n\n private defaultItemSize: number;\n private sizes: number[];\n}\n","import type { ItemOffsetMapping } from \"./ItemOffsetMapping\";\nimport { FixedSizeItemOffsetMapping } from \"./FixedSizeItemOffsetMapping\";\nimport { Result, ok } from \"./Result\";\nimport { ResultAsync, errAsync } from \"./ResultAsync\";\nimport { ValidationError, StorageError, storageError } from \"./Error\";\n\n/** Possible spreadsheet error values\n * \n * Includes those that can be returned by `ERROR.TYPE` and additional values\n * introduced by more recent versions of Excel.\n*/\nexport type CellErrorValue = '#NULL!' | \n '#DIV/0!' |\n '#VALUE!' |\n '#REF!' |\n '#NAME?' |\n '#NUM!' |\n '#N/A' |\n '#GETTING_DATA' |\n '#SPILL!' |\n '#UNKNOWN!' |\n '#FIELD!' |\n '#CALC!';\n\n/** Type that represents an error value stored in a cell\n * \n * Defined as a discriminated union so that additional cell value types\n * can be added in future.\n */\nexport interface CellError {\n /** Discriminated union tag */\n type: 'CellError',\n\n /** {@link CellErrorValue | Error Value} */\n value: CellErrorValue;\n};\n\n/** Possible types for a cell value \n * \n * The native JavaScript types string, number and boolean represent the *Text*, *Number* and *Logical*\n * spreadsheet data types. {@link CellError} represents an *Error Value*.\n * \n * Undefined is used to represent a cell with no defined value. Null represents a cell that has been\n * explicitly marked as empty. \n*/\nexport type CellValue = string | number | boolean | null | undefined | CellError\n\n/** Format of cell typically used when displaying numbers */\nexport type CellFormat = string | undefined;\n\n/** Data stored in a spreadsheet cell */\nexport interface CellData {\n /** Value of cell */\n value: CellValue;\n\n /** Format of cell */\n format?: CellFormat;\n}\n\n/** A viewport onto the spreadsheet. Usually the portion of the spreadsheet visible on-screen. */\nexport interface SpreadsheetViewport {\n /** Offset down the rows to the start of the viewport (using {@link ItemOffsetMapping} offsets) */\n rowMinOffset: number,\n\n /** Offset along the columns to the start of the viewport (using {@link ItemOffsetMapping} offsets) */\n columnMinOffset: number,\n\n /** Viewport width */\n width: number,\n\n /** Viewport height */\n height: number\n}\n\n/** Are two viewports equal by value? */\nexport function equalViewports(a: SpreadsheetViewport | undefined, b: SpreadsheetViewport | undefined): boolean {\n if (a === b)\n return true;\n\n if (!a || !b)\n return false;\n\n return a.rowMinOffset === b.rowMinOffset &&\n a.columnMinOffset === b.columnMinOffset &&\n a.width === b.width &&\n a.height === b.height;\n}\n\n/** Creates an empty viewport */\nexport function emptyViewport(): SpreadsheetViewport {\n return { rowMinOffset: 0, columnMinOffset: 0, width: 0, height: 0 }\n}\n\n/** Types of error that can be returned by {@link SpreadsheetData} methods */\nexport type SpreadsheetDataError = ValidationError | StorageError;\n\n/**\n * Interface used to access the data in a spreadsheet\n * \n * The data exposed through the interface may change over time outside of any changes made through the interface. The caller\n * can use the {@link subscribe} method to be notified when the data changes. When reading data, the caller must first request\n * a snapshot using {@link getSnapshot}. All values returned by gettors are relative to a specified snapshot. The values will be\n * consistent with each other as long as the same snapshot is used.\n * \n * @typeParam Snapshot - Type of snapshot. Implementations are free to use whatever type makes sense for them.\n */\nexport interface SpreadsheetData<Snapshot> {\n /** Subscribe to data changes */\n subscribe(onDataChange: () => void): () => void\n\n /** Return a snapshot to use when accessing values at a consistent point in time */\n getSnapshot(): Snapshot\n\n /** \n * Return load status at the time the snapshot was created \n * \n * On Success returns true if load has completed, false if still in progress\n * On Err returns most recent error reported by the storage system\n */\n getLoadStatus(snapshot: Snapshot): Result<boolean,StorageError>\n\n /** Number of rows in the spreadsheet */\n getRowCount(snapshot: Snapshot): number\n\n /** {@link ItemOffsetMapping} which describes sizes and offsets to start of rows */\n getRowItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping\n\n /** Number of columns in the spreadsheet */\n getColumnCount(snapshot: Snapshot): number\n\n /** {@link ItemOffsetMapping} which describes sizes and offsets to start of columns */\n getColumnItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping\n\n /** Value of specified cell using 0-based row and column indexes */\n getCellValue(snapshot: Snapshot, row: number, column: number): CellValue\n\n /** Format of specified cell using 0-based row and column indexes */\n getCellFormat(snapshot: Snapshot, row: number, column: number): CellFormat\n\n /** Set value and format of specified cell\n * \n * @returns `Ok` if the change was successfully applied\n */\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): ResultAsync<void,SpreadsheetDataError>\n\n /** Check whether value and format are valid to set for specified cell\n * \n * @returns `Ok` if the value and format are valid\n */\n isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: CellFormat): Result<void,ValidationError>\n\n /** Set viewport of interest\n * \n * Can be used by `SpreadsheetData` implementations to optimize data retrieval and memory usage.\n * Queries for cells outside the viewport *may* return `undefined`. Clients should not rely on any particular behavior\n * for queries outside the viewport.\n * \n * Set to undefined (the default) if the client needs access to the entire spreadsheet\n */\n setViewport(viewport: SpreadsheetViewport | undefined): void\n\n /** Return the viewport in force (if any) */\n getViewport(snapshot: Snapshot): SpreadsheetViewport | undefined\n}\n\nconst rowItemOffsetMapping = new FixedSizeItemOffsetMapping(30);\nconst columnItemOffsetMapping = new FixedSizeItemOffsetMapping(100);\n\nexport class EmptySpreadsheetData implements SpreadsheetData<number> {\n constructor() {\n this.viewport = undefined;\n }\n\n subscribe(_onDataChange: () => void) { return () => {}; }\n getSnapshot() { return 0; }\n \n getLoadStatus(_snapshot: number): Result<boolean,StorageError> { return ok(true); }\n getRowCount(_snapshot: number) { return 0; }\n getRowItemOffsetMapping(_snapshot: number): ItemOffsetMapping { return rowItemOffsetMapping; }\n getColumnCount(_snapshot: number) { return 0; }\n getColumnItemOffsetMapping(_snapshot: number): ItemOffsetMapping { return columnItemOffsetMapping; }\n getCellValue(_snapshot: number, _row: number, _column: number): CellValue { return null; }\n getCellFormat(_snapshot: number, _row: number, _column: number): string|undefined { return undefined; }\n setCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): ResultAsync<void,SpreadsheetDataError> \n { return errAsync(storageError(\"Not implemented\", 501)); }\n isValidCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: CellFormat): Result<void,ValidationError> \n { return ok(); }\n\n setViewport(viewport: SpreadsheetViewport | undefined): void { this.viewport = viewport; }\n getViewport(_snapshot: number): SpreadsheetViewport | undefined { return this.viewport }\n\n private viewport: SpreadsheetViewport | undefined;\n}\n\n","/** Classic Spreadsheet reference to Column (e.g \"A\") */\nexport type ColRef = string;\n\n/** Classic Spreadsheet reference to Cell (e.g. \"A1\"), Row (e.g. \"1\") or Column (e.g \"A\") */\nexport type RowColRef = string;\n\n/** Equivalent to {@link RowColRef} as coordinate pair. \"A1\" has coords [0,0], \"1\" is [0,undefined] and \"A\" is [undefined,0] */\nexport type RowColCoords = [row: number|undefined, col: number|undefined];\n\n/** Converts a {@link ColRef} to the 0-based index of the column */\nexport function colRefToIndex(col: ColRef): number {\n let n = 0;\n for (let i = 0; i < col.length; i ++) {\n n = col.charCodeAt(i) - 64 + n * 26;\n }\n return n-1;\n}\n\n/** Converts a 0-based column index to a {@link ColRef} */\nexport function indexToColRef(index: number): ColRef {\n let ret = \"\";\n index ++;\n while (index > 0) {\n index --;\n const remainder = index % 26;\n index = Math.floor(index / 26);\n ret = String.fromCharCode(65+remainder) + ret;\n }\n return ret;\n}\n\n/** Splits a RowColRef into a 0-based row index and a {@link ColRef} */\nexport function splitRowColRef(ref: RowColRef): [row: number|undefined, col: ColRef|undefined] {\n const re = /^([A-Z]*)(\\d*)$/;\n const found = ref.match(re);\n if (!found)\n return [undefined,undefined];\n\n const col = found[1];\n const row = found[2] ? parseInt(found[2]) : 0;\n return [(row>0) ? row-1 : undefined, col ? col : undefined];\n}\n\n/** Converts a {@link RowColRef} to {@link RowColCoords} */\nexport function rowColRefToCoords(ref: RowColRef): RowColCoords {\n const [row,col] = splitRowColRef(ref);\n return [row, col ? colRefToIndex(col) : undefined];\n}\n\n/** Converts {@link RowColCoords} to a {@link RowColRef} */\nexport function rowColCoordsToRef(row: number|undefined, col: number|undefined): RowColRef {\n if (row !== undefined) {\n if (col !== undefined) {\n return indexToColRef(col) + (row+1);\n } else {\n return (row+1).toString();\n }\n } else {\n if (col !== undefined) {\n return indexToColRef(col);\n } else {\n return \"\";\n }\n }\n}"],"names":["neverthrow_ok","neverthrow_err","neverthrow_ResultAsync","neverthrow_okAsync","neverthrow_errAsync"],"mappings":";;AA0EM,SAAU,EAAE,CAAe,KAAQ,EAAA;AACvC,IAAA,OAAOA,IAAa,CAAM,KAAK,CAAC;AAClC;A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;AACR,QAAA,OAAO,CAAC,SAAS,EAAC,SAAS,CAAC;AAE9B,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;IACpB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7C,OAAO,CAAC,CAAC,GAAG,GAAC,CAAC,IAAI,GAAG,GAAC,CAAC,GAAG,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;AAC7D;AAEA;AACM,SAAU,iBAAiB,CAAC,GAAc,EAAA;IAC9C,MAAM,CAAC,GAAG,EAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC;AACrC,IAAA,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AACpD;AAEA;AACM,SAAU,iBAAiB,CAAC,GAAqB,EAAE,GAAqB,EAAA;AAC5E,IAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACrB,QAAA,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,GAAC,CAAC,CAAC;QACrC;aAAO;YACL,OAAO,CAAC,GAAG,GAAC,CAAC,EAAE,QAAQ,EAAE;QAC3B;IACF;SAAO;AACL,QAAA,IAAI,GAAG,KAAK,SAAS,EAAE;AACrB,YAAA,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B;aAAO;AACL,YAAA,OAAO,EAAE;QACX;IACF;AACF;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@candidstartup/infinisheet-types",
3
3
  "private": false,
4
- "version": "0.11.0",
4
+ "version": "0.13.0",
5
5
  "description": "Common types for the InfiniSheet packages",
6
6
  "author": "Tim Wiegand <tim.wiegand@thecandidstartup.org>",
7
7
  "license": "BSD-3-Clause",
@@ -52,5 +52,5 @@
52
52
  "dependencies": {
53
53
  "neverthrow": "^8.2.0"
54
54
  },
55
- "gitHead": "0c72d04996502cb84f8720972bfda453e4989106"
55
+ "gitHead": "ca46dae5575a3011416803e2b159457ecb59eaee"
56
56
  }