@jsb188/mday 1.1.10 → 1.1.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 (119) hide show
  1. package/package.json +105 -54
  2. package/src/constants/agentDoc.ts +12 -0
  3. package/src/constants/agentMemory.ts +154 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/campaign.ts +127 -0
  6. package/src/constants/dataTable.ts +35 -9
  7. package/src/constants/dataTableFieldTypes.generated.ts +63 -0
  8. package/src/constants/docAccess.ts +32 -0
  9. package/src/constants/email.ts +20 -4
  10. package/src/constants/fieldDoc.ts +34 -0
  11. package/src/constants/graphqlReactivity.ts +113 -0
  12. package/src/constants/integration.ts +8 -9
  13. package/src/constants/log.ts +7 -410
  14. package/src/constants/logActivityGroupColors.generated.ts +19 -0
  15. package/src/constants/logTaxonomy.generated.ts +1103 -0
  16. package/src/constants/noteDoc.ts +77 -0
  17. package/src/constants/organization.ts +13 -15
  18. package/src/constants/pageRoute.ts +23 -0
  19. package/src/constants/schedule.ts +220 -0
  20. package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
  21. package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
  22. package/src/constants/sheet.ts +154 -6
  23. package/src/constants/sheetRegionSources.generated.ts +578 -0
  24. package/src/constants/square.ts +6 -6
  25. package/src/constants/storage.ts +56 -7
  26. package/src/constants/usage.ts +79 -0
  27. package/src/schemas/editLogEntry.ts +1010 -777
  28. package/src/schemas/fieldDocsQuery.ts +12 -0
  29. package/src/schemas/inboundContact.ts +60 -55
  30. package/src/schemas/logsQuery.ts +55 -49
  31. package/src/schemas/organization.ts +49 -46
  32. package/src/types/account.d.ts +4 -1
  33. package/src/types/agentDoc.d.ts +64 -0
  34. package/src/types/agentMemory.d.ts +74 -0
  35. package/src/types/campaign.d.ts +683 -0
  36. package/src/types/dataTable.d.ts +175 -256
  37. package/src/types/docAccess.d.ts +96 -0
  38. package/src/types/email.d.ts +83 -12
  39. package/src/types/fieldDoc.d.ts +273 -0
  40. package/src/types/inboundContact.d.ts +2 -1
  41. package/src/types/log.d.ts +209 -341
  42. package/src/types/noteDoc.d.ts +86 -0
  43. package/src/types/organization.d.ts +83 -40
  44. package/src/types/pageRoute.d.ts +48 -0
  45. package/src/types/schedule.d.ts +391 -0
  46. package/src/types/sheet.d.ts +862 -30
  47. package/src/types/storage.d.ts +206 -125
  48. package/src/types/usage.d.ts +106 -0
  49. package/src/types/workflow.d.ts +149 -18
  50. package/src/utils/agentDoc.ts +109 -0
  51. package/src/utils/aiChat.ts +26 -0
  52. package/src/utils/campaign.ts +741 -0
  53. package/src/utils/campaignFormEditor.ts +871 -0
  54. package/src/utils/dataTable.ts +425 -410
  55. package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
  56. package/src/utils/dataTableRealtimeAuthority.ts +209 -0
  57. package/src/utils/dataTableRealtimeSelection.ts +134 -0
  58. package/src/utils/dataTableRowDocument.ts +508 -0
  59. package/src/utils/dataTableSource.ts +230 -0
  60. package/src/utils/docAccess.ts +383 -0
  61. package/src/utils/documentName.ts +53 -0
  62. package/src/utils/email.ts +112 -53
  63. package/src/utils/fieldDoc.ts +113 -0
  64. package/src/utils/log.ts +169 -176
  65. package/src/utils/logRegistryValue.ts +90 -0
  66. package/src/utils/logStoreRead.ts +266 -0
  67. package/src/utils/logTaxonomy.ts +76 -0
  68. package/src/utils/logTaxonomyDisplay.ts +439 -0
  69. package/src/utils/noteDoc.ts +827 -0
  70. package/src/utils/organization.ts +510 -91
  71. package/src/utils/pageRoute.ts +71 -0
  72. package/src/utils/schedule.ts +799 -0
  73. package/src/utils/scheduleEvaluation.ts +1994 -0
  74. package/src/utils/scheduleICS.ts +246 -0
  75. package/src/utils/scheduleRuleTemplates.ts +188 -0
  76. package/src/utils/sheet.ts +4842 -39
  77. package/src/utils/sheetAxisMove.ts +830 -0
  78. package/src/utils/sheetBootstrap.ts +1769 -0
  79. package/src/utils/sheetCommand.ts +423 -0
  80. package/src/utils/sheetExport.ts +238 -0
  81. package/src/utils/sheetFormulaEvaluation.ts +914 -0
  82. package/src/utils/sheetFormulaEvaluator.ts +852 -0
  83. package/src/utils/sheetJournal.ts +78 -0
  84. package/src/utils/sheetNumberFormat.ts +1211 -0
  85. package/src/utils/sheetRegion.ts +374 -0
  86. package/src/utils/sheetRegionFilter.ts +1259 -0
  87. package/src/utils/sheetRegionSourceRegistry.ts +594 -0
  88. package/src/utils/sheetSequence.ts +148 -0
  89. package/src/utils/sheetSnapshot.ts +992 -0
  90. package/src/utils/sheetStructureEdit.ts +1284 -0
  91. package/src/utils/square.ts +22 -12
  92. package/src/utils/storage.ts +152 -0
  93. package/src/utils/table-route.ts +127 -11
  94. package/src/utils/workflow.ts +191 -23
  95. package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
  96. package/tests/docAccess.test.ts +525 -0
  97. package/tests/editLogEntry.test.ts +112 -0
  98. package/tests/noteDoc.test.ts +669 -0
  99. package/tests/schedule.test.ts +693 -0
  100. package/tests/scheduleEvaluation.test.ts +1970 -0
  101. package/tests/scheduleICS.test.ts +208 -0
  102. package/tests/scheduleRuleTemplates.test.ts +176 -0
  103. package/tests/scheduleSweepInvariants.test.ts +428 -0
  104. package/tests/sheetAxisMove.test.ts +343 -0
  105. package/tests/sheetFormulaEvaluator.test.ts +575 -0
  106. package/tests/sheetRegionFilter.test.ts +1135 -0
  107. package/tests/sheetSequence.test.ts +41 -0
  108. package/tests/sheetStructureEdit.test.ts +82 -0
  109. package/tsconfig.json +10 -10
  110. package/vitest.config.ts +8 -0
  111. package/src/constants/log-activityTexts.ts +0 -235
  112. package/src/constants/product.ts +0 -42
  113. package/src/constants/report.ts +0 -44
  114. package/src/schemas/productsQuery.ts +0 -53
  115. package/src/schemas/reportsQuery.ts +0 -20
  116. package/src/types/product.d.ts +0 -84
  117. package/src/types/report.d.ts +0 -290
  118. package/src/utils/product-calEvent.ts +0 -455
  119. package/src/utils/report.ts +0 -158
@@ -1,12 +1,310 @@
1
1
  import type {
2
+ GRID_ITEM_SORT_ENUMS,
3
+ SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS,
2
4
  SHEET_CELL_SOURCE_TYPE_ENUMS,
5
+ SHEET_CELL_TEXT_ALIGN_ENUMS,
6
+ SHEET_CELL_TEXT_WRAP_ENUMS,
7
+ SHEET_CELL_VALUE_TYPE_ENUMS,
8
+ SHEET_CELL_VERTICAL_ALIGN_ENUMS,
9
+ SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS,
10
+ SHEET_EXPORT_FORMAT_ENUMS,
3
11
  SHEET_REGION_CONFLICT_POLICY_ENUMS,
12
+ SHEET_REGION_PROJECTION_STATUS_ENUMS,
13
+ SHEET_REGION_SOURCE_FILTER_COMBINATOR_ENUMS,
14
+ SHEET_REGION_SOURCE_FILTER_OPERATOR_ENUMS,
15
+ SHEET_REGION_SOURCE_SORT_DIRECTION_ENUMS,
16
+ SHEET_REGION_SOURCE_TYPE_ENUMS,
4
17
  SHEET_REGION_TYPE_ENUMS,
18
+ SHEET_STRUCTURE_OPERATION_ENUMS,
5
19
  } from '../constants/sheet.ts';
20
+ import type { SheetFormulaASTNode } from '../utils/sheet.ts';
21
+ import type {
22
+ DataTableDesignGQL,
23
+ DataTableFieldTypeEnum,
24
+ } from './dataTable.d.ts';
25
+ import type { DocAccessBaseObj } from './docAccess.d.ts';
26
+
27
+ export type SheetCellSourceTypeEnum =
28
+ (typeof SHEET_CELL_SOURCE_TYPE_ENUMS)[number];
29
+ export type SheetCellTextAlignEnum =
30
+ (typeof SHEET_CELL_TEXT_ALIGN_ENUMS)[number];
31
+ export type SheetCellTextWrapEnum = (typeof SHEET_CELL_TEXT_WRAP_ENUMS)[number];
32
+ export type SheetCellVerticalAlignEnum =
33
+ (typeof SHEET_CELL_VERTICAL_ALIGN_ENUMS)[number];
34
+ export type SheetRegionTypeEnum = (typeof SHEET_REGION_TYPE_ENUMS)[number];
35
+ export type SheetRegionProjectionStatusEnum =
36
+ (typeof SHEET_REGION_PROJECTION_STATUS_ENUMS)[number];
37
+ export type SheetRegionSourceTypeEnum =
38
+ (typeof SHEET_REGION_SOURCE_TYPE_ENUMS)[number];
39
+ export type SheetRegionConflictPolicyEnum =
40
+ (typeof SHEET_REGION_CONFLICT_POLICY_ENUMS)[number];
41
+ export type SheetRegionSourceFilterCombinatorEnum =
42
+ (typeof SHEET_REGION_SOURCE_FILTER_COMBINATOR_ENUMS)[number];
43
+ export type SheetRegionSourceFilterOperatorEnum =
44
+ (typeof SHEET_REGION_SOURCE_FILTER_OPERATOR_ENUMS)[number];
45
+ export type SheetRegionSourceSortDirectionEnum =
46
+ (typeof SHEET_REGION_SOURCE_SORT_DIRECTION_ENUMS)[number];
47
+ export type SheetStructureOperationEnum =
48
+ (typeof SHEET_STRUCTURE_OPERATION_ENUMS)[number];
49
+ export type SheetCellValueTypeEnum =
50
+ (typeof SHEET_CELL_VALUE_TYPE_ENUMS)[number];
51
+ export type SheetCellNumberFormatTypeEnum =
52
+ (typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number];
53
+ export type GridItemSortEnum = (typeof GRID_ITEM_SORT_ENUMS)[number];
54
+ export type SheetExportFormatEnum = (typeof SHEET_EXPORT_FORMAT_ENUMS)[number];
55
+ export type SheetFormulaReferenceKind =
56
+ | 'SHEET_CELL'
57
+ | 'SHEET_RANGE'
58
+ | 'DATA_TABLE_CELL'
59
+ | 'DATA_TABLE_QUERY_CELL';
60
+ export type SheetFormulaReferenceStatusEnum =
61
+ | 'READY'
62
+ | 'LOADING'
63
+ | 'ERROR'
64
+ | 'NOT_FOUND';
65
+ export type SheetRegionColumnKind = 'DATA_TABLE_CELL' | 'FORMULA';
66
+ export type SheetCustomRegionSourceColumnFormulaValueSourceEnum =
67
+ (typeof SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS)[number];
68
+
69
+ /* Durable Sheet command lifecycle returned by mutations and acknowledgements. */
70
+ export type SheetCommandStatusEnum = 'COMMITTED' | 'REPLAYED' | 'CONFLICTED';
71
+
72
+ /* Client-side lifecycle while a durable command is waiting for authority. */
73
+ export type SheetClientCommandStatusEnum =
74
+ | 'PENDING'
75
+ | 'IN_FLIGHT'
76
+ | SheetCommandStatusEnum
77
+ | 'FAILED';
78
+
79
+ /* Design entity addressed by one property-level design command intent. */
80
+ export type SheetDesignOperationTargetType =
81
+ | 'COLUMN'
82
+ | 'ROW'
83
+ | 'GRID'
84
+ | 'DEFAULT_CELL_STYLE'
85
+ | 'DEFAULT_CELL_FORMAT'
86
+ | 'NAMED_RANGE'
87
+ | 'MERGED_RANGE'
88
+ | 'METADATA';
89
+
90
+ /* Mutation requested for one canonical design target/property. */
91
+ export type SheetDesignOperationType =
92
+ | 'SET_PROPERTY'
93
+ | 'DELETE_PROPERTY'
94
+ | 'UPSERT_ENTITY'
95
+ | 'DELETE_ENTITY';
96
+
97
+ /* Client intent deliberately excludes `before`; the server captures authority. */
98
+ export interface SheetDesignCommandIntent {
99
+ operation: SheetDesignOperationType;
100
+ property?: string | null;
101
+ targetKey: string;
102
+ targetType: SheetDesignOperationTargetType;
103
+ value?: unknown;
104
+ }
105
+
106
+ /* Sparse UI design delta converted to keyed command intents before transport. */
107
+ export interface SheetDesignPatchInput {
108
+ columns?: string | null;
109
+ defaultCellFormat?: string | null;
110
+ defaultCellStyle?: SheetCellStyleObj | null;
111
+ grid?: SheetGridDesignGQL | null;
112
+ metadata?: string | null;
113
+ namedRanges?: SheetNamedRangeObj[] | null;
114
+ rows?: string | null;
115
+ }
116
+
117
+ /* One durable Sheet range mutation intent. */
118
+ export type SheetRangeCommandOperationEnum = 'UPSERT' | 'DELETE';
119
+
120
+ /* One durable Sheet region definition mutation intent. */
121
+ export type SheetRegionCommandOperationEnum = 'UPSERT' | 'DELETE';
122
+
123
+ /* Ordered mutation family accepted by one atomic compound Sheet command. */
124
+ export type SheetCompoundCommandFamily =
125
+ | 'CELLS'
126
+ | 'DESIGN'
127
+ | 'DATA_TABLE_CELLS'
128
+ | 'REGION';
129
+
130
+ /* Cell intent embedded in an atomic compound Sheet command. */
131
+ export interface SheetCompoundCellEditInput {
132
+ cell: {
133
+ columnIndex: number;
134
+ rowIndex: number;
135
+ format?: string | null;
136
+ note?: string | null;
137
+ rawInput?: string | null;
138
+ regionId?: string | number | bigint | null;
139
+ style?: SheetCellStyleObj | null;
140
+ value?: string | null;
141
+ };
142
+ clear?: boolean | null;
143
+ }
144
+
145
+ /* DataTable source-cell intent embedded in an atomic compound command. */
146
+ export interface SheetCompoundDataTableCellInput {
147
+ cellKey: string;
148
+ dataTableRowId: string | number | bigint;
149
+ regionId: string | number | bigint;
150
+ value?: string | null;
151
+ }
152
+
153
+ /* Filter condition accepted by the SheetRegionSourceFilterConditionInput contract. */
154
+ export interface SheetRegionSourceFilterConditionInput {
155
+ booleanValue?: boolean | null;
156
+ cellKey: string;
157
+ dateValue?: string | null;
158
+ datetimeValue?: string | Date | null;
159
+ numberValue?: number | null;
160
+ operator: SheetRegionSourceFilterOperatorEnum;
161
+ textValue?: string | null;
162
+ textValues?: string[] | null;
163
+ }
164
+
165
+ /* Recursive filter group accepted by the SheetRegionSourceFilterInput contract. */
166
+ export interface SheetRegionSourceFilterInput {
167
+ combinator: SheetRegionSourceFilterCombinatorEnum;
168
+ conditions?: SheetRegionSourceFilterConditionInput[] | null;
169
+ groups?: SheetRegionSourceFilterInput[] | null;
170
+ }
171
+
172
+ /* Sort entry accepted by the SheetRegionSourceSortInput contract. */
173
+ export interface SheetRegionSourceSortInput {
174
+ cellKey: string;
175
+ direction: SheetRegionSourceSortDirectionEnum;
176
+ }
177
+
178
+ /* Source definition accepted by the SheetRegionSourceInput contract. */
179
+ export interface SheetRegionSourceInput {
180
+ dataTableId?: number | bigint | string | null;
181
+ filter?: SheetRegionSourceFilterInput | null;
182
+ includeRowIds?: Array<number | bigint | string> | null;
183
+ sort?: SheetRegionSourceSortInput[] | null;
184
+ type: SheetRegionSourceTypeEnum;
185
+ }
186
+
187
+ /* Column definition accepted by the SheetRegionColumnInput contract. */
188
+ export interface SheetRegionColumnInput {
189
+ formulaText?: string | null;
190
+ kind: SheetRegionColumnKind;
191
+ sourceCellKey?: string | null;
192
+ }
193
+
194
+ /* Region definition accepted by the SheetRegionInput contract. */
195
+ export interface SheetCompoundRegionInput {
196
+ active?: boolean | null;
197
+ columns: SheetRegionColumnInput[];
198
+ options?: SheetRegionOptionsObj | null;
199
+ source: SheetRegionSourceInput;
200
+ startColumnIndex: number;
201
+ startRowIndex: number;
202
+ type: SheetRegionTypeEnum;
203
+ }
204
+
205
+ /*
206
+ * One ordered compound component. Optional GraphQL fields are intentionally
207
+ * represented as a discriminated union in shared application code.
208
+ */
209
+ export type SheetCompoundCommandOperationInput =
210
+ | {
211
+ family: 'CELLS';
212
+ cells: SheetCompoundCellEditInput[];
213
+ }
214
+ | {
215
+ family: 'DESIGN';
216
+ designOperations: SheetDesignCommandIntent[];
217
+ }
218
+ | {
219
+ family: 'DATA_TABLE_CELLS';
220
+ dataTableCells: SheetCompoundDataTableCellInput[];
221
+ dataTableId: string | number | bigint;
222
+ }
223
+ | {
224
+ family: 'REGION';
225
+ regionOperation: SheetRegionCommandOperationEnum;
226
+ region?: SheetCompoundRegionInput | null;
227
+ regionId?: string | number | bigint | null;
228
+ };
229
+
230
+ /* Durable command family accepted by one ordered Sheet command batch item. */
231
+ export type SheetCommandBatchItemTypeEnum =
232
+ | 'EDIT_CELLS'
233
+ | 'EDIT_DESIGN'
234
+ | 'EDIT_DATA_TABLE_CELLS'
235
+ | 'EDIT_COMPOUND'
236
+ | 'EDIT_RANGE'
237
+ | 'MOVE_AXIS'
238
+ | 'UNDO'
239
+ | 'REDO';
240
+
241
+ /* Compact semantic row/column permutation accepted by MOVE_AXIS commands. */
242
+ export interface SheetAxisMoveCommandInput {
243
+ axis: 'COLUMN' | 'ROW';
244
+ sourceEndIndex: number;
245
+ sourceStartIndex: number;
246
+ targetStartIndex: number;
247
+ }
248
+
249
+ /*
250
+ * Pragmatic shared shape of one GraphQL Sheet command batch item. The server
251
+ * validates which optional payload belongs to the selected command family.
252
+ */
253
+ export interface SheetCommandBatchItemInput {
254
+ axisMove?: SheetAxisMoveCommandInput | null;
255
+ baseDesignRevision: SheetJournalSeqInput;
256
+ baseRevision: SheetJournalSeqInput;
257
+ cells?: SheetCompoundCellEditInput[] | null;
258
+ commandId: string;
259
+ commandType: SheetCommandBatchItemTypeEnum;
260
+ compoundOperations?: SheetCompoundCommandOperationInput[] | null;
261
+ dataTableCells?: SheetCompoundDataTableCellInput[] | null;
262
+ dataTableId?: string | number | bigint | null;
263
+ designOperations?: SheetDesignCommandIntent[] | null;
264
+ includeInOperationalHistory?: boolean | null;
265
+ operation?: SheetRangeCommandOperationEnum | null;
266
+ predecessorCommandIds?: string[] | null;
267
+ previewClientId?: string | null;
268
+ previewEnvelopeId?: string | null;
269
+ previewSeq?: number | null;
270
+ previewTargetKeys?: string[] | null;
271
+ range?: SheetRangeInput | null;
272
+ rangeId?: string | number | bigint | null;
273
+ sessionId: string;
274
+ sheetTabId: string | number | bigint;
275
+ targetCommandId?: string | null;
276
+ }
277
+
278
+ /* Canonical input shared by Sheet range command operations. */
279
+ export interface SheetRangeInput {
280
+ endColumnIndex: number;
281
+ endRowIndex: number;
282
+ format?: string | null;
283
+ metadata?: string | null;
284
+ position?: number | null;
285
+ startColumnIndex: number;
286
+ startRowIndex: number;
287
+ style?: SheetCellStyleObj | null;
288
+ }
289
+
290
+ /* Authoritative operation persisted after the server captures before/after state. */
291
+ export interface SheetStoredDesignOperation
292
+ extends Omit<SheetDesignCommandIntent, 'value'> {
293
+ after?: unknown;
294
+ before?: unknown;
295
+ commandId: string;
296
+ designRevision: SheetJournalSeq;
297
+ operationIndex: number;
298
+ }
6
299
 
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];
300
+ export interface SheetCustomRegionSourceColumnObj {
301
+ key: string;
302
+ labelKey: string;
303
+ fieldType?: DataTableFieldTypeEnum | null;
304
+ formulaValueSource?: SheetCustomRegionSourceColumnFormulaValueSourceEnum | null;
305
+ relatedTable?: string | null;
306
+ width: number;
307
+ }
10
308
 
11
309
  export type SheetCellValue =
12
310
  | string
@@ -16,6 +314,50 @@ export type SheetCellValue =
16
314
  | Record<string, any>
17
315
  | any[];
18
316
 
317
+ export type SheetCellBorderStyleValue =
318
+ | 'solid'
319
+ | 'dashed'
320
+ | 'dotted'
321
+ | 'double';
322
+
323
+ export interface SheetCellStyleObj {
324
+ fontSize?: number | null;
325
+ textColor?: string | null;
326
+ fillColor?: string | null;
327
+ textWrap?: SheetCellTextWrapEnum | null;
328
+ textAlign?: SheetCellTextAlignEnum | null;
329
+ verticalAlign?: SheetCellVerticalAlignEnum | null;
330
+ disableMarkdown?: boolean | null;
331
+ bold?: boolean | null;
332
+ italic?: boolean | null;
333
+ underline?: boolean | null;
334
+ strikethrough?: boolean | null;
335
+ borderTopWidth?: number | null;
336
+ borderTopColor?: string | null;
337
+ borderTopStyle?: SheetCellBorderStyleValue | null;
338
+ borderRightWidth?: number | null;
339
+ borderRightColor?: string | null;
340
+ borderRightStyle?: SheetCellBorderStyleValue | null;
341
+ borderBottomWidth?: number | null;
342
+ borderBottomColor?: string | null;
343
+ borderBottomStyle?: SheetCellBorderStyleValue | null;
344
+ borderLeftWidth?: number | null;
345
+ borderLeftColor?: string | null;
346
+ borderLeftStyle?: SheetCellBorderStyleValue | null;
347
+ }
348
+
349
+ export interface SheetCellNumberFormatObj {
350
+ type: SheetCellNumberFormatTypeEnum;
351
+ /* Google-Sheets-style pattern; presets resolve from type, CUSTOM requires it */
352
+ pattern?: string | null;
353
+ /* ISO 4217 code used to resolve the currency symbol in currency-family presets */
354
+ currency?: string | null;
355
+ }
356
+
357
+ export interface SheetCellFormatObj {
358
+ numberFormat?: SheetCellNumberFormatObj | null;
359
+ }
360
+
19
361
  export interface SheetGridDesignObj {
20
362
  rowCount: number;
21
363
  columnCount: number;
@@ -27,13 +369,20 @@ export interface SheetAxisDesignObj {
27
369
  width?: number | null;
28
370
  height?: number | null;
29
371
  hidden?: boolean | null;
30
- style?: Record<string, any> | null;
31
- format?: Record<string, any> | null;
372
+ style?: SheetCellStyleObj | null;
373
+ format?: SheetCellFormatObj | null;
32
374
  metadata?: Record<string, any> | null;
33
375
  }
34
376
 
35
377
  export interface SheetNamedRangeObj {
36
- name: string;
378
+ name?: string | null;
379
+ startRowIndex: number;
380
+ startColumnIndex: number;
381
+ endRowIndex: number;
382
+ endColumnIndex: number;
383
+ }
384
+
385
+ export interface SheetMergedRangeObj {
37
386
  startRowIndex: number;
38
387
  startColumnIndex: number;
39
388
  endRowIndex: number;
@@ -45,19 +394,109 @@ export interface SheetDesignObj {
45
394
  grid: SheetGridDesignObj;
46
395
  columns?: Record<string, SheetAxisDesignObj>;
47
396
  rows?: Record<string, SheetAxisDesignObj>;
48
- defaultCellStyle?: Record<string, any>;
49
- defaultCellFormat?: Record<string, any>;
397
+ defaultCellStyle?: SheetCellStyleObj;
398
+ defaultCellFormat?: SheetCellFormatObj;
50
399
  namedRanges?: SheetNamedRangeObj[];
51
400
  metadata?: Record<string, any>;
52
401
  }
53
402
 
54
- export interface SheetFormulaObj {
55
- version: number;
56
- kind: string;
403
+ export type SheetEditorObj = Partial<{
404
+ textColors: string[];
405
+ fillColors: string[];
406
+ }>;
407
+
408
+ export interface SheetFormulaReferenceObj {
409
+ id?: string | null;
410
+ kind: SheetFormulaReferenceKind;
57
411
  text: string;
412
+ status?: SheetFormulaReferenceStatusEnum | null;
413
+ sheetName?: string | null;
414
+ sheetTabId?: number | bigint | string | null;
415
+ rowIndex?: number | null;
416
+ columnIndex?: number | null;
417
+ columnLabel?: string | null;
418
+ startRowIndex?: number | null;
419
+ startColumnIndex?: number | null;
420
+ endRowIndex?: number | null;
421
+ endColumnIndex?: number | null;
58
422
  dataTableName?: string | null;
59
423
  rowIdentifier?: string | null;
60
424
  cellKey?: string | null;
425
+ value?: SheetCellValue;
426
+ textValue?: string | null;
427
+ numberValue?: number | null;
428
+ booleanValue?: boolean | null;
429
+ dateValue?: Date | string | null;
430
+ datetimeValue?: Date | string | null;
431
+ error?: SheetFormulaErrorObj | null;
432
+ cells?: SheetCellData[] | SheetCellGQL[] | null;
433
+ }
434
+
435
+ export interface SheetFormulaErrorObj {
436
+ code: string;
437
+ message: string;
438
+ }
439
+
440
+ export interface SheetFormulaObj {
441
+ version: number;
442
+ engine: string;
443
+ text: string;
444
+ references?: SheetFormulaReferenceObj[];
445
+ error?: SheetFormulaErrorObj | null;
446
+ }
447
+
448
+ export interface SheetCompiledFormulaDiagnosticObj {
449
+ code: string;
450
+ message: string;
451
+ sheetName?: string | null;
452
+ }
453
+
454
+ export interface SheetCompiledFormulaCellReferenceObj {
455
+ rowIndex: number;
456
+ columnIndex: number;
457
+ sheetName?: string | null;
458
+ sheetTabId?: number | bigint | string | null;
459
+ status: SheetFormulaReferenceStatusEnum;
460
+ }
461
+
462
+ export interface SheetCompiledFormulaRangeReferenceObj {
463
+ startRowIndex: number;
464
+ startColumnIndex: number;
465
+ endRowIndex: number;
466
+ endColumnIndex: number;
467
+ sheetName?: string | null;
468
+ sheetTabId?: number | bigint | string | null;
469
+ status: SheetFormulaReferenceStatusEnum;
470
+ }
471
+
472
+ export interface SheetCompiledFormulaObj {
473
+ version: number;
474
+ text: string;
475
+ volatile: boolean;
476
+ cells: SheetCompiledFormulaCellReferenceObj[];
477
+ ranges: SheetCompiledFormulaRangeReferenceObj[];
478
+ dataTableCells: Array<{
479
+ dataTableName: string;
480
+ cellKey: string;
481
+ rowIdentifier: string | null;
482
+ text: string;
483
+ }>;
484
+ dataTableQueries: Array<{
485
+ dataTableName: string;
486
+ cellKey: string;
487
+ conditions: Array<{
488
+ cellKey: string;
489
+ operator: string;
490
+ isStatic: boolean;
491
+ staticValue: string | number | boolean | null;
492
+ text: string;
493
+ }>;
494
+ text: string;
495
+ }>;
496
+ diagnostics: SheetCompiledFormulaDiagnosticObj[];
497
+ /* Stored parse tree for current compile-cache evaluation. It is null on a
498
+ * parse failure; consumers reparse canonical formula text on a cache miss. */
499
+ ast?: SheetFormulaASTNode | null;
61
500
  }
62
501
 
63
502
  export interface SheetData {
@@ -69,33 +508,76 @@ export interface SheetData {
69
508
  title: string;
70
509
  description?: string | null;
71
510
  position: number;
511
+ editor?: SheetEditorObj | null;
512
+ access?: DocAccessBaseObj | null;
513
+ deletedAt?: Date | string | null;
514
+ hiddenByJobId?: number | bigint | null;
515
+ accessEpoch?: number | bigint;
516
+ createdAt: Date;
517
+ updatedAt: Date;
518
+ }
519
+
520
+ export interface SheetTabData {
521
+ __table: 'sheet_tabs';
522
+
523
+ id: number | bigint;
524
+ organizationId: number | bigint;
525
+ sheetId: number | bigint;
526
+ name: string;
527
+ position: number;
72
528
  design: SheetDesignObj;
73
- active: boolean;
529
+ cellsRevision: SheetJournalSeq | bigint;
530
+ designRevision: SheetJournalSeq | bigint;
531
+ hiddenByJobId?: number | bigint | null;
74
532
  createdAt: Date;
75
533
  updatedAt: Date;
76
534
  }
77
535
 
536
+ export interface SheetCellSourceMetaObj {
537
+ relatedTable?: string | null;
538
+ relatedId?: string | null;
539
+ referenceStatus?: 'ACTIVE' | 'DELETED' | null;
540
+ iconName?: string | null;
541
+ }
542
+
78
543
  export interface SheetCellData {
79
544
  __table: 'sheet_cells';
80
545
 
81
546
  id: number | bigint | string;
82
547
  organizationId: number | bigint;
83
548
  sheetId: number | bigint;
549
+ sheetTabId: number | bigint;
84
550
  rowIndex: number;
85
551
  columnIndex: number;
86
552
  rawInput?: string | null;
553
+ formulaText?: string | null;
554
+ compiledFormula?: SheetCompiledFormulaObj | null;
87
555
  value?: SheetCellValue;
556
+ formulaValue?: SheetCellValue;
88
557
  textValue?: string | null;
89
558
  numberValue?: number | null;
90
559
  booleanValue?: boolean | null;
91
560
  dateValue?: Date | string | null;
92
561
  datetimeValue?: Date | string | null;
562
+ errorCode?: string | null;
563
+ errorMessage?: string | null;
564
+ computedAt?: Date | string | null;
565
+ revision: number | bigint;
566
+ volatile?: boolean;
93
567
  formula?: SheetFormulaObj | null;
94
- style?: Record<string, any> | null;
568
+ style?: SheetCellStyleObj | null;
95
569
  format?: Record<string, any> | null;
96
570
  note?: string | null;
97
571
  sourceType: SheetCellSourceTypeEnum;
98
572
  regionId?: number | bigint | null;
573
+ sourceDataTableRowId?: number | bigint | null;
574
+ sourceRowKey?: string | null;
575
+ sourceCellKey?: string | null;
576
+ /* Stable DATA_TABLE provenance; sourceCellKey remains the display-field key. */
577
+ sourceColumnId?: number | bigint | string | null;
578
+ sourceMeta?: SheetCellSourceMetaObj | null;
579
+ deletedAt?: Date | string | null;
580
+ deletionJobId?: number | bigint | null;
99
581
  region?: SheetCellRegionSourceObj | null;
100
582
  createdAt: Date;
101
583
  updatedAt: Date;
@@ -107,33 +589,69 @@ export interface SheetRangeData {
107
589
  id: number | bigint;
108
590
  organizationId: number | bigint;
109
591
  sheetId: number | bigint;
592
+ sheetTabId: number | bigint;
110
593
  startRowIndex: number;
111
594
  startColumnIndex: number;
112
595
  endRowIndex: number;
113
596
  endColumnIndex: number;
114
597
  position: number;
115
- style?: Record<string, any> | null;
598
+ style?: SheetCellStyleObj | null;
116
599
  format?: Record<string, any> | null;
117
600
  metadata?: Record<string, any> | null;
118
- active: boolean;
119
601
  createdAt: Date;
120
602
  updatedAt: Date;
121
603
  }
122
604
 
123
605
  export interface SheetRegionSourceObj {
124
- type: 'DATA_TABLE';
125
- dataTableId: number | bigint | string;
126
- viewId?: string | null;
606
+ type: SheetRegionSourceTypeEnum;
607
+ /* Stable-column JSON contract version. Present only for physical DATA_TABLE sources. */
608
+ identityVersion?: 1 | null;
609
+ dataTableId?: number | bigint | string | null;
610
+ filter?: SheetRegionSourceFilterGroupObj | null;
611
+ sort?: SheetRegionSourceSortObj[] | null;
612
+ /* Included source row ids for built-in (generated) sources; null/absent inserts every row */
613
+ includeRowIds?: Array<number | bigint | string> | null;
614
+ }
615
+
616
+ export interface SheetRegionSourceFilterGroupObj {
617
+ combinator: SheetRegionSourceFilterCombinatorEnum;
618
+ conditions?: SheetRegionSourceFilterConditionObj[] | null;
619
+ groups?: SheetRegionSourceFilterGroupObj[] | null;
620
+ }
621
+
622
+ export interface SheetRegionSourceFilterConditionObj {
623
+ cellKey: string;
624
+ /* Stable physical column identity paired with the authored/public cellKey. */
625
+ columnId?: number | bigint | string | null;
626
+ operator: SheetRegionSourceFilterOperatorEnum;
627
+ textValue?: string | null;
628
+ textValues?: string[] | null;
629
+ numberValue?: number | null;
630
+ booleanValue?: boolean | null;
631
+ dateValue?: string | null;
632
+ datetimeValue?: string | Date | null;
633
+ }
634
+
635
+ export interface SheetRegionSourceSortObj {
636
+ cellKey: string;
637
+ /* Stable physical column identity paired with the authored/public cellKey. */
638
+ columnId?: number | bigint | string | null;
639
+ direction: SheetRegionSourceSortDirectionEnum;
127
640
  }
128
641
 
129
642
  export interface SheetRegionColumnObj {
130
- sourceCellKey: string;
131
- label?: string | null;
132
- width?: number | null;
643
+ kind: SheetRegionColumnKind;
644
+ sourceCellKey?: string | null;
645
+ /* Stable identity for DATA_TABLE_CELL columns. */
646
+ sourceColumnId?: number | bigint | string | null;
647
+ /* Stable identities referenced by self(...) in a FORMULA column. */
648
+ sourceColumnIds?: Array<number | bigint | string> | null;
649
+ formulaText?: string | null;
133
650
  }
134
651
 
135
652
  export interface SheetRegionOptionsObj {
136
653
  conflictPolicy?: SheetRegionConflictPolicyEnum | null;
654
+ endRowIndex?: number | null;
137
655
  includeHeaderRow?: boolean | null;
138
656
  }
139
657
 
@@ -143,15 +661,20 @@ export interface SheetRegionData {
143
661
  id: number | bigint;
144
662
  organizationId: number | bigint;
145
663
  sheetId: number | bigint;
664
+ sheetTabId: number | bigint;
146
665
  type: SheetRegionTypeEnum;
147
666
  startRowIndex: number;
148
667
  startColumnIndex: number;
149
668
  sourceDataTableId?: number | bigint | null;
150
- sourceViewId?: string | null;
151
669
  source: SheetRegionSourceObj;
152
670
  columns: SheetRegionColumnObj[];
153
671
  options: SheetRegionOptionsObj;
154
672
  active: boolean;
673
+ definitionRevision: number | bigint;
674
+ lastSyncedAt?: Date | string | null;
675
+ projectionRevision?: number | bigint | null;
676
+ projectionStatus: SheetRegionProjectionStatusEnum;
677
+ syncRevision?: number | bigint;
155
678
  createdAt: Date;
156
679
  updatedAt: Date;
157
680
  }
@@ -167,6 +690,7 @@ export interface SheetCellRegionSourceObj {
167
690
  regionId?: number | bigint | string | null;
168
691
  sourceRowId?: number | bigint | string | null;
169
692
  sourceCellKey?: string | null;
693
+ sourceColumnId?: number | bigint | string | null;
170
694
  }
171
695
 
172
696
  export interface SheetGridRowObj {
@@ -180,7 +704,6 @@ export interface SheetGridPageInfoObj {
180
704
 
181
705
  export interface SheetGridObj {
182
706
  id: number | bigint;
183
- sheet: SheetData;
184
707
  viewport: SheetGridViewportObj;
185
708
  rows: SheetGridRowObj[];
186
709
  cells: SheetCellData[];
@@ -196,59 +719,351 @@ export interface SheetGridDesignGQL {
196
719
  frozenColumns?: number | null;
197
720
  }
198
721
 
722
+ /* Canonical on-wire representation for sheet_tabs.cellsRevision and journal seq. */
723
+ export type SheetJournalSeq = string;
724
+
725
+ /* Internal database callers may supply bigint; wire callers use decimal strings. */
726
+ export type SheetJournalSeqInput = SheetJournalSeq | bigint | null | undefined;
727
+
199
728
  export interface SheetDesignGQL {
200
729
  id?: string | null;
201
730
  version?: number | null;
202
731
  grid?: SheetGridDesignGQL | null;
203
732
  columns?: string | null;
204
733
  rows?: string | null;
205
- defaultCellStyle?: string | null;
734
+ defaultCellStyle?: SheetCellStyleObj | null;
206
735
  defaultCellFormat?: string | null;
207
736
  namedRanges?: SheetNamedRangeObj[];
208
737
  metadata?: string | null;
209
738
  }
210
739
 
740
+ export type SheetEditorGQL = Partial<{
741
+ textColors: string[];
742
+ fillColors: string[];
743
+ }>;
744
+
745
+ export interface SheetAccessInfoGQL {
746
+ sheetId?: string | null;
747
+ organizationId?: string | null;
748
+ canView?: boolean | null;
749
+ canEdit?: boolean | null;
750
+ signInRequired?: boolean | null;
751
+ }
752
+
753
+ export type SheetBootstrapMode = 'SNAPSHOT' | 'DELTA';
754
+ export type SheetBootstrapStatus = 'DENIED' | 'READY' | 'RETRY' | 'UNAVAILABLE';
755
+
756
+ export interface SheetTabSummaryGQL {
757
+ id?: string | null;
758
+ name?: string | null;
759
+ position?: number | null;
760
+ currentSeq?: SheetJournalSeq | null;
761
+ referencedTabIds?: string[] | null;
762
+ updatedAt?: string | null;
763
+ }
764
+
765
+ export interface SheetBootstrapSnapshotGQL {
766
+ seq?: SheetJournalSeq | null;
767
+ encodingVersion?: number | null;
768
+ viewport?: SheetGridViewportObj | null;
769
+ payload?: string | null;
770
+ checksum?: string | null;
771
+ cellCount?: number | null;
772
+ payloadBytes?: string | null;
773
+ createdAt?: string | null;
774
+ }
775
+
776
+ export interface SheetTabChangeGQL {
777
+ causationId?: string | null;
778
+ commandId?: string | null;
779
+ commandType?: string | null;
780
+ sheetTabId?: string | null;
781
+ seq?: SheetJournalSeq | null;
782
+ kind?: string | null;
783
+ payload?: string | null;
784
+ sessionId?: string | null;
785
+ createdAt?: string | null;
786
+ }
787
+
788
+ export interface SheetReferencedDataTableSchemaGQL {
789
+ id?: string | null;
790
+ realtimeToken?: string | null;
791
+ name?: string | null;
792
+ title?: string | null;
793
+ design?: DataTableDesignGQL | null;
794
+ updatedAt?: string | null;
795
+ }
796
+
211
797
  export interface SheetGQL {
798
+ __deleted?: boolean;
799
+
212
800
  id?: string | null;
801
+ cursor?: string | null;
213
802
  organizationId?: string | null;
214
803
  name?: string | null;
215
804
  title?: string | null;
216
805
  description?: string | null;
217
806
  position?: number | null;
807
+ editor?: SheetEditorGQL | null;
808
+ access?: DocAccessBaseObj | null;
809
+ deletedAt?: string | null;
810
+ tabs?: SheetTabGQL[];
811
+ /* Mutation-only acknowledgement for an already-committed structure opId. */
812
+ structureCommandReplayed?: boolean | null;
813
+ createdAt?: string | null;
814
+ updatedAt?: string | null;
815
+ }
816
+
817
+ export interface SheetTabGQL {
818
+ __deleted?: boolean;
819
+
820
+ id?: string | null;
821
+ organizationId?: string | null;
822
+ sheetId?: string | null;
823
+ name?: string | null;
824
+ position?: number | null;
218
825
  design?: SheetDesignGQL | null;
219
- active?: boolean | null;
826
+ /* BigInt is serialized as a canonical base-10 string. */
827
+ cellsRevision?: SheetJournalSeq;
828
+ /* Monotonic revision for property-level design operations. */
829
+ designRevision?: SheetJournalSeq;
220
830
  createdAt?: string | null;
221
831
  updatedAt?: string | null;
222
832
  }
223
833
 
834
+ export interface SheetBootstrapGQL {
835
+ access: SheetAccessInfoGQL;
836
+ contractVersion: number;
837
+ realtimeToken?: string | null;
838
+ status: SheetBootstrapStatus;
839
+ unavailableReason?: string | null;
840
+ sheet?: SheetGQL | null;
841
+ tabs?: SheetTabSummaryGQL[] | null;
842
+ selectedTab?: SheetTabGQL | null;
843
+ mode?: SheetBootstrapMode | null;
844
+ currentSeq?: SheetJournalSeq | null;
845
+ servedViewport?: SheetGridViewportObj | null;
846
+ snapshot?: SheetBootstrapSnapshotGQL | null;
847
+ changes?: SheetTabChangeGQL[] | null;
848
+ referencedDataTables?: SheetReferencedDataTableSchemaGQL[] | null;
849
+ }
850
+
851
+ export type SheetTabBootstrapGQL = Omit<SheetBootstrapGQL, 'sheet' | 'tabs'> & {
852
+ sheet?: never;
853
+ tabs?: never;
854
+ };
855
+
224
856
  export interface SheetCellGQL {
225
857
  id?: string | null;
226
858
  organizationId?: string | null;
227
859
  sheetId?: string | null;
860
+ sheetTabId?: string | null;
228
861
  rowIndex?: number | null;
229
862
  columnIndex?: number | null;
230
863
  rawInput?: string | null;
864
+ formulaText?: string | null;
865
+ compiledFormula?: SheetCompiledFormulaObj | null;
231
866
  value?: string | null;
867
+ formulaValue?: SheetCellValue;
232
868
  textValue?: string | null;
233
869
  numberValue?: number | null;
234
870
  booleanValue?: boolean | null;
235
871
  dateValue?: string | null;
236
872
  datetimeValue?: string | null;
873
+ errorCode?: string | null;
874
+ errorMessage?: string | null;
875
+ computedAt?: string | null;
876
+ /* BIGINT is serialized as a canonical base-10 string. */
877
+ revision?: SheetJournalSeq;
237
878
  formula?: SheetFormulaObj | null;
238
- style?: string | null;
879
+ style?: SheetCellStyleObj | null;
239
880
  format?: string | null;
240
881
  note?: string | null;
241
882
  sourceType?: SheetCellSourceTypeEnum | null;
242
883
  regionId?: string | null;
884
+ sourceDataTableRowId?: string | null;
885
+ sourceCellKey?: string | null;
886
+ sourceMeta?: SheetCellSourceMetaObj | null;
243
887
  region?: SheetCellRegionSourceObj | null;
244
888
  createdAt?: string | null;
245
889
  updatedAt?: string | null;
246
890
  }
247
891
 
892
+ /* Server-authored Sheet cell payload with mandatory tab ownership and revision. */
893
+ export type SheetAuthoritativeCellGQL = SheetCellGQL & {
894
+ id: string;
895
+ rowIndex: number;
896
+ columnIndex: number;
897
+ revision: SheetJournalSeq;
898
+ sheetTabId: string;
899
+ };
900
+
248
901
  export interface SheetGridRowGQL {
249
902
  rowIndex: number;
250
903
  }
251
904
 
905
+ export interface SheetViewStructureOpGQL {
906
+ at?: number | null;
907
+ index: number;
908
+ opId?: string | null;
909
+ operation: string;
910
+ structureSeq?: SheetJournalSeq | null;
911
+ }
912
+
913
+ /*
914
+ * Ordered revision-fenced row/column permutation. Consumers apply it only
915
+ * when both local base revisions match and otherwise use authoritative
916
+ * cells/design or snapshot recovery from the same patch.
917
+ */
918
+ export interface SheetAxisMoveDeltaGQL extends SheetAxisMoveCommandInput {
919
+ baseDesignRevision: SheetJournalSeq;
920
+ baseRevision: SheetJournalSeq;
921
+ commandId: string;
922
+ resultDesignRevision: SheetJournalSeq;
923
+ resultRevision: SheetJournalSeq;
924
+ schemaVersion: 1;
925
+ sheetTabId: string;
926
+ }
927
+
928
+ export interface SheetViewGQL {
929
+ id: string;
930
+ sheetId: string;
931
+ sheetTabId: string;
932
+ axisMoveOps?: SheetAxisMoveDeltaGQL[] | null;
933
+ /* Per-tab monotonic counter bumped on every cell-content change; carried
934
+ * on realtime cells payloads so clients can detect dropped messages */
935
+ cellsRevision: SheetJournalSeq;
936
+ /* Latest design CAS revision serialized under the same BigInt contract. */
937
+ designRevision: SheetJournalSeq;
938
+ /* One-shot journal range on realtime patches. */
939
+ fromSeq?: SheetJournalSeq | null;
940
+ toSeq?: SheetJournalSeq | null;
941
+ originActorAccountId?: string | null;
942
+ originClientId?: string | null;
943
+ purgedRegionIds?: string[] | null;
944
+ /* One-shot authoritative region membership patches delivered with command ACKs. */
945
+ regionUpserts?: SheetAuthoritativeRegionGQL[] | null;
946
+ requiresSnapshot?: boolean | null;
947
+ /* One-shot authoritative settlement for a durable Sheet command. */
948
+ commandAck?: SheetCommandAckGQL | null;
949
+ /* One-shot authoritative settlement for a durable command envelope. */
950
+ commandBatchAck?: SheetCommandBatchAckGQL | null;
951
+ sheetTab?: SheetTabGQL | null;
952
+ cells?: SheetAuthoritativeCellGQL[];
953
+ cellsDelta?: SheetAuthoritativeCellGQL[] | null;
954
+ deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
955
+ ranges?: SheetRangeGQL[];
956
+ regions?: SheetAuthoritativeRegionGQL[];
957
+ structureOps?: SheetViewStructureOpGQL[] | null;
958
+ pageInfo?: SheetGridPageInfoGQL | null;
959
+ }
960
+
961
+ export interface SheetDeletedCellCoordGQL {
962
+ rowIndex: number;
963
+ columnIndex: number;
964
+ id: string | null;
965
+ revision: SheetJournalSeq | null;
966
+ sheetTabId: string;
967
+ }
968
+
969
+ /* Per-tab revisions allocated by one durable Sheet command. */
970
+ export interface SheetCommandTabRevisionGQL {
971
+ sheetTabId: string;
972
+ baseRevision: SheetJournalSeq;
973
+ resultRevision: SheetJournalSeq;
974
+ baseDesignRevision: SheetJournalSeq;
975
+ resultDesignRevision: SheetJournalSeq;
976
+ journalFromSeq: SheetJournalSeq | null;
977
+ journalToSeq: SheetJournalSeq | null;
978
+ }
979
+
980
+ /* Structured optimistic-concurrency conflict returned without losing local work. */
981
+ export interface SheetCommandConflictGQL {
982
+ code: string;
983
+ historyBoundary?: boolean | null;
984
+ invalidatesTargetCommandId?: string | null;
985
+ message?: string | null;
986
+ targetType?: string | null;
987
+ targetKey?: string | null;
988
+ }
989
+
990
+ /* Shared mutation result for edit, undo, and redo command operations. */
991
+ export interface SheetCommandResultGQL {
992
+ commandId: string;
993
+ commandStatus: SheetCommandStatusEnum;
994
+ replayed: boolean;
995
+ axisMoveOps?: SheetAxisMoveDeltaGQL[] | null;
996
+ tabRevisions: SheetCommandTabRevisionGQL[];
997
+ affectedCells?: SheetAuthoritativeCellGQL[] | null;
998
+ affectedRegions?: SheetAuthoritativeRegionGQL[] | null;
999
+ affectedTabs?: SheetTabGQL[] | null;
1000
+ deletedCellCoords?: SheetDeletedCellCoordGQL[] | null;
1001
+ conflict?: SheetCommandConflictGQL | null;
1002
+ requiresSnapshot?: boolean | null;
1003
+ }
1004
+
1005
+ /* One authoritative item settlement returned by a Sheet command batch. */
1006
+ export interface SheetCommandBatchSettlementGQL {
1007
+ commandId: string;
1008
+ errorCode: string | null;
1009
+ result: SheetCommandResultGQL | null;
1010
+ }
1011
+
1012
+ /* Durable settlement for one command-owned realtime preview. */
1013
+ export interface SheetCommandPreviewAuthorityGQL {
1014
+ clientId: string;
1015
+ envelopeId: string;
1016
+ previewSeq: SheetJournalSeq;
1017
+ serverSeq: SheetJournalSeq;
1018
+ sheetTabId: string;
1019
+ targetKeys: string[];
1020
+ }
1021
+
1022
+ /* Preview watermark committed by one durable Sheet command envelope. */
1023
+ export interface SheetCommandBatchAckGQL {
1024
+ actorAccountId: string;
1025
+ envelopeId: string;
1026
+ previewAuthorities: SheetCommandPreviewAuthorityGQL[];
1027
+ sourceClientId: string;
1028
+ committedPreviewSeq: SheetJournalSeq;
1029
+ }
1030
+
1031
+ /* Ordered settlements and final authority returned by one Sheet command batch. */
1032
+ export interface SheetCommandBatchResultGQL extends SheetCommandBatchAckGQL {
1033
+ settlements: SheetCommandBatchSettlementGQL[];
1034
+ authoritativePatches: SheetViewGQL[];
1035
+ }
1036
+
1037
+ /* Realtime settlement includes source session identity for exact reconciliation. */
1038
+ export interface SheetCommandAckGQL
1039
+ extends Omit<
1040
+ SheetCommandResultGQL,
1041
+ 'affectedCells' | 'affectedRegions' | 'affectedTabs' | 'deletedCellCoords'
1042
+ > {
1043
+ actorAccountId: string;
1044
+ commandType: string;
1045
+ sessionId: string;
1046
+ }
1047
+
1048
+ export interface SheetOperationalHistoryCommandGQL {
1049
+ axisMove?: SheetAxisMoveCommandInput | null;
1050
+ commandId: string;
1051
+ commandType: string;
1052
+ committedAt: string;
1053
+ resultRevision: SheetJournalSeq;
1054
+ resultDesignRevision: SheetJournalSeq;
1055
+ }
1056
+
1057
+ export interface SheetOperationalHistoryGQL {
1058
+ incompleteBeforeBoundary: boolean;
1059
+ redo: SheetOperationalHistoryCommandGQL[];
1060
+ sessionId: string;
1061
+ sheetId: string;
1062
+ sheetTabId: string;
1063
+ truncated: boolean;
1064
+ undo: SheetOperationalHistoryCommandGQL[];
1065
+ }
1066
+
252
1067
  export interface SheetGridPageInfoGQL {
253
1068
  hasMoreRows?: boolean | null;
254
1069
  lastContentRowIndex?: number | null;
@@ -258,37 +1073,54 @@ export interface SheetRangeGQL {
258
1073
  id?: string | null;
259
1074
  organizationId?: string | null;
260
1075
  sheetId?: string | null;
1076
+ sheetTabId?: string | null;
261
1077
  startRowIndex?: number | null;
262
1078
  startColumnIndex?: number | null;
263
1079
  endRowIndex?: number | null;
264
1080
  endColumnIndex?: number | null;
265
1081
  position?: number | null;
266
- style?: string | null;
1082
+ style?: SheetCellStyleObj | null;
267
1083
  format?: string | null;
268
1084
  metadata?: string | null;
269
- active?: boolean | null;
270
1085
  createdAt?: string | null;
271
1086
  updatedAt?: string | null;
272
1087
  }
273
1088
 
1089
+ export interface SheetRegionBoundsGQL {
1090
+ startRowIndex?: number | null;
1091
+ startColumnIndex?: number | null;
1092
+ endRowIndex?: number | null;
1093
+ endColumnIndex?: number | null;
1094
+ }
1095
+
274
1096
  export interface SheetRegionGQL {
275
1097
  id?: string | null;
276
1098
  organizationId?: string | null;
277
1099
  sheetId?: string | null;
1100
+ sheetTabId?: string | null;
278
1101
  type?: SheetRegionTypeEnum | null;
279
1102
  startRowIndex?: number | null;
280
1103
  startColumnIndex?: number | null;
281
1104
  source?: SheetRegionSourceObj | null;
282
1105
  columns?: SheetRegionColumnObj[];
283
1106
  options?: SheetRegionOptionsObj | null;
284
- active?: boolean | null;
1107
+ effectiveBounds?: SheetRegionBoundsGQL | null;
1108
+ active: boolean;
1109
+ definitionRevision: string;
1110
+ projectionRevision: string | null;
1111
+ projectionStatus: SheetRegionProjectionStatusEnum;
1112
+ syncRevision?: string | null;
285
1113
  createdAt?: string | null;
286
1114
  updatedAt?: string | null;
287
1115
  }
288
1116
 
1117
+ /* Server-authored Sheet region payload with mandatory tab ownership. */
1118
+ export type SheetAuthoritativeRegionGQL = SheetRegionGQL & {
1119
+ sheetTabId: string;
1120
+ };
1121
+
289
1122
  export interface SheetGridGQL {
290
1123
  id?: string | null;
291
- sheet?: SheetGQL | null;
292
1124
  viewport?: SheetGridViewportObj | null;
293
1125
  rows?: SheetGridRowGQL[];
294
1126
  cells?: SheetCellGQL[];