@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
@@ -0,0 +1,578 @@
1
+ // GENERATED FILE — DO NOT EDIT BY HAND.
2
+ // Regenerate with (cwd: server/): deno task generate:region-sources (reads the sheet region source registry).
3
+ // Contract-checked by: deno task check:sheet-region-source-registry
4
+
5
+ import type { SheetRegionSourceKindDescriptor } from '../utils/sheetRegionSourceRegistry.ts';
6
+
7
+ // 'DATA_TABLE' is the physical DataTable source (no registry row); the
8
+ // remaining entries are the registry kind keys in registry order.
9
+ export const SHEET_REGION_SOURCE_TYPE_ENUMS = [
10
+ 'DATA_TABLE',
11
+ 'CHILD_ORGANIZATIONS',
12
+ 'LOGS',
13
+ ] as const;
14
+
15
+ export const SHEET_CUSTOM_REGION_SOURCE_CHILD_ORGANIZATIONS =
16
+ 'CHILD_ORGANIZATIONS';
17
+ export const SHEET_CUSTOM_REGION_SOURCE_LOGS = 'LOGS';
18
+
19
+ export const SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS = [
20
+ 'CHILD_ORGANIZATION_ID',
21
+ 'LOG_ACCOUNT_ID',
22
+ 'LOG_CHILD_ORGANIZATION_ID',
23
+ 'LOG_ID',
24
+ 'LOG_INBOUND_CONTACT_ID',
25
+ 'LOG_REPORT_ID',
26
+ 'LOG_REPORT_SUBMISSION_ID',
27
+ 'LOG_SITE_ID',
28
+ ] as const;
29
+
30
+ export const SHEET_CUSTOM_REGION_SOURCE_CHILD_ORGANIZATION_COLUMNS = [
31
+ {
32
+ key: 'organizationId',
33
+ labelKey: 'form.organization_id',
34
+ width: 160,
35
+ },
36
+ {
37
+ key: 'name',
38
+ labelKey: 'form.name',
39
+ formulaValueSource: 'CHILD_ORGANIZATION_ID',
40
+ width: 300,
41
+ },
42
+ {
43
+ key: 'phone',
44
+ labelKey: 'form.phone',
45
+ width: 160,
46
+ },
47
+ {
48
+ key: 'email',
49
+ labelKey: 'form.email',
50
+ width: 275,
51
+ },
52
+ {
53
+ key: 'type',
54
+ labelKey: 'form.type',
55
+ width: 108,
56
+ },
57
+ ] as const;
58
+
59
+ export const SHEET_CUSTOM_REGION_SOURCE_LOG_COLUMNS = [
60
+ {
61
+ key: 'id',
62
+ labelKey: 'form.log_id',
63
+ fieldType: 'ID',
64
+ formulaValueSource: 'LOG_ID',
65
+ relatedTable: 'logs',
66
+ width: 160,
67
+ },
68
+ {
69
+ key: 'summary',
70
+ labelKey: 'form.summary',
71
+ fieldType: 'ID_OR_TEXT',
72
+ formulaValueSource: 'LOG_ID',
73
+ relatedTable: 'logs',
74
+ width: 420,
75
+ },
76
+ {
77
+ key: 'date',
78
+ labelKey: 'form.date',
79
+ fieldType: 'DATETIME',
80
+ width: 190,
81
+ },
82
+ {
83
+ key: 'createdAt',
84
+ labelKey: 'form.created_at',
85
+ fieldType: 'DATETIME',
86
+ width: 190,
87
+ },
88
+ {
89
+ key: 'childOrgId',
90
+ labelKey: 'form.child_org_id',
91
+ fieldType: 'ID',
92
+ width: 160,
93
+ },
94
+ {
95
+ key: 'childOrgName',
96
+ labelKey: 'form.child_org_name',
97
+ fieldType: 'ID_OR_TEXT',
98
+ formulaValueSource: 'LOG_CHILD_ORGANIZATION_ID',
99
+ relatedTable: 'organizations',
100
+ width: 260,
101
+ },
102
+ {
103
+ key: 'siteId',
104
+ labelKey: 'form.site_id',
105
+ fieldType: 'ID',
106
+ width: 150,
107
+ },
108
+ {
109
+ key: 'siteName',
110
+ labelKey: 'form.site_name',
111
+ fieldType: 'ID_OR_TEXT',
112
+ formulaValueSource: 'LOG_SITE_ID',
113
+ relatedTable: 'organization_sites',
114
+ width: 240,
115
+ },
116
+ {
117
+ key: 'inboundContactId',
118
+ labelKey: 'form.inbound_contact_id',
119
+ fieldType: 'ID',
120
+ width: 180,
121
+ },
122
+ {
123
+ key: 'inboundContactEmail',
124
+ labelKey: 'form.inbound_contact_email',
125
+ fieldType: 'ID_OR_TEXT',
126
+ formulaValueSource: 'LOG_INBOUND_CONTACT_ID',
127
+ relatedTable: 'inbound_contacts',
128
+ width: 260,
129
+ },
130
+ {
131
+ key: 'inboundContactPhone',
132
+ labelKey: 'form.inbound_contact_phone',
133
+ fieldType: 'ID_OR_TEXT',
134
+ formulaValueSource: 'LOG_INBOUND_CONTACT_ID',
135
+ relatedTable: 'inbound_contacts',
136
+ width: 190,
137
+ },
138
+ {
139
+ key: 'fieldDocId',
140
+ labelKey: 'form.field_doc_id',
141
+ fieldType: 'ID',
142
+ width: 150,
143
+ },
144
+ {
145
+ key: 'fieldDocName',
146
+ labelKey: 'form.field_doc_name',
147
+ fieldType: 'ID_OR_TEXT',
148
+ formulaValueSource: 'LOG_REPORT_ID',
149
+ relatedTable: 'field_docs',
150
+ width: 260,
151
+ },
152
+ {
153
+ key: 'fieldDocSubmissionId',
154
+ labelKey: 'form.field_doc_submission_id',
155
+ fieldType: 'ID',
156
+ width: 190,
157
+ },
158
+ {
159
+ key: 'fieldDocSubmissionPeriod',
160
+ labelKey: 'form.field_doc_submission_period',
161
+ fieldType: 'DATE',
162
+ formulaValueSource: 'LOG_REPORT_SUBMISSION_ID',
163
+ relatedTable: 'field_doc_submissions',
164
+ width: 210,
165
+ },
166
+ {
167
+ key: 'accountId',
168
+ labelKey: 'form.account_id',
169
+ fieldType: 'ID',
170
+ width: 150,
171
+ },
172
+ {
173
+ key: 'accountPersonName',
174
+ labelKey: 'form.account_person_name',
175
+ fieldType: 'ID_OR_TEXT',
176
+ formulaValueSource: 'LOG_ACCOUNT_ID',
177
+ relatedTable: 'accounts',
178
+ width: 220,
179
+ },
180
+ ] as const;
181
+
182
+ export const SHEET_REGION_SOURCE_KIND_KEYS: string[] = [
183
+ 'CHILD_ORGANIZATIONS',
184
+ 'LOGS',
185
+ ];
186
+
187
+ export const SHEET_REGION_SOURCE_DESCRIPTORS: Record<
188
+ string,
189
+ SheetRegionSourceKindDescriptor
190
+ > = {
191
+ CHILD_ORGANIZATIONS: {
192
+ key: 'CHILD_ORGANIZATIONS',
193
+ fetchStrategy: 'DIRECTORY',
194
+ baseTable: null,
195
+ titleKey: 'form.vendors',
196
+ appRoute: '/app/vendors',
197
+ revisionSourceKey: 'CHILD_ORGANIZATIONS',
198
+ enabled: true,
199
+ joins: [],
200
+ fields: [
201
+ {
202
+ key: 'organizationId',
203
+ labelKey: 'form.organization_id',
204
+ fieldType: null,
205
+ formulaValueSource: null,
206
+ relatedTable: null,
207
+ width: 160,
208
+ ordinal: 0,
209
+ filterable: false,
210
+ sortable: false,
211
+ reach: null,
212
+ },
213
+ {
214
+ key: 'name',
215
+ labelKey: 'form.name',
216
+ fieldType: null,
217
+ formulaValueSource: 'CHILD_ORGANIZATION_ID',
218
+ relatedTable: null,
219
+ width: 300,
220
+ ordinal: 1,
221
+ filterable: false,
222
+ sortable: false,
223
+ reach: null,
224
+ },
225
+ {
226
+ key: 'phone',
227
+ labelKey: 'form.phone',
228
+ fieldType: null,
229
+ formulaValueSource: null,
230
+ relatedTable: null,
231
+ width: 160,
232
+ ordinal: 2,
233
+ filterable: false,
234
+ sortable: false,
235
+ reach: null,
236
+ },
237
+ {
238
+ key: 'email',
239
+ labelKey: 'form.email',
240
+ fieldType: null,
241
+ formulaValueSource: null,
242
+ relatedTable: null,
243
+ width: 275,
244
+ ordinal: 3,
245
+ filterable: false,
246
+ sortable: false,
247
+ reach: null,
248
+ },
249
+ {
250
+ key: 'type',
251
+ labelKey: 'form.type',
252
+ fieldType: null,
253
+ formulaValueSource: null,
254
+ relatedTable: null,
255
+ width: 108,
256
+ ordinal: 4,
257
+ filterable: false,
258
+ sortable: false,
259
+ reach: null,
260
+ },
261
+ ],
262
+ },
263
+ LOGS: {
264
+ key: 'LOGS',
265
+ fetchStrategy: 'SQL',
266
+ baseTable: 'logs',
267
+ titleKey: 'log.logs',
268
+ appRoute: '/app/logs',
269
+ revisionSourceKey: 'LOGS',
270
+ enabled: true,
271
+ joins: [
272
+ {
273
+ key: 'site',
274
+ table: 'organization_sites',
275
+ fromJoinKey: null,
276
+ fromColumn: 'siteId',
277
+ toColumn: 'id',
278
+ },
279
+ {
280
+ key: 'counterparty',
281
+ table: 'counterparties',
282
+ fromJoinKey: null,
283
+ fromColumn: 'counterpartyId',
284
+ toColumn: 'id',
285
+ },
286
+ {
287
+ key: 'childOrg',
288
+ table: 'organizations',
289
+ fromJoinKey: 'counterparty',
290
+ fromColumn: 'linkedOrgId',
291
+ toColumn: 'id',
292
+ },
293
+ {
294
+ key: 'inboundContact',
295
+ table: 'inbound_contacts',
296
+ fromJoinKey: 'counterparty',
297
+ fromColumn: 'inboundContactId',
298
+ toColumn: 'id',
299
+ },
300
+ {
301
+ key: 'fieldDoc',
302
+ table: 'field_docs',
303
+ fromJoinKey: null,
304
+ fromColumn: 'fieldDocId',
305
+ toColumn: 'id',
306
+ },
307
+ {
308
+ key: 'fieldDocSubmission',
309
+ table: 'field_doc_submissions',
310
+ fromJoinKey: null,
311
+ fromColumn: 'fieldDocSubmissionId',
312
+ toColumn: 'id',
313
+ },
314
+ {
315
+ key: 'accountProfile',
316
+ table: 'account_profiles',
317
+ fromJoinKey: null,
318
+ fromColumn: 'accountId',
319
+ toColumn: 'accountId',
320
+ },
321
+ ],
322
+ fields: [
323
+ {
324
+ key: 'id',
325
+ labelKey: 'form.log_id',
326
+ fieldType: 'ID',
327
+ formulaValueSource: 'LOG_ID',
328
+ relatedTable: 'logs',
329
+ width: 160,
330
+ ordinal: 0,
331
+ filterable: true,
332
+ sortable: true,
333
+ reach: { kind: 'COLUMN', column: 'id', render: 'TEXT_ID' },
334
+ },
335
+ {
336
+ key: 'summary',
337
+ labelKey: 'form.summary',
338
+ fieldType: 'ID_OR_TEXT',
339
+ formulaValueSource: 'LOG_ID',
340
+ relatedTable: 'logs',
341
+ width: 420,
342
+ ordinal: 1,
343
+ filterable: true,
344
+ sortable: true,
345
+ reach: { kind: 'COLUMN', column: 'summary', render: 'COALESCE_TEXT' },
346
+ },
347
+ {
348
+ key: 'date',
349
+ labelKey: 'form.date',
350
+ fieldType: 'DATETIME',
351
+ formulaValueSource: null,
352
+ relatedTable: null,
353
+ width: 190,
354
+ ordinal: 2,
355
+ filterable: true,
356
+ sortable: true,
357
+ reach: { kind: 'COLUMN', column: 'date', render: 'RAW' },
358
+ },
359
+ {
360
+ key: 'createdAt',
361
+ labelKey: 'form.created_at',
362
+ fieldType: 'DATETIME',
363
+ formulaValueSource: null,
364
+ relatedTable: null,
365
+ width: 190,
366
+ ordinal: 3,
367
+ filterable: true,
368
+ sortable: true,
369
+ reach: { kind: 'COLUMN', column: 'createdAt', render: 'RAW' },
370
+ },
371
+ {
372
+ key: 'childOrgId',
373
+ labelKey: 'form.child_org_id',
374
+ fieldType: 'ID',
375
+ formulaValueSource: null,
376
+ relatedTable: null,
377
+ width: 160,
378
+ ordinal: 4,
379
+ filterable: true,
380
+ sortable: true,
381
+ reach: {
382
+ join: 'counterparty',
383
+ kind: 'JOINED_COLUMN',
384
+ column: 'linkedOrgId',
385
+ render: 'TEXT_ID',
386
+ },
387
+ },
388
+ {
389
+ key: 'childOrgName',
390
+ labelKey: 'form.child_org_name',
391
+ fieldType: 'ID_OR_TEXT',
392
+ formulaValueSource: 'LOG_CHILD_ORGANIZATION_ID',
393
+ relatedTable: 'organizations',
394
+ width: 260,
395
+ ordinal: 5,
396
+ filterable: true,
397
+ sortable: true,
398
+ reach: {
399
+ join: 'childOrg',
400
+ kind: 'JOINED_COLUMN',
401
+ column: 'name',
402
+ render: 'COALESCE_TEXT',
403
+ },
404
+ },
405
+ {
406
+ key: 'siteId',
407
+ labelKey: 'form.site_id',
408
+ fieldType: 'ID',
409
+ formulaValueSource: null,
410
+ relatedTable: null,
411
+ width: 150,
412
+ ordinal: 6,
413
+ filterable: true,
414
+ sortable: true,
415
+ reach: { kind: 'COLUMN', column: 'siteId', render: 'TEXT_ID' },
416
+ },
417
+ {
418
+ key: 'siteName',
419
+ labelKey: 'form.site_name',
420
+ fieldType: 'ID_OR_TEXT',
421
+ formulaValueSource: 'LOG_SITE_ID',
422
+ relatedTable: 'organization_sites',
423
+ width: 240,
424
+ ordinal: 7,
425
+ filterable: true,
426
+ sortable: true,
427
+ reach: {
428
+ join: 'site',
429
+ kind: 'JOINED_COLUMN',
430
+ column: 'name',
431
+ render: 'COALESCE_TEXT',
432
+ },
433
+ },
434
+ {
435
+ key: 'inboundContactId',
436
+ labelKey: 'form.inbound_contact_id',
437
+ fieldType: 'ID',
438
+ formulaValueSource: null,
439
+ relatedTable: null,
440
+ width: 180,
441
+ ordinal: 8,
442
+ filterable: true,
443
+ sortable: true,
444
+ reach: {
445
+ join: 'counterparty',
446
+ kind: 'JOINED_COLUMN',
447
+ column: 'inboundContactId',
448
+ render: 'TEXT_ID',
449
+ },
450
+ },
451
+ {
452
+ key: 'inboundContactEmail',
453
+ labelKey: 'form.inbound_contact_email',
454
+ fieldType: 'ID_OR_TEXT',
455
+ formulaValueSource: 'LOG_INBOUND_CONTACT_ID',
456
+ relatedTable: 'inbound_contacts',
457
+ width: 260,
458
+ ordinal: 9,
459
+ filterable: true,
460
+ sortable: true,
461
+ reach: {
462
+ join: 'inboundContact',
463
+ kind: 'JOINED_COLUMN',
464
+ column: 'email',
465
+ render: 'COALESCE_TEXT',
466
+ },
467
+ },
468
+ {
469
+ key: 'inboundContactPhone',
470
+ labelKey: 'form.inbound_contact_phone',
471
+ fieldType: 'ID_OR_TEXT',
472
+ formulaValueSource: 'LOG_INBOUND_CONTACT_ID',
473
+ relatedTable: 'inbound_contacts',
474
+ width: 190,
475
+ ordinal: 10,
476
+ filterable: true,
477
+ sortable: true,
478
+ reach: {
479
+ join: 'inboundContact',
480
+ kind: 'JOINED_COLUMN',
481
+ column: 'phone',
482
+ render: 'COALESCE_TEXT',
483
+ },
484
+ },
485
+ {
486
+ key: 'fieldDocId',
487
+ labelKey: 'form.field_doc_id',
488
+ fieldType: 'ID',
489
+ formulaValueSource: null,
490
+ relatedTable: null,
491
+ width: 150,
492
+ ordinal: 11,
493
+ filterable: true,
494
+ sortable: true,
495
+ reach: { kind: 'COLUMN', column: 'fieldDocId', render: 'TEXT_ID' },
496
+ },
497
+ {
498
+ key: 'fieldDocName',
499
+ labelKey: 'form.field_doc_name',
500
+ fieldType: 'ID_OR_TEXT',
501
+ formulaValueSource: 'LOG_REPORT_ID',
502
+ relatedTable: 'field_docs',
503
+ width: 260,
504
+ ordinal: 12,
505
+ filterable: true,
506
+ sortable: true,
507
+ reach: {
508
+ join: 'fieldDoc',
509
+ kind: 'JOINED_COLUMN',
510
+ column: 'title',
511
+ render: 'COALESCE_TEXT',
512
+ },
513
+ },
514
+ {
515
+ key: 'fieldDocSubmissionId',
516
+ labelKey: 'form.field_doc_submission_id',
517
+ fieldType: 'ID',
518
+ formulaValueSource: null,
519
+ relatedTable: null,
520
+ width: 190,
521
+ ordinal: 13,
522
+ filterable: true,
523
+ sortable: true,
524
+ reach: {
525
+ kind: 'COLUMN',
526
+ column: 'fieldDocSubmissionId',
527
+ render: 'TEXT_ID',
528
+ },
529
+ },
530
+ {
531
+ key: 'fieldDocSubmissionPeriod',
532
+ labelKey: 'form.field_doc_submission_period',
533
+ fieldType: 'DATE',
534
+ formulaValueSource: 'LOG_REPORT_SUBMISSION_ID',
535
+ relatedTable: 'field_doc_submissions',
536
+ width: 210,
537
+ ordinal: 14,
538
+ filterable: true,
539
+ sortable: true,
540
+ reach: {
541
+ join: 'fieldDocSubmission',
542
+ kind: 'JOINED_COLUMN',
543
+ column: 'period',
544
+ render: 'RAW',
545
+ },
546
+ },
547
+ {
548
+ key: 'accountId',
549
+ labelKey: 'form.account_id',
550
+ fieldType: 'ID',
551
+ formulaValueSource: null,
552
+ relatedTable: null,
553
+ width: 150,
554
+ ordinal: 15,
555
+ filterable: true,
556
+ sortable: true,
557
+ reach: { kind: 'COLUMN', column: 'accountId', render: 'TEXT_ID' },
558
+ },
559
+ {
560
+ key: 'accountPersonName',
561
+ labelKey: 'form.account_person_name',
562
+ fieldType: 'ID_OR_TEXT',
563
+ formulaValueSource: 'LOG_ACCOUNT_ID',
564
+ relatedTable: 'accounts',
565
+ width: 220,
566
+ ordinal: 16,
567
+ filterable: true,
568
+ sortable: true,
569
+ reach: {
570
+ join: 'accountProfile',
571
+ kind: 'PERSON_NAME',
572
+ lastNameColumn: 'lastName',
573
+ firstNameColumn: 'firstName',
574
+ },
575
+ },
576
+ ],
577
+ },
578
+ };
@@ -2,14 +2,14 @@ import type { IntegrationConnectionStatusEnum } from './integration.ts';
2
2
  import { INTEGRATION_CONNECTION_STATUSES } from './integration.ts';
3
3
 
4
4
  export const SQUARE_OAUTH_SCOPES = [
5
- 'MERCHANT_PROFILE_READ',
6
- 'PAYMENTS_READ',
7
- 'ORDERS_READ',
8
- 'ORDERS_WRITE',
9
- 'PAYMENTS_WRITE',
5
+ 'MERCHANT_PROFILE_READ',
6
+ 'PAYMENTS_READ',
7
+ 'ORDERS_READ',
8
+ 'ORDERS_WRITE',
9
+ 'PAYMENTS_WRITE',
10
10
  ] as const;
11
11
 
12
- export type SquareOAuthScope = typeof SQUARE_OAUTH_SCOPES[number];
12
+ export type SquareOAuthScope = (typeof SQUARE_OAUTH_SCOPES)[number];
13
13
 
14
14
  export const SQUARE_CONNECTION_STATUSES = INTEGRATION_CONNECTION_STATUSES;
15
15
 
@@ -1,12 +1,61 @@
1
-
2
1
  export const STORAGE_INTENT_ENUMS = [
3
- 'REPORT_SUBMISSION_FILE',
4
- 'CREATE_COMPLIANCE_DOCUMENT',
2
+ 'FIELD_DOC_SUBMISSION_FILE',
3
+ 'CAMPAIGN_HEADER_IMAGE',
4
+ 'CREATE_COMPLIANCE_DOCUMENT',
5
+ 'IMPORT_SHEET_FILE',
6
+ 'EXPORT_SHEET_FILE',
7
+ 'AI_CHAT_FILE',
8
+ 'CAMPAIGN_GENERATION_FILE',
9
+ 'AI_GENERATED_FILE',
10
+ 'AGENT_DOC_FILE',
11
+ 'LOG_FILE',
12
+ 'UNUSED',
13
+ 'STATIC',
14
+ ] as const;
15
+
16
+ // Public form header images are resized by the asset route before display.
17
+ export const CAMPAIGN_HEADER_IMAGE_CONTENT_TYPES = [
18
+ 'image/jpeg',
19
+ 'image/png',
20
+ 'image/webp',
21
+ ] as const;
22
+
23
+ export const CAMPAIGN_HEADER_IMAGE_MAX_FILE_SIZE = 10 * 1024 * 1024;
24
+
25
+ // How long AI-generated files (CSV exports) stay downloadable before the
26
+ // daily cron reaps the GCS object; storage_generated rows stay as history
27
+ export const GENERATED_FILE_RETENTION_DAYS = 180;
28
+
29
+ // Maximum number of files that can be attached to a single AI chat message
30
+ export const MAX_AI_CHAT_ATTACHMENTS = 5;
31
+
32
+ // Maximum number of source files accepted by one public-form generation
33
+ export const MAX_PUBLIC_FORM_GENERATION_FILES = 10;
34
+
35
+ // File extensions the AI chat composer accepts. This must stay a subset of the
36
+ // OPENAI_PROMPT_*_EXTENSIONS lists in [server/src/utils/file.ts]
37
+ export const AI_CHAT_FILE_EXTENSIONS = [
38
+ // Images (input_image)
39
+ 'gif',
40
+ 'jpeg',
41
+ 'jpg',
42
+ 'png',
43
+ 'webp',
44
+ // Documents (input_file)
45
+ 'csv',
46
+ 'doc',
47
+ 'docx',
48
+ 'md',
49
+ 'pdf',
50
+ 'tsv',
51
+ 'txt',
52
+ 'xls',
53
+ 'xlsx',
5
54
  ];
6
55
 
7
56
  export const FILE_STATUS_ENUMS = [
8
- 'PENDING', // default value
9
- 'PROCESSING',
10
- 'COMPLETED',
11
- 'FAILED',
57
+ 'PENDING', // default value
58
+ 'PROCESSING',
59
+ 'COMPLETED',
60
+ 'FAILED',
12
61
  ] as const;