@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,11 +1,30 @@
1
- import type { DATA_TABLE_FIELD_TYPE_ENUMS } from '../constants/dataTable.ts';
1
+ import type {
2
+ DATA_TABLE_CHANGE_KIND_ENUMS,
3
+ DATA_TABLE_FIELD_TYPE_ENUMS,
4
+ DATA_TABLE_RECORD_RESOLVED_VALUE_KIND_ENUMS,
5
+ DATA_TABLE_RECORD_VALUE_KIND_ENUMS,
6
+ DATA_TABLE_ROW_DOCUMENT_VERSION,
7
+ } from '../constants/dataTable.ts';
2
8
 
3
- export type DataTableFieldTypeEnum = typeof DATA_TABLE_FIELD_TYPE_ENUMS[number];
9
+ export type DataTableFieldTypeEnum =
10
+ (typeof DATA_TABLE_FIELD_TYPE_ENUMS)[number];
11
+
12
+ export type DataTableRecordValueKind =
13
+ (typeof DATA_TABLE_RECORD_VALUE_KIND_ENUMS)[number];
14
+
15
+ export type DataTableRecordResolvedValueKind =
16
+ (typeof DATA_TABLE_RECORD_RESOLVED_VALUE_KIND_ENUMS)[number];
17
+
18
+ export type DataTableChangeKind = (typeof DATA_TABLE_CHANGE_KIND_ENUMS)[number];
4
19
 
5
20
  export type DataTableFieldTypeGQL = DataTableFieldTypeEnum;
6
21
 
7
22
  export type DataTableCellReferenceStatus = 'NONE' | 'ACTIVE' | 'DELETED';
8
23
 
24
+ export interface DataTablesFilterArgs {
25
+ active?: boolean | null;
26
+ }
27
+
9
28
  export type DataTableRecordValue =
10
29
  | string
11
30
  | number
@@ -26,7 +45,6 @@ export interface DataTableDesignCellObj {
26
45
  humanLabel?: string | null;
27
46
  iconName?: string | null;
28
47
  fieldType: DataTableFieldTypeEnum;
29
- humanFieldType: DataTableFieldTypeEnum;
30
48
  format?: string | null;
31
49
  instructions?: string | null;
32
50
  source?: {
@@ -42,132 +60,12 @@ export interface DataTableDesignCellObj {
42
60
  width?: number | null;
43
61
  }
44
62
 
45
- export interface DataTableDesignViewColumnSourceObj {
46
- type: 'MASTER_CELL' | 'FORMULA' | 'STATIC' | 'DIMENSION' | 'CUSTOM' | 'RELATED_RECORD' | 'COMPUTED';
47
- cellKey?: string | null;
48
- formulaKey?: string | null;
49
- dimensionKey?: string | null;
50
- table?: string | null;
51
- path?: string | null;
52
- sourceCellKey?: string | null;
53
- sourceCellKeys?: string[];
54
- operation?: 'SUM' | null;
55
- }
56
-
57
- export interface DataTableDesignViewDimensionObj {
58
- key: string;
59
- label?: string | null;
60
- source?: DataTableDesignViewColumnSourceObj | null;
61
- }
62
-
63
- export interface DataTableDesignViewGeneratorDateSeriesObj {
64
- key: string;
65
- label?: string | null;
66
- sourceCellKey?: string | null;
67
- grain: 'DAY' | 'WEEK';
68
- weekStart?: 'MONDAY';
69
- range: {
70
- type: 'CURRENT_MONTH' | 'FIXED';
71
- start?: string;
72
- end?: string;
73
- };
74
- }
75
-
76
- export interface DataTableDesignViewGeneratorDimensionObj {
77
- key: string;
78
- label?: string | null;
79
- source:
80
- | {
81
- type: 'MASTER_CELL_OPTIONS';
82
- cellKey: string;
83
- }
84
- | {
85
- type: 'STATIC_VALUES';
86
- values: Array<{
87
- value: string;
88
- label?: string | null;
89
- }>;
90
- };
91
- }
92
-
93
- export interface DataTableDesignViewGeneratorMeasureObj {
94
- key: string;
95
- label?: string | null;
96
- operation: 'COUNT' | 'SUM';
97
- sourceCellKey?: string | null;
98
- }
99
-
100
- export interface DataTableDesignViewGeneratorObj {
101
- keyPrefix: string;
102
- dateSeries?: DataTableDesignViewGeneratorDateSeriesObj;
103
- dimensions?: DataTableDesignViewGeneratorDimensionObj[];
104
- measures?: DataTableDesignViewGeneratorMeasureObj[];
105
- }
106
-
107
- export interface DataTableDesignViewRowModelObj {
108
- type: 'MASTER_ROWS' | 'GROUPED_ROWS';
109
- dimensions?: DataTableDesignViewDimensionObj[];
110
- generator?: DataTableDesignViewGeneratorObj | null;
111
- }
112
-
113
- export interface DataTableDesignViewColumnObj {
114
- key: string;
115
- label: string;
116
- humanLabel?: string | null;
117
- iconName?: string | null;
118
- fieldType?: DataTableFieldTypeEnum | null;
119
- humanFieldType: DataTableFieldTypeEnum;
120
- source?: DataTableDesignViewColumnSourceObj | null;
121
- options?: DataTableDesignCellOptionObj[];
122
- openLink?: boolean;
123
- humansCannotEdit?: boolean;
124
- width?: number | null;
125
- }
126
-
127
- export interface DataTableDesignViewFilterObj {
128
- id: string;
129
- columnKey: string;
130
- operator: string;
131
- value?: any;
132
- enabled?: boolean;
133
- }
134
-
135
- export interface DataTableDesignViewSortObj {
136
- columnKey: string;
137
- direction: 'ASC' | 'DESC';
138
- }
139
-
140
- export interface DataTableDesignViewGroupObj {
141
- columnKey: string;
142
- direction?: 'ASC' | 'DESC';
143
- }
144
-
145
- export interface DataTableDesignViewObj {
146
- id: string;
147
- name: string;
148
- layout: 'GRID';
149
- iconName?: string | null;
150
- color?: string | null;
151
- description?: string | null;
152
- rowModel?: DataTableDesignViewRowModelObj | null;
153
- columns: DataTableDesignViewColumnObj[];
154
- columnsOrder?: string[];
155
- filters?: DataTableDesignViewFilterObj[];
156
- sorts?: DataTableDesignViewSortObj[];
157
- groups?: DataTableDesignViewGroupObj[];
158
- stickyTop?: number | null;
159
- stickyLeft?: number | null;
160
- humansCannotEdit?: boolean | null;
161
- }
162
-
163
63
  export interface DataTableDesignObj {
164
64
  cells: DataTableDesignCellObj[];
165
65
  cellsOrder?: string[];
166
- views?: DataTableDesignViewObj[];
167
- viewsOrder?: string[];
168
- defaultViewId?: string | null;
169
66
  instructions?: string;
170
67
  humansCannotEdit?: boolean; // If true, humans cannot edit any cells in this dataTable
68
+ rowIdentifier?: string[];
171
69
  stickyTop?: number;
172
70
  stickyLeft?: number;
173
71
  }
@@ -177,11 +75,12 @@ export interface DataTableData {
177
75
 
178
76
  id: number | bigint;
179
77
  organizationId: number | bigint;
180
- name: string;
78
+ name?: string | null;
181
79
  title: string;
182
80
  description?: string | null;
183
81
  design: DataTableDesignObj;
184
82
  active: boolean;
83
+ deletedAt?: Date | string | null;
185
84
  createdAt: Date;
186
85
  updatedAt: Date;
187
86
  }
@@ -193,9 +92,11 @@ export interface DataTableRowData {
193
92
  organizationId: number | bigint;
194
93
  dataTableId: number | bigint;
195
94
  identifier?: string | null;
196
- viewId?: string | null;
197
- viewRowKey?: string | null;
198
- position: number;
95
+ orderKey: number | bigint;
96
+ /* Persisted reads carry DataTableRowDocument; GraphQL hydration exposes the
97
+ * public DataTableRecordData[] facade. */
98
+ cells: DataTableRowDocument | DataTableRecordData[];
99
+ rowRevision: number | bigint;
199
100
  metadata: Record<string, any>;
200
101
  }
201
102
 
@@ -203,9 +104,13 @@ export interface DataTableRecordData {
203
104
  __table: 'data_table_records';
204
105
 
205
106
  id: number | bigint;
107
+ organizationId: number | bigint;
206
108
  dataTableId: number | bigint;
207
109
  dataTableRowId: number | bigint;
110
+ columnId: number | bigint;
208
111
  cellKey: string;
112
+ valueKind: DataTableRecordValueKind;
113
+ resolvedValueKind?: DataTableRecordResolvedValueKind | null;
209
114
  iconName?: string | null;
210
115
  value?: DataTableRecordValue;
211
116
  textValue?: string | null;
@@ -217,11 +122,125 @@ export interface DataTableRecordData {
217
122
  relatedId?: number | bigint | null;
218
123
  referenceDataTableId?: number | bigint | null;
219
124
  referenceDataTableRowId?: number | bigint | null;
125
+ referenceColumnId?: number | bigint | null;
220
126
  referenceCellKey?: string | null;
221
127
  createdAt: Date;
222
128
  updatedAt: Date;
223
129
  }
224
130
 
131
+ export type DataTableRowDocumentRecordInput = Pick<
132
+ DataTableRecordData,
133
+ | 'id'
134
+ | 'columnId'
135
+ | 'valueKind'
136
+ | 'resolvedValueKind'
137
+ | 'value'
138
+ | 'textValue'
139
+ | 'numberValue'
140
+ | 'booleanValue'
141
+ | 'dateValue'
142
+ | 'datetimeValue'
143
+ | 'relatedTable'
144
+ | 'relatedId'
145
+ | 'referenceDataTableId'
146
+ | 'referenceDataTableRowId'
147
+ | 'referenceColumnId'
148
+ > &
149
+ Partial<Pick<DataTableRecordData, 'createdAt' | 'updatedAt'>>;
150
+
151
+ export interface DataTableColumnData {
152
+ __table: 'data_table_columns';
153
+
154
+ id: number | bigint;
155
+ organizationId: number | bigint;
156
+ dataTableId: number | bigint;
157
+ key: string;
158
+ fieldType: DataTableFieldTypeEnum;
159
+ ordinal: number;
160
+ config: Record<string, any>;
161
+ version: number | bigint;
162
+ deletedAt?: Date | string | null;
163
+ createdAt: Date;
164
+ updatedAt: Date;
165
+ }
166
+
167
+ export interface DataTableColumnAliasData {
168
+ __table: 'data_table_column_aliases';
169
+
170
+ id: number | bigint;
171
+ organizationId: number | bigint;
172
+ dataTableId: number | bigint;
173
+ dataTableColumnId: number | bigint;
174
+ key: string;
175
+ retiredAt?: Date | string | null;
176
+ createdAt: Date;
177
+ }
178
+
179
+ export interface DataTableStateData {
180
+ __table: 'data_table_state';
181
+
182
+ dataTableId: number | bigint;
183
+ organizationId: number | bigint;
184
+ currentSeq: number | bigint;
185
+ lastOrderKey: number | bigint;
186
+ createdAt: Date;
187
+ updatedAt: Date;
188
+ }
189
+
190
+ export interface DataTableChangeData {
191
+ __table: 'data_table_changes';
192
+
193
+ dataTableId: number | bigint;
194
+ seq: number | bigint;
195
+ organizationId: number | bigint;
196
+ kind: DataTableChangeKind;
197
+ payload: Record<string, any>;
198
+ actorAccountId?: number | bigint | null;
199
+ sourceSocketId?: string | null;
200
+ commandId?: string | null;
201
+ correlationId?: string | null;
202
+ causationId?: string | null;
203
+ createdAt: Date;
204
+ }
205
+
206
+ export interface DataTableRowDocumentRelatedValue {
207
+ table: string;
208
+ id: string;
209
+ }
210
+
211
+ export interface DataTableRowDocumentReferenceValue {
212
+ dataTableId: string;
213
+ dataTableRowId: string | null;
214
+ columnId: string;
215
+ status: 'ACTIVE' | 'DELETED';
216
+ }
217
+
218
+ export interface DataTableRowDocumentCell {
219
+ recordId: string;
220
+ valueKind: DataTableRecordValueKind;
221
+ resolvedValueKind?: DataTableRecordResolvedValueKind;
222
+ value: DataTableRecordValue;
223
+ textValue?: string;
224
+ numberValue?: number;
225
+ booleanValue?: boolean;
226
+ dateValue?: string;
227
+ datetimeValue?: string;
228
+ createdAt?: string;
229
+ updatedAt?: string;
230
+ related?: DataTableRowDocumentRelatedValue;
231
+ reference?: DataTableRowDocumentReferenceValue;
232
+ }
233
+
234
+ /*
235
+ * Versioned render projection. byColumnId is keyed by decimal-string stable
236
+ * data_table_columns IDs so JSON never rounds a BIGINT through JavaScript.
237
+ * data_table_records remains the normalized typed query projection.
238
+ */
239
+ export interface DataTableRowDocument {
240
+ v: typeof DATA_TABLE_ROW_DOCUMENT_VERSION;
241
+ byColumnId: Record<string, DataTableRowDocumentCell>;
242
+ }
243
+
225
244
  export interface DataTableCellReferenceGQL {
226
245
  dataTableId?: string | null;
227
246
  dataTableRowId?: string | null;
@@ -245,7 +264,6 @@ export interface DataTableDesignCellGQL {
245
264
  humanLabel?: string | null;
246
265
  iconName?: string | null;
247
266
  fieldType: DataTableFieldTypeGQL;
248
- humanFieldType: DataTableFieldTypeGQL;
249
267
  format?: string | null;
250
268
  instructions?: string | null;
251
269
  source?: DataTableDesignCellSourceGQL | null;
@@ -258,133 +276,13 @@ export interface DataTableDesignCellGQL {
258
276
  width?: number | null;
259
277
  }
260
278
 
261
- export interface DataTableDesignViewColumnSourceGQL {
262
- type: 'MASTER_CELL' | 'FORMULA' | 'STATIC' | 'DIMENSION' | 'CUSTOM' | 'RELATED_RECORD' | 'COMPUTED';
263
- cellKey?: string | null;
264
- formulaKey?: string | null;
265
- dimensionKey?: string | null;
266
- table?: string | null;
267
- path?: string | null;
268
- sourceCellKey?: string | null;
269
- sourceCellKeys?: string[];
270
- operation?: 'SUM' | null;
271
- }
272
-
273
- export interface DataTableDesignViewDimensionGQL {
274
- key: string;
275
- label?: string | null;
276
- source?: DataTableDesignViewColumnSourceGQL | null;
277
- }
278
-
279
- export interface DataTableDesignViewGeneratorDateSeriesGQL {
280
- key: string;
281
- label?: string | null;
282
- sourceCellKey?: string | null;
283
- grain: 'DAY' | 'WEEK';
284
- weekStart?: 'MONDAY' | null;
285
- range: {
286
- type: 'CURRENT_MONTH' | 'FIXED';
287
- start?: string | null;
288
- end?: string | null;
289
- };
290
- }
291
-
292
- export interface DataTableDesignViewGeneratorDimensionGQL {
293
- key: string;
294
- label?: string | null;
295
- source:
296
- | {
297
- type: 'MASTER_CELL_OPTIONS';
298
- cellKey: string;
299
- }
300
- | {
301
- type: 'STATIC_VALUES';
302
- values: Array<{
303
- value: string;
304
- label?: string | null;
305
- }>;
306
- };
307
- }
308
-
309
- export interface DataTableDesignViewGeneratorMeasureGQL {
310
- key: string;
311
- label?: string | null;
312
- operation: 'COUNT' | 'SUM';
313
- sourceCellKey?: string | null;
314
- }
315
-
316
- export interface DataTableDesignViewGeneratorGQL {
317
- keyPrefix: string;
318
- dateSeries?: DataTableDesignViewGeneratorDateSeriesGQL | null;
319
- dimensions?: DataTableDesignViewGeneratorDimensionGQL[];
320
- measures?: DataTableDesignViewGeneratorMeasureGQL[];
321
- }
322
-
323
- export interface DataTableDesignViewRowModelGQL {
324
- type: 'MASTER_ROWS' | 'GROUPED_ROWS';
325
- dimensions?: DataTableDesignViewDimensionGQL[];
326
- generator?: DataTableDesignViewGeneratorGQL | null;
327
- }
328
-
329
- export interface DataTableDesignViewColumnGQL {
330
- key: string;
331
- label: string;
332
- humanLabel?: string | null;
333
- iconName?: string | null;
334
- fieldType?: DataTableFieldTypeGQL | null;
335
- humanFieldType: DataTableFieldTypeGQL;
336
- source?: DataTableDesignViewColumnSourceGQL | null;
337
- options?: DataTableDesignCellOptionGQL[];
338
- openLink?: boolean | null;
339
- humansCannotEdit?: boolean | null;
340
- width?: number | null;
341
- }
342
-
343
- export interface DataTableDesignViewFilterGQL {
344
- id: string;
345
- columnKey: string;
346
- operator: string;
347
- value?: string | null;
348
- enabled?: boolean | null;
349
- }
350
-
351
- export interface DataTableDesignViewSortGQL {
352
- columnKey: string;
353
- direction: 'ASC' | 'DESC';
354
- }
355
-
356
- export interface DataTableDesignViewGroupGQL {
357
- columnKey: string;
358
- direction?: 'ASC' | 'DESC' | null;
359
- }
360
-
361
- export interface DataTableDesignViewGQL {
362
- id: string;
363
- name: string;
364
- layout: 'GRID';
365
- iconName?: string | null;
366
- color?: string | null;
367
- description?: string | null;
368
- rowModel?: DataTableDesignViewRowModelGQL | null;
369
- columns: DataTableDesignViewColumnGQL[];
370
- columnsOrder: string[];
371
- filters: DataTableDesignViewFilterGQL[];
372
- sorts: DataTableDesignViewSortGQL[];
373
- groups: DataTableDesignViewGroupGQL[];
374
- stickyTop?: number | null;
375
- stickyLeft?: number | null;
376
- humansCannotEdit?: boolean | null;
377
- }
378
-
379
279
  export interface DataTableDesignGQL {
380
280
  id: string;
381
281
  cells: DataTableDesignCellGQL[];
382
282
  cellsOrder: string[];
383
- views?: DataTableDesignViewGQL[];
384
- viewsOrder?: string[];
385
- defaultViewId?: string | null;
386
283
  instructions?: string | null;
387
284
  humansCannotEdit?: boolean | null;
285
+ rowIdentifier?: string[] | null;
388
286
  stickyTop?: number | null;
389
287
  stickyLeft?: number | null;
390
288
  }
@@ -393,13 +291,16 @@ export interface DataTableGQL {
393
291
  __deleted?: boolean;
394
292
 
395
293
  id: string;
294
+ cursor?: string | null;
396
295
  organizationId: string;
296
+ realtimeToken?: string | null;
397
297
 
398
298
  name: string;
399
299
  title: string;
400
300
  description?: string | null;
401
301
  design: DataTableDesignGQL;
402
302
  active: boolean;
303
+ deletedAt?: string | null;
403
304
 
404
305
  createdAt: string;
405
306
  updatedAt: string;
@@ -411,23 +312,41 @@ export interface DataTableRowGQL {
411
312
  id: string;
412
313
  cursor: string;
413
314
  organizationId: string;
414
- dataTableId: string;
315
+ dataTableId?: string | null;
415
316
 
416
317
  identifier?: string | null;
417
- viewId?: string | null;
418
- viewRowKey?: string | null;
419
- position: number;
420
318
  metadata: string;
421
319
  cells?: DataTableCellGQL[];
422
320
  updatedAt?: string | null;
423
321
  }
424
322
 
323
+ export interface DataTableRowsForSheetRegionColumnGQL {
324
+ formulaText?: string | null;
325
+ kind?: string | null;
326
+ sheetColumnIndex?: number | null;
327
+ sourceCellKey?: string | null;
328
+ }
329
+
330
+ export interface DataTableRowsForSheetRegionRowGQL {
331
+ row?: DataTableRowGQL | null;
332
+ sheetRowIndex?: number | null;
333
+ }
334
+
335
+ export interface DataTableRowsForSheetRegionGQL {
336
+ columns?: DataTableRowsForSheetRegionColumnGQL[] | null;
337
+ dataTableId?: string | null;
338
+ regionId?: string | null;
339
+ rows?: DataTableRowsForSheetRegionRowGQL[] | null;
340
+ sourceId?: string | null;
341
+ sourceType?: string | null;
342
+ }
343
+
425
344
  export interface DataTableCellGQL {
426
345
  __deleted?: boolean;
427
346
 
428
347
  id: string;
429
- dataTableId: string;
430
- dataTableRowId: string;
348
+ dataTableId?: string | null;
349
+ dataTableRowId?: string | null;
431
350
 
432
351
  cellKey: string;
433
352
  iconName?: string | null;
@@ -0,0 +1,96 @@
1
+ import type {
2
+ DOC_ACCESS_ENTITY_TYPE_ENUMS,
3
+ DOC_ACCESS_GRANTEE_TYPE_ENUMS,
4
+ DOC_ACCESS_SCOPE_ENUMS,
5
+ DOC_GRANT_PERMISSION_ENUMS,
6
+ DOC_PERMISSION_ENUMS,
7
+ } from '../constants/docAccess.ts';
8
+
9
+ export type DocPermissionEnum = (typeof DOC_PERMISSION_ENUMS)[number];
10
+ export type DocGrantPermissionEnum =
11
+ (typeof DOC_GRANT_PERMISSION_ENUMS)[number];
12
+ export type DocAccessGranteeTypeEnum =
13
+ (typeof DOC_ACCESS_GRANTEE_TYPE_ENUMS)[number];
14
+ export type DocAccessEntityTypeEnum =
15
+ (typeof DOC_ACCESS_ENTITY_TYPE_ENUMS)[number];
16
+ export type DocAccessScopeEnum = (typeof DOC_ACCESS_SCOPE_ENUMS)[number];
17
+
18
+ /**
19
+ * Base access policy stored on the document row itself (jsonb "access"):
20
+ * - team: what every owner-org member gets ("NONE" restricts the document
21
+ * to grant holders and owner-org members with the document edit ACL)
22
+ * - public: what everyone with the link gets
23
+ * - network: what every member of the owner org's network (child)
24
+ * organizations gets
25
+ */
26
+
27
+ export interface DocAccessBaseObj {
28
+ team: DocPermissionEnum;
29
+ public: DocPermissionEnum;
30
+ network: DocPermissionEnum;
31
+ }
32
+
33
+ /**
34
+ * One access grant for one account or one organization. A grant overrides
35
+ * the base policy for its grantee (ACCOUNT grants override the team rule,
36
+ * ORGANIZATION grants override the network rule), so it can raise or lower
37
+ * access, including an explicit "NONE" block. Grants are stored relationally
38
+ * in access_grants; ids are serialized GenericIDs on the client and parsed
39
+ * numeric ids in server storage.
40
+ */
41
+
42
+ export interface DocAccessGrantObj {
43
+ granteeType: DocAccessGranteeTypeEnum;
44
+ granteeId: string | number | bigint;
45
+ permission: DocGrantPermissionEnum;
46
+ }
47
+
48
+ /**
49
+ * Full access settings for one document: the base policy plus the grants
50
+ * list. Fetch paths that skip the grants table leave "grants" undefined.
51
+ */
52
+
53
+ export interface DocAccessObj extends DocAccessBaseObj {
54
+ grants?: DocAccessGrantObj[] | null;
55
+ }
56
+
57
+ /**
58
+ * Viewer facts needed to evaluate one document's access settings.
59
+ * - isOwnerOrgMember: viewer passes the owner org's "general_read" ACL
60
+ * - isAdminOrOwner: viewer's role in the owner org is ADMIN or OWNER
61
+ * (admins and owners always keep full view and edit access)
62
+ * - hasWriteACL: viewer passes the owner org's "general_write" ACL; the
63
+ * team policy only grants EDIT to members who can write org data
64
+ * (read-only members cap at VIEW unless an explicit grant raises them)
65
+ * - isNetworkOrgMember: viewer belongs to one of the owner org's network
66
+ * (child) organizations
67
+ * - viewerOrganizationIds: every organization the viewer belongs to
68
+ */
69
+
70
+ export interface DocAccessViewerCtx {
71
+ accountId?: string | number | bigint | null;
72
+ isOwnerOrgMember?: boolean | null;
73
+ isAdminOrOwner?: boolean | null;
74
+ hasWriteACL?: boolean | null;
75
+ isNetworkOrgMember?: boolean | null;
76
+ viewerOrganizationIds?: Array<string | number | bigint> | null;
77
+ }
78
+
79
+ /**
80
+ * One access_grants database row.
81
+ */
82
+
83
+ export interface DocAccessGrantData {
84
+ __table: 'access_grants';
85
+
86
+ id: number | bigint;
87
+ organizationId: number | bigint;
88
+ entityType: DocAccessEntityTypeEnum;
89
+ entityId: number | bigint;
90
+ granteeType: DocAccessGranteeTypeEnum;
91
+ granteeAccountId?: number | bigint | null;
92
+ granteeOrganizationId?: number | bigint | null;
93
+ permission: DocGrantPermissionEnum;
94
+ createdAt: Date;
95
+ updatedAt: Date;
96
+ }