@jsb188/mday 1.1.8 → 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 -35
- 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 +48 -0
- package/src/constants/dataTableFieldTypes.generated.ts +63 -0
- package/src/constants/docAccess.ts +32 -0
- package/src/constants/email.ts +44 -0
- package/src/constants/fieldDoc.ts +34 -0
- package/src/constants/graphqlReactivity.ts +113 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +13 -0
- package/src/constants/log.ts +7 -366
- 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 +18 -11
- 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 +168 -0
- package/src/constants/sheetRegionSources.generated.ts +578 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +61 -0
- package/src/constants/usage.ts +79 -0
- package/src/schemas/editLogEntry.ts +1017 -738
- package/src/schemas/fieldDocsQuery.ts +12 -0
- package/src/schemas/inboundContact.ts +77 -0
- package/src/schemas/logsQuery.ts +57 -316
- package/src/schemas/organization.ts +53 -213
- package/src/types/account.d.ts +81 -0
- 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 +366 -0
- package/src/types/docAccess.d.ts +96 -0
- package/src/types/email.d.ts +142 -0
- package/src/types/fieldDoc.d.ts +273 -0
- package/src/types/inboundContact.d.ts +57 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +169 -190
- package/src/types/noteDoc.d.ts +86 -0
- package/src/types/organization.d.ts +175 -76
- package/src/types/pageRoute.d.ts +48 -0
- package/src/types/schedule.d.ts +391 -0
- package/src/types/sheet.d.ts +1130 -0
- package/src/types/storage.d.ts +242 -0
- package/src/types/usage.d.ts +106 -0
- package/src/types/workflow.d.ts +305 -0
- 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 +849 -0
- 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 +172 -0
- package/src/utils/fieldDoc.ts +113 -0
- package/src/utils/log.ts +173 -778
- 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 +683 -81
- 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 +4973 -0
- 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 +32 -0
- package/src/utils/storage.ts +152 -0
- package/src/utils/table-route.ts +262 -0
- package/src/utils/workflow.ts +380 -0
- 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 +12 -0
- package/vitest.config.ts +8 -0
- package/src/constants/log-activityTexts.ts +0 -209
- package/src/constants/product.ts +0 -66
- package/src/constants/report.ts +0 -25
- package/src/schemas/childOrganizationsQuery.ts +0 -44
- package/src/schemas/productsQuery.ts +0 -145
- package/src/schemas/reportsQuery.ts +0 -107
- package/src/types/action.d.ts +0 -42
- package/src/types/product.d.ts +0 -173
- package/src/types/report.d.ts +0 -203
- package/src/utils/product-calEvent.ts +0 -508
- package/src/utils/route-helpers.ts +0 -583
package/src/types/log.d.ts
CHANGED
|
@@ -1,224 +1,175 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
LOG_FARMERS_MARKET_ACTIVITY_ENUMS,
|
|
8
|
-
LOG_LIVESTOCK_ACTIVITY_ENUMS,
|
|
9
|
-
LOG_SORT_ENUMS
|
|
10
|
-
} from '../constants/log';
|
|
1
|
+
import { REQUEST_SOURCE_ENUMS } from '@jsb188/app/constants/agent.ts';
|
|
2
|
+
import type { LabelAndValue } from '@jsb188/app/types/other.d.ts';
|
|
3
|
+
import { LOG_SORT_ENUMS } from '../constants/log.ts';
|
|
4
|
+
import type { OrganizationOperationEnum } from '../types/organization.d.ts';
|
|
5
|
+
import type { AccountObj } from './account.d.ts';
|
|
6
|
+
import type { StorageGQL } from './storage.d.ts';
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
9
|
* Enums
|
|
14
10
|
*/
|
|
15
11
|
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
12
|
+
export type LogContentName = 'log' | 'invoice' | 'receipt'; // For UI visuals, client-side only
|
|
13
|
+
export type LogSortEnum = (typeof LOG_SORT_ENUMS)[number];
|
|
14
|
+
export type RequestSourceEnum = (typeof REQUEST_SOURCE_ENUMS)[number];
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export type LogArableTypeEnum =
|
|
25
|
-
| 'SEED'
|
|
26
|
-
| 'PLANTING'
|
|
27
|
-
| 'FIELD'
|
|
28
|
-
| 'HARVEST'
|
|
29
|
-
| 'POST_HARVEST'
|
|
30
|
-
| 'SALES'
|
|
31
|
-
| 'WATER'
|
|
32
|
-
| 'HYGIENE'
|
|
33
|
-
| 'SANITATION'
|
|
34
|
-
| 'EQUIPMENTS'
|
|
35
|
-
| 'BIOSECURITY'
|
|
36
|
-
| 'EMPLOYEES';
|
|
37
|
-
export type LogArableActivityEnum = typeof LOG_ARABLE_ACTIVITY_ENUMS[number];
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Farmers Market
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export type LogFarmersMarketTypeEnum = 'MARKET_RECEIPTS' | 'MARKET_OPERATIONS';
|
|
44
|
-
export type LogFarmersMarketActivityEnum = typeof LOG_FARMERS_MARKET_ACTIVITY_ENUMS[number];
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Livestock
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
export type LogLivestockTypeEnum =
|
|
51
|
-
| 'SUPPLY_PURCHASE'
|
|
52
|
-
| 'LIVESTOCK_LIFE_CYCLE'
|
|
53
|
-
| 'LIVESTOCK_TRACKING'
|
|
54
|
-
| 'PASTURE_LAND_MANAGEMENT'
|
|
55
|
-
| 'LIVESTOCK_HEALTHCARE'
|
|
56
|
-
| 'LIVESTOCK_SALE';
|
|
57
|
-
export type LogLivestockActivityEnum = typeof LOG_LIVESTOCK_ACTIVITY_ENUMS[number];
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* All log types/activities Union
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
export type LogTypeEnum = LogArableTypeEnum | LogFarmersMarketTypeEnum | LogLivestockTypeEnum | 'AI_TASK';
|
|
64
|
-
export type LogActivityEnum = LogArableActivityEnum | LogFarmersMarketActivityEnum | LogLivestockActivityEnum;
|
|
16
|
+
// Activity and group keys are registry data and can be extended per organization.
|
|
17
|
+
export type LogTypeEnum = string;
|
|
18
|
+
export type LogActivityEnum = string;
|
|
65
19
|
|
|
66
20
|
/**
|
|
67
|
-
*
|
|
21
|
+
* Shared log details fields
|
|
68
22
|
*/
|
|
69
23
|
|
|
70
|
-
interface
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
24
|
+
export interface LogDetailsBase {
|
|
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;
|
|
87
44
|
}
|
|
88
45
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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;
|
|
93
53
|
}
|
|
94
54
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
location: string;
|
|
106
|
-
fieldLocation?: string;
|
|
107
|
-
otherParty?: string;
|
|
108
|
-
referenceNumber?: string;
|
|
109
|
-
values?: LabelValueObj[];
|
|
110
|
-
tax: number;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export interface LogArableObj {
|
|
114
|
-
type?: LogArableTypeEnum; // Only set in server if manually extended
|
|
115
|
-
activity: LogArableActivityEnum;
|
|
116
|
-
notes: string | null;
|
|
117
|
-
translation?: string | null;
|
|
118
|
-
metadata?: Partial<LogArableMetadata> | null;
|
|
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;
|
|
119
65
|
}
|
|
120
66
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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;
|
|
125
77
|
}
|
|
126
78
|
|
|
127
|
-
|
|
79
|
+
// Details for registry-driven operations; type/activity are registry keys
|
|
80
|
+
export interface LogEntryDetailsGQL {
|
|
81
|
+
__typename: 'LogEntryDetails';
|
|
128
82
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
export type LogFarmersMarketMetadata = LogMetadataBase & {
|
|
134
|
-
referenceNumber: string;
|
|
135
|
-
voided: boolean;
|
|
136
|
-
childOrgId?: number;
|
|
137
|
-
values: LabelValueObj[];
|
|
138
|
-
};
|
|
83
|
+
id: string;
|
|
84
|
+
type: string | null;
|
|
85
|
+
activity: string;
|
|
86
|
+
notes: string;
|
|
139
87
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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;
|
|
147
99
|
}
|
|
148
100
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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;
|
|
156
108
|
}
|
|
157
109
|
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
damIdentifier?: string;
|
|
166
|
-
livestockIdentifiers: string[];
|
|
167
|
-
livestockGroup?: string;
|
|
168
|
-
livestock: string;
|
|
169
|
-
otherParty?: string;
|
|
170
|
-
referenceNumber?: string;
|
|
171
|
-
values?: LabelValueObj[];
|
|
172
|
-
item: string;
|
|
173
|
-
quantity: number;
|
|
174
|
-
unit: string;
|
|
175
|
-
location: string;
|
|
176
|
-
fieldLocation?: string;
|
|
177
|
-
price: number;
|
|
178
|
-
tax: number;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export interface LogLivestockObj {
|
|
182
|
-
type?: LogLivestockTypeEnum; // Only set in server if manually extended
|
|
183
|
-
activity: LogLivestockActivityEnum;
|
|
184
|
-
notes: string | null;
|
|
185
|
-
translation?: string | null;
|
|
186
|
-
damIdentifier?: string;
|
|
187
|
-
livestockIdentifiers: string[];
|
|
188
|
-
livestockGroup?: string;
|
|
189
|
-
metadata?: Partial<LogLivestockMetadata> | null;
|
|
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;
|
|
190
117
|
}
|
|
191
118
|
|
|
192
|
-
export interface
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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;
|
|
196
129
|
}
|
|
197
130
|
|
|
198
|
-
export
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
export type LogDetailsObj = LogArableObj | LogFarmersMarketObj | LogLivestockObj;
|
|
205
|
-
export type LogMetadataGQL = LogArableMetadataGQL | LogFarmersMarketMetadataGQL | LogLivestockMetadataGQL;
|
|
131
|
+
export interface LogTaxonomyGQL {
|
|
132
|
+
operation: string;
|
|
133
|
+
groups: LogTaxonomyGroupGQL[];
|
|
134
|
+
activities: LogTaxonomyActivityGQL[];
|
|
135
|
+
fieldDefs: LogTaxonomyFieldDefGQL[];
|
|
136
|
+
}
|
|
206
137
|
|
|
207
138
|
/**
|
|
208
139
|
* GQL data interfaces
|
|
209
140
|
*/
|
|
210
141
|
|
|
211
142
|
export interface LogEntryGQL {
|
|
143
|
+
__typename: string;
|
|
212
144
|
__deleted?: boolean;
|
|
213
145
|
|
|
214
146
|
id: string;
|
|
147
|
+
cursor?: string | null;
|
|
215
148
|
accountId: string;
|
|
216
149
|
organizationId: string;
|
|
217
|
-
|
|
218
|
-
|
|
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;
|
|
219
170
|
|
|
220
171
|
account: any;
|
|
221
|
-
|
|
172
|
+
files: StorageGQL[];
|
|
222
173
|
|
|
223
174
|
date: string; // ISO date string
|
|
224
175
|
createdAt: string; // ISO date string
|
|
@@ -227,9 +178,18 @@ export interface LogEntryGQL {
|
|
|
227
178
|
|
|
228
179
|
export interface LogEntryInsertObj {
|
|
229
180
|
id?: number | bigint; // Only for edits
|
|
230
|
-
accountId: number | bigint;
|
|
181
|
+
accountId: number | bigint | null;
|
|
231
182
|
organizationId: number | bigint;
|
|
232
|
-
|
|
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;
|
|
233
193
|
details: any;
|
|
234
194
|
date: Date;
|
|
235
195
|
}
|
|
@@ -239,16 +199,36 @@ export interface LogEntryData {
|
|
|
239
199
|
id: number | bigint;
|
|
240
200
|
accountId: number | bigint;
|
|
241
201
|
organizationId: number | bigint;
|
|
242
|
-
|
|
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;
|
|
243
224
|
distance?: number; // For vector search
|
|
244
|
-
details:
|
|
225
|
+
details: LogEntryDetailsData;
|
|
245
226
|
date: Date;
|
|
246
227
|
createdAt: Date;
|
|
247
228
|
updatedAt: Date;
|
|
248
229
|
|
|
249
230
|
// This is for outputs, but will never be set for inserts
|
|
250
231
|
account?: AccountObj;
|
|
251
|
-
actions?: ActionTaskObj[];
|
|
252
232
|
}
|
|
253
233
|
|
|
254
234
|
/**
|
|
@@ -256,13 +236,12 @@ export interface LogEntryData {
|
|
|
256
236
|
*/
|
|
257
237
|
|
|
258
238
|
export interface FilterLogEntriesArgs {
|
|
259
|
-
operation: OrganizationOperationEnum;
|
|
260
239
|
accountId?: string | null; // Account ID to filter logs by account
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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;
|
|
264
244
|
startDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
265
245
|
endDate?: string | null; // CalDate, with dashes (YYYY-MM-DD)
|
|
266
|
-
timeZone?: string | null; // Timezone string, e.g., 'America/New_York'
|
|
267
246
|
query?: string | null;
|
|
268
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
|
+
}
|