@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.
- package/package.json +105 -54
- package/src/constants/agentDoc.ts +12 -0
- package/src/constants/agentMemory.ts +154 -0
- package/src/constants/aiChat.ts +5 -0
- package/src/constants/campaign.ts +127 -0
- package/src/constants/dataTable.ts +35 -9
- package/src/constants/dataTableFieldTypes.generated.ts +63 -0
- package/src/constants/docAccess.ts +32 -0
- package/src/constants/email.ts +20 -4
- package/src/constants/fieldDoc.ts +34 -0
- package/src/constants/graphqlReactivity.ts +113 -0
- package/src/constants/integration.ts +8 -9
- package/src/constants/log.ts +7 -410
- package/src/constants/logActivityGroupColors.generated.ts +19 -0
- package/src/constants/logTaxonomy.generated.ts +1103 -0
- package/src/constants/noteDoc.ts +77 -0
- package/src/constants/organization.ts +13 -15
- package/src/constants/pageRoute.ts +23 -0
- package/src/constants/schedule.ts +220 -0
- package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
- package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
- package/src/constants/sheet.ts +154 -6
- package/src/constants/sheetRegionSources.generated.ts +578 -0
- package/src/constants/square.ts +6 -6
- package/src/constants/storage.ts +56 -7
- package/src/constants/usage.ts +79 -0
- package/src/schemas/editLogEntry.ts +1010 -777
- package/src/schemas/fieldDocsQuery.ts +12 -0
- package/src/schemas/inboundContact.ts +60 -55
- package/src/schemas/logsQuery.ts +55 -49
- package/src/schemas/organization.ts +49 -46
- package/src/types/account.d.ts +4 -1
- package/src/types/agentDoc.d.ts +64 -0
- package/src/types/agentMemory.d.ts +74 -0
- package/src/types/campaign.d.ts +683 -0
- package/src/types/dataTable.d.ts +175 -256
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/email.d.ts +83 -12
- package/src/types/fieldDoc.d.ts +273 -0
- package/src/types/inboundContact.d.ts +2 -1
- package/src/types/log.d.ts +209 -341
- package/src/types/noteDoc.d.ts +86 -0
- package/src/types/organization.d.ts +83 -40
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/schedule.d.ts +391 -0
- package/src/types/sheet.d.ts +862 -30
- package/src/types/storage.d.ts +206 -125
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +149 -18
- package/src/utils/agentDoc.ts +109 -0
- package/src/utils/aiChat.ts +26 -0
- package/src/utils/campaign.ts +741 -0
- package/src/utils/campaignFormEditor.ts +871 -0
- package/src/utils/dataTable.ts +425 -410
- package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
- package/src/utils/dataTableRealtimeAuthority.ts +209 -0
- package/src/utils/dataTableRealtimeSelection.ts +134 -0
- package/src/utils/dataTableRowDocument.ts +508 -0
- package/src/utils/dataTableSource.ts +230 -0
- package/src/utils/docAccess.ts +383 -0
- package/src/utils/documentName.ts +53 -0
- package/src/utils/email.ts +112 -53
- package/src/utils/fieldDoc.ts +113 -0
- package/src/utils/log.ts +169 -176
- package/src/utils/logRegistryValue.ts +90 -0
- package/src/utils/logStoreRead.ts +266 -0
- package/src/utils/logTaxonomy.ts +76 -0
- package/src/utils/logTaxonomyDisplay.ts +439 -0
- package/src/utils/noteDoc.ts +827 -0
- package/src/utils/organization.ts +510 -91
- package/src/utils/pageRoute.ts +71 -0
- package/src/utils/schedule.ts +799 -0
- package/src/utils/scheduleEvaluation.ts +1994 -0
- package/src/utils/scheduleICS.ts +246 -0
- package/src/utils/scheduleRuleTemplates.ts +188 -0
- package/src/utils/sheet.ts +4842 -39
- package/src/utils/sheetAxisMove.ts +830 -0
- package/src/utils/sheetBootstrap.ts +1769 -0
- package/src/utils/sheetCommand.ts +423 -0
- package/src/utils/sheetExport.ts +238 -0
- package/src/utils/sheetFormulaEvaluation.ts +914 -0
- package/src/utils/sheetFormulaEvaluator.ts +852 -0
- package/src/utils/sheetJournal.ts +78 -0
- package/src/utils/sheetNumberFormat.ts +1211 -0
- package/src/utils/sheetRegion.ts +374 -0
- package/src/utils/sheetRegionFilter.ts +1259 -0
- package/src/utils/sheetRegionSourceRegistry.ts +594 -0
- package/src/utils/sheetSequence.ts +148 -0
- package/src/utils/sheetSnapshot.ts +992 -0
- package/src/utils/sheetStructureEdit.ts +1284 -0
- package/src/utils/square.ts +22 -12
- package/src/utils/storage.ts +152 -0
- package/src/utils/table-route.ts +127 -11
- package/src/utils/workflow.ts +191 -23
- package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
- package/tests/docAccess.test.ts +525 -0
- package/tests/editLogEntry.test.ts +112 -0
- package/tests/noteDoc.test.ts +669 -0
- package/tests/schedule.test.ts +693 -0
- package/tests/scheduleEvaluation.test.ts +1970 -0
- package/tests/scheduleICS.test.ts +208 -0
- package/tests/scheduleRuleTemplates.test.ts +176 -0
- package/tests/scheduleSweepInvariants.test.ts +428 -0
- package/tests/sheetAxisMove.test.ts +343 -0
- package/tests/sheetFormulaEvaluator.test.ts +575 -0
- package/tests/sheetRegionFilter.test.ts +1135 -0
- package/tests/sheetSequence.test.ts +41 -0
- package/tests/sheetStructureEdit.test.ts +82 -0
- package/tsconfig.json +10 -10
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -235
- package/src/constants/product.ts +0 -42
- package/src/constants/report.ts +0 -44
- package/src/schemas/productsQuery.ts +0 -53
- package/src/schemas/reportsQuery.ts +0 -20
- package/src/types/product.d.ts +0 -84
- package/src/types/report.d.ts +0 -290
- package/src/utils/product-calEvent.ts +0 -455
- package/src/utils/report.ts +0 -158
package/src/types/log.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { REQUEST_SOURCE_ENUMS } from '@jsb188/app/constants/agent.ts';
|
|
2
2
|
import type { LabelAndValue } from '@jsb188/app/types/other.d.ts';
|
|
3
|
-
import {
|
|
4
|
-
LOG_ARABLE_ACTIVITY_ENUMS,
|
|
5
|
-
LOG_FARMERS_MARKET_ACTIVITY_ENUMS,
|
|
6
|
-
LOG_GROWER_NETWORK_ACTIVITY_ENUMS,
|
|
7
|
-
LOG_LIVESTOCK_ACTIVITY_ENUMS,
|
|
8
|
-
LOG_SORT_ENUMS
|
|
9
|
-
} from '../constants/log.ts';
|
|
3
|
+
import { LOG_SORT_ENUMS } from '../constants/log.ts';
|
|
10
4
|
import type { OrganizationOperationEnum } from '../types/organization.d.ts';
|
|
11
5
|
import type { AccountObj } from './account.d.ts';
|
|
12
6
|
import type { StorageGQL } from './storage.d.ts';
|
|
@@ -16,351 +10,225 @@ import type { StorageGQL } from './storage.d.ts';
|
|
|
16
10
|
*/
|
|
17
11
|
|
|
18
12
|
export type LogContentName = 'log' | 'invoice' | 'receipt'; // For UI visuals, client-side only
|
|
19
|
-
export type LogSortEnum = typeof LOG_SORT_ENUMS[number];
|
|
20
|
-
export type RequestSourceEnum = typeof REQUEST_SOURCE_ENUMS[number];
|
|
13
|
+
export type LogSortEnum = (typeof LOG_SORT_ENUMS)[number];
|
|
14
|
+
export type RequestSourceEnum = (typeof REQUEST_SOURCE_ENUMS)[number];
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type LogArableTypeEnum =
|
|
27
|
-
| 'SEED'
|
|
28
|
-
| 'PLANTING'
|
|
29
|
-
| 'FIELD'
|
|
30
|
-
| 'HARVEST'
|
|
31
|
-
| 'POST_HARVEST'
|
|
32
|
-
| 'SALES'
|
|
33
|
-
| 'WATER'
|
|
34
|
-
| 'HYGIENE'
|
|
35
|
-
| 'SANITATION'
|
|
36
|
-
| 'EQUIPMENT'
|
|
37
|
-
| 'BIOSECURITY'
|
|
38
|
-
| 'EMPLOYEE';
|
|
39
|
-
export type LogArableActivityEnum = typeof LOG_ARABLE_ACTIVITY_ENUMS[number];
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Farmers Market
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
export type LogFarmersMarketTypeEnum = 'MARKET_RECEIPT' | 'MARKET_OPERATION';
|
|
46
|
-
export type LogFarmersMarketActivityEnum =
|
|
47
|
-
typeof LOG_FARMERS_MARKET_ACTIVITY_ENUMS[number];
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Grower Network
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
export type LogGrowerNetworkTypeEnum =
|
|
54
|
-
| 'WORKER_PRACTICE'
|
|
55
|
-
| 'EQUIPMENT'
|
|
56
|
-
| 'FIELD'
|
|
57
|
-
| 'PRODUCTION_INPUT'
|
|
58
|
-
| 'OPERATION';
|
|
59
|
-
export type LogGrowerNetworkActivityEnum =
|
|
60
|
-
typeof LOG_GROWER_NETWORK_ACTIVITY_ENUMS[number];
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Livestock
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
export type LogLivestockTypeEnum =
|
|
67
|
-
| 'SUPPLY_PURCHASE'
|
|
68
|
-
| 'LIVESTOCK_LIFE_CYCLE'
|
|
69
|
-
| 'LIVESTOCK_TRACKING'
|
|
70
|
-
| 'PASTURE_LAND_MANAGEMENT'
|
|
71
|
-
| 'LIVESTOCK_HEALTHCARE'
|
|
72
|
-
| 'LIVESTOCK_SALE';
|
|
73
|
-
export type LogLivestockActivityEnum =
|
|
74
|
-
typeof LOG_LIVESTOCK_ACTIVITY_ENUMS[number];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* All log types/activities Union
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
export type LogTypeEnum =
|
|
81
|
-
| LogArableTypeEnum
|
|
82
|
-
| LogFarmersMarketTypeEnum
|
|
83
|
-
| LogGrowerNetworkTypeEnum
|
|
84
|
-
| LogLivestockTypeEnum;
|
|
85
|
-
|
|
86
|
-
export type LogActivityEnum =
|
|
87
|
-
| LogArableActivityEnum
|
|
88
|
-
| LogFarmersMarketActivityEnum
|
|
89
|
-
| LogGrowerNetworkActivityEnum
|
|
90
|
-
| LogLivestockActivityEnum;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Log metadata
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
interface LogMetadataBase {
|
|
97
|
-
__before: any;
|
|
98
|
-
item: string;
|
|
99
|
-
date: string;
|
|
100
|
-
time: string;
|
|
101
|
-
otherParty?: string;
|
|
102
|
-
referenceNumber?: string;
|
|
103
|
-
|
|
104
|
-
// Interface specific
|
|
105
|
-
values?: LabelAndValue[];
|
|
106
|
-
voided?: boolean;
|
|
107
|
-
|
|
108
|
-
summary?: string;
|
|
109
|
-
location?: string;
|
|
110
|
-
tax?: number; // Need to be removed and replaced by values[#].tax -- but this will require some logic changes
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface LogArableMetadata extends LogMetadataBase {
|
|
114
|
-
fieldLocation?: string;
|
|
115
|
-
quantity: number;
|
|
116
|
-
unit: string;
|
|
117
|
-
concentration: number;
|
|
118
|
-
concentrationUnit: string;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface LogFarmersMarketMetadata extends LogMetadataBase {
|
|
122
|
-
values: LabelAndValue[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface LogGrowerNetworkMetadata extends LogMetadataBase {
|
|
126
|
-
fieldLocation?: string;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface LogLivestockMetadata extends LogMetadataBase {
|
|
130
|
-
fieldLocation?: string;
|
|
131
|
-
}
|
|
16
|
+
// Activity and group keys are registry data and can be extended per organization.
|
|
17
|
+
export type LogTypeEnum = string;
|
|
18
|
+
export type LogActivityEnum = string;
|
|
132
19
|
|
|
133
20
|
/**
|
|
134
|
-
*
|
|
21
|
+
* Shared log details fields
|
|
135
22
|
*/
|
|
136
23
|
|
|
137
24
|
export interface LogDetailsBase {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export interface
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
livestockGroup: string | null;
|
|
250
|
-
damIdentifier: string | null;
|
|
251
|
-
otherParty: string | null;
|
|
252
|
-
referenceNumber: string | null;
|
|
253
|
-
values: LabelAndValue[] | null;
|
|
254
|
-
tax: number | null;
|
|
255
|
-
voided: boolean | null;
|
|
256
|
-
item: string | null;
|
|
257
|
-
quantity: number | null;
|
|
258
|
-
unit: string | null;
|
|
259
|
-
price: number | null;
|
|
260
|
-
fieldLocation: string | null;
|
|
25
|
+
id: number | bigint;
|
|
26
|
+
childOrg?: {
|
|
27
|
+
id: number | bigint;
|
|
28
|
+
name: string;
|
|
29
|
+
operation?: OrganizationOperationEnum | null;
|
|
30
|
+
};
|
|
31
|
+
childOrgId?: number | bigint | null;
|
|
32
|
+
fieldDocId?: number | bigint | null;
|
|
33
|
+
fieldDocSubmissionId?: number | bigint | null;
|
|
34
|
+
siteId?: number | bigint | null;
|
|
35
|
+
site?: {
|
|
36
|
+
id: number | bigint;
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
39
|
+
location?: {
|
|
40
|
+
name: string;
|
|
41
|
+
} | null;
|
|
42
|
+
notes: string | null;
|
|
43
|
+
translation: string | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// All operations use one registry-driven details shape.
|
|
47
|
+
export interface LogEntryDetailsData extends LogDetailsBase {
|
|
48
|
+
__table: 'log_entry_details';
|
|
49
|
+
activity: string;
|
|
50
|
+
logType?: string | null;
|
|
51
|
+
fields?: LogEntryDetailsFieldGQL[] | null;
|
|
52
|
+
metadata?: Record<string, any> | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// One typed field-def value on a registry-driven operation's log
|
|
56
|
+
export interface LogEntryDetailsFieldGQL {
|
|
57
|
+
key: string;
|
|
58
|
+
fieldType: string | null;
|
|
59
|
+
textValue: string | null;
|
|
60
|
+
numberValue: number | null;
|
|
61
|
+
booleanValue: boolean | null;
|
|
62
|
+
dateValue: string | null;
|
|
63
|
+
datetimeValue: string | null;
|
|
64
|
+
unit: string | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// One typed field-def value sent when editing a registry-driven log
|
|
68
|
+
export interface LogEntryDetailsFieldInput {
|
|
69
|
+
key: string;
|
|
70
|
+
textValue?: string | null;
|
|
71
|
+
numberValue?: number | null;
|
|
72
|
+
booleanValue?: boolean | null;
|
|
73
|
+
dateValue?: string | null;
|
|
74
|
+
datetimeValue?: string | null;
|
|
75
|
+
unit?: string | null;
|
|
76
|
+
clear?: boolean | null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Details for registry-driven operations; type/activity are registry keys
|
|
80
|
+
export interface LogEntryDetailsGQL {
|
|
81
|
+
__typename: 'LogEntryDetails';
|
|
82
|
+
|
|
83
|
+
id: string;
|
|
84
|
+
type: string | null;
|
|
85
|
+
activity: string;
|
|
86
|
+
notes: string;
|
|
87
|
+
|
|
88
|
+
item: string | null;
|
|
89
|
+
quantity: number | null;
|
|
90
|
+
unit: string | null;
|
|
91
|
+
price: number | null;
|
|
92
|
+
values: LabelAndValue[] | null;
|
|
93
|
+
fields: LogEntryDetailsFieldGQL[] | null;
|
|
94
|
+
|
|
95
|
+
otherParty: string | null;
|
|
96
|
+
referenceNumber: string | null;
|
|
97
|
+
fieldLocation: string | null;
|
|
98
|
+
voided: boolean | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Log taxonomy carried by the existing organization bootstrap (registry rows)
|
|
102
|
+
export interface LogTaxonomyGroupGQL {
|
|
103
|
+
key: string;
|
|
104
|
+
label: string | null;
|
|
105
|
+
ordinal: number | null;
|
|
106
|
+
requiredFields: string[] | null;
|
|
107
|
+
orRequiredFields: string[] | null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface LogTaxonomyActivityGQL {
|
|
111
|
+
key: string;
|
|
112
|
+
groupKey: string | null;
|
|
113
|
+
agentText: string | null;
|
|
114
|
+
ordinal: number | null;
|
|
115
|
+
requiredFields: string[] | null;
|
|
116
|
+
orRequiredFields: string[] | null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface LogTaxonomyFieldDefGQL {
|
|
120
|
+
key: string;
|
|
121
|
+
fieldType: string;
|
|
122
|
+
required: boolean | null;
|
|
123
|
+
ordinal: number | null;
|
|
124
|
+
agentHint: string | null;
|
|
125
|
+
options: string[] | null;
|
|
126
|
+
allowedUnits: string[] | null;
|
|
127
|
+
groupKey: string | null;
|
|
128
|
+
activityKey: string | null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface LogTaxonomyGQL {
|
|
132
|
+
operation: string;
|
|
133
|
+
groups: LogTaxonomyGroupGQL[];
|
|
134
|
+
activities: LogTaxonomyActivityGQL[];
|
|
135
|
+
fieldDefs: LogTaxonomyFieldDefGQL[];
|
|
261
136
|
}
|
|
262
137
|
|
|
263
|
-
/**
|
|
264
|
-
* Union type for log details
|
|
265
|
-
*/
|
|
266
|
-
|
|
267
|
-
export type LogMetadataGQL =
|
|
268
|
-
| LogArableDetailsGQL
|
|
269
|
-
| LogFarmersMarketDetailsGQL
|
|
270
|
-
| LogGrowerNetworkDetailsGQL
|
|
271
|
-
| LogLivestockDetailsGQL;
|
|
272
|
-
|
|
273
138
|
/**
|
|
274
139
|
* GQL data interfaces
|
|
275
140
|
*/
|
|
276
141
|
|
|
277
142
|
export interface LogEntryGQL {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
143
|
+
__typename: string;
|
|
144
|
+
__deleted?: boolean;
|
|
145
|
+
|
|
146
|
+
id: string;
|
|
147
|
+
cursor?: string | null;
|
|
148
|
+
accountId: string;
|
|
149
|
+
organizationId: string;
|
|
150
|
+
childOrgId: string | null;
|
|
151
|
+
childOrgName: string | null;
|
|
152
|
+
inboundContactId: string | null;
|
|
153
|
+
inboundContactName: string | null;
|
|
154
|
+
inboundContactEmail?: string | null;
|
|
155
|
+
inboundContactPhone?: string | null;
|
|
156
|
+
fieldDocId: string | null;
|
|
157
|
+
fieldDocName?: string | null;
|
|
158
|
+
fieldDocSubmissionId: string | null;
|
|
159
|
+
fieldDocSubmissionPeriod?: string | null;
|
|
160
|
+
siteId: string | null;
|
|
161
|
+
siteName?: string | null;
|
|
162
|
+
location: string | null;
|
|
163
|
+
accountPersonName?: string | null;
|
|
164
|
+
details: LogEntryDetailsGQL;
|
|
165
|
+
summary: string;
|
|
166
|
+
source?: RequestSourceEnum | null;
|
|
167
|
+
confidence?: number | null;
|
|
168
|
+
originalMessage?: string | null;
|
|
169
|
+
flagColor?: string | null;
|
|
170
|
+
|
|
171
|
+
account: any;
|
|
172
|
+
files: StorageGQL[];
|
|
173
|
+
|
|
174
|
+
date: string; // ISO date string
|
|
175
|
+
createdAt: string; // ISO date string
|
|
176
|
+
updatedAt: string; // ISO date string
|
|
305
177
|
}
|
|
306
178
|
|
|
307
179
|
export interface LogEntryInsertObj {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
180
|
+
id?: number | bigint; // Only for edits
|
|
181
|
+
accountId: number | bigint | null;
|
|
182
|
+
organizationId: number | bigint;
|
|
183
|
+
childOrgId?: number | bigint | null;
|
|
184
|
+
inboundContactId?: number | bigint | null;
|
|
185
|
+
emailId?: number | bigint | null;
|
|
186
|
+
fieldDocId?: number | bigint | null;
|
|
187
|
+
fieldDocSubmissionId?: number | bigint | null;
|
|
188
|
+
siteId?: number | bigint | null;
|
|
189
|
+
summary: string;
|
|
190
|
+
source?: RequestSourceEnum | null;
|
|
191
|
+
confidence?: number | null;
|
|
192
|
+
originalMessage?: string | null;
|
|
193
|
+
details: any;
|
|
194
|
+
date: Date;
|
|
323
195
|
}
|
|
324
196
|
|
|
325
197
|
export interface LogEntryData {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
updatedAt: Date;
|
|
361
|
-
|
|
362
|
-
// This is for outputs, but will never be set for inserts
|
|
363
|
-
account?: AccountObj;
|
|
198
|
+
__table: 'logs';
|
|
199
|
+
id: number | bigint;
|
|
200
|
+
accountId: number | bigint;
|
|
201
|
+
organizationId: number | bigint;
|
|
202
|
+
childOrgId?: number | bigint | null;
|
|
203
|
+
inboundContactId?: number | bigint | null;
|
|
204
|
+
emailId?: number | bigint | null;
|
|
205
|
+
inboundContact?: {
|
|
206
|
+
id: number | bigint;
|
|
207
|
+
personName?: string | null;
|
|
208
|
+
} | null;
|
|
209
|
+
childOrg?: {
|
|
210
|
+
id: number | bigint;
|
|
211
|
+
name: string;
|
|
212
|
+
operation?: OrganizationOperationEnum | null;
|
|
213
|
+
} | null;
|
|
214
|
+
fieldDocId?: number | bigint | null;
|
|
215
|
+
fieldDocSubmissionId?: number | bigint | null;
|
|
216
|
+
siteId?: number | bigint | null;
|
|
217
|
+
summary: string;
|
|
218
|
+
source?: RequestSourceEnum | null;
|
|
219
|
+
confidence?: number | null;
|
|
220
|
+
originalMessage?: string | null;
|
|
221
|
+
location?: {
|
|
222
|
+
name: string;
|
|
223
|
+
} | null;
|
|
224
|
+
distance?: number; // For vector search
|
|
225
|
+
details: LogEntryDetailsData;
|
|
226
|
+
date: Date;
|
|
227
|
+
createdAt: Date;
|
|
228
|
+
updatedAt: Date;
|
|
229
|
+
|
|
230
|
+
// This is for outputs, but will never be set for inserts
|
|
231
|
+
account?: AccountObj;
|
|
364
232
|
}
|
|
365
233
|
|
|
366
234
|
/**
|
|
@@ -368,12 +236,12 @@ export interface LogEntryData {
|
|
|
368
236
|
*/
|
|
369
237
|
|
|
370
238
|
export interface FilterLogEntriesArgs {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
239
|
+
accountId?: string | null; // Account ID to filter logs by account
|
|
240
|
+
siteId?: string | number | bigint | null; // Site ID to filter logs by site
|
|
241
|
+
preset?: 'WEEKS_5' | null;
|
|
242
|
+
types?: string[] | null;
|
|
243
|
+
activities?: string[] | null;
|
|
244
|
+
startDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
245
|
+
endDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
246
|
+
query?: string | null;
|
|
379
247
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NOTE_BLOCK_TYPES,
|
|
3
|
+
NOTE_INLINE_TYPES,
|
|
4
|
+
NOTE_MARK_TYPES,
|
|
5
|
+
} from '../constants/noteDoc.ts';
|
|
6
|
+
|
|
7
|
+
export type NoteBlockType = (typeof NOTE_BLOCK_TYPES)[number];
|
|
8
|
+
export type NoteInlineType = (typeof NOTE_INLINE_TYPES)[number];
|
|
9
|
+
export type NoteMarkType = (typeof NOTE_MARK_TYPES)[number];
|
|
10
|
+
|
|
11
|
+
// Heading depth; sanitizeNoteDoc clamps anything else into this range
|
|
12
|
+
export type NoteHeadingLevel = 1 | 2 | 3;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Attrs carried by one "image" void block. storageId is the string form of
|
|
16
|
+
* the storage row id and is the notes_storage_rels source-of-truth key:
|
|
17
|
+
* image blocks whose storageId has no surviving rel row are filtered out of
|
|
18
|
+
* the document on read. fileUri locates the GCS object for rendering.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export interface NoteImageAttrs {
|
|
22
|
+
storageId: string;
|
|
23
|
+
fileUri: string;
|
|
24
|
+
alt?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* One inline mark on a text run. color/highlight marks carry a palette
|
|
30
|
+
* token from NOTE_COLOR_TOKENS; link marks carry an http(s)/mailto href;
|
|
31
|
+
* every other mark type carries no attrs.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export interface NoteMark {
|
|
35
|
+
type: NoteMarkType;
|
|
36
|
+
attrs?: {
|
|
37
|
+
token?: string;
|
|
38
|
+
href?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* One inline node inside a text-bearing block: a styled text run, or a
|
|
44
|
+
* hard line break (which carries neither text nor marks).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export interface NoteInlineNode {
|
|
48
|
+
type: NoteInlineType;
|
|
49
|
+
text?: string;
|
|
50
|
+
marks?: NoteMark[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Attrs a block node may carry: "level" on headings, image attrs on image
|
|
55
|
+
* blocks. Every other block type carries no attrs.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export interface NoteBlockAttrs extends Partial<NoteImageAttrs> {
|
|
59
|
+
level?: NoteHeadingLevel;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* One block-level node. Containers (bulletList, orderedList, listItem,
|
|
64
|
+
* blockquote) hold block children; paragraph/heading hold inline children;
|
|
65
|
+
* divider/image hold none. _key and _uploading are client-editor-only
|
|
66
|
+
* fields, always stripped by sanitizeNoteDoc before persistence.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export interface NoteBlockNode {
|
|
70
|
+
type: NoteBlockType;
|
|
71
|
+
attrs?: NoteBlockAttrs;
|
|
72
|
+
content?: Array<NoteBlockNode | NoteInlineNode>;
|
|
73
|
+
_key?: string;
|
|
74
|
+
_uploading?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The root note document stored in notes.content (JSONB). Always non-empty
|
|
79
|
+
* after sanitizing: at least one (possibly empty) paragraph.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export interface NoteDoc {
|
|
83
|
+
type: 'doc';
|
|
84
|
+
version: number;
|
|
85
|
+
content: NoteBlockNode[];
|
|
86
|
+
}
|