@sheetxl/query 0.8.0-beta.1 → 0.8.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/browser/esm/index.mjs +4008 -1103
  2. package/node/esm/index.mjs +4301 -1346
  3. package/package.json +6 -7
  4. package/types/src/Tool.d.ts +38 -0
  5. package/types/src/api/_aliases.d.ts +16 -0
  6. package/types/src/api/_offered.d.ts +13 -0
  7. package/types/src/api/apiTool.d.ts +22 -0
  8. package/types/src/api/index.d.ts +4 -0
  9. package/types/src/api/lookupApi.d.ts +171 -0
  10. package/types/src/api/renderApi.d.ts +13 -0
  11. package/types/src/delta/describeDelta.d.ts +148 -0
  12. package/types/src/delta/index.d.ts +4 -0
  13. package/types/src/delta/readRunDelta.d.ts +21 -0
  14. package/types/src/delta/renderDelta.d.ts +20 -0
  15. package/types/src/encode/encodeCell.d.ts +19 -7
  16. package/types/src/grep/GrepTypes.d.ts +88 -42
  17. package/types/src/grep/grep.d.ts +4 -1
  18. package/types/src/index.d.ts +10 -0
  19. package/types/src/markdown/appendDependencies.d.ts +106 -0
  20. package/types/src/markdown/appendPivotTables.d.ts +22 -0
  21. package/types/src/markdown/appendSections.d.ts +57 -105
  22. package/types/src/markdown/caps.d.ts +4 -0
  23. package/types/src/markdown/describeAnomaly.d.ts +22 -0
  24. package/types/src/markdown/describeChart.d.ts +72 -0
  25. package/types/src/markdown/describeExternalCitation.d.ts +27 -0
  26. package/types/src/markdown/describeHistogram.d.ts +186 -0
  27. package/types/src/markdown/describeRegionPayload.d.ts +4 -4
  28. package/types/src/markdown/describeRule.d.ts +5 -5
  29. package/types/src/markdown/describeShape.d.ts +41 -0
  30. package/types/src/markdown/describeStyle.d.ts +7 -7
  31. package/types/src/markdown/findLabels.d.ts +19 -0
  32. package/types/src/markdown/index.d.ts +6 -1
  33. package/types/src/markdown/profileRegion.d.ts +56 -1
  34. package/types/src/markdown/registry.d.ts +18 -4
  35. package/types/src/markdown/renderCell.d.ts +14 -11
  36. package/types/src/markdown/renderCellRange.d.ts +3 -2
  37. package/types/src/markdown/renderFormula.d.ts +2 -2
  38. package/types/src/markdown/renderModules.d.ts +55 -0
  39. package/types/src/markdown/renderMovable.d.ts +83 -14
  40. package/types/src/markdown/renderNames.d.ts +2 -2
  41. package/types/src/markdown/renderPageLayout.d.ts +22 -0
  42. package/types/src/markdown/renderProtection.d.ts +81 -0
  43. package/types/src/markdown/renderRecords.d.ts +8 -0
  44. package/types/src/markdown/renderRegions.d.ts +1 -0
  45. package/types/src/markdown/renderStyle.d.ts +2 -2
  46. package/types/src/markdown/renderTable.d.ts +11 -3
  47. package/types/src/markdown/renderWorkbook.d.ts +33 -26
  48. package/types/src/markdown/{renderSheet.d.ts → renderWorksheet.d.ts} +10 -11
  49. package/browser/cjs/index.cjs +0 -26
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/query",
3
3
  "description": "SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface",
4
- "version": "0.8.0-beta.1",
4
+ "version": "0.8.0-beta.11",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -9,13 +9,12 @@
9
9
  "types": "./types/index.d.ts",
10
10
  "browser": "./browser/esm/index.mjs",
11
11
  "node": "./node/esm/index.mjs",
12
- "import": "./browser/esm/index.mjs",
13
- "require": "./browser/cjs/index.cjs"
12
+ "default": "./browser/esm/index.mjs"
14
13
  }
15
14
  },
16
15
  "types": "./types/index.d.ts",
17
16
  "module": "./browser/esm/index.mjs",
18
- "main": "./browser/cjs/index.cjs",
17
+ "main": "./browser/esm/index.mjs",
19
18
  "sideEffects": false,
20
19
  "engines": {
21
20
  "node": ">=20 <21 || >=22"
@@ -43,10 +42,10 @@
43
42
  "query"
44
43
  ],
45
44
  "dependencies": {
46
- "@sheetxl/primitives": "^0.8.0-beta.1",
47
- "@sheetxl/sdk": "^0.8.0-beta.1"
45
+ "@sheetxl/primitives": "^0.8.0-beta.11",
46
+ "@sheetxl/sdk": "^0.8.0-beta.11"
48
47
  },
49
48
  "devDependencies": {
50
- "@types/node": "^26.1.2"
49
+ "@types/node": "^26.6.4"
51
50
  }
52
51
  }
@@ -104,5 +104,43 @@ export declare namespace Tool {
104
104
  */
105
105
  render(result: R): string | Promise<string>;
106
106
  }
107
+ /**
108
+ * A capability that reads the INSTALL rather than a workbook — the API reference.
109
+ *
110
+ * @remarks
111
+ * A separate shape rather than a {@link Descriptor} with an ignored argument, because what a
112
+ * surface wraps around a descriptor is exactly the part that does not apply: naming a workbook on
113
+ * a terminal, routing to a session over MCP. A reference answers the same with no workbook open
114
+ * and no session created, and a surface that demanded either would be asking for something the
115
+ * capability never reads.
116
+ *
117
+ * Everything else holds as it does for a descriptor: defined once, adapted mechanically, text
118
+ * agent-facing and English, defaults applied by the tool.
119
+ */
120
+ interface Reference<A = any, R = any> {
121
+ /** Tool name and subcommand — the same word on every surface. */
122
+ readonly name: string;
123
+ /** One or two lines, agent-facing, English. */
124
+ readonly description: string;
125
+ readonly params: readonly Param[];
126
+ run(args: A): Promise<R>;
127
+ /** The default agent-facing rendering of a result. */
128
+ render(result: R, options?: RenderOptions): string;
129
+ }
130
+ /**
131
+ * What a surface tells a renderer about itself.
132
+ */
133
+ interface RenderOptions {
134
+ /**
135
+ * How THIS surface spells the capability's own command — `sheetxl api`, `.api`. Defaults to the
136
+ * bare name, which is the spelling of a tool call.
137
+ *
138
+ * @remarks
139
+ * An answer that points at a follow-up ("everything on the type: …") is printing something to
140
+ * be typed, and the same capability is typed differently on each surface. This is the one
141
+ * affordance a renderer cannot work out for itself.
142
+ */
143
+ readonly command?: string;
144
+ }
107
145
  }
108
146
  //# sourceMappingURL=Tool.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Names a script reaches for from another spreadsheet API — Excel's, Office Scripts', openpyxl's —
3
+ * and where SheetXL keeps that concept. Each answer names the member it relies on, and is offered
4
+ * only while the index still has it.
5
+ */
6
+ export declare const API_ALIASES: readonly {
7
+ readonly match: RegExp;
8
+ readonly relies: [string, string];
9
+ readonly hint: string;
10
+ }[];
11
+ /**
12
+ * The answer to a member called on a plain array (`wb.getSheets().getAt(0)`): `getAt`/`getItems`
13
+ * belong to a collection, and an array is indexed.
14
+ */
15
+ export declare const arrayReceiverHint: (elementType: string) => string;
16
+ //# sourceMappingURL=_aliases.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { ScriptingApi } from '@sheetxl/sdk';
2
+ /**
3
+ * Whether a declaration is offered. A `@deprecated` or `@hidden` one stays declared so a script that
4
+ * calls it still type-checks, and a lookup of its exact name still answers with its replacement; it
5
+ * is left out of listings, searches and suggestions, so nothing leads a reader to it.
6
+ */
7
+ export declare const isOffered: (declared: {
8
+ readonly deprecated?: true;
9
+ readonly hidden?: true;
10
+ }) => boolean;
11
+ /** The members of `entry` that are {@link isOffered | offered}. */
12
+ export declare const offeredMembers: (entry: ScriptingApi.Entry) => ScriptingApi.Member[];
13
+ //# sourceMappingURL=_offered.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { Tool } from '../Tool';
2
+ import { ApiLookup } from './lookupApi';
3
+ export interface ApiArgs {
4
+ name?: string;
5
+ }
6
+ /**
7
+ * Looks a name up in the scripting API — see {@link lookupApi} for what a name may be.
8
+ *
9
+ * @remarks
10
+ * A member answer carries its full declaration, sliced out of `scripting.d.ts` by the span the
11
+ * index recorded. That is the only lookup that reads the declarations at all: a type listing or a
12
+ * search is answered from the index alone, which is the point of having one.
13
+ *
14
+ * Declarations that cannot be read leave the member answer with its index line rather than failing
15
+ * it; the signature is still the answer to "how do I call this".
16
+ */
17
+ export declare function describeApi(name?: string): Promise<ApiLookup.Result>;
18
+ /**
19
+ * The API reference: what a script can call, from the declarations it is type-checked against.
20
+ */
21
+ export declare const apiTool: Tool.Reference<ApiArgs, ApiLookup.Result>;
22
+ //# sourceMappingURL=apiTool.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './lookupApi';
2
+ export * from './renderApi';
3
+ export * from './apiTool';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,171 @@
1
+ import { ScriptingApi } from '@sheetxl/sdk';
2
+ /**
3
+ * What a name resolved to in the scripting API index.
4
+ *
5
+ * @remarks
6
+ * One query string, four answers, decided by what the name matches — the caller never says which
7
+ * it wants. Nothing → the {@link ApiLookup.Overview}; a type → its members; `Type.member` → that
8
+ * member in full; anything else → a name {@link ApiLookup.Search}.
9
+ */
10
+ export declare namespace ApiLookup {
11
+ /** A type {@link Type} extends, with where to read its members. */
12
+ interface Base {
13
+ /** As written in the `extends` clause, type arguments included. */
14
+ readonly text: string;
15
+ /** The index key it resolved to, or `null` for a type outside the index (`Iterable`, `Omit`). */
16
+ readonly key: string | null;
17
+ readonly memberCount: number;
18
+ }
19
+ interface Overview {
20
+ readonly kind: 'overview';
21
+ /** How many names the index holds. */
22
+ readonly total: number;
23
+ readonly entryPoints: readonly {
24
+ readonly key: string;
25
+ readonly entry: ScriptingApi.Entry;
26
+ }[];
27
+ }
28
+ interface Type {
29
+ readonly kind: 'type';
30
+ readonly key: string;
31
+ readonly entry: ScriptingApi.Entry;
32
+ readonly bases: readonly Base[];
33
+ /** The member substring the listing was narrowed by, when `Type.<text>` named no exact member. */
34
+ readonly filter?: string;
35
+ /** The entry's own members, narrowed by {@link filter} when present. */
36
+ readonly members: readonly ScriptingApi.Member[];
37
+ }
38
+ interface Member {
39
+ readonly kind: 'member';
40
+ /** The type that was asked about. */
41
+ readonly key: string;
42
+ /** The type that DECLARES the member — a base of {@link key} when the member is inherited. */
43
+ readonly declaredOn: string;
44
+ /** Every overload, in declaration order. */
45
+ readonly members: readonly ScriptingApi.Member[];
46
+ /**
47
+ * Each overload's full declaration, documentation included, parallel to {@link members}.
48
+ * Filled by the caller that has `scripting.d.ts` to slice; a lookup alone leaves it unset.
49
+ */
50
+ sources?: readonly string[];
51
+ }
52
+ interface Search {
53
+ readonly kind: 'search';
54
+ readonly query: string;
55
+ readonly types: readonly string[];
56
+ readonly members: readonly {
57
+ readonly key: string;
58
+ readonly member: ScriptingApi.Member;
59
+ }[];
60
+ /** Matches beyond the caps, not listed. */
61
+ readonly omitted: number;
62
+ }
63
+ /**
64
+ * `Type.member` where the API has no such thing — the type, the member, or both — answered
65
+ * with what is nearest rather than with a search for the member's name across every type.
66
+ *
67
+ * @remarks
68
+ * A dotted name is a claim about where something lives, and the claim is what the reader needs
69
+ * corrected: `ISheets.add` wants to hear that the collection is `IWorksheetCollection`, and
70
+ * `ICellRange.setStyle` that a range's style is reached through `getStyle()`. A bare search for
71
+ * `add` or `setStyle` lists every type that has one and leaves the claim standing.
72
+ */
73
+ interface Miss {
74
+ readonly kind: 'miss';
75
+ /** The type as typed, and the index key it resolved to — `null` when no type matched. */
76
+ readonly owner: {
77
+ readonly text: string;
78
+ readonly key: string | null;
79
+ };
80
+ /** The member as typed. */
81
+ readonly text: string;
82
+ /** When the type is unknown: the nearest type names, those with the member first. */
83
+ readonly nearestTypes: readonly {
84
+ readonly key: string;
85
+ readonly hasMember: boolean;
86
+ }[];
87
+ /** When the type is known: its members nearest the name, inherited ones included. */
88
+ readonly nearest: readonly ScriptingApi.Member[];
89
+ /** Where SheetXL keeps a concept another API spells this way, when the name is one of those. */
90
+ readonly hints: readonly string[];
91
+ /** Types that do have a member of exactly this name. */
92
+ readonly elsewhere: readonly {
93
+ readonly key: string;
94
+ readonly member: ScriptingApi.Member;
95
+ }[];
96
+ /** `elsewhere` entries beyond the cap, not listed. */
97
+ readonly elsewhereOmitted: number;
98
+ }
99
+ type Result = Overview | Type | Member | Search | Miss;
100
+ }
101
+ /**
102
+ * The names an overview leads with — where a script's reach into a workbook starts.
103
+ *
104
+ * @remarks
105
+ * Advertising, not scope: every indexed name answers a lookup. These are the handful worth naming
106
+ * before the reader has asked for anything, in the order a script meets them.
107
+ */
108
+ export declare const API_ENTRY_POINTS: readonly string[];
109
+ /**
110
+ * Resolves a name against the scripting API index.
111
+ *
112
+ * @param name A type (`ICellRange`), a member (`ICellRange.setValues`), a word to search for, or
113
+ * nothing for the overview. A leading `SheetXL.` is accepted and ignored — it is how the name is
114
+ * written in a script, and a name copied out of one should resolve.
115
+ *
116
+ * @remarks
117
+ * `Type.text` is tried as a nested type first (`ICellRange.Coords` is its own entry), then as a
118
+ * member, inherited ones included. Text that names no member exactly narrows the type's listing to
119
+ * the members containing it — `ICellRange.merge` answers with every merge-related member rather
120
+ * than with "not found".
121
+ */
122
+ export declare function lookupApi(index: ScriptingApi.Index, name?: string): ApiLookup.Result;
123
+ /**
124
+ * The indexed type of a live SDK object, or `null` when it carries no brand the index knows.
125
+ *
126
+ * @remarks
127
+ * SDK objects answer `true` for an `isI<Name>` brand per interface they implement — the SDK's own
128
+ * convention for runtime type checks — so the brand names are the type names. An object usually
129
+ * carries several (a named range is an `INamedRange` AND an `ICellRange`); the most derived one
130
+ * wins, because its listing reaches the others through `extends` and the reverse is not true.
131
+ */
132
+ export declare function apiTypeOf(index: ScriptingApi.Index, target: unknown): string | null;
133
+ /**
134
+ * The `api` lookup that answers a compiler finding — `` `api ICellRanges` lists its members. `` —
135
+ * or `null` when the finding names no SDK type.
136
+ *
137
+ * @param message A TypeScript diagnostic, e.g. `Property 'getValues' does not exist on type 'ICellRanges'.`
138
+ * @param command How the host spells the lookup — `sheetxl api` in a terminal, `api` for a tool
139
+ * call. The line is there to be typed, so it has to be typeable where it is shown.
140
+ *
141
+ * @remarks
142
+ * A wrong member is the moment the listing is wanted: the finding names the receiver's type, and
143
+ * the type is the one thing the lookup needs. Only a plain capitalized name is taken — a union, a
144
+ * generic or a primitive is not something the index answers for.
145
+ */
146
+ export declare function apiPointerFor(message: string, command: string): string | null;
147
+ /**
148
+ * A compiler finding without its `Did you mean '…'?` when TypeScript means a member the index does
149
+ * not offer — a deprecated alias is still declared, so the compiler finds it nearest.
150
+ *
151
+ * @param message A compiler finding, e.g. `Property 'setFormat' does not exist on type 'ICellRange'.
152
+ * Did you mean 'getFormat'?`
153
+ */
154
+ export declare function withoutHiddenSuggestion(index: ScriptingApi.Index, message: string): string;
155
+ /**
156
+ * The members nearest a name the script used and the API does not have — the answer an `api`
157
+ * lookup would be asked for next, inline.
158
+ *
159
+ * @param message A compiler finding (`Property 'getFormat' does not exist on type 'ICellRange'.
160
+ * Did you mean 'getFormula'?`) or a run-time one (`r.getFormat is not a function`).
161
+ * @param command How the host spells the lookup, as for {@link apiPointerFor}.
162
+ *
163
+ * @remarks
164
+ * A compiler finding names the receiver, so its members are the candidates, TypeScript's own
165
+ * suggestion first. A run-time one names only the member, so every entry point's members are.
166
+ * A name another spreadsheet API uses for a concept SheetXL keeps elsewhere is answered with where
167
+ * (`getFormat` → the style). Returns `null` when nothing is near enough to be worth a line; the
168
+ * compiler finding's {@link apiPointerFor} still stands then.
169
+ */
170
+ export declare function apiSuggestionsFor(index: ScriptingApi.Index, message: string, command: string): string | null;
171
+ //# sourceMappingURL=lookupApi.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { Tool } from '../Tool';
2
+ import { ApiLookup } from './lookupApi';
3
+ /**
4
+ * Renders an API lookup as its agent-facing text.
5
+ *
6
+ * @remarks
7
+ * Every answer ends by naming the next lookup, and that line is there to be typed. So it is
8
+ * written the way the surface showing it spells the command ({@link Tool.RenderOptions.command}):
9
+ * `sheetxl api ICellRange` in a terminal, `.api ICellRange` in a session. One neutral spelling for
10
+ * all of them is wrong on most of them — `api IWorkbook` typed into a session is a syntax error.
11
+ */
12
+ export declare function renderApi(result: ApiLookup.Result, options?: Tool.RenderOptions): string;
13
+ //# sourceMappingURL=renderApi.d.ts.map
@@ -0,0 +1,148 @@
1
+ import { IRange } from '@sheetxl/primitives';
2
+ import { IWorkbook, IWorksheet } from '@sheetxl/sdk';
3
+ /**
4
+ * What one commit did to a workbook, at region altitude: the structured half of the run delta.
5
+ *
6
+ * @remarks
7
+ * JSON-safe, so a host can send it as it is; {@link renderDelta} is its markdown. Every address is
8
+ * sheet-qualified and every list is capped, with the uncounted rest in a `more` field.
9
+ */
10
+ export interface RunDelta {
11
+ /** The commit described. */
12
+ commitId: string;
13
+ /** One entry per sheet whose cells the commit changed. */
14
+ sheets: RunDelta.SheetChange[];
15
+ /** The cells downstream of the written ones, or `null` when nothing reads them. */
16
+ dependents: RunDelta.Dependents | null;
17
+ /** Errors now in the written and dependent cells, by region. */
18
+ errors: RunDelta.ErrorRegion[];
19
+ /** Error regions past {@link RunDelta.errors}. */
20
+ errorsMore: number;
21
+ /** Written cells that held an error before the commit and hold none now. */
22
+ errorsCleared: number;
23
+ /** What is not a cell, over the written or dependent cells. */
24
+ touches: RunDelta.Touches;
25
+ }
26
+ export declare namespace RunDelta {
27
+ /** What a commit did to one sheet. */
28
+ interface SheetChange {
29
+ /** The sheet, quoted as a reference would quote it. */
30
+ sheet: string;
31
+ /** The cells whose values or formulas were written, or `null` when none were. */
32
+ written: string | null;
33
+ /** Cells in {@link written}. */
34
+ cells: number;
35
+ /** Written cells that now hold a formula. */
36
+ formulas: number;
37
+ /** Written cells that now hold a value that is not a formula. */
38
+ values: number;
39
+ /** Written cells that are now empty. */
40
+ cleared: number;
41
+ /**
42
+ * What the write replaced, from the sheet as it was: populated cells and formulas among the
43
+ * written ones. `null` when it cannot be told: the commit moved cells, or the store no longer
44
+ * keeps the state before it.
45
+ */
46
+ replaced: {
47
+ populated: number;
48
+ formulas: number;
49
+ } | null;
50
+ /** The inserts and deletes of cells, in the order they ran. */
51
+ shifts: Shift[];
52
+ /** Ranges whose formatting changed, or `null`. */
53
+ styles: string | null;
54
+ /** The written formulas, one per block of the same formula. */
55
+ blocks: FormulaBlock[];
56
+ /** Blocks past {@link blocks}. */
57
+ blocksMore: number;
58
+ }
59
+ /** One insert or delete of cells. */
60
+ interface Shift {
61
+ kind: IWorksheet.ShiftKind;
62
+ /** The axis the neighboring cells moved along. */
63
+ axis: IRange.Axis;
64
+ /** The cells inserted or deleted, sheet-qualified; `null` when the state before was not kept. */
65
+ address: string | null;
66
+ /** Whole rows or columns, rather than cells within them. */
67
+ whole: boolean;
68
+ }
69
+ /** One written formula and the results it computed. */
70
+ interface FormulaBlock {
71
+ /** The block, sheet-qualified. */
72
+ address: string;
73
+ /** The formula as its first cell shows it, `=` included. */
74
+ formula: string;
75
+ /** Cells in the block. */
76
+ cells: number;
77
+ /** Results in reading order: all of them for a small block, else the first few and the last. */
78
+ values: string[];
79
+ /** `true` when {@link values} skips some, between its last two entries. */
80
+ sampled: boolean;
81
+ }
82
+ /** The cells downstream of the write. */
83
+ interface Dependents {
84
+ /** Populated dependent cells. */
85
+ cells: number;
86
+ /** The sheets they are on, with their cells. */
87
+ sheets: {
88
+ sheet: string;
89
+ cells: number;
90
+ }[];
91
+ /** Their areas, sheet-qualified. */
92
+ areas: string[];
93
+ /** Areas past {@link areas}. */
94
+ areasMore: number;
95
+ }
96
+ /** A region of one error, with its count. */
97
+ interface ErrorRegion {
98
+ /** Sheet-qualified. */
99
+ address: string;
100
+ /** The error as a cell shows it: `#VALUE!`, `#REF!`, … */
101
+ error: string;
102
+ /** Cells in the region. */
103
+ cells: number;
104
+ }
105
+ /** Objects over the written or dependent cells: listed, never evaluated. */
106
+ interface Touches {
107
+ /** Defined names over the written or dependent cells, or read through by a dependent. */
108
+ names: string[];
109
+ /** Conditional formats over the written or dependent cells, by their anchors. */
110
+ conditionalFormats: string[];
111
+ /** Data validations over the written or dependent cells, by their anchors. */
112
+ dataValidations: string[];
113
+ /** Charts that read the written cells or their dependents. */
114
+ charts: string[];
115
+ }
116
+ }
117
+ /** Options for {@link describeDelta}. */
118
+ export interface DescribeDeltaOptions {
119
+ /**
120
+ * How many entries a list holds before the rest is counted: formula blocks, dependent areas,
121
+ * error regions.
122
+ *
123
+ * @defaultValue 20
124
+ */
125
+ maxEntries?: number;
126
+ /**
127
+ * How many results a formula block lists in full; a longer block lists its first few and its
128
+ * last.
129
+ *
130
+ * @defaultValue 8
131
+ */
132
+ maxBlockValues?: number;
133
+ }
134
+ /**
135
+ * Describes what a commit did, read from the workbook after its calculation settled.
136
+ *
137
+ * @param workbook The workbook the commit landed on, settled.
138
+ * @param commitId The commit. Omit for the current one.
139
+ * @returns `null` when the commit changed no cells.
140
+ *
141
+ * @remarks
142
+ * Nothing here is collected on the write path. The written ranges come from the commit
143
+ * ({@link IWorkbook.getChanges}), what they replaced from the sheet as it was at the commit before
144
+ * ({@link IWorksheet.ChangeEvent.getPreviousRanges}), and everything else is a read of the settled
145
+ * workbook bounded by what was written.
146
+ */
147
+ export declare function describeDelta(workbook: IWorkbook, commitId?: string, options?: DescribeDeltaOptions): Promise<RunDelta | null>;
148
+ //# sourceMappingURL=describeDelta.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './describeDelta';
2
+ export * from './renderDelta';
3
+ export * from './readRunDelta';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { IWorkbook } from '@sheetxl/sdk';
2
+ import { DescribeDeltaOptions, RunDelta } from './describeDelta';
3
+ /** What {@link readRunDelta} hands a run report. */
4
+ export interface RunDeltaReport {
5
+ /** The delta, JSON-safe; absent when the commit changed no cells or it could not be read. */
6
+ delta?: RunDelta;
7
+ /** The report's lines: the delta rendered, or why it could not be read. */
8
+ markdown?: string;
9
+ }
10
+ /**
11
+ * The delta of a run's commit, as a run report carries it: the structure and its lines.
12
+ *
13
+ * @param workbook The workbook the run committed to, settled.
14
+ * @param commitId The run's commit; nothing is read without one (a run that wrote nothing).
15
+ *
16
+ * @remarks
17
+ * Never throws. The run has already committed, and a delta that cannot be read must not turn a
18
+ * write that landed into a reported failure, so the reason is reported in its place.
19
+ */
20
+ export declare function readRunDelta(workbook: IWorkbook, commitId: string | undefined, options?: DescribeDeltaOptions): Promise<RunDeltaReport>;
21
+ //# sourceMappingURL=readRunDelta.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { RunDelta } from './describeDelta';
2
+ /**
3
+ * Renders a {@link RunDelta} as the lines a run report appends.
4
+ *
5
+ * @remarks
6
+ * One line per fact, labeled, so a reader scans the labels: what was written and what it
7
+ * replaced, the formulas with their results, what moved, what reads the write, the errors, and
8
+ * what sits over it that is not a cell.
9
+ *
10
+ * @example
11
+ * ```
12
+ * Changed: Sheet1!H7:H38 — 32 formulas, 0 populated cells replaced
13
+ * Sheet1!H7:H38 =B7*C7 → 12, 15, 18 … 90 (32 cells)
14
+ * Structure: Sheet1!5:7 rows inserted
15
+ * Dependents: 212 cells on 2 sheets — Sheet1!K7:K38, Summary!B4:B9
16
+ * Errors: Sheet1!K9:K12 #VALUE! (4)
17
+ * ```
18
+ */
19
+ export declare function renderDelta(delta: RunDelta): string;
20
+ //# sourceMappingURL=renderDelta.d.ts.map
@@ -15,7 +15,7 @@ import { ICell, Scalar } from '@sheetxl/sdk';
15
15
  *
16
16
  * ---
17
17
  *
18
- * **Quarantine note.** `ICell.getText()` is the only SDK call this module makes, and it is on its
18
+ * **Quarantine note.** `ICell.getText()` is the only SDK text call this module makes, and it is on its
19
19
  * way out — its contract fuses formatting, localization, csv escaping and this encoding into one
20
20
  * method with no clear answer for large values. It is isolated to this file deliberately: when
21
21
  * the SDK splits pure number formatting away from the encoding, exactly one file changes and no
@@ -35,14 +35,26 @@ export declare namespace CellEncoding {
35
35
  */
36
36
  readonly Display: "display";
37
37
  /**
38
- * The cell as the formula bar shows it — full precision, number formatting stripped.
38
+ * The stored scalar — what `getValue()` returns, with no number format applied.
39
39
  *
40
40
  * @remarks
41
- * `1234.5678` where {@link Mode.Display | display} shows `$1,234.57`. Dates stay dates
42
- * rather than decaying to serials, so the result is still searchable rather than merely
43
- * lossless.
41
+ * `1234.5678` where {@link Mode.Display | display} shows `$1,234.57`, `0.04` where it shows
42
+ * `4%`, and a date as its serial. A reader wants one of two things: what the grid shows, or
43
+ * what a formula computes with. There is deliberately no layer in between — the formula
44
+ * bar's text (`4%` at full precision, dates kept) is the stored scalar restyled by the
45
+ * format's category, and both of those are already reported.
44
46
  */
45
47
  readonly Value: "value";
48
+ /**
49
+ * The formula text where the cell has a formula (`=SUM(B2:B9)`), else its stored
50
+ * {@link Mode.Value | value}.
51
+ *
52
+ * @remarks
53
+ * Excel's Show Formulas view: for reading a block's logic as a grid. The inputs read as the
54
+ * scalars the formulas compute with — `0.25`, not `25%`; a date as its serial. The text carries
55
+ * its leading `=`, as the formula bar shows it.
56
+ */
57
+ readonly Formula: "formula";
46
58
  };
47
59
  type Mode = typeof Mode[keyof typeof Mode];
48
60
  /**
@@ -137,8 +149,8 @@ export declare function encodeCell(cell: ICell, mode: CellEncoding.Mode): CellEn
137
149
  * The counterpart to {@link encodeCell} for the stateless value layer (`IRange`, `Scalar[][]`),
138
150
  * where there is no cell to ask for text and therefore **no number format to apply**. That is
139
151
  * the whole difference: `0.04` encodes as `0.04` here and as `4%` through a cell that formats
140
- * it. There is consequently no `mode` — the two modes differ only by how much formatting they
141
- * apply, and here there is none to strip.
152
+ * it. There is consequently no `mode` — this is what {@link CellEncoding.Mode.Value} produces
153
+ * for a cell, and the only form a bare value has.
142
154
  *
143
155
  * Everything above formatting is identical, because it is the same contract: the `'` prefix on
144
156
  * strings, `TRUE`/`FALSE`, error labels, blank elision.