@jsb188/mday 1.1.8 → 1.1.10
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 +39 -20
- package/src/constants/dataTable.ts +22 -0
- package/src/constants/email.ts +28 -0
- package/src/constants/inboundContact.ts +8 -0
- package/src/constants/integration.ts +14 -0
- package/src/constants/log-activityTexts.ts +54 -28
- package/src/constants/log.ts +82 -38
- package/src/constants/organization.ts +11 -2
- package/src/constants/product.ts +9 -33
- package/src/constants/report.ts +29 -10
- package/src/constants/sheet.ts +20 -0
- package/src/constants/square.ts +16 -0
- package/src/constants/storage.ts +12 -0
- package/src/schemas/editLogEntry.ts +90 -44
- package/src/schemas/inboundContact.ts +72 -0
- package/src/schemas/logsQuery.ts +7 -272
- package/src/schemas/organization.ts +11 -174
- package/src/schemas/productsQuery.ts +2 -94
- package/src/schemas/reportsQuery.ts +8 -95
- package/src/types/account.d.ts +78 -0
- package/src/types/dataTable.d.ts +447 -0
- package/src/types/email.d.ts +71 -0
- package/src/types/inboundContact.d.ts +56 -0
- package/src/types/integration.d.ts +42 -0
- package/src/types/log.d.ts +289 -178
- package/src/types/organization.d.ts +106 -50
- package/src/types/product.d.ts +7 -96
- package/src/types/report.d.ts +239 -152
- package/src/types/sheet.d.ts +298 -0
- package/src/types/storage.d.ts +161 -0
- package/src/types/workflow.d.ts +174 -0
- package/src/utils/dataTable.ts +834 -0
- package/src/utils/email.ts +113 -0
- package/src/utils/log.ts +30 -628
- package/src/utils/organization.ts +227 -44
- package/src/utils/product-calEvent.ts +7 -60
- package/src/utils/report.ts +158 -0
- package/src/utils/sheet.ts +170 -0
- package/src/utils/square.ts +22 -0
- package/src/utils/table-route.ts +146 -0
- package/src/utils/workflow.ts +212 -0
- package/tsconfig.json +12 -0
- package/src/schemas/childOrganizationsQuery.ts +0 -44
- package/src/types/action.d.ts +0 -42
- package/src/utils/route-helpers.ts +0 -583
package/src/types/report.d.ts
CHANGED
|
@@ -1,203 +1,290 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
REPORT_FREQUENCY_ENUMS,
|
|
3
|
+
REPORT_ROW_PRESETS,
|
|
4
|
+
REPORT_SORT_OPTS,
|
|
5
|
+
REPORT_STATUS_ENUMS,
|
|
6
|
+
} from "../constants/report.ts";
|
|
7
|
+
import type {
|
|
8
|
+
OrganizationData,
|
|
9
|
+
OrganizationSiteData,
|
|
10
|
+
} from "./organization.d.ts";
|
|
11
|
+
import type { StorageData, StorageGQL } from "./storage.d.ts";
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
14
|
* Enums
|
|
6
15
|
*/
|
|
7
16
|
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
17
|
+
export type ReportRowPresetEnum = typeof REPORT_ROW_PRESETS[number];
|
|
18
|
+
export type ReportsSortEnum = typeof REPORT_SORT_OPTS[number];
|
|
19
|
+
export type ReportFrequencyEnum = typeof REPORT_FREQUENCY_ENUMS[number];
|
|
20
|
+
export type ReportSubmissionStatusEnum = typeof REPORT_STATUS_ENUMS[number];
|
|
11
21
|
|
|
12
22
|
/**
|
|
13
23
|
* Filters
|
|
14
24
|
*/
|
|
15
25
|
|
|
16
26
|
export interface ReportsFilterArgs {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
preset?: "?" | null;
|
|
28
|
+
reportGroupId?: string | null;
|
|
29
|
+
startPeriod?: string | null; // YYYY-MM-DD
|
|
30
|
+
endPeriod?: string | null; // YYYY-MM-DD
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
/**
|
|
24
34
|
* Report; fields
|
|
25
35
|
*/
|
|
26
36
|
|
|
27
|
-
interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
37
|
+
export interface ReportFieldsVariables {
|
|
38
|
+
month?: number; // Used for MONTH presets (required for all preset="MONTH" rows)
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ReportFieldsObj {
|
|
43
|
+
__notAutomated?: boolean; // If true, report is not skipped during automation
|
|
44
|
+
__prompt?: string; // Server-only, this prompt used on the entire report as a whole (ie. OSP generation)
|
|
45
|
+
valueRule?: string;
|
|
46
|
+
gridLayoutStyle?: string;
|
|
47
|
+
aside?: ReportFieldsAsideBlock[];
|
|
48
|
+
sections?: ReportFieldsSection[];
|
|
49
|
+
metadata?: ReportFieldsRow[];
|
|
50
|
+
variables?: ReportFieldsVariables;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ReportResolvedFieldsObj
|
|
54
|
+
extends Omit<ReportFieldsObj, "variables"> {
|
|
55
|
+
variables: ReportFieldsVariables;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ReportFieldsSection {
|
|
59
|
+
id?: string; // GraphQL Cursor, client-side only, but if present in Server, it will be an Array
|
|
60
|
+
key: string; // Every section must have a unique string UID
|
|
61
|
+
isGroupTitle?: boolean;
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
rows?: ReportFieldsRow[];
|
|
65
|
+
requireFileUploads?: boolean;
|
|
66
|
+
files?: StorageData[];
|
|
67
|
+
|
|
68
|
+
__prompt_section?: string; // Server-only; full prompt for this section - this is the only prompt that allows {{variable}} regex
|
|
69
|
+
__prompt_examples?: string; // Server-only; for examples of what the output should be
|
|
70
|
+
__prompt_topics?: string; // Server-only; for topics this section should cover
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ReportFieldsAsideBlock {
|
|
74
|
+
title: string;
|
|
75
|
+
nullText?: string;
|
|
76
|
+
items: ReportFieldsAsideItem[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ReportFieldsAsideItem {
|
|
80
|
+
className?: string;
|
|
81
|
+
label: string;
|
|
82
|
+
text: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface ReportFieldsRow {
|
|
86
|
+
id?: string; // GraphQL Cursor, client-side only, but if present in Server, it will be an Array
|
|
87
|
+
key: string; // Key is used to map row/columns to answers
|
|
88
|
+
preset?: ReportRowPresetEnum;
|
|
89
|
+
className?: string;
|
|
90
|
+
isHeader?: boolean;
|
|
91
|
+
templateRule: string; // COPY_FROM_CONFIG
|
|
92
|
+
hintQuestion?: string;
|
|
93
|
+
hintOptions?: string[];
|
|
94
|
+
defaultOnlyBoolean?: boolean;
|
|
95
|
+
defaultPlaceholder?: string | null;
|
|
96
|
+
defaultCheckedShortText?: string | null;
|
|
97
|
+
defaultNotCheckedShortText?: string | null;
|
|
98
|
+
defaultCheckedText?: string | null;
|
|
99
|
+
defaultNotCheckedText?: string | null;
|
|
100
|
+
defaultWarningIfNotChecked?: string | null;
|
|
101
|
+
columns: ReportFieldsColumn[];
|
|
102
|
+
__notAutomated?: boolean; // If true, this column is not filled during automation
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface ReportFieldsColumn {
|
|
106
|
+
id?: string; // GraphQL Cursor, client-side only, but if present in Server, it will be an Array
|
|
107
|
+
key: string; // Key is used to map column to answers
|
|
108
|
+
className?: string;
|
|
109
|
+
iconName?: string;
|
|
110
|
+
labelClassName?: string;
|
|
111
|
+
label?: string; // Typically, this is the "question" the AI Agent/human must answer
|
|
112
|
+
answer?: string | null; // GraphQL-facing saved answer value used for realtime updates
|
|
113
|
+
text?: string; // This the answer provided by the AI Agent/human
|
|
114
|
+
shortText?: string | null;
|
|
115
|
+
checkedText?: string | null;
|
|
116
|
+
checkedShortText?: string | null;
|
|
117
|
+
notCheckedText?: string | null;
|
|
118
|
+
notCheckedShortText?: string | null;
|
|
119
|
+
confirmationNeeded?: boolean;
|
|
120
|
+
doNotAllowNotes?: boolean; // If true, AI will NOT leave notes for this column
|
|
121
|
+
allowMultipleAnswers?: boolean;
|
|
122
|
+
allowCorrectiveActions?: boolean; // If true, AI Agents are allowed to provide corrective actions for this column if the user adds one
|
|
123
|
+
hint?: string; // Additional instructions or context for this column, typically only shown to AI Agents for more guidance.
|
|
124
|
+
onlyBoolean?: boolean;
|
|
125
|
+
warningIfNotChecked?: string | null;
|
|
126
|
+
warningNote?: string; // GraphQL-facing warning field used by mapped report data
|
|
127
|
+
placeholder?: string | null;
|
|
128
|
+
checked?: boolean | null;
|
|
129
|
+
options?: string[]; // If set, user provided inputs *must* be one of these options (ie. for dropdowns, radios, etc.)
|
|
130
|
+
__notAutomated?: boolean; // If true, this column is not filled during automation
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ReportColumnGQL extends ReportFieldsColumn {
|
|
134
|
+
id: string; // GraphQL Cursor, client-side only, but if present in Server, it will be an Array
|
|
135
|
+
entityId?: string | null;
|
|
136
|
+
referenceIds?: string[] | null;
|
|
137
|
+
lineNumber?: string | null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type ReportRowGQL = Omit<ReportFieldsRow, "key" | "columns"> & {
|
|
141
|
+
id: string; // GraphQL Cursor, client-side only, but if present in Server, it will be an Array
|
|
142
|
+
columns?: ReportColumnGQL[] | null;
|
|
69
143
|
};
|
|
70
144
|
|
|
71
|
-
interface
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
labelClassName?: string;
|
|
76
|
-
label: string;
|
|
77
|
-
text: string;
|
|
78
|
-
placeholder: string | null;
|
|
79
|
-
value: string | null; // Available only in server; this value has the indexes to map answers to directly without keys
|
|
80
|
-
checked: boolean | null;
|
|
145
|
+
export interface ReportGroupLayoutObj {
|
|
146
|
+
columns: string[];
|
|
147
|
+
headers: string[];
|
|
148
|
+
gridLayoutStyle: string;
|
|
81
149
|
}
|
|
82
150
|
|
|
83
151
|
/**
|
|
84
152
|
* Report data
|
|
85
153
|
*/
|
|
86
154
|
|
|
155
|
+
export interface ReportGroupData {
|
|
156
|
+
__table: "report_groups";
|
|
157
|
+
id: number;
|
|
158
|
+
name: string;
|
|
159
|
+
shortName?: string | null;
|
|
160
|
+
layout?: Partial<ReportGroupLayoutObj> | null;
|
|
161
|
+
}
|
|
162
|
+
|
|
87
163
|
export interface ReportData {
|
|
88
|
-
|
|
164
|
+
__table: "reports";
|
|
89
165
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
166
|
+
id: number;
|
|
167
|
+
reportGroupId: number;
|
|
168
|
+
reportGroup?: ReportGroupData | null;
|
|
169
|
+
documentName: string;
|
|
170
|
+
title: string;
|
|
171
|
+
description: string;
|
|
172
|
+
frequency: ReportFrequencyEnum;
|
|
173
|
+
order: number;
|
|
96
174
|
|
|
97
|
-
|
|
98
|
-
|
|
175
|
+
fields: ReportFieldsObj;
|
|
176
|
+
submission?: ReportSubmissionData | null; // Present when report_submissions was joined onto the report row.
|
|
99
177
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
178
|
+
template?: {
|
|
179
|
+
__table: "report_templates";
|
|
180
|
+
id: number;
|
|
181
|
+
fields: ReportFieldsObj;
|
|
182
|
+
description: string | null;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
site?: Pick<OrganizationSiteData, "id" | "name"> | null;
|
|
186
|
+
childOrg?: OrganizationData;
|
|
187
|
+
organization?: OrganizationData;
|
|
106
188
|
}
|
|
107
189
|
|
|
108
190
|
export interface ReportGQL {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
id: string;
|
|
112
|
-
organizationId: string;
|
|
113
|
-
documentName: string;
|
|
114
|
-
title: string;
|
|
115
|
-
description: string;
|
|
116
|
-
type: ReportTypeEnum;
|
|
117
|
-
period: string; // YYYY-MM-DD
|
|
118
|
-
evidencesCount: number;
|
|
119
|
-
activityAt: string | null; // ISO date string
|
|
120
|
-
|
|
121
|
-
sections?: ReportSectionGQL[];
|
|
122
|
-
rows?: ReportRowGQL[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
interface ReportSectionGQL {
|
|
126
|
-
id: string;
|
|
127
|
-
isGroupTitle?: boolean;
|
|
128
|
-
sectionKey: string;
|
|
129
|
-
sectionName: string;
|
|
130
|
-
title: string;
|
|
131
|
-
description: string;
|
|
132
|
-
rows?: ReportRowGQL[];
|
|
133
|
-
requireFileUploads?: boolean;
|
|
134
|
-
files?: StorageGQL[];
|
|
135
|
-
}
|
|
191
|
+
__deleted?: boolean;
|
|
136
192
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
193
|
+
id: string;
|
|
194
|
+
organizationId: string;
|
|
195
|
+
documentName: string;
|
|
196
|
+
title: string;
|
|
197
|
+
description: string;
|
|
198
|
+
frequency?: ReportFrequencyEnum | null;
|
|
199
|
+
reportGroupId: string;
|
|
200
|
+
groupName: string;
|
|
201
|
+
groupShortName?: string | null;
|
|
202
|
+
period: string; // YYYY-MM-DD
|
|
203
|
+
summary?: string | null;
|
|
204
|
+
submission?: ReportSubmissionGQL | null;
|
|
205
|
+
gridLayoutStyle?: string | null;
|
|
140
206
|
|
|
141
|
-
|
|
142
|
-
|
|
207
|
+
aside?: ReportFieldsAsideBlock[];
|
|
208
|
+
sections?: ReportSectionGQL[];
|
|
209
|
+
}
|
|
143
210
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
211
|
+
export interface ReportSectionGQL {
|
|
212
|
+
id: string;
|
|
213
|
+
isGroupTitle?: boolean;
|
|
214
|
+
title?: string | null;
|
|
215
|
+
description?: string | null;
|
|
216
|
+
rows?: ReportRowGQL[];
|
|
217
|
+
requireFileUploads?: boolean;
|
|
218
|
+
files?: StorageGQL[];
|
|
148
219
|
}
|
|
149
220
|
|
|
150
221
|
export interface ReportSubmissionGQL {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
id: string;
|
|
154
|
-
reportId: string;
|
|
155
|
-
organizationId: string;
|
|
156
|
-
sectionKey: string;
|
|
157
|
-
documentName: string;
|
|
158
|
-
sectionName: string;
|
|
159
|
-
title: string;
|
|
160
|
-
period: string; // YYYY-MM-DD
|
|
161
|
-
activityAt: string | null; // ISO date string
|
|
162
|
-
rows: ReportRowGQL[];
|
|
163
|
-
evidences: string[];
|
|
164
|
-
requireFileUploads: boolean;
|
|
165
|
-
}
|
|
222
|
+
__deleted?: boolean;
|
|
166
223
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
224
|
+
id: string;
|
|
225
|
+
reportSubmissionId: string;
|
|
226
|
+
reportId: string;
|
|
227
|
+
value?: string | null;
|
|
228
|
+
frequency: ReportFrequencyEnum;
|
|
229
|
+
reportSubmissionIdEnc?: string | null;
|
|
230
|
+
organizationId: string;
|
|
231
|
+
organizationIdEnc?: string | null;
|
|
232
|
+
location?: string | null;
|
|
233
|
+
childOrgId: string | null;
|
|
234
|
+
childOrgIdEnc?: string | null;
|
|
235
|
+
childOrgName: string | null;
|
|
236
|
+
childOrgOperation: string | null;
|
|
237
|
+
organizationName?: string | null;
|
|
238
|
+
organizationOperation?: string | null;
|
|
239
|
+
reportGroupId: string;
|
|
240
|
+
groupName: string;
|
|
241
|
+
groupShortName?: string | null;
|
|
242
|
+
period: string; // YYYY-MM-DD
|
|
243
|
+
status: ReportSubmissionStatusEnum | null;
|
|
244
|
+
activityAt: string | null; // ISO date string
|
|
245
|
+
createdAt: string | null; // ISO date string
|
|
246
|
+
updatedAt: string | null; // ISO date string
|
|
172
247
|
}
|
|
173
248
|
|
|
174
249
|
export interface ReportStorageRelData {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
250
|
+
__table: "report_storage_rels";
|
|
251
|
+
reportSubmissionId: number | bigint;
|
|
252
|
+
storageId: number | bigint;
|
|
253
|
+
sectionKey: string;
|
|
254
|
+
order: number;
|
|
255
|
+
file: StorageData;
|
|
181
256
|
}
|
|
182
257
|
|
|
183
258
|
export interface ReportSubmissionData {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
259
|
+
__table: "report_submissions";
|
|
260
|
+
id: number;
|
|
261
|
+
childOrgId?: number | bigint | null;
|
|
262
|
+
siteId?: number | bigint | null;
|
|
263
|
+
value?: string | null;
|
|
264
|
+
report?: Pick<ReportData, "id" | "frequency"> | null;
|
|
265
|
+
site?: Pick<OrganizationSiteData, "id" | "name"> | null;
|
|
266
|
+
childOrg?: OrganizationData;
|
|
267
|
+
organization?: OrganizationData;
|
|
268
|
+
organizationId: number;
|
|
269
|
+
reportId: number;
|
|
270
|
+
period: Date; // YYYY-MM-DD in database, Date object in server via ORM
|
|
271
|
+
answers: Record<string, any>; // key-value pairs of answers
|
|
272
|
+
status?: ReportSubmissionStatusEnum | null;
|
|
273
|
+
storageRels?: ReportStorageRelData[];
|
|
274
|
+
activityAt: Date;
|
|
275
|
+
createdAt: Date;
|
|
276
|
+
updatedAt: Date;
|
|
193
277
|
}
|
|
194
278
|
|
|
195
279
|
/**
|
|
196
|
-
*
|
|
280
|
+
* Report groups
|
|
197
281
|
*/
|
|
198
282
|
|
|
199
|
-
export interface
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
283
|
+
export interface ReportGroupGQL {
|
|
284
|
+
id: string;
|
|
285
|
+
name: string;
|
|
286
|
+
shortName?: string | null;
|
|
287
|
+
layout?: Partial<ReportGroupLayoutObj> | null;
|
|
288
|
+
lastSubmissionPeriod?: string | null; // YYYY-MM-DD
|
|
289
|
+
lastSubmissionReportId?: string | null;
|
|
203
290
|
}
|