@candidstartup/infinisheet-types 0.9.0 → 0.11.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![NPM Type Definitions](https://img.shields.io/npm/types/@candidstartup/infinisheet-types)](https://www.npmjs.com/package/@candidstartup/infinisheet-types)
1
+ [![TypeScript](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2FTheCandidStartup%2Finfinisheet%2Fmain%2Fpackage.json&query=%24.devDependencies.typescript&label=TypeScript&color=blue)](https://github.com/TheCandidStartup/infinisheet/blob/main/README.md#typescript-semantic-versioning)
2
2
  [![NPM Version](https://img.shields.io/npm/v/@candidstartup/infinisheet-types)](https://www.npmjs.com/package/@candidstartup/infinisheet-types)
3
3
  [![NPM bundle size](https://img.shields.io/bundlephobia/minzip/@candidstartup/infinisheet-types)](https://www.npmjs.com/package/@candidstartup/infinisheet-types)
4
4
  [![Build Status](https://github.com/TheCandidStartup/infinisheet/actions/workflows/build.yml/badge.svg?event=push)](https://github.com/TheCandidStartup/infinisheet/actions/workflows/build.yml)
package/dist/index.d.ts CHANGED
@@ -1,3 +1,308 @@
1
+ import { Ok as Ok$1, Err as Err$1, ResultAsync as ResultAsync$1 } from 'neverthrow';
2
+
3
+ /**
4
+ * An `Ok` instance is the *successful* variant of the {@link Result} type,
5
+ * representing a successful outcome from an operation which may fail.
6
+ *
7
+ * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)
8
+ *
9
+ * @typeParam T - The type of the value contained in the `Result` for the success case
10
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
11
+ */
12
+ interface Ok<T, E> extends Ok$1<T, E> {
13
+ }
14
+ /**
15
+ * An `Err` instance is the failure variant of the {@link Result} type,
16
+ * representing a failure outcome from an operation which may fail.
17
+ *
18
+ * Implemented using [`neverthrow`](https://github.com/supermacro/neverthrow)
19
+ *
20
+ * @typeParam T - The type of the value contained in the `Result` for the success case
21
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
22
+ */
23
+ interface Err<T, E> extends Err$1<T, E> {
24
+ }
25
+ /**
26
+ * A `Result` represents success ({@link Ok}) or failure ({@link Err}).
27
+ *
28
+ * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)
29
+ *
30
+ * @typeParam T - The type of the value contained in the `Result` for the success case
31
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
32
+ */
33
+ type Result<T, E> = Ok<T, E> | Err<T, E>;
34
+ /**
35
+ * Create an instance of {@link Ok}.
36
+ *
37
+ * If you need to create an instance with a specific type (as you do whenever you
38
+ * are not constructing immediately for a function return or as an argument to a
39
+ * function), you can use a type parameter:
40
+ *
41
+ * ```ts
42
+ * const yayNumber = ok<number, string>(12);
43
+ * ```
44
+ *
45
+ * Note: passing nothing will produce a `Result<void, E>`, passing `undefined` will
46
+ * produce a `Result<undefined, E>` which is compatible with `Result<void, E>`.
47
+ *
48
+ * ```ts
49
+ * const normalResult = ok<number, string>(42);
50
+ * const explicitUndefined = ok<undefined, string>(undefined);
51
+ * const implicitVoid = ok<void, string>();
52
+ * ```
53
+ *
54
+ * In the context of an immediate function return, or an arrow function with a
55
+ * single expression value, you do not have to specify the types, so this can be
56
+ * quite convenient.
57
+ *
58
+ * ```ts
59
+ * const arrowValidate = (data: SomeData): Result<void, string> =>
60
+ * isValid(data) ? ok() : err('something was wrong!');
61
+ *
62
+ * function fnValidate(data: someData): Result<void, string> {
63
+ * return isValid(data) ? ok() : err('something was wrong');
64
+ * }
65
+ * ```
66
+ *
67
+ * @typeParam T - The type of the value contained in the `Result` for the success case
68
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
69
+ * @param value - The value to wrap in a `Result.Ok`.
70
+ */
71
+ declare function ok<T, E = never>(value: T): Ok<T, E>;
72
+ declare function ok<_T extends void = void, E = never>(value: void): Ok<void, E>;
73
+ /**
74
+ * Create an instance of {@link Err}.
75
+ *
76
+ * If you need to create an instance with a specific type (as you do whenever you
77
+ * are not constructing immediately for a function return or as an argument to a
78
+ * function), you can use a type parameter:
79
+ *
80
+ * ```ts
81
+ * const notString = err<number, string>('something went wrong');
82
+ * ```
83
+ *
84
+ * Note: passing nothing will produce a `Result<T, void>`, passing `undefined` will
85
+ * produce a `Result<T, undefined>` which is compatible with `Result<T, void>`.
86
+ *
87
+ * ```ts
88
+ * const normalResult = err<number, string>('oh no');
89
+ * const explicitUndefined = err<number, undefined>(undefined);
90
+ * const implicitVoid = err<number, void>();
91
+ * ```
92
+ *
93
+ * In the context of an immediate function return, or an arrow function with a
94
+ * single expression value, you do not have to specify the types, so this can be
95
+ * quite convenient.
96
+ *
97
+ * ```ts
98
+ * const arrowValidate = (data: SomeData): Result<number, string> =>
99
+ * isValid(data) ? ok(42) : err('something went wrong');
100
+ *
101
+ * function fnValidate(data: someData): Result<number, string> {
102
+ * return isValid(data) ? ok(42) : err('something went wrong');
103
+ * }
104
+ * ```
105
+ *
106
+ * @typeParam T - The type of the value contained in the `Result` for the success case
107
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
108
+ * @param err - The value to wrap in a `Result.Err`.
109
+ */
110
+ declare function err<T = never, E extends string = string>(err: E): Err<T, E>;
111
+ declare function err<T = never, E = unknown>(err: E): Err<T, E>;
112
+ declare function err<T = never, _E extends void = void>(err: void): Err<T, void>;
113
+
114
+ /**
115
+ * `ResultAsync` allows you to work with asynchronous Results in a type safe way
116
+ *
117
+ * `ResultAsync<T,E>` is a wrapper around `Promise<Result<T,E>>` which provides the same methods for chaining different
118
+ * `Result` and `ResultAsync` together as {@link Result}, while also chaining the asynchronous operations together using
119
+ * `Promise.then`.
120
+ *
121
+ * `ResultAsync` is *thenable* (implements `PromiseLike<T>`) so can be used in most places that a `Promise` can, including with `await`.
122
+ *
123
+ * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)
124
+ *
125
+ * @typeParam T - The type of the value contained in the `ResultAsync` for the success case
126
+ * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case
127
+ */
128
+ declare class ResultAsync<T, E> extends ResultAsync$1<T, E> {
129
+ }
130
+ /**
131
+ * Create an instance of `ResultAsync` containing an {@link Ok} variant of {@link Result}
132
+ *
133
+ * Equivalent to `new ResultAsync(Promise.resolve(new Ok(value)))`
134
+ *
135
+ * @typeParam T - The type of the value contained in the `ResultAsync` for the success case
136
+ * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case
137
+ * @param value - The value to wrap in a `Result.Ok`.
138
+ */
139
+ declare function okAsync<T, E = never>(value: T): ResultAsync<T, E>;
140
+ declare function okAsync<_T extends void = void, E = never>(value: void): ResultAsync<void, E>;
141
+ /**
142
+ * Create an instance of `ResultAsync` containing an {@link Err} variant of {@link Result}
143
+ *
144
+ * Equivalent to `new ResultAsync(Promise.resolve(new Err(err)))`
145
+ *
146
+ * @typeParam T - The type of the value contained in the `Result` for the success case
147
+ * @typeParam E - The type of the error contained in the `Result` for the failure case
148
+ * @param err - The value to wrap in a `Result.Err`.
149
+ */
150
+ declare function errAsync<T = never, E = unknown>(err: E): ResultAsync<T, E>;
151
+ declare function errAsync<T = never, _E extends void = void>(err: void): ResultAsync<T, void>;
152
+
153
+ /** Common properties for Infinisheet errors */
154
+ interface InfinisheetError {
155
+ /** Discriminated union tag */
156
+ type: string;
157
+ /** End user message describing the problem */
158
+ message: string;
159
+ }
160
+ /**
161
+ * Attempt to access data that is outside the available range
162
+ *
163
+ */
164
+ interface InfinisheetRangeError extends InfinisheetError {
165
+ /** Discriminated union tag */
166
+ type: 'InfinisheetRangeError';
167
+ }
168
+ /** Convenience method that creates an {@link InfinisheetRangeError} */
169
+ declare function infinisheetRangeError(message: string): InfinisheetRangeError;
170
+ /** Type that represents an error when validating data passed to an API */
171
+ interface ValidationError extends InfinisheetError {
172
+ /** Discriminated union tag */
173
+ type: 'ValidationError';
174
+ }
175
+ /** Convenience method that creates a {@link ValidationError} */
176
+ declare function validationError(message: string): ValidationError;
177
+ /** Type that represents an error when accessing data in persistent storage */
178
+ interface StorageError extends InfinisheetError {
179
+ /** Discriminated union tag */
180
+ type: 'StorageError';
181
+ /** HTTP style status code
182
+ *
183
+ * Describes the type of problem encountered. Expected to be a 4XX or 5XX code.
184
+ */
185
+ statusCode?: number | undefined;
186
+ }
187
+ /** Convenience method that creates a {@link StorageError} */
188
+ declare function storageError(message: string, statusCode?: number): StorageError;
189
+
190
+ type BlobId = string;
191
+ type WorkflowId = string;
192
+ type SequenceId = bigint;
193
+ /**
194
+ * Metadata stored in an {@link EventLog} entry
195
+ */
196
+ interface LogMetadata {
197
+ /** Stores a reference to a snapshot of the complete log up to and including this entry */
198
+ snapshot?: BlobId | undefined;
199
+ /** Stores a reference to an external history of the event log up to and including the previous entry */
200
+ history?: BlobId | undefined;
201
+ /** Indicates that a background workflow is pending */
202
+ pending?: WorkflowId | undefined;
203
+ }
204
+ /**
205
+ * Type that represents an entry in an {@link EventLog}
206
+ *
207
+ * Base interface that clients will typically implement multiple times.
208
+ * Each concrete implementation will define its own data properties that
209
+ * need to be serialized into the event log.
210
+ *
211
+ * Properties defined here are common metadata which require special handling
212
+ * by any `EventLog` implementation.
213
+ *
214
+ * All data properties are immutable once an entry has been added to the log. Metadata
215
+ * properties (apart from `type`) may change over time.
216
+ */
217
+ interface LogEntry extends LogMetadata {
218
+ /** Used as a discriminated union tag by implementations */
219
+ type: string;
220
+ }
221
+ /**
222
+ * Type that represents a consistency conflict when adding a {@link LogEntry} to an {@link EventLog}
223
+ *
224
+ * Occurs when an attempt is made to add an entry with a sequence id that is not
225
+ * the next available in the log.
226
+ *
227
+ * Typically happens when another client makes a change since you last read the log.
228
+ * Sync with the additional log entries and then try again.
229
+ */
230
+ interface ConflictError extends InfinisheetError {
231
+ /** Discriminated union tag */
232
+ type: 'ConflictError';
233
+ /** Next available sequence id */
234
+ nextSequenceId: SequenceId;
235
+ }
236
+ /** Convenience method that creates a {@link ConflictError} */
237
+ declare function conflictError(message: string, nextSequenceId: SequenceId): ConflictError;
238
+ /** Errors that can be returned by {@link EventLog} `addEntry` method */
239
+ type AddEntryError = ConflictError | StorageError;
240
+ /** Errors that can be returned by {@link EventLog} `query` method */
241
+ type QueryError = InfinisheetRangeError | StorageError;
242
+ /** Errors that can be returned by {@link EventLog} `truncate` method */
243
+ type TruncateError = InfinisheetRangeError | StorageError;
244
+ /** Errors that can be returned by {@link EventLog} `setMetadata` method */
245
+ type MetadataError = InfinisheetRangeError | StorageError;
246
+ /** A range of {@link LogEntry} values returned by querying an {@link EventLog} */
247
+ interface QueryValue<T extends LogEntry> {
248
+ /** Sequence id corresponding to the first entry in `entries`
249
+ *
250
+ * All other entries have consecutive ascending sequence ids
251
+ */
252
+ startSequenceId: SequenceId;
253
+ /**
254
+ * Sequence id after the final entry in `entries`
255
+ *
256
+ * If query was up to the `end` sequence id AND
257
+ * `isComplete` is true, this is the next available
258
+ * sequence id for `addEntry`.
259
+ */
260
+ endSequenceId: SequenceId;
261
+ /** True if all the requested entries have been returned
262
+ *
263
+ * Queries may return fewer entries than requested. If
264
+ * `isComplete` is `false`, repeat the query starting
265
+ * from `nextSequenceId`.
266
+ */
267
+ isComplete: boolean;
268
+ /** The {@link LogEntry} records returned by the query */
269
+ entries: T[];
270
+ }
271
+ /** Abstract interface representing an event log
272
+ *
273
+ *
274
+ */
275
+ interface EventLog<T extends LogEntry> {
276
+ /**
277
+ * Add an entry to the log with the given sequence id
278
+ *
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.
281
+ * Any other problem with serializing the entry will return a {@link StorageError}.
282
+ */
283
+ addEntry(entry: T, sequenceId: SequenceId): ResultAsync<void, AddEntryError>;
284
+ /**
285
+ * Set some or all of a log entry's metadata fields
286
+ *
287
+ * Changes are atomic. Either all of the specified fields are updated or none are.
288
+ */
289
+ setMetadata(sequenceId: SequenceId, metaData: LogMetadata): ResultAsync<void, MetadataError>;
290
+ /** Return a range of entries from `first` to `last` inclusive
291
+ *
292
+ * The event log may return fewer entries than requested. If so, repeat the query starting from `nextSequenceId`.
293
+ *
294
+ * @param start - `SequenceId` of first entry to return.
295
+ * Use `'start'` to query from the first entry in the log.
296
+ * Use `'snapshot'` to query from the most recent entry with a snapshot, or the first if no snapshot is defined.
297
+ *
298
+ * @param end - `SequenceId` one after the last entry to return.
299
+ * Use `'end'` to query everything to the end of the log.
300
+ */
301
+ query(start: SequenceId | 'snapshot' | 'start', end: SequenceId | 'end'): ResultAsync<QueryValue<T>, QueryError>;
302
+ /** All entries prior to `start` are removed from the log. */
303
+ truncate(start: SequenceId): ResultAsync<void, TruncateError>;
304
+ }
305
+
1
306
  /**
2
307
  * Interface used to determine the size and positioning offset for items in a single dimension.
3
308
  */
@@ -70,6 +375,8 @@ interface CellError {
70
375
  * explicitly marked as empty.
71
376
  */
72
377
  type CellValue = string | number | boolean | null | undefined | CellError;
378
+ /** Types of error that can be returned by {@link SpreadsheetData} methods */
379
+ type SpreadsheetDataError = ValidationError | StorageError;
73
380
  /**
74
381
  * Interface used to access the data in a spreadsheet
75
382
  *
@@ -99,9 +406,14 @@ interface SpreadsheetData<Snapshot> {
99
406
  getCellFormat(snapshot: Snapshot, row: number, column: number): string | undefined;
100
407
  /** Set value and format of specified cell
101
408
  *
102
- * @returns True if the change was successfully applied
409
+ * @returns `Ok` if the change was successfully applied
410
+ */
411
+ setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void, SpreadsheetDataError>;
412
+ /** Check whether value and format are valid to set for specified cell
413
+ *
414
+ * @returns `Ok` if the value and format are valid
103
415
  */
104
- setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): boolean;
416
+ isValidCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): Result<void, ValidationError>;
105
417
  }
106
418
  declare class EmptySpreadsheetData implements SpreadsheetData<number> {
107
419
  subscribe(_onDataChange: () => void): () => void;
@@ -112,7 +424,8 @@ declare class EmptySpreadsheetData implements SpreadsheetData<number> {
112
424
  getColumnItemOffsetMapping(_snapshot: number): ItemOffsetMapping;
113
425
  getCellValue(_snapshot: number, _row: number, _column: number): CellValue;
114
426
  getCellFormat(_snapshot: number, _row: number, _column: number): string | undefined;
115
- setCellValueAndFormat(_row: number, _column: number, _value: CellValue, _format: string | undefined): boolean;
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>;
116
429
  }
117
430
 
118
431
  /** Classic Spreadsheet reference to Column (e.g "A") */
@@ -132,4 +445,4 @@ declare function rowColRefToCoords(ref: RowColRef): RowColCoords;
132
445
  /** Converts {@link RowColCoords} to a {@link RowColRef} */
133
446
  declare function rowColCoordsToRef(row: number | undefined, col: number | undefined): RowColRef;
134
447
 
135
- export { type CellError, type CellErrorValue, type CellValue, type ColRef, EmptySpreadsheetData, FixedSizeItemOffsetMapping, type ItemOffsetMapping, type RowColCoords, type RowColRef, type SpreadsheetData, VariableSizeItemOffsetMapping, colRefToIndex, indexToColRef, rowColCoordsToRef, rowColRefToCoords, splitRowColRef };
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 };
package/dist/index.js CHANGED
@@ -1,3 +1,53 @@
1
+ import { ok as ok$1, err as err$1, ResultAsync as ResultAsync$1, okAsync as okAsync$1, errAsync as errAsync$1 } from 'neverthrow';
2
+
3
+ function ok(value) {
4
+ return ok$1(value);
5
+ }
6
+ function err(err) {
7
+ return err$1(err);
8
+ }
9
+
10
+ /**
11
+ * `ResultAsync` allows you to work with asynchronous Results in a type safe way
12
+ *
13
+ * `ResultAsync<T,E>` is a wrapper around `Promise<Result<T,E>>` which provides the same methods for chaining different
14
+ * `Result` and `ResultAsync` together as {@link Result}, while also chaining the asynchronous operations together using
15
+ * `Promise.then`.
16
+ *
17
+ * `ResultAsync` is *thenable* (implements `PromiseLike<T>`) so can be used in most places that a `Promise` can, including with `await`.
18
+ *
19
+ * Compatible with [`neverthrow`](https://github.com/supermacro/neverthrow)
20
+ *
21
+ * @typeParam T - The type of the value contained in the `ResultAsync` for the success case
22
+ * @typeParam E - The type of the error contained in the `ResultAsync` for the failure case
23
+ */
24
+ class ResultAsync extends ResultAsync$1 {
25
+ }
26
+ function okAsync(value) {
27
+ return okAsync$1(value);
28
+ }
29
+ function errAsync(err) {
30
+ return errAsync$1(err);
31
+ }
32
+
33
+ /** Convenience method that creates an {@link InfinisheetRangeError} */
34
+ function infinisheetRangeError(message) {
35
+ return { type: 'InfinisheetRangeError', message };
36
+ }
37
+ /** Convenience method that creates a {@link ValidationError} */
38
+ function validationError(message) {
39
+ return { type: 'ValidationError', message };
40
+ }
41
+ /** Convenience method that creates a {@link StorageError} */
42
+ function storageError(message, statusCode) {
43
+ return { type: 'StorageError', message, statusCode };
44
+ }
45
+
46
+ /** Convenience method that creates a {@link ConflictError} */
47
+ function conflictError(message, nextSequenceId) {
48
+ return { type: 'ConflictError', message, nextSequenceId };
49
+ }
50
+
1
51
  /**
2
52
  * Implementation of {@link ItemOffsetMapping} for use when all items have a fixed size
3
53
  */
@@ -80,7 +130,8 @@ class EmptySpreadsheetData {
80
130
  getColumnItemOffsetMapping(_snapshot) { return columnItemOffsetMapping; }
81
131
  getCellValue(_snapshot, _row, _column) { return null; }
82
132
  getCellFormat(_snapshot, _row, _column) { return undefined; }
83
- setCellValueAndFormat(_row, _column, _value, _format) { return false; }
133
+ setCellValueAndFormat(_row, _column, _value, _format) { return err(storageError("Not implemented", 501)); }
134
+ isValidCellValueAndFormat(_row, _column, _value, _format) { return ok(); }
84
135
  }
85
136
 
86
137
  /** Converts a {@link ColRef} to the 0-based index of the column */
@@ -138,5 +189,5 @@ function rowColCoordsToRef(row, col) {
138
189
  }
139
190
  }
140
191
 
141
- export { EmptySpreadsheetData, FixedSizeItemOffsetMapping, VariableSizeItemOffsetMapping, colRefToIndex, indexToColRef, rowColCoordsToRef, rowColRefToCoords, splitRowColRef };
192
+ export { EmptySpreadsheetData, FixedSizeItemOffsetMapping, ResultAsync, VariableSizeItemOffsetMapping, colRefToIndex, conflictError, err, errAsync, indexToColRef, infinisheetRangeError, ok, okAsync, rowColCoordsToRef, rowColRefToCoords, splitRowColRef, storageError, validationError };
142
193
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/FixedSizeItemOffsetMapping.ts","../src/VariableSizeItemOffsetMapping.ts","../src/SpreadsheetData.ts","../src/RowColRef.ts"],"sourcesContent":["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\";\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/**\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 True if the change was successfully applied\n */\n setCellValueAndFormat(row: number, column: number, value: CellValue, format: string | undefined): boolean;\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): boolean { return false; }\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":[],"mappings":"AAEA;;AAEG;MACU,0BAA0B,CAAA;AACrC;;AAEG;AACH,IAAA,WAAA,CAAa,QAAgB,EAAA;AAC3B,QAAA,IAAI,CAAC,cAAc,GAAG,QAAQ;;AAGhC,IAAA,QAAQ,CAAC,UAAkB,EAAA;QACzB,OAAO,IAAI,CAAC,cAAc;;AAG5B,IAAA,UAAU,CAAC,SAAiB,EAAA;AAC1B,QAAA,OAAO,SAAS,GAAG,IAAI,CAAC,cAAc;;AAGxC,IAAA,YAAY,CAAC,MAAc,EAAA;AACzB,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC;AAC1D,QAAA,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC,cAAc;AAEnD,QAAA,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;;AAGjC,IAAA,cAAc;AACf;;AC3BD;;AAEG;MACU,6BAA6B,CAAA;AACxC;;;AAGG;IACH,WAAa,CAAA,eAAuB,EAAE,KAAe,EAAA;AACnD,QAAA,IAAI,CAAC,gBAAgB,GAAG,eAAe;AACvC,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;;AAGrB,IAAA,QAAQ,CAAC,SAAiB,EAAA;QACxB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAE,GAAG,IAAI,CAAC,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AAC;;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/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;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AC5E,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;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@candidstartup/infinisheet-types",
3
3
  "private": false,
4
- "version": "0.9.0",
4
+ "version": "0.11.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",
@@ -49,5 +49,8 @@
49
49
  "test": "vitest"
50
50
  },
51
51
  "main": "index.js",
52
- "gitHead": "8035218a392af0bc15c99ff272536ba8ef841c49"
52
+ "dependencies": {
53
+ "neverthrow": "^8.2.0"
54
+ },
55
+ "gitHead": "0c72d04996502cb84f8720972bfda453e4989106"
53
56
  }