@jsb188/mday 1.1.11 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/package.json +58 -23
  2. package/src/constants/agentMemory.ts +14 -45
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +156 -47
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +12 -38
  10. package/src/constants/dataTableFieldTypes.generated.ts +3 -7
  11. package/src/constants/docAccess.ts +3 -2
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +114 -12
  14. package/src/constants/fieldDoc.ts +74 -4
  15. package/src/constants/graphqlReactivity.ts +108 -25
  16. package/src/constants/log.ts +9 -0
  17. package/src/constants/logDisplay/README.md +88 -0
  18. package/src/constants/logDisplay/defaults.ts +39 -0
  19. package/src/constants/logDisplay/index.ts +27 -0
  20. package/src/constants/logDisplay/operations/arable.ts +16 -0
  21. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  22. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  23. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  24. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  25. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  26. package/src/constants/logTaxonomy.generated.ts +1834 -730
  27. package/src/constants/organization.ts +13 -14
  28. package/src/constants/qrCode.ts +30 -0
  29. package/src/constants/sheet.ts +65 -101
  30. package/src/constants/sms.ts +18 -0
  31. package/src/constants/storage.ts +33 -9
  32. package/src/constants/usage.ts +3 -0
  33. package/src/constants/workflowSteps.ts +60 -0
  34. package/src/schemas/editLogEntry.ts +106 -283
  35. package/src/schemas/inboundContact.ts +5 -5
  36. package/src/types/agentMemory.d.ts +38 -14
  37. package/src/types/agentNote.d.ts +443 -0
  38. package/src/types/billing.d.ts +537 -0
  39. package/src/types/campaign.d.ts +1043 -193
  40. package/src/types/contact.d.ts +15 -0
  41. package/src/types/csvExport.d.ts +213 -0
  42. package/src/types/dataAnalysis.d.ts +44 -0
  43. package/src/types/dataTable.d.ts +102 -309
  44. package/src/types/definitionElement.d.ts +35 -0
  45. package/src/types/dt.d.ts +257 -0
  46. package/src/types/email.d.ts +144 -55
  47. package/src/types/emailReplyReport.d.ts +76 -0
  48. package/src/types/fieldDoc.d.ts +579 -150
  49. package/src/types/fieldDocContract.d.ts +90 -0
  50. package/src/types/inboundContact.d.ts +8 -0
  51. package/src/types/log.d.ts +94 -3
  52. package/src/types/logDisplay.types.ts +85 -0
  53. package/src/types/organization.d.ts +8 -3
  54. package/src/types/qrCode.d.ts +96 -0
  55. package/src/types/richText.d.ts +81 -0
  56. package/src/types/sheet.d.ts +180 -463
  57. package/src/types/sms.d.ts +38 -0
  58. package/src/types/storage.d.ts +266 -27
  59. package/src/types/workflow.d.ts +196 -66
  60. package/src/utils/agentMemory.ts +15 -0
  61. package/src/utils/agentNote.ts +850 -0
  62. package/src/utils/aiChat.ts +31 -14
  63. package/src/utils/aiChatWork.ts +64 -0
  64. package/src/utils/billing.ts +37 -0
  65. package/src/utils/campaign.ts +642 -209
  66. package/src/utils/campaignAI.ts +72 -0
  67. package/src/utils/campaignAccess.ts +239 -0
  68. package/src/utils/campaignEmail.ts +601 -0
  69. package/src/utils/campaignEmailCompiler.ts +372 -0
  70. package/src/utils/campaignEmailImages.ts +60 -0
  71. package/src/utils/campaignEmailStyles.ts +544 -0
  72. package/src/utils/campaignLifecycle.ts +104 -0
  73. package/src/utils/campaignPreview.ts +285 -0
  74. package/src/utils/contact.ts +50 -0
  75. package/src/utils/csvExport.ts +19 -0
  76. package/src/utils/dataTable.ts +18 -556
  77. package/src/utils/dataTableFieldTypeRegistry.ts +1 -0
  78. package/src/utils/dataTableRelativeDate.ts +447 -0
  79. package/src/utils/definitionElement.ts +84 -0
  80. package/src/utils/email.ts +208 -1
  81. package/src/utils/emailReplyReport.test.ts +187 -0
  82. package/src/utils/emailReplyReport.ts +143 -0
  83. package/src/utils/fieldDoc.ts +81 -37
  84. package/src/utils/fieldDocAnswers.ts +128 -0
  85. package/src/utils/fieldDocDefaults.ts +36 -0
  86. package/src/utils/fieldDocProgram.ts +36 -0
  87. package/src/utils/fieldDocSummary.ts +30 -0
  88. package/src/utils/log.ts +232 -141
  89. package/src/utils/logDisplay.helpers.ts +177 -0
  90. package/src/utils/logDisplay.ts +87 -0
  91. package/src/utils/logStoreRead.ts +9 -13
  92. package/src/utils/logTaxonomy.helpers.ts +17 -0
  93. package/src/utils/logTaxonomyDisplay.ts +80 -124
  94. package/src/utils/noteDoc.ts +66 -284
  95. package/src/utils/organization.ts +117 -283
  96. package/src/utils/qrCode.helpers.ts +189 -0
  97. package/src/utils/qrCode.test.ts +519 -0
  98. package/src/utils/qrCode.ts +273 -0
  99. package/src/utils/richTextHTML.ts +385 -0
  100. package/src/utils/sheet.ts +123 -4834
  101. package/src/utils/sheetAxisMove.ts +77 -291
  102. package/src/utils/sheetBootstrap.ts +771 -1138
  103. package/src/utils/sheetCellLiteral.ts +101 -0
  104. package/src/utils/sheetCommand.ts +23 -88
  105. package/src/utils/sheetDesign.ts +705 -0
  106. package/src/utils/sheetExport.ts +17 -69
  107. package/src/utils/sheetFeatureReference.ts +183 -0
  108. package/src/utils/sheetFormulaArgs.ts +168 -0
  109. package/src/utils/sheetFormulaCompile.ts +475 -0
  110. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  111. package/src/utils/sheetFormulaCriteria.ts +656 -0
  112. package/src/utils/sheetFormulaDate.ts +444 -0
  113. package/src/utils/sheetFormulaEvaluation.ts +388 -403
  114. package/src/utils/sheetFormulaEvaluator.ts +589 -444
  115. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  116. package/src/utils/sheetFormulaLogical.ts +116 -0
  117. package/src/utils/sheetFormulaLookup.ts +488 -0
  118. package/src/utils/sheetFormulaMath.ts +48 -0
  119. package/src/utils/sheetFormulaParser.ts +729 -0
  120. package/src/utils/sheetFormulaRange.ts +330 -0
  121. package/src/utils/sheetFormulaReference.ts +703 -0
  122. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  123. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  124. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  125. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  126. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  127. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  128. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  129. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  130. package/src/utils/sheetFormulaText.ts +430 -0
  131. package/src/utils/sheetJournal.ts +140 -18
  132. package/src/utils/sheetNumberFormat.ts +68 -267
  133. package/src/utils/sheetPreview.ts +68 -0
  134. package/src/utils/sheetSequence.ts +13 -43
  135. package/src/utils/sheetSnapshot.ts +176 -429
  136. package/src/utils/sheetStructureEdit.ts +537 -907
  137. package/src/utils/sheetStructureReferences.ts +389 -0
  138. package/src/utils/storage.ts +49 -3
  139. package/src/utils/time.ts +12 -0
  140. package/src/utils/workflow.ts +199 -73
  141. package/src/utils/workflowLogFingerprint.ts +302 -0
  142. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  143. package/src/utils/workflowProgress.ts +280 -0
  144. package/src/utils/workflowTriggers.ts +61 -0
  145. package/tests/agentNote.test.ts +395 -0
  146. package/tests/campaignAI.test.ts +119 -0
  147. package/tests/campaignAccess.test.ts +239 -0
  148. package/tests/campaignEmail.test.ts +441 -0
  149. package/tests/campaignLifecycle.test.ts +134 -0
  150. package/tests/campaignPublication.test.ts +309 -0
  151. package/tests/dataTableFieldTypeRegistry.test.ts +2 -1
  152. package/tests/dataTableRelativeDate.test.ts +412 -0
  153. package/tests/email.test.ts +39 -0
  154. package/tests/fieldDocProgram.test.ts +114 -0
  155. package/tests/logDisplay.fixtures.ts +67 -0
  156. package/tests/logDisplay.test.ts +227 -0
  157. package/tests/noteDoc.test.ts +37 -192
  158. package/tests/richTextHTML.test.ts +185 -0
  159. package/tests/sheetAxisMove.test.ts +49 -40
  160. package/tests/sheetBootstrap.test.ts +1967 -0
  161. package/tests/sheetFeatureReference.test.ts +22 -0
  162. package/tests/sheetFormulaCriteria.test.ts +269 -0
  163. package/tests/sheetFormulaEvaluator.test.ts +93 -200
  164. package/tests/sheetFormulaFunctions.test.ts +538 -0
  165. package/tests/sheetFormulaLanguage.test.ts +361 -0
  166. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  167. package/tests/sheetFormulaParity.test.ts +188 -0
  168. package/tests/sheetFormulaRange.test.ts +167 -0
  169. package/tests/sheetFormulaReference.test.ts +78 -0
  170. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  171. package/tests/sheetFormulaTextDate.test.ts +512 -0
  172. package/tests/sheetSequence.test.ts +4 -23
  173. package/tests/sheetSnapshot.test.ts +134 -0
  174. package/tests/sheetStructureEdit.test.ts +492 -37
  175. package/tests/sheetStructureReferences.test.ts +589 -0
  176. package/tests/workflowLifecycleStatus.test.ts +60 -0
  177. package/tests/workflowLogFingerprint.test.ts +203 -0
  178. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  179. package/tests/workflowProgress.test.ts +180 -0
  180. package/tests/workflowTriggers.test.ts +29 -0
  181. package/src/constants/agentDoc.ts +0 -12
  182. package/src/constants/logActivityGroupColors.generated.ts +0 -19
  183. package/src/constants/schedule.ts +0 -220
  184. package/src/constants/scheduleRuleTemplateSeed.ts +0 -138
  185. package/src/constants/scheduleRuleTemplates.generated.ts +0 -145
  186. package/src/constants/sheetRegionSources.generated.ts +0 -578
  187. package/src/schemas/fieldDocsQuery.ts +0 -12
  188. package/src/schemas/organization.ts +0 -68
  189. package/src/types/agentDoc.d.ts +0 -64
  190. package/src/types/noteDoc.d.ts +0 -86
  191. package/src/types/schedule.d.ts +0 -391
  192. package/src/utils/agentDoc.ts +0 -109
  193. package/src/utils/campaignFormEditor.ts +0 -871
  194. package/src/utils/dataTableRealtimeAuthority.ts +0 -209
  195. package/src/utils/dataTableRealtimeSelection.ts +0 -134
  196. package/src/utils/dataTableRowDocument.ts +0 -508
  197. package/src/utils/dataTableSource.ts +0 -230
  198. package/src/utils/schedule.ts +0 -799
  199. package/src/utils/scheduleEvaluation.ts +0 -1994
  200. package/src/utils/scheduleICS.ts +0 -246
  201. package/src/utils/scheduleRuleTemplates.ts +0 -188
  202. package/src/utils/sheetRegion.ts +0 -374
  203. package/src/utils/sheetRegionFilter.ts +0 -1259
  204. package/src/utils/sheetRegionSourceRegistry.ts +0 -594
  205. package/tests/schedule.test.ts +0 -693
  206. package/tests/scheduleEvaluation.test.ts +0 -1970
  207. package/tests/scheduleICS.test.ts +0 -208
  208. package/tests/scheduleRuleTemplates.test.ts +0 -176
  209. package/tests/scheduleSweepInvariants.test.ts +0 -428
  210. package/tests/sheetRegionFilter.test.ts +0 -1135
@@ -14,6 +14,16 @@ export const OPERATION_ENUMS = [
14
14
  'VENDOR',
15
15
  'WHOLESALE_FOOD',
16
16
  'UNKNOWN',
17
+
18
+ // Project-scheduled operations (appended; see note above)
19
+ 'CONSTRUCTION',
20
+ 'UTILITIES',
21
+ 'CHILDCARE',
22
+
23
+ // Registry-logged operations (appended; see note above)
24
+ 'CONSTRUCTION_INSPECTION_AGENCY',
25
+ 'EMERGENCY_MEDICAL_SERVICES_AGENCY',
26
+ 'FOOD_MANUFACTURING',
17
27
  ];
18
28
 
19
29
  export const PARENT_ORG_OPERATIONS = ['FARMERS_MARKET', 'GROWER_NETWORK'];
@@ -32,14 +42,7 @@ export const ROLE_CATEGORY_ENUMS = ['EMPLOYEES_ONLY', 'MANAGERS_ONLY'];
32
42
 
33
43
  // Org departments
34
44
 
35
- export const ORG_CONTACTS = [
36
- 'PRIMARY_CONTACT',
37
- 'ACCOUNTS_RECEIVABLE',
38
- 'SALES',
39
- 'CUSTOMER_SERVICE',
40
- 'SHIPPING_RECEIVING',
41
- 'OTHER',
42
- ];
45
+ export const ORG_CONTACTS = ['PRIMARY_CONTACT', 'ACCOUNTS_RECEIVABLE', 'SALES', 'CUSTOMER_SERVICE', 'SHIPPING_RECEIVING', 'OTHER'];
43
46
 
44
47
  // Compliance
45
48
 
@@ -52,10 +55,6 @@ export const COMPLIANCE_DOCUMENT_TYPE_MAP = {
52
55
  'Nursery License': 'NURSERY_LICENSE',
53
56
  };
54
57
 
55
- export const COMPLIANCE_DOCUMENT_TYPE_ENUMS = Object.values(
56
- COMPLIANCE_DOCUMENT_TYPE_MAP,
57
- );
58
+ export const COMPLIANCE_DOCUMENT_TYPE_ENUMS = Object.values(COMPLIANCE_DOCUMENT_TYPE_MAP);
58
59
 
59
- export const COMPLIANCE_DOCUMENT_TYPE_LABELS = Object.keys(
60
- COMPLIANCE_DOCUMENT_TYPE_MAP,
61
- );
60
+ export const COMPLIANCE_DOCUMENT_TYPE_LABELS = Object.keys(COMPLIANCE_DOCUMENT_TYPE_MAP);
@@ -0,0 +1,30 @@
1
+ export const QR_CODE_LIMITS = {
2
+ maxTextBytes: 2_000,
3
+ nameLength: 120,
4
+ publicIdBytes: 16,
5
+ maxFields: 50,
6
+ fieldKeyLength: 80,
7
+ fieldDescriptionLength: 120,
8
+ fieldValueLength: 255,
9
+ displayNameLength: 120,
10
+ referenceIdLength: 40,
11
+ // Bounds for external scanned JSON envelopes, not editable QR field values.
12
+ maxJSONDepth: 16,
13
+ maxJSONNodes: 2_000,
14
+ } as const;
15
+
16
+ export const QR_CODE_PAYLOAD_VERSION = 3 as const;
17
+
18
+ export const QR_CODE_REFERENCE_TYPES = ['ORGANIZATION_SITE', 'CHILD_ORGANIZATION'] as const;
19
+
20
+ export const QR_CODE_REFERENCE_ID_PREFIXES = {
21
+ ORGANIZATION_SITE: 'site',
22
+ CHILD_ORGANIZATION: 'org',
23
+ } as const;
24
+
25
+ export const QR_CODE_APP_FIELD_REFERENCE_TYPES = {
26
+ siteLocation: 'ORGANIZATION_SITE',
27
+ childOrg: 'CHILD_ORGANIZATION',
28
+ } as const;
29
+
30
+ export const QR_CODE_RENDER_OPTIONS = { errorCorrectionLevel: 'M', margin: 4 } as const;
@@ -1,88 +1,12 @@
1
- export const SHEET_CELL_SOURCE_TYPE_ENUMS = [
2
- 'USER',
3
- 'REGION_GENERATED',
4
- 'REGION_OVERRIDE',
5
- ] as const;
6
-
7
1
  export const SHEET_CELL_TEXT_WRAP_ENUMS = ['OVERFLOW', 'WRAP', 'CLIP'] as const;
8
2
 
9
3
  export const SHEET_CELL_TEXT_ALIGN_ENUMS = ['LEFT', 'CENTER', 'RIGHT'] as const;
10
4
 
11
- export const SHEET_CELL_VERTICAL_ALIGN_ENUMS = [
12
- 'TOP',
13
- 'MIDDLE',
14
- 'BOTTOM',
15
- ] as const;
16
-
17
- export const SHEET_REGION_TYPE_ENUMS = ['DATA_TABLE'] as const;
18
-
19
- export const SHEET_REGION_PROJECTION_STATUS_ENUMS = [
20
- 'PENDING',
21
- 'READY',
22
- 'FAILED',
23
- 'INACTIVE',
24
- ] as const;
25
-
26
- // Registry-generated (sheet region source registry): the custom entries come
27
- // from sheet_region_source_kinds rows; regenerate with (cwd: server/)
28
- // `deno task generate:region-sources`. Re-exported here so every existing
29
- // import site keeps compiling unchanged.
30
- export {
31
- SHEET_CUSTOM_REGION_SOURCE_CHILD_ORGANIZATION_COLUMNS,
32
- SHEET_CUSTOM_REGION_SOURCE_CHILD_ORGANIZATIONS,
33
- SHEET_CUSTOM_REGION_SOURCE_COLUMN_FORMULA_VALUE_SOURCE_ENUMS,
34
- SHEET_CUSTOM_REGION_SOURCE_LOG_COLUMNS,
35
- SHEET_CUSTOM_REGION_SOURCE_LOGS,
36
- SHEET_REGION_SOURCE_DESCRIPTORS,
37
- SHEET_REGION_SOURCE_KIND_KEYS,
38
- SHEET_REGION_SOURCE_TYPE_ENUMS,
39
- } from './sheetRegionSources.generated.ts';
40
-
41
- export const SHEET_REGION_CONFLICT_POLICY_ENUMS = [
42
- 'TRUNCATE_AT_FIRST_BLOCKER',
43
- 'OVERWRITE',
44
- ] as const;
45
-
46
- export const SHEET_REGION_SOURCE_FILTER_COMBINATOR_ENUMS = [
47
- 'AND',
48
- 'OR',
49
- ] as const;
50
-
51
- export const SHEET_REGION_SOURCE_FILTER_OPERATOR_ENUMS = [
52
- 'CONTAINS',
53
- 'EQUALS',
54
- 'IN',
55
- 'IS_EMPTY',
56
- 'GT',
57
- 'GTE',
58
- 'LT',
59
- 'LTE',
60
- 'BEFORE',
61
- 'AFTER',
62
- 'ON_OR_BEFORE',
63
- 'ON_OR_AFTER',
64
- 'CONTAINS_ANY',
65
- ] as const;
66
-
67
- export const SHEET_REGION_SOURCE_SORT_DIRECTION_ENUMS = [
68
- 'ASC',
69
- 'DESC',
70
- ] as const;
5
+ export const SHEET_CELL_VERTICAL_ALIGN_ENUMS = ['TOP', 'MIDDLE', 'BOTTOM'] as const;
71
6
 
72
- export const SHEET_STRUCTURE_OPERATION_ENUMS = [
73
- 'INSERT_ROW_ABOVE',
74
- 'INSERT_COLUMN_LEFT',
75
- 'DELETE_ROW',
76
- 'DELETE_COLUMN',
77
- ] as const;
7
+ export const SHEET_STRUCTURE_OPERATION_ENUMS = ['INSERT_ROW_ABOVE', 'INSERT_COLUMN_LEFT', 'DELETE_ROW', 'DELETE_COLUMN'] as const;
78
8
 
79
- export const SHEET_CELL_VALUE_TYPE_ENUMS = [
80
- 'CELL_INT',
81
- 'CELL_FLOAT',
82
- 'CELL_DATE',
83
- 'CELL_BOOLEAN',
84
- 'CELL_TEXT',
85
- ] as const;
9
+ export const SHEET_CELL_VALUE_TYPE_ENUMS = ['CELL_INT', 'CELL_FLOAT', 'CELL_DATE', 'CELL_BOOLEAN', 'CELL_TEXT'] as const;
86
10
 
87
11
  export const SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS = [
88
12
  'AUTOMATIC',
@@ -104,10 +28,7 @@ export const SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS = [
104
28
  // Canonical Google-Sheets-style pattern per preset number format type; null
105
29
  // types render raw (AUTOMATIC) or require an explicit saved pattern (CUSTOM).
106
30
  // The "$" literal is substituted with the locale currency symbol at resolve time.
107
- export const SHEET_NUMBER_FORMAT_PRESET_PATTERNS: Record<
108
- (typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number],
109
- string | null
110
- > = {
31
+ export const SHEET_NUMBER_FORMAT_PRESET_PATTERNS: Record<(typeof SHEET_CELL_NUMBER_FORMAT_TYPE_ENUMS)[number], string | null> = {
111
32
  AUTOMATIC: null,
112
33
  TEXT: '@',
113
34
  NUMBER: '#,##0.00',
@@ -128,15 +49,11 @@ export const GRID_ITEM_SORT_ENUMS = ['UPDATED_AT_DESC', 'TITLE_ASC'] as const;
128
49
 
129
50
  export const SHEET_EXPORT_FORMAT_ENUMS = ['CSV', 'TSV', 'XLSX', 'PDF'] as const;
130
51
 
131
- // Journaled sheet_tab_changes row kinds. Stage 1 only produces CELLS,
132
- // STRUCTURE, and REGION rows; RANGES and DESIGN are reserved for Stage 5.
133
- export const SHEET_TAB_CHANGE_KIND_ENUMS = [
134
- 'CELLS',
135
- 'STRUCTURE',
136
- 'RANGES',
137
- 'REGION',
138
- 'DESIGN',
139
- ] as const;
52
+ // Journaled sheet_tab_changes row kinds, in the order of the table's CHECK
53
+ // constraint. CELLS rows carry cell images, COMPUTED rows carry
54
+ // derived write-backs (computed fields only); every other kind is a
55
+ // presentation/structure row applied by its own payload shape.
56
+ export const SHEET_TAB_CHANGE_KIND_ENUMS = ['CELLS', 'COMPUTED', 'STRUCTURE', 'DESIGN'] as const;
140
57
 
141
58
  export const GRID_ITEM_LIST_LIMIT = 1000;
142
59
  export const SHEET_MAX_ROW_COUNT = 500;
@@ -144,9 +61,7 @@ export const SHEET_MAX_ROW_COUNT = 500;
144
61
  // imported worksheets at 256 columns (sheetOps-import-parse.ts maxColumns must
145
62
  // stay in sync with this)
146
63
  export const SHEET_MAX_COLUMN_COUNT = 256;
147
- export const SHEET_DATA_TABLE_REGION_DEFAULT_LIMIT = 10;
148
- export const SHEET_DATA_TABLE_REGION_INSERT_DEFAULT_LIMIT = 50;
149
- export const SHEET_DATA_TABLE_REGION_MAX_ROWS = SHEET_MAX_ROW_COUNT;
64
+
150
65
  export const SHEET_DEFAULT_ROW_COUNT = SHEET_MAX_ROW_COUNT;
151
66
  export const SHEET_DEFAULT_COLUMN_COUNT = 26;
152
67
  // Viewport clamps must cover the full sheet caps: the client fetches the whole
@@ -157,12 +72,61 @@ export const SHEET_VIEWPORT_MAX_ROWS = SHEET_MAX_ROW_COUNT;
157
72
  export const SHEET_VIEWPORT_MAX_COLUMNS = SHEET_MAX_COLUMN_COUNT;
158
73
  export const SHEET_DEFAULT_COLUMN_WIDTH = 160;
159
74
 
75
+ // Maximum UTF-16 length stored or relayed for one editable Sheet cell value.
76
+ export const SHEET_CELL_TEXT_MAX_CHARS = 10_000;
77
+
78
+ // Maximum UTF-16 length stored or relayed for one Sheet cell note.
79
+ export const SHEET_CELL_NOTE_MAX_CHARS = 2_000;
80
+
160
81
  // Hard cap for one complete Sheet realtime event encoded as UTF-8 JSON.
161
82
  export const SHEET_REALTIME_RELAY_MAX_BYTES = 64 * 1024;
162
83
 
163
- export const BUILT_IN_DATA_TABLE_NAMES = [
164
- 'log',
165
- 'logs',
166
- 'organizations',
167
- 'orgs',
168
- ];
84
+ // One durable command read set stays bounded identically across browser,
85
+ // IndexedDB, GraphQL, REST beacon, and server transaction validation.
86
+ export const SHEET_COMMAND_PRECONDITION_MAX_SHEET_CELLS = 10_000;
87
+
88
+ // Version 5 accepts ordinary spreadsheet references and builtins. Stored ASTs
89
+ // from older versions must be recompiled from their authored formula text.
90
+ export const SHEET_FORMULA_LANGUAGE_VERSION = 5;
91
+ export const SHEET_FORMULA_MIN_STORED_AST_VERSION = 5;
92
+
93
+ // Builtins that also accept the legacy '@name(...)' spelling. Newer builtins
94
+ // never do, so '@index(...)', '@text(...)' and similar are unknown functions
95
+ export const SHEET_FORMULA_AT_PREFIX_BUILTIN_FUNCTION_NAMES = [
96
+ 'ABS',
97
+ 'AVERAGE',
98
+ 'CEILING',
99
+ 'COUNT',
100
+ 'COUNTA',
101
+ 'DATE',
102
+ 'DAY',
103
+ 'FLOOR',
104
+ 'IF',
105
+ 'IFERROR',
106
+ 'IFNA',
107
+ 'INCLUDES',
108
+ 'MAX',
109
+ 'MIN',
110
+ 'MOD',
111
+ 'MONTH',
112
+ 'NOW',
113
+ 'POWER',
114
+ 'ROUND',
115
+ 'ROUNDDOWN',
116
+ 'ROUNDUP',
117
+ 'REGEXMATCH',
118
+ 'SUM',
119
+ 'TODAY',
120
+ 'YEAR',
121
+ ] as const;
122
+
123
+ // Display tokens for formula error codes (Excel/Sheets spelling). Codes that
124
+ // are not listed display the generic '#ERROR!' token.
125
+ export const SHEET_FORMULA_ERROR_DISPLAY_BY_CODE: Readonly<Record<string, string>> = {
126
+ DIVIDE_BY_ZERO: '#DIV/0!',
127
+ INVALID_NUMBER: '#NUM!',
128
+ INVALID_REFERENCE: '#REF!',
129
+ INVALID_VALUE: '#VALUE!',
130
+ NOT_FOUND: '#N/A',
131
+ };
132
+ export const SHEET_FORMULA_ERROR_FALLBACK_DISPLAY = '#ERROR!';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Supported outbound SMS providers.
3
+ */
4
+ export const SMS_PROVIDER_ENUMS = ['TWILIO', 'TELNYX'] as const;
5
+
6
+ /**
7
+ * Durable outbound SMS lifecycle statuses.
8
+ */
9
+ export const SMS_OUTBOUND_STATUS_ENUMS = [
10
+ 'QUEUED',
11
+ 'PROCESSING',
12
+ 'SENT',
13
+ 'DELIVERED',
14
+ 'FAILED',
15
+ 'DELIVERY_UNKNOWN',
16
+ 'BOUNCED',
17
+ 'BLOCKED',
18
+ ] as const;
@@ -1,39 +1,47 @@
1
+ // The storage_intents DB enum keeps retired labels; code never writes them.
1
2
  export const STORAGE_INTENT_ENUMS = [
2
- 'FIELD_DOC_SUBMISSION_FILE',
3
3
  'CAMPAIGN_HEADER_IMAGE',
4
+ 'CAMPAIGN_ELEMENT_IMAGE',
4
5
  'CREATE_COMPLIANCE_DOCUMENT',
5
6
  'IMPORT_SHEET_FILE',
6
7
  'EXPORT_SHEET_FILE',
7
8
  'AI_CHAT_FILE',
8
9
  'CAMPAIGN_GENERATION_FILE',
10
+ 'CAMPAIGN_TEMPLATE_PREVIEW',
9
11
  'AI_GENERATED_FILE',
10
- 'AGENT_DOC_FILE',
11
12
  'LOG_FILE',
12
13
  'UNUSED',
13
14
  'STATIC',
14
15
  ] as const;
15
16
 
16
17
  // 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;
18
+ export const CAMPAIGN_HEADER_IMAGE_CONTENT_TYPES = ['image/jpeg', 'image/png', 'image/webp'] as const;
22
19
 
23
20
  export const CAMPAIGN_HEADER_IMAGE_MAX_FILE_SIZE = 10 * 1024 * 1024;
24
21
 
22
+ // Email/form content images may retain animation and use any browser image MIME.
23
+ export const CAMPAIGN_ELEMENT_IMAGE_MAX_FILE_SIZE = 20 * 1024 * 1024;
24
+
25
25
  // How long AI-generated files (CSV exports) stay downloadable before the
26
26
  // daily cron reaps the GCS object; storage_generated rows stay as history
27
27
  export const GENERATED_FILE_RETENTION_DAYS = 180;
28
28
 
29
+ // Who may list/download a generated file inside its organization: everyone
30
+ // with generated-files access, or only the account that requested it
31
+ export const GENERATED_FILE_VISIBILITY_ENUMS = ['ORGANIZATION', 'REQUESTER'] as const;
32
+
33
+ // How many times one minted download link (web or SMS) may be redeemed
34
+ // before it stops serving bytes; expiry ends a link regardless of uses
35
+ export const GENERATED_FILE_DOWNLOAD_MAX_USES = 3;
36
+
29
37
  // Maximum number of files that can be attached to a single AI chat message
30
38
  export const MAX_AI_CHAT_ATTACHMENTS = 5;
31
39
 
32
40
  // Maximum number of source files accepted by one public-form generation
33
41
  export const MAX_PUBLIC_FORM_GENERATION_FILES = 10;
34
42
 
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]
43
+ // File extensions the AI chat composer accepts. Images/documents become model files;
44
+ // audio/video use the shared media decoder before entering model context.
37
45
  export const AI_CHAT_FILE_EXTENSIONS = [
38
46
  // Images (input_image)
39
47
  'gif',
@@ -51,6 +59,22 @@ export const AI_CHAT_FILE_EXTENSIONS = [
51
59
  'txt',
52
60
  'xls',
53
61
  'xlsx',
62
+ // Audio recordings and videos (decoded into transcript and timestamped frames)
63
+ 'aac',
64
+ 'amr',
65
+ 'flac',
66
+ 'm4a',
67
+ 'mp3',
68
+ 'ogg',
69
+ 'opus',
70
+ 'wav',
71
+ '3gp',
72
+ '3gpp',
73
+ 'm4v',
74
+ 'mkv',
75
+ 'mov',
76
+ 'mp4',
77
+ 'webm',
54
78
  ];
55
79
 
56
80
  export const FILE_STATUS_ENUMS = [
@@ -30,9 +30,12 @@ export const USAGE_ORIGINS = [
30
30
  'LOG_EMBEDDING',
31
31
  'VOICE_TRANSCRIPTION',
32
32
  'CSV_EXPORT',
33
+ 'CAMPAIGN',
33
34
  'FIELD_DOC',
34
35
  'FORM_SUBMISSION',
35
36
  'USER_ACTION',
37
+ 'SCHEDULE',
38
+ 'AGENT_NOTE',
36
39
  ] as const;
37
40
 
38
41
  /*
@@ -0,0 +1,60 @@
1
+ /* Shared authoring limits for human-readable workflow descriptions. */
2
+ export const WORKFLOW_STEP_TEXT_MAX_LENGTH = 120;
3
+ export const WORKFLOW_STEP_ACTION_WORDS = [
4
+ 'Add',
5
+ 'Ask',
6
+ 'Assign',
7
+ 'Calculate',
8
+ 'Check',
9
+ 'Choose',
10
+ 'Collect',
11
+ 'Compare',
12
+ 'Complete',
13
+ 'Confirm',
14
+ 'Contact',
15
+ 'Copy',
16
+ 'Create',
17
+ 'Delete',
18
+ 'Determine',
19
+ 'Email',
20
+ 'Evaluate',
21
+ 'Fill',
22
+ 'Find',
23
+ 'Finish',
24
+ 'Flag',
25
+ 'Generate',
26
+ 'Identify',
27
+ 'Keep',
28
+ 'Link',
29
+ 'List',
30
+ 'Mark',
31
+ 'Match',
32
+ 'Notify',
33
+ 'Prepare',
34
+ 'Read',
35
+ 'Record',
36
+ 'Remind',
37
+ 'Remove',
38
+ 'Report',
39
+ 'Request',
40
+ 'Resolve',
41
+ 'Resend',
42
+ 'Review',
43
+ 'Save',
44
+ 'Schedule',
45
+ 'Select',
46
+ 'Send',
47
+ 'Set',
48
+ 'Skip',
49
+ 'Sort',
50
+ 'Stop',
51
+ 'Summarize',
52
+ 'Track',
53
+ 'Treat',
54
+ 'Update',
55
+ 'Use',
56
+ 'Validate',
57
+ 'Verify',
58
+ 'Wait',
59
+ ] as const;
60
+ export const WORKFLOW_STEP_TEXT_PATTERN = `^(?:${WORKFLOW_STEP_ACTION_WORDS.join('|')})\\b`;