@jsb188/mday 1.1.10 → 1.1.12

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 (210) hide show
  1. package/package.json +140 -54
  2. package/src/constants/agentMemory.ts +123 -0
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +10 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +236 -0
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +21 -21
  10. package/src/constants/dataTableFieldTypes.generated.ts +59 -0
  11. package/src/constants/docAccess.ts +33 -0
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +125 -7
  14. package/src/constants/fieldDoc.ts +104 -0
  15. package/src/constants/graphqlReactivity.ts +196 -0
  16. package/src/constants/integration.ts +8 -9
  17. package/src/constants/log.ts +14 -408
  18. package/src/constants/logDisplay/README.md +88 -0
  19. package/src/constants/logDisplay/defaults.ts +39 -0
  20. package/src/constants/logDisplay/index.ts +27 -0
  21. package/src/constants/logDisplay/operations/arable.ts +16 -0
  22. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  23. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  24. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  25. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  26. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  27. package/src/constants/logTaxonomy.generated.ts +2207 -0
  28. package/src/constants/noteDoc.ts +77 -0
  29. package/src/constants/organization.ts +18 -21
  30. package/src/constants/pageRoute.ts +23 -0
  31. package/src/constants/qrCode.ts +30 -0
  32. package/src/constants/sheet.ts +126 -14
  33. package/src/constants/sms.ts +18 -0
  34. package/src/constants/square.ts +6 -6
  35. package/src/constants/storage.ts +80 -7
  36. package/src/constants/usage.ts +82 -0
  37. package/src/constants/workflowSteps.ts +60 -0
  38. package/src/schemas/editLogEntry.ts +836 -780
  39. package/src/schemas/inboundContact.ts +60 -55
  40. package/src/schemas/logsQuery.ts +55 -49
  41. package/src/types/account.d.ts +4 -1
  42. package/src/types/agentMemory.d.ts +98 -0
  43. package/src/types/agentNote.d.ts +443 -0
  44. package/src/types/billing.d.ts +537 -0
  45. package/src/types/campaign.d.ts +1533 -0
  46. package/src/types/contact.d.ts +15 -0
  47. package/src/types/csvExport.d.ts +213 -0
  48. package/src/types/dataAnalysis.d.ts +44 -0
  49. package/src/types/dataTable.d.ts +115 -403
  50. package/src/types/definitionElement.d.ts +35 -0
  51. package/src/types/docAccess.d.ts +96 -0
  52. package/src/types/dt.d.ts +257 -0
  53. package/src/types/email.d.ts +184 -24
  54. package/src/types/emailReplyReport.d.ts +76 -0
  55. package/src/types/fieldDoc.d.ts +702 -0
  56. package/src/types/fieldDocContract.d.ts +90 -0
  57. package/src/types/inboundContact.d.ts +10 -1
  58. package/src/types/log.d.ts +254 -295
  59. package/src/types/logDisplay.types.ts +85 -0
  60. package/src/types/organization.d.ts +91 -43
  61. package/src/types/pageRoute.d.ts +48 -0
  62. package/src/types/qrCode.d.ts +96 -0
  63. package/src/types/richText.d.ts +81 -0
  64. package/src/types/sheet.d.ts +678 -129
  65. package/src/types/sms.d.ts +38 -0
  66. package/src/types/storage.d.ts +449 -129
  67. package/src/types/usage.d.ts +106 -0
  68. package/src/types/workflow.d.ts +315 -54
  69. package/src/utils/agentMemory.ts +15 -0
  70. package/src/utils/agentNote.ts +850 -0
  71. package/src/utils/aiChat.ts +43 -0
  72. package/src/utils/aiChatWork.ts +64 -0
  73. package/src/utils/billing.ts +37 -0
  74. package/src/utils/campaign.ts +1174 -0
  75. package/src/utils/campaignAI.ts +72 -0
  76. package/src/utils/campaignAccess.ts +239 -0
  77. package/src/utils/campaignEmail.ts +601 -0
  78. package/src/utils/campaignEmailCompiler.ts +372 -0
  79. package/src/utils/campaignEmailImages.ts +60 -0
  80. package/src/utils/campaignEmailStyles.ts +544 -0
  81. package/src/utils/campaignLifecycle.ts +104 -0
  82. package/src/utils/campaignPreview.ts +285 -0
  83. package/src/utils/contact.ts +50 -0
  84. package/src/utils/csvExport.ts +19 -0
  85. package/src/utils/dataTable.ts +95 -618
  86. package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
  87. package/src/utils/dataTableRelativeDate.ts +447 -0
  88. package/src/utils/definitionElement.ts +84 -0
  89. package/src/utils/docAccess.ts +383 -0
  90. package/src/utils/documentName.ts +53 -0
  91. package/src/utils/email.ts +317 -51
  92. package/src/utils/emailReplyReport.test.ts +187 -0
  93. package/src/utils/emailReplyReport.ts +143 -0
  94. package/src/utils/fieldDoc.ts +157 -0
  95. package/src/utils/fieldDocAnswers.ts +128 -0
  96. package/src/utils/fieldDocDefaults.ts +36 -0
  97. package/src/utils/fieldDocProgram.ts +36 -0
  98. package/src/utils/fieldDocSummary.ts +30 -0
  99. package/src/utils/log.ts +276 -192
  100. package/src/utils/logDisplay.helpers.ts +177 -0
  101. package/src/utils/logDisplay.ts +87 -0
  102. package/src/utils/logRegistryValue.ts +90 -0
  103. package/src/utils/logStoreRead.ts +262 -0
  104. package/src/utils/logTaxonomy.helpers.ts +17 -0
  105. package/src/utils/logTaxonomy.ts +76 -0
  106. package/src/utils/logTaxonomyDisplay.ts +395 -0
  107. package/src/utils/noteDoc.ts +609 -0
  108. package/src/utils/organization.ts +337 -84
  109. package/src/utils/pageRoute.ts +71 -0
  110. package/src/utils/qrCode.helpers.ts +189 -0
  111. package/src/utils/qrCode.test.ts +519 -0
  112. package/src/utils/qrCode.ts +273 -0
  113. package/src/utils/richTextHTML.ts +385 -0
  114. package/src/utils/sheet.ts +199 -107
  115. package/src/utils/sheetAxisMove.ts +616 -0
  116. package/src/utils/sheetBootstrap.ts +1402 -0
  117. package/src/utils/sheetCellLiteral.ts +101 -0
  118. package/src/utils/sheetCommand.ts +358 -0
  119. package/src/utils/sheetDesign.ts +705 -0
  120. package/src/utils/sheetExport.ts +186 -0
  121. package/src/utils/sheetFeatureReference.ts +183 -0
  122. package/src/utils/sheetFormulaArgs.ts +168 -0
  123. package/src/utils/sheetFormulaCompile.ts +475 -0
  124. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  125. package/src/utils/sheetFormulaCriteria.ts +656 -0
  126. package/src/utils/sheetFormulaDate.ts +444 -0
  127. package/src/utils/sheetFormulaEvaluation.ts +899 -0
  128. package/src/utils/sheetFormulaEvaluator.ts +997 -0
  129. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  130. package/src/utils/sheetFormulaLogical.ts +116 -0
  131. package/src/utils/sheetFormulaLookup.ts +488 -0
  132. package/src/utils/sheetFormulaMath.ts +48 -0
  133. package/src/utils/sheetFormulaParser.ts +729 -0
  134. package/src/utils/sheetFormulaRange.ts +330 -0
  135. package/src/utils/sheetFormulaReference.ts +703 -0
  136. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  137. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  138. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  139. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  140. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  141. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  142. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  143. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  144. package/src/utils/sheetFormulaText.ts +430 -0
  145. package/src/utils/sheetJournal.ts +200 -0
  146. package/src/utils/sheetNumberFormat.ts +1012 -0
  147. package/src/utils/sheetPreview.ts +68 -0
  148. package/src/utils/sheetSequence.ts +118 -0
  149. package/src/utils/sheetSnapshot.ts +739 -0
  150. package/src/utils/sheetStructureEdit.ts +914 -0
  151. package/src/utils/sheetStructureReferences.ts +389 -0
  152. package/src/utils/square.ts +22 -12
  153. package/src/utils/storage.ts +198 -0
  154. package/src/utils/table-route.ts +127 -11
  155. package/src/utils/time.ts +12 -0
  156. package/src/utils/workflow.ts +334 -40
  157. package/src/utils/workflowLogFingerprint.ts +302 -0
  158. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  159. package/src/utils/workflowProgress.ts +280 -0
  160. package/src/utils/workflowTriggers.ts +61 -0
  161. package/tests/agentNote.test.ts +395 -0
  162. package/tests/campaignAI.test.ts +119 -0
  163. package/tests/campaignAccess.test.ts +239 -0
  164. package/tests/campaignEmail.test.ts +441 -0
  165. package/tests/campaignLifecycle.test.ts +134 -0
  166. package/tests/campaignPublication.test.ts +309 -0
  167. package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
  168. package/tests/dataTableRelativeDate.test.ts +412 -0
  169. package/tests/docAccess.test.ts +525 -0
  170. package/tests/editLogEntry.test.ts +112 -0
  171. package/tests/email.test.ts +39 -0
  172. package/tests/fieldDocProgram.test.ts +114 -0
  173. package/tests/logDisplay.fixtures.ts +67 -0
  174. package/tests/logDisplay.test.ts +227 -0
  175. package/tests/noteDoc.test.ts +514 -0
  176. package/tests/richTextHTML.test.ts +185 -0
  177. package/tests/sheetAxisMove.test.ts +352 -0
  178. package/tests/sheetBootstrap.test.ts +1967 -0
  179. package/tests/sheetFeatureReference.test.ts +22 -0
  180. package/tests/sheetFormulaCriteria.test.ts +269 -0
  181. package/tests/sheetFormulaEvaluator.test.ts +468 -0
  182. package/tests/sheetFormulaFunctions.test.ts +538 -0
  183. package/tests/sheetFormulaLanguage.test.ts +361 -0
  184. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  185. package/tests/sheetFormulaParity.test.ts +188 -0
  186. package/tests/sheetFormulaRange.test.ts +167 -0
  187. package/tests/sheetFormulaReference.test.ts +78 -0
  188. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  189. package/tests/sheetFormulaTextDate.test.ts +512 -0
  190. package/tests/sheetSequence.test.ts +22 -0
  191. package/tests/sheetSnapshot.test.ts +134 -0
  192. package/tests/sheetStructureEdit.test.ts +537 -0
  193. package/tests/sheetStructureReferences.test.ts +589 -0
  194. package/tests/workflowLifecycleStatus.test.ts +60 -0
  195. package/tests/workflowLogFingerprint.test.ts +203 -0
  196. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  197. package/tests/workflowProgress.test.ts +180 -0
  198. package/tests/workflowTriggers.test.ts +29 -0
  199. package/tsconfig.json +10 -10
  200. package/vitest.config.ts +8 -0
  201. package/src/constants/log-activityTexts.ts +0 -235
  202. package/src/constants/product.ts +0 -42
  203. package/src/constants/report.ts +0 -44
  204. package/src/schemas/organization.ts +0 -65
  205. package/src/schemas/productsQuery.ts +0 -53
  206. package/src/schemas/reportsQuery.ts +0 -20
  207. package/src/types/product.d.ts +0 -84
  208. package/src/types/report.d.ts +0 -290
  209. package/src/utils/product-calEvent.ts +0 -455
  210. package/src/utils/report.ts +0 -158
@@ -1,20 +1,217 @@
1
1
  import type {
2
- SHEET_CELL_SOURCE_TYPE_ENUMS,
3
- SHEET_REGION_CONFLICT_POLICY_ENUMS,
4
- SHEET_REGION_TYPE_ENUMS,
2
+ GRID_ITEM_SORT_ENUMS,
3
+ SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS,
4
+ SHEET_CELL_TEXT_ALIGN_ENUMS,
5
+ SHEET_CELL_TEXT_WRAP_ENUMS,
6
+ SHEET_CELL_VALUE_TYPE_ENUMS,
7
+ SHEET_CELL_VERTICAL_ALIGN_ENUMS,
8
+ SHEET_EXPORT_FORMAT_ENUMS,
9
+ SHEET_STRUCTURE_OPERATION_ENUMS,
5
10
  } from '../constants/sheet.ts';
11
+ import type { SheetFormulaASTNode } from '../utils/sheetFormulaSyntax.ts';
12
+ import type { SheetComputedCellPayload } from '../utils/sheetJournal.ts';
13
+ import type { DocAccessBaseObj } from './docAccess.d.ts';
14
+
15
+ /* Explicit authored scalar interpretation; null retains ordinary automatic input parsing. */
16
+ export type SheetCellLiteralType = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATETIME';
17
+
18
+ export type SheetCellTextAlignEnum = (typeof SHEET_CELL_TEXT_ALIGN_ENUMS)[number];
19
+ export type SheetCellTextWrapEnum = (typeof SHEET_CELL_TEXT_WRAP_ENUMS)[number];
20
+ export type SheetCellVerticalAlignEnum = (typeof SHEET_CELL_VERTICAL_ALIGN_ENUMS)[number];
21
+
22
+ export type SheetStructureOperationEnum = (typeof SHEET_STRUCTURE_OPERATION_ENUMS)[number];
23
+ export type SheetCellValueTypeEnum = (typeof SHEET_CELL_VALUE_TYPE_ENUMS)[number];
24
+ export type SheetCellNumberFormatTypeEnum = (typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number];
25
+ export type GridItemSortEnum = (typeof GRID_ITEM_SORT_ENUMS)[number];
26
+ export type SheetExportFormatEnum = (typeof SHEET_EXPORT_FORMAT_ENUMS)[number];
27
+ export type SheetFormulaReferenceKind = 'SHEET_CELL' | 'SHEET_RANGE';
28
+ export type SheetFormulaReferenceStatusEnum = 'READY' | 'LOADING' | 'ERROR' | 'NOT_FOUND';
29
+
30
+ /* Durable Sheet command lifecycle returned by mutations and acknowledgements. */
31
+ export type SheetCommandStatusEnum = 'COMMITTED' | 'REPLAYED' | 'CONFLICTED';
32
+
33
+ /* Client-side lifecycle while a durable command is waiting for authority. */
34
+ export type SheetClientCommandStatusEnum = 'PENDING' | 'IN_FLIGHT' | SheetCommandStatusEnum | 'FAILED';
35
+
36
+ /* Design entity addressed by one property-level design command intent. */
37
+ export type SheetDesignOperationTargetType =
38
+ | 'COLUMN'
39
+ | 'ROW'
40
+ | 'GRID'
41
+ | 'DEFAULT_CELL_STYLE'
42
+ | 'DEFAULT_CELL_FORMAT'
43
+ | 'NAMED_RANGE'
44
+ | 'MERGED_RANGE'
45
+ | 'METADATA';
46
+
47
+ /* Mutation requested for one canonical design target/property. */
48
+ export type SheetDesignOperationType = 'SET_PROPERTY' | 'DELETE_PROPERTY' | 'UPSERT_ENTITY' | 'DELETE_ENTITY';
49
+
50
+ /* Client intent deliberately excludes `before`; the server captures authority. */
51
+ export interface SheetDesignCommandIntent {
52
+ operation: SheetDesignOperationType;
53
+ property?: string | null;
54
+ targetKey: string;
55
+ targetType: SheetDesignOperationTargetType;
56
+ value?: unknown;
57
+ }
58
+
59
+ /* Sparse UI design delta converted to keyed command intents before transport. */
60
+ export interface SheetDesignPatchInput {
61
+ columns?: string | null;
62
+ defaultCellFormat?: string | null;
63
+ defaultCellStyle?: SheetCellStyleObj | null;
64
+ grid?: SheetGridDesignGQL | null;
65
+ metadata?: string | null;
66
+ namedRanges?: SheetNamedRangeObj[] | null;
67
+ rows?: string | null;
68
+ }
69
+
70
+ /* Ordered mutation family accepted by one atomic compound Sheet command. */
71
+ export type SheetCompoundCommandFamily = 'CELLS' | 'DESIGN';
72
+
73
+ /* Cell intent embedded in an atomic compound Sheet command. */
74
+ export interface SheetCompoundCellEditInput {
75
+ cell: {
76
+ columnIndex: number;
77
+ rowIndex: number;
78
+ format?: string | null;
79
+ note?: string | null;
80
+ rawInput?: string | null;
81
+ literalType?: SheetCellLiteralType | null;
82
+
83
+ style?: SheetCellStyleObj | null;
84
+ value?: string | null;
85
+ };
86
+ clear?: boolean | null;
87
+ }
6
88
 
7
- export type SheetCellSourceTypeEnum = typeof SHEET_CELL_SOURCE_TYPE_ENUMS[number];
8
- export type SheetRegionTypeEnum = typeof SHEET_REGION_TYPE_ENUMS[number];
9
- export type SheetRegionConflictPolicyEnum = typeof SHEET_REGION_CONFLICT_POLICY_ENUMS[number];
89
+ /*
90
+ * One reusable, serialized authority condition evaluated before a Sheet
91
+ * command mutates any target. More condition kinds can extend this union.
92
+ */
93
+ export type SheetCommandPrecondition = {
94
+ baseDesignRevision: SheetJournalSeq;
95
+ baseRevision: SheetJournalSeq;
96
+
97
+ kind: 'CELL_TARGETS_UNCHANGED';
98
+ sheetCells: SheetCompoundCellEditInput[];
99
+ };
100
+
101
+ /*
102
+ * One ordered compound component. Optional GraphQL fields are intentionally
103
+ * represented as a discriminated union in shared application code.
104
+ */
105
+ export type SheetCompoundCommandOperationInput =
106
+ | {
107
+ family: 'CELLS';
108
+ cells: SheetCompoundCellEditInput[];
109
+ }
110
+ | {
111
+ family: 'DESIGN';
112
+ designOperations: SheetDesignCommandIntent[];
113
+ };
114
+
115
+ /* Durable command family of one Sheet command (GraphQL enum SheetCommandType). */
116
+ export type SheetCommandTypeEnum = 'EDIT_CELLS' | 'EDIT_DESIGN' | 'EDIT_COMPOUND' | 'EDIT_STRUCTURE' | 'MOVE_AXIS' | 'UNDO' | 'REDO';
117
+
118
+ /* Compact semantic row/column permutation accepted by MOVE_AXIS commands. */
119
+ export interface SheetAxisMoveCommandInput {
120
+ axis: 'COLUMN' | 'ROW';
121
+ sourceEndIndex: number;
122
+ sourceStartIndex: number;
123
+ targetStartIndex: number;
124
+ }
10
125
 
11
- export type SheetCellValue =
12
- | string
13
- | number
14
- | boolean
15
- | null
16
- | Record<string, any>
17
- | any[];
126
+ /*
127
+ * One command of a sealed Sheet command envelope (wire contract v4, DESIGN
128
+ * §1.1). Base revisions are the client's applied cursors of the tab at seal
129
+ * time; `recordUndo: false` marks a command the server keeps no undo record
130
+ * for. The server validates which optional payload belongs to the family.
131
+ */
132
+ export interface SheetCommandInput {
133
+ axisMove?: SheetAxisMoveCommandInput | null;
134
+ baseDesignRevision: SheetJournalSeqInput;
135
+ baseRevision: SheetJournalSeqInput;
136
+ cells?: SheetCompoundCellEditInput[] | null;
137
+ commandId: string;
138
+ commandType: SheetCommandTypeEnum;
139
+ confirmDestructive?: boolean | null;
140
+ compoundOperations?: SheetCompoundCommandOperationInput[] | null;
141
+
142
+ designOperations?: SheetDesignCommandIntent[] | null;
143
+ precondition?: SheetCommandPrecondition | null;
144
+ recordUndo?: boolean | null;
145
+ sheetTabId: string | number | bigint;
146
+ structureIndex?: number | null;
147
+ structureOperation?: SheetStructureOperationEnum | null;
148
+ targetCommandId?: string | null;
149
+ }
150
+
151
+ /*
152
+ * One sealed command envelope: a random idempotency key, the per-document
153
+ * client id and its strictly increasing sequence, and the sessionStorage
154
+ * session that scopes undo (DESIGN §0 D2).
155
+ */
156
+ export interface SheetCommandEnvelopeInput {
157
+ contractVersion: 4;
158
+ clientId: string;
159
+ clientSeq: number;
160
+ commands: SheetCommandInput[];
161
+ envelopeId: string;
162
+ sessionId: string;
163
+ }
164
+
165
+ /* Authoritative operation persisted after the server captures before/after state. */
166
+ export interface SheetStoredDesignOperation extends Omit<SheetDesignCommandIntent, 'value'> {
167
+ after?: unknown;
168
+ before?: unknown;
169
+ commandId: string;
170
+ designRevision: SheetJournalSeq;
171
+ operationIndex: number;
172
+ }
173
+
174
+ export type SheetCellValue = string | number | boolean | null | Record<string, any> | any[];
175
+
176
+ export type SheetCellBorderStyleValue = 'solid' | 'dashed' | 'dotted' | 'double';
177
+
178
+ export interface SheetCellStyleObj {
179
+ fontSize?: number | null;
180
+ textColor?: string | null;
181
+ fillColor?: string | null;
182
+ textWrap?: SheetCellTextWrapEnum | null;
183
+ textAlign?: SheetCellTextAlignEnum | null;
184
+ verticalAlign?: SheetCellVerticalAlignEnum | null;
185
+ disableMarkdown?: boolean | null;
186
+ bold?: boolean | null;
187
+ italic?: boolean | null;
188
+ underline?: boolean | null;
189
+ strikethrough?: boolean | null;
190
+ borderTopWidth?: number | null;
191
+ borderTopColor?: string | null;
192
+ borderTopStyle?: SheetCellBorderStyleValue | null;
193
+ borderRightWidth?: number | null;
194
+ borderRightColor?: string | null;
195
+ borderRightStyle?: SheetCellBorderStyleValue | null;
196
+ borderBottomWidth?: number | null;
197
+ borderBottomColor?: string | null;
198
+ borderBottomStyle?: SheetCellBorderStyleValue | null;
199
+ borderLeftWidth?: number | null;
200
+ borderLeftColor?: string | null;
201
+ borderLeftStyle?: SheetCellBorderStyleValue | null;
202
+ }
203
+
204
+ export interface SheetCellNumberFormatObj {
205
+ type: SheetCellNumberFormatTypeEnum;
206
+ /* Google-Sheets-style pattern; presets resolve from type, CUSTOM requires it */
207
+ pattern?: string | null;
208
+ /* ISO 4217 code used to resolve the currency symbol in currency-family presets */
209
+ currency?: string | null;
210
+ }
211
+
212
+ export interface SheetCellFormatObj {
213
+ numberFormat?: SheetCellNumberFormatObj | null;
214
+ }
18
215
 
19
216
  export interface SheetGridDesignObj {
20
217
  rowCount: number;
@@ -27,13 +224,20 @@ export interface SheetAxisDesignObj {
27
224
  width?: number | null;
28
225
  height?: number | null;
29
226
  hidden?: boolean | null;
30
- style?: Record<string, any> | null;
31
- format?: Record<string, any> | null;
227
+ style?: SheetCellStyleObj | null;
228
+ format?: SheetCellFormatObj | null;
32
229
  metadata?: Record<string, any> | null;
33
230
  }
34
231
 
35
232
  export interface SheetNamedRangeObj {
36
- name: string;
233
+ name?: string | null;
234
+ startRowIndex: number;
235
+ startColumnIndex: number;
236
+ endRowIndex: number;
237
+ endColumnIndex: number;
238
+ }
239
+
240
+ export interface SheetMergedRangeObj {
37
241
  startRowIndex: number;
38
242
  startColumnIndex: number;
39
243
  endRowIndex: number;
@@ -45,19 +249,90 @@ export interface SheetDesignObj {
45
249
  grid: SheetGridDesignObj;
46
250
  columns?: Record<string, SheetAxisDesignObj>;
47
251
  rows?: Record<string, SheetAxisDesignObj>;
48
- defaultCellStyle?: Record<string, any>;
49
- defaultCellFormat?: Record<string, any>;
252
+ defaultCellStyle?: SheetCellStyleObj;
253
+ defaultCellFormat?: SheetCellFormatObj;
50
254
  namedRanges?: SheetNamedRangeObj[];
51
255
  metadata?: Record<string, any>;
52
256
  }
53
257
 
258
+ export type SheetEditorObj = Partial<{
259
+ textColors: string[];
260
+ fillColors: string[];
261
+ }>;
262
+
263
+ export interface SheetFormulaReferenceObj {
264
+ id?: string | null;
265
+ kind: SheetFormulaReferenceKind;
266
+ text: string;
267
+ status?: SheetFormulaReferenceStatusEnum | null;
268
+ sheetName?: string | null;
269
+ sheetTabId?: number | bigint | string | null;
270
+ rowIndex?: number | null;
271
+ columnIndex?: number | null;
272
+ columnLabel?: string | null;
273
+ startRowIndex?: number | null;
274
+ startColumnIndex?: number | null;
275
+ endRowIndex?: number | null;
276
+ endColumnIndex?: number | null;
277
+
278
+ value?: SheetCellValue;
279
+ textValue?: string | null;
280
+ numberValue?: number | null;
281
+ booleanValue?: boolean | null;
282
+ dateValue?: Date | string | null;
283
+ datetimeValue?: Date | string | null;
284
+ error?: SheetFormulaErrorObj | null;
285
+ cells?: SheetCellData[] | SheetCellGQL[] | null;
286
+ }
287
+
288
+ export interface SheetFormulaErrorObj {
289
+ code: string;
290
+ message: string;
291
+ }
292
+
54
293
  export interface SheetFormulaObj {
55
294
  version: number;
56
- kind: string;
295
+ engine: string;
296
+ text: string;
297
+ references?: SheetFormulaReferenceObj[];
298
+ error?: SheetFormulaErrorObj | null;
299
+ }
300
+
301
+ export interface SheetCompiledFormulaDiagnosticObj {
302
+ code: string;
303
+ message: string;
304
+ sheetName?: string | null;
305
+ }
306
+
307
+ export interface SheetCompiledFormulaCellReferenceObj {
308
+ rowIndex: number;
309
+ columnIndex: number;
310
+ sheetName?: string | null;
311
+ sheetTabId?: number | bigint | string | null;
312
+ status: SheetFormulaReferenceStatusEnum;
313
+ }
314
+
315
+ export interface SheetCompiledFormulaRangeReferenceObj {
316
+ startRowIndex: number;
317
+ startColumnIndex: number;
318
+ endRowIndex: number;
319
+ endColumnIndex: number;
320
+ sheetName?: string | null;
321
+ sheetTabId?: number | bigint | string | null;
322
+ status: SheetFormulaReferenceStatusEnum;
323
+ }
324
+
325
+ export interface SheetCompiledFormulaObj {
326
+ version: number;
57
327
  text: string;
58
- dataTableName?: string | null;
59
- rowIdentifier?: string | null;
60
- cellKey?: string | null;
328
+ volatile: boolean;
329
+ cells: SheetCompiledFormulaCellReferenceObj[];
330
+ ranges: SheetCompiledFormulaRangeReferenceObj[];
331
+
332
+ diagnostics: SheetCompiledFormulaDiagnosticObj[];
333
+ /* Stored parse tree for current compile-cache evaluation. It is null on a
334
+ * parse failure; consumers reparse canonical formula text on a cache miss. */
335
+ ast?: SheetFormulaASTNode | null;
61
336
  }
62
337
 
63
338
  export interface SheetData {
@@ -69,8 +344,29 @@ export interface SheetData {
69
344
  title: string;
70
345
  description?: string | null;
71
346
  position: number;
347
+ editor?: SheetEditorObj | null;
348
+ access?: DocAccessBaseObj | null;
349
+ deletedAt?: Date | string | null;
350
+ hiddenByJobId?: number | bigint | null;
351
+ accessEpoch?: number | bigint;
352
+ manifestRevision?: SheetJournalSeq | bigint;
353
+ createdAt: Date;
354
+ updatedAt: Date;
355
+ }
356
+
357
+ export interface SheetTabData {
358
+ __table: 'sheet_tabs';
359
+
360
+ id: number | bigint;
361
+ organizationId: number | bigint;
362
+ sheetId: number | bigint;
363
+ name: string;
364
+ position: number;
365
+ hidden: boolean;
72
366
  design: SheetDesignObj;
73
- active: boolean;
367
+ cellsRevision: SheetJournalSeq | bigint;
368
+ designRevision: SheetJournalSeq | bigint;
369
+ hiddenByJobId?: number | bigint | null;
74
370
  createdAt: Date;
75
371
  updatedAt: Date;
76
372
  }
@@ -81,77 +377,34 @@ export interface SheetCellData {
81
377
  id: number | bigint | string;
82
378
  organizationId: number | bigint;
83
379
  sheetId: number | bigint;
380
+ sheetTabId: number | bigint;
84
381
  rowIndex: number;
85
382
  columnIndex: number;
86
383
  rawInput?: string | null;
384
+ literalType?: SheetCellLiteralType | null;
385
+
386
+ formulaText?: string | null;
387
+ compiledFormula?: SheetCompiledFormulaObj | null;
87
388
  value?: SheetCellValue;
389
+ formulaValue?: SheetCellValue;
88
390
  textValue?: string | null;
89
391
  numberValue?: number | null;
90
392
  booleanValue?: boolean | null;
91
393
  dateValue?: Date | string | null;
92
394
  datetimeValue?: Date | string | null;
395
+ errorCode?: string | null;
396
+ errorMessage?: string | null;
397
+ computedAt?: Date | string | null;
398
+ revision: number | bigint;
399
+ volatile?: boolean;
93
400
  formula?: SheetFormulaObj | null;
94
- style?: Record<string, any> | null;
401
+ style?: SheetCellStyleObj | null;
95
402
  format?: Record<string, any> | null;
96
403
  note?: string | null;
97
- sourceType: SheetCellSourceTypeEnum;
98
- regionId?: number | bigint | null;
99
- region?: SheetCellRegionSourceObj | null;
100
- createdAt: Date;
101
- updatedAt: Date;
102
- }
103
404
 
104
- export interface SheetRangeData {
105
- __table: 'sheet_ranges';
405
+ deletedAt?: Date | string | null;
406
+ deletionJobId?: number | bigint | null;
106
407
 
107
- id: number | bigint;
108
- organizationId: number | bigint;
109
- sheetId: number | bigint;
110
- startRowIndex: number;
111
- startColumnIndex: number;
112
- endRowIndex: number;
113
- endColumnIndex: number;
114
- position: number;
115
- style?: Record<string, any> | null;
116
- format?: Record<string, any> | null;
117
- metadata?: Record<string, any> | null;
118
- active: boolean;
119
- createdAt: Date;
120
- updatedAt: Date;
121
- }
122
-
123
- export interface SheetRegionSourceObj {
124
- type: 'DATA_TABLE';
125
- dataTableId: number | bigint | string;
126
- viewId?: string | null;
127
- }
128
-
129
- export interface SheetRegionColumnObj {
130
- sourceCellKey: string;
131
- label?: string | null;
132
- width?: number | null;
133
- }
134
-
135
- export interface SheetRegionOptionsObj {
136
- conflictPolicy?: SheetRegionConflictPolicyEnum | null;
137
- includeHeaderRow?: boolean | null;
138
- }
139
-
140
- export interface SheetRegionData {
141
- __table: 'sheet_regions';
142
-
143
- id: number | bigint;
144
- organizationId: number | bigint;
145
- sheetId: number | bigint;
146
- type: SheetRegionTypeEnum;
147
- startRowIndex: number;
148
- startColumnIndex: number;
149
- sourceDataTableId?: number | bigint | null;
150
- sourceViewId?: string | null;
151
- source: SheetRegionSourceObj;
152
- columns: SheetRegionColumnObj[];
153
- options: SheetRegionOptionsObj;
154
- active: boolean;
155
408
  createdAt: Date;
156
409
  updatedAt: Date;
157
410
  }
@@ -163,12 +416,6 @@ export interface SheetGridViewportObj {
163
416
  columnCount: number;
164
417
  }
165
418
 
166
- export interface SheetCellRegionSourceObj {
167
- regionId?: number | bigint | string | null;
168
- sourceRowId?: number | bigint | string | null;
169
- sourceCellKey?: string | null;
170
- }
171
-
172
419
  export interface SheetGridRowObj {
173
420
  rowIndex: number;
174
421
  }
@@ -180,12 +427,10 @@ export interface SheetGridPageInfoObj {
180
427
 
181
428
  export interface SheetGridObj {
182
429
  id: number | bigint;
183
- sheet: SheetData;
184
430
  viewport: SheetGridViewportObj;
185
431
  rows: SheetGridRowObj[];
186
432
  cells: SheetCellData[];
187
- ranges: SheetRangeData[];
188
- regions: SheetRegionData[];
433
+
189
434
  pageInfo: SheetGridPageInfoObj;
190
435
  }
191
436
 
@@ -196,103 +441,407 @@ export interface SheetGridDesignGQL {
196
441
  frozenColumns?: number | null;
197
442
  }
198
443
 
444
+ /* Canonical on-wire representation for sheet_tabs.cellsRevision and journal seq. */
445
+ export type SheetJournalSeq = string;
446
+
447
+ /* Internal database callers may supply bigint; wire callers use decimal strings. */
448
+ export type SheetJournalSeqInput = SheetJournalSeq | bigint | null | undefined;
449
+
199
450
  export interface SheetDesignGQL {
200
451
  id?: string | null;
201
452
  version?: number | null;
202
453
  grid?: SheetGridDesignGQL | null;
203
454
  columns?: string | null;
204
455
  rows?: string | null;
205
- defaultCellStyle?: string | null;
456
+ defaultCellStyle?: SheetCellStyleObj | null;
206
457
  defaultCellFormat?: string | null;
207
458
  namedRanges?: SheetNamedRangeObj[];
208
459
  metadata?: string | null;
209
460
  }
210
461
 
462
+ export type SheetEditorGQL = Partial<{
463
+ textColors: string[];
464
+ fillColors: string[];
465
+ }>;
466
+
467
+ export interface SheetAccessInfoGQL {
468
+ sheetId?: string | null;
469
+ organizationId?: string | null;
470
+ canView?: boolean | null;
471
+ canEdit?: boolean | null;
472
+ signInRequired?: boolean | null;
473
+ }
474
+
475
+ export type SheetBootstrapMode = 'SNAPSHOT' | 'DELTA';
476
+ export type SheetBootstrapStatus = 'DENIED' | 'READY' | 'RETRY' | 'UNAVAILABLE';
477
+ export type SheetReplicaSyncReason =
478
+ | 'FORMULA_DEPENDENCY'
479
+ | 'INITIAL'
480
+ | 'MANIFEST_REFRESH'
481
+ | 'PERSISTED_RESTORE'
482
+ | 'REALTIME_GAP'
483
+ | 'SELECTION';
484
+
485
+ export interface SheetReplicaSyncRequirement {
486
+ minimumCellsRevision?: SheetJournalSeqInput;
487
+ minimumDesignRevision?: SheetJournalSeqInput;
488
+ requireSnapshot?: boolean;
489
+ }
490
+
491
+ export interface SheetTabSummaryGQL {
492
+ id?: string | null;
493
+ name?: string | null;
494
+ position?: number | null;
495
+ hidden?: boolean | null;
496
+ currentSeq?: SheetJournalSeq | null;
497
+ referencedTabIds?: string[] | null;
498
+ updatedAt?: string | null;
499
+ }
500
+
501
+ /* Versioned workbook/tab catalog delivered by bootstrap and realtime. */
502
+ export interface SheetManifestGQL {
503
+ id: string;
504
+ manifestRevision: SheetJournalSeq;
505
+ tabs: SheetTabSummaryGQL[];
506
+ }
507
+
508
+ export interface SheetBootstrapSnapshotGQL {
509
+ seq?: SheetJournalSeq | null;
510
+ encodingVersion?: number | null;
511
+ viewport?: SheetGridViewportObj | null;
512
+ payload?: string | null;
513
+ checksum?: string | null;
514
+ cellCount?: number | null;
515
+ payloadBytes?: string | null;
516
+ createdAt?: string | null;
517
+ }
518
+
519
+ export interface SheetTabChangeGQL {
520
+ causationId?: string | null;
521
+ commandId?: string | null;
522
+ commandType?: string | null;
523
+ sheetTabId?: string | null;
524
+ seq?: SheetJournalSeq | null;
525
+ kind?: string | null;
526
+ payload?: string | null;
527
+ sessionId?: string | null;
528
+ createdAt?: string | null;
529
+ }
530
+
531
+ export interface SheetRealtimeTabWatermark {
532
+ currentSeq: SheetJournalSeq;
533
+ designRevision: SheetJournalSeq;
534
+ sheetTabId: string;
535
+ }
536
+
537
+ export interface SheetRealtimeWatermarks {
538
+ manifestRevision: SheetJournalSeq;
539
+ tabs: SheetRealtimeTabWatermark[];
540
+ }
541
+
211
542
  export interface SheetGQL {
543
+ __deleted?: boolean;
544
+
212
545
  id?: string | null;
546
+ cursor?: string | null;
213
547
  organizationId?: string | null;
214
548
  name?: string | null;
215
549
  title?: string | null;
216
550
  description?: string | null;
217
551
  position?: number | null;
552
+ editor?: SheetEditorGQL | null;
553
+ access?: DocAccessBaseObj | null;
554
+ deletedAt?: string | null;
555
+ /* Monotonic workbook/tab catalog revision serialized as BigInt text. */
556
+ manifestRevision?: SheetJournalSeq;
557
+ tabs?: SheetTabGQL[];
558
+ /* Mutation-only acknowledgement for an already-committed structure opId. */
559
+ structureCommandReplayed?: boolean | null;
560
+ createdAt?: string | null;
561
+ updatedAt?: string | null;
562
+ }
563
+
564
+ export interface SheetTabMutationResultGQL {
565
+ changed: boolean;
566
+ commandId: string;
567
+ deletedSheetTabId?: string | null;
568
+ manifestRevision: SheetJournalSeq;
569
+ replayed: boolean;
570
+ tab?: SheetTabGQL | null;
571
+ tabs: SheetTabGQL[];
572
+ }
573
+
574
+ export interface SheetTabGQL {
575
+ __deleted?: boolean;
576
+
577
+ id?: string | null;
578
+ organizationId?: string | null;
579
+ sheetId?: string | null;
580
+ name?: string | null;
581
+ position?: number | null;
582
+ hidden?: boolean | null;
218
583
  design?: SheetDesignGQL | null;
219
- active?: boolean | null;
584
+ /* BigInt is serialized as a canonical base-10 string. */
585
+ cellsRevision?: SheetJournalSeq;
586
+ /* Monotonic revision for property-level design operations. */
587
+ designRevision?: SheetJournalSeq;
220
588
  createdAt?: string | null;
221
589
  updatedAt?: string | null;
222
590
  }
223
591
 
592
+ /*
593
+ * Internal, token-authorized first-tab payload for a browser screenshot.
594
+ */
595
+ export interface OverallSheetPreviewCaptureObj {
596
+ sheetId: string;
597
+ sheetTabId: string;
598
+ revision: string;
599
+ timeZone: string | null;
600
+ sheetTab: SheetTabGQL;
601
+ cells: SheetCellGQL[];
602
+ viewport: SheetGridViewportObj;
603
+ }
604
+
605
+ export interface SheetBootstrapGQL {
606
+ access: SheetAccessInfoGQL;
607
+ contractVersion: number;
608
+ realtimeToken?: string | null;
609
+ status: SheetBootstrapStatus;
610
+ unavailableReason?: string | null;
611
+ sheet?: SheetGQL | null;
612
+ tabs?: SheetTabSummaryGQL[] | null;
613
+ selectedTab?: SheetTabGQL | null;
614
+ mode?: SheetBootstrapMode | null;
615
+ currentSeq?: SheetJournalSeq | null;
616
+ servedViewport?: SheetGridViewportObj | null;
617
+ snapshot?: SheetBootstrapSnapshotGQL | null;
618
+ changes?: SheetTabChangeGQL[] | null;
619
+ /*
620
+ * SNAPSHOT answers to a request with sinceSeq: the STRUCTURE rows (their op
621
+ * only) in (sinceSeq, snapshot.seq] the image absorbed; every such row when
622
+ * topologyComplete is true, none when false; both null otherwise.
623
+ */
624
+ topologyChanges?: SheetTabChangeGQL[] | null;
625
+ topologyComplete?: boolean | null;
626
+ }
627
+
628
+ export type SheetTabBootstrapGQL = Omit<SheetBootstrapGQL, 'sheet' | 'tabs'> & {
629
+ sheet?: never;
630
+ tabs?: never;
631
+ };
632
+
633
+ /* Freshly signed capabilities from openSheet's authorization, without workbook data. */
634
+ export interface SheetRealtimeCapabilityGQL {
635
+ access: SheetAccessInfoGQL;
636
+ status: SheetBootstrapStatus;
637
+ unavailableReason?: string | null;
638
+ realtimeToken?: string | null;
639
+ }
640
+
224
641
  export interface SheetCellGQL {
225
642
  id?: string | null;
226
643
  organizationId?: string | null;
227
644
  sheetId?: string | null;
645
+ sheetTabId?: string | null;
228
646
  rowIndex?: number | null;
229
647
  columnIndex?: number | null;
230
648
  rawInput?: string | null;
649
+ literalType?: SheetCellLiteralType | null;
650
+
651
+ formulaText?: string | null;
652
+ compiledFormula?: SheetCompiledFormulaObj | null;
231
653
  value?: string | null;
654
+ formulaValue?: SheetCellValue;
232
655
  textValue?: string | null;
233
656
  numberValue?: number | null;
234
657
  booleanValue?: boolean | null;
235
658
  dateValue?: string | null;
236
659
  datetimeValue?: string | null;
660
+ errorCode?: string | null;
661
+ errorMessage?: string | null;
662
+ computedAt?: string | null;
663
+ /* BIGINT is serialized as a canonical base-10 string. */
664
+ revision?: SheetJournalSeq;
237
665
  formula?: SheetFormulaObj | null;
238
- style?: string | null;
666
+ style?: SheetCellStyleObj | null;
239
667
  format?: string | null;
240
668
  note?: string | null;
241
- sourceType?: SheetCellSourceTypeEnum | null;
242
- regionId?: string | null;
243
- region?: SheetCellRegionSourceObj | null;
669
+
244
670
  createdAt?: string | null;
245
671
  updatedAt?: string | null;
246
672
  }
247
673
 
674
+ /* Server-authored Sheet cell payload with mandatory tab ownership and revision. */
675
+ export type SheetAuthoritativeCellGQL = SheetCellGQL & {
676
+ id: string;
677
+ rowIndex: number;
678
+ columnIndex: number;
679
+ revision: SheetJournalSeq;
680
+ sheetTabId: string;
681
+ };
682
+
683
+ /* Derived write-back item (computed fields only) delivered by cellsComputedDelta. */
684
+ export type SheetComputedCellGQL = SheetComputedCellPayload;
685
+
248
686
  export interface SheetGridRowGQL {
249
687
  rowIndex: number;
250
688
  }
251
689
 
252
- export interface SheetGridPageInfoGQL {
253
- hasMoreRows?: boolean | null;
254
- lastContentRowIndex?: number | null;
690
+ export interface SheetViewStructureOpGQL {
691
+ at?: number | null;
692
+
693
+ index: number;
694
+ opId?: string | null;
695
+ operation: string;
696
+ structureSeq?: SheetJournalSeq | null;
255
697
  }
256
698
 
257
- export interface SheetRangeGQL {
258
- id?: string | null;
259
- organizationId?: string | null;
260
- sheetId?: string | null;
261
- startRowIndex?: number | null;
262
- startColumnIndex?: number | null;
263
- endRowIndex?: number | null;
264
- endColumnIndex?: number | null;
265
- position?: number | null;
266
- style?: string | null;
267
- format?: string | null;
268
- metadata?: string | null;
269
- active?: boolean | null;
270
- createdAt?: string | null;
271
- updatedAt?: string | null;
699
+ /*
700
+ * Ordered revision-fenced row/column permutation. Consumers apply it only
701
+ * when both local base revisions match and otherwise use authoritative
702
+ * cells/design or snapshot recovery from the same patch.
703
+ */
704
+ export interface SheetAxisMoveDeltaGQL extends SheetAxisMoveCommandInput {
705
+ baseDesignRevision: SheetJournalSeq;
706
+ baseRevision: SheetJournalSeq;
707
+ commandId: string;
708
+ resultDesignRevision: SheetJournalSeq;
709
+ resultRevision: SheetJournalSeq;
710
+ schemaVersion: 1;
711
+ sheetTabId: string;
272
712
  }
273
713
 
274
- export interface SheetRegionGQL {
275
- id?: string | null;
276
- organizationId?: string | null;
277
- sheetId?: string | null;
278
- type?: SheetRegionTypeEnum | null;
279
- startRowIndex?: number | null;
280
- startColumnIndex?: number | null;
281
- source?: SheetRegionSourceObj | null;
282
- columns?: SheetRegionColumnObj[];
283
- options?: SheetRegionOptionsObj | null;
284
- active?: boolean | null;
285
- createdAt?: string | null;
286
- updatedAt?: string | null;
714
+ export interface SheetViewGQL {
715
+ id: string;
716
+ sheetId: string;
717
+ sheetTabId: string;
718
+ axisMoveOps?: SheetAxisMoveDeltaGQL[] | null;
719
+ /* Per-tab monotonic counter bumped on every cell-content change; carried
720
+ * on realtime cells payloads so clients can detect dropped messages */
721
+ cellsRevision: SheetJournalSeq;
722
+ /* Latest design CAS revision serialized under the same BigInt contract. */
723
+ designRevision: SheetJournalSeq;
724
+ /* One-shot journal range on realtime patches. */
725
+ fromSeq?: SheetJournalSeq | null;
726
+ toSeq?: SheetJournalSeq | null;
727
+ /* Chunk metadata: every chunk of one packet shares fromSeq/toSeq (v3). */
728
+ chunkIndex?: number | null;
729
+ chunkCount?: number | null;
730
+ originActorAccountId?: string | null;
731
+ /* The origin envelope's per-document clientId (v3); null for agents. */
732
+ originClientId?: string | null;
733
+
734
+ requiresSnapshot?: boolean | null;
735
+ /* One-shot authoritative settlement for a durable command envelope. */
736
+ commandBatchAck?: SheetCommandBatchAckGQL | null;
737
+ sheetTab?: SheetTabGQL | null;
738
+ cells?: SheetAuthoritativeCellGQL[];
739
+ cellsDelta?: SheetAuthoritativeCellGQL[] | null;
740
+ /* Derived cells converged by the server; apply after cellsDelta by coordinate + id. */
741
+ cellsComputedDelta?: SheetComputedCellGQL[] | null;
742
+ deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
743
+
744
+ structureOps?: SheetViewStructureOpGQL[] | null;
745
+ pageInfo?: SheetGridPageInfoGQL | null;
746
+ }
747
+
748
+ export interface SheetDeletedCellCoordGQL {
749
+ rowIndex: number;
750
+ columnIndex: number;
751
+ id: string | null;
752
+ revision: SheetJournalSeq | null;
753
+ sheetTabId: string;
754
+ }
755
+
756
+ /* Per-tab revisions allocated by one durable Sheet command. */
757
+ export interface SheetCommandTabRevisionGQL {
758
+ sheetTabId: string;
759
+ baseRevision: SheetJournalSeq;
760
+ resultRevision: SheetJournalSeq;
761
+ baseDesignRevision: SheetJournalSeq;
762
+ resultDesignRevision: SheetJournalSeq;
763
+ journalFromSeq: SheetJournalSeq | null;
764
+ journalToSeq: SheetJournalSeq | null;
765
+ }
766
+
767
+ /* Structured optimistic-concurrency conflict returned without losing local work. */
768
+ export interface SheetCommandConflictGQL {
769
+ code: string;
770
+ historyBoundary?: boolean | null;
771
+ invalidatesTargetCommandId?: string | null;
772
+ message?: string | null;
773
+ targetType?: string | null;
774
+ targetKey?: string | null;
775
+ }
776
+
777
+ /* Shared mutation result for edit, undo, and redo command operations. */
778
+ export interface SheetCommandResultGQL {
779
+ commandId: string;
780
+ commandStatus: SheetCommandStatusEnum;
781
+ replayed: boolean;
782
+ axisMoveOps?: SheetAxisMoveDeltaGQL[] | null;
783
+ tabRevisions: SheetCommandTabRevisionGQL[];
784
+ affectedCells?: SheetAuthoritativeCellGQL[] | null;
785
+
786
+ affectedTabs?: SheetTabGQL[] | null;
787
+ deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
788
+ conflict?: SheetCommandConflictGQL | null;
789
+ requiresSnapshot?: boolean | null;
790
+ /* Whether the server kept an undo record for this command (contract v4). */
791
+ undoRecorded?: boolean | null;
792
+ }
793
+
794
+ /* One authoritative item settlement returned by a Sheet command batch. */
795
+ export interface SheetCommandBatchSettlementGQL {
796
+ commandId: string;
797
+ errorCode: string | null;
798
+ result: SheetCommandResultGQL | null;
799
+ }
800
+
801
+ /*
802
+ * One command envelope's settlement carried by realtime and HTTP patches
803
+ * (wire contract v4). Peers retire outbox items and drafts whose ids appear
804
+ * in committedCommandIds or noWriteCommandIds.
805
+ */
806
+ export interface SheetCommandBatchAckGQL {
807
+ actorAccountId: string;
808
+ envelopeId: string;
809
+ /* The envelope's per-document client id; null for agent and script envelopes */
810
+ clientId: string | null;
811
+ /* Items the envelope committed or replayed (never CONFLICTED) */
812
+ committedCommandIds: string[];
813
+ /* Committed items whose every tab revision wrote no journal row (no-op writes) */
814
+ noWriteCommandIds: string[];
815
+ }
816
+
817
+ /*
818
+ * Ordered settlements and final authority returned by one Sheet command
819
+ * envelope (wire contract v4). `replayed` marks the stored receipt of an
820
+ * envelope that had already committed.
821
+ */
822
+ export interface SheetCommandBatchResultGQL {
823
+ actorAccountId: string;
824
+ envelopeId: string;
825
+ clientId: string;
826
+ clientSeq: number;
827
+ replayed: boolean;
828
+ committedCommandIds: string[];
829
+ noWriteCommandIds: string[];
830
+ /* One settlement per command, in envelope order */
831
+ settlements: SheetCommandBatchSettlementGQL[];
832
+ authoritativePatches: SheetViewGQL[];
833
+ }
834
+
835
+ export interface SheetGridPageInfoGQL {
836
+ hasMoreRows?: boolean | null;
837
+ lastContentRowIndex?: number | null;
287
838
  }
288
839
 
289
840
  export interface SheetGridGQL {
290
841
  id?: string | null;
291
- sheet?: SheetGQL | null;
292
842
  viewport?: SheetGridViewportObj | null;
293
843
  rows?: SheetGridRowGQL[];
294
844
  cells?: SheetCellGQL[];
295
- ranges?: SheetRangeGQL[];
296
- regions?: SheetRegionGQL[];
845
+
297
846
  pageInfo?: SheetGridPageInfoGQL | null;
298
847
  }