@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.
Files changed (123) hide show
  1. package/package.json +105 -35
  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 +48 -0
  7. package/src/constants/dataTableFieldTypes.generated.ts +63 -0
  8. package/src/constants/docAccess.ts +32 -0
  9. package/src/constants/email.ts +44 -0
  10. package/src/constants/fieldDoc.ts +34 -0
  11. package/src/constants/graphqlReactivity.ts +113 -0
  12. package/src/constants/inboundContact.ts +8 -0
  13. package/src/constants/integration.ts +13 -0
  14. package/src/constants/log.ts +7 -366
  15. package/src/constants/logActivityGroupColors.generated.ts +19 -0
  16. package/src/constants/logTaxonomy.generated.ts +1103 -0
  17. package/src/constants/noteDoc.ts +77 -0
  18. package/src/constants/organization.ts +18 -11
  19. package/src/constants/pageRoute.ts +23 -0
  20. package/src/constants/schedule.ts +220 -0
  21. package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
  22. package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
  23. package/src/constants/sheet.ts +168 -0
  24. package/src/constants/sheetRegionSources.generated.ts +578 -0
  25. package/src/constants/square.ts +16 -0
  26. package/src/constants/storage.ts +61 -0
  27. package/src/constants/usage.ts +79 -0
  28. package/src/schemas/editLogEntry.ts +1017 -738
  29. package/src/schemas/fieldDocsQuery.ts +12 -0
  30. package/src/schemas/inboundContact.ts +77 -0
  31. package/src/schemas/logsQuery.ts +57 -316
  32. package/src/schemas/organization.ts +53 -213
  33. package/src/types/account.d.ts +81 -0
  34. package/src/types/agentDoc.d.ts +64 -0
  35. package/src/types/agentMemory.d.ts +74 -0
  36. package/src/types/campaign.d.ts +683 -0
  37. package/src/types/dataTable.d.ts +366 -0
  38. package/src/types/docAccess.d.ts +96 -0
  39. package/src/types/email.d.ts +142 -0
  40. package/src/types/fieldDoc.d.ts +273 -0
  41. package/src/types/inboundContact.d.ts +57 -0
  42. package/src/types/integration.d.ts +42 -0
  43. package/src/types/log.d.ts +169 -190
  44. package/src/types/noteDoc.d.ts +86 -0
  45. package/src/types/organization.d.ts +175 -76
  46. package/src/types/pageRoute.d.ts +48 -0
  47. package/src/types/schedule.d.ts +391 -0
  48. package/src/types/sheet.d.ts +1130 -0
  49. package/src/types/storage.d.ts +242 -0
  50. package/src/types/usage.d.ts +106 -0
  51. package/src/types/workflow.d.ts +305 -0
  52. package/src/utils/agentDoc.ts +109 -0
  53. package/src/utils/aiChat.ts +26 -0
  54. package/src/utils/campaign.ts +741 -0
  55. package/src/utils/campaignFormEditor.ts +871 -0
  56. package/src/utils/dataTable.ts +849 -0
  57. package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
  58. package/src/utils/dataTableRealtimeAuthority.ts +209 -0
  59. package/src/utils/dataTableRealtimeSelection.ts +134 -0
  60. package/src/utils/dataTableRowDocument.ts +508 -0
  61. package/src/utils/dataTableSource.ts +230 -0
  62. package/src/utils/docAccess.ts +383 -0
  63. package/src/utils/documentName.ts +53 -0
  64. package/src/utils/email.ts +172 -0
  65. package/src/utils/fieldDoc.ts +113 -0
  66. package/src/utils/log.ts +173 -778
  67. package/src/utils/logRegistryValue.ts +90 -0
  68. package/src/utils/logStoreRead.ts +266 -0
  69. package/src/utils/logTaxonomy.ts +76 -0
  70. package/src/utils/logTaxonomyDisplay.ts +439 -0
  71. package/src/utils/noteDoc.ts +827 -0
  72. package/src/utils/organization.ts +683 -81
  73. package/src/utils/pageRoute.ts +71 -0
  74. package/src/utils/schedule.ts +799 -0
  75. package/src/utils/scheduleEvaluation.ts +1994 -0
  76. package/src/utils/scheduleICS.ts +246 -0
  77. package/src/utils/scheduleRuleTemplates.ts +188 -0
  78. package/src/utils/sheet.ts +4973 -0
  79. package/src/utils/sheetAxisMove.ts +830 -0
  80. package/src/utils/sheetBootstrap.ts +1769 -0
  81. package/src/utils/sheetCommand.ts +423 -0
  82. package/src/utils/sheetExport.ts +238 -0
  83. package/src/utils/sheetFormulaEvaluation.ts +914 -0
  84. package/src/utils/sheetFormulaEvaluator.ts +852 -0
  85. package/src/utils/sheetJournal.ts +78 -0
  86. package/src/utils/sheetNumberFormat.ts +1211 -0
  87. package/src/utils/sheetRegion.ts +374 -0
  88. package/src/utils/sheetRegionFilter.ts +1259 -0
  89. package/src/utils/sheetRegionSourceRegistry.ts +594 -0
  90. package/src/utils/sheetSequence.ts +148 -0
  91. package/src/utils/sheetSnapshot.ts +992 -0
  92. package/src/utils/sheetStructureEdit.ts +1284 -0
  93. package/src/utils/square.ts +32 -0
  94. package/src/utils/storage.ts +152 -0
  95. package/src/utils/table-route.ts +262 -0
  96. package/src/utils/workflow.ts +380 -0
  97. package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
  98. package/tests/docAccess.test.ts +525 -0
  99. package/tests/editLogEntry.test.ts +112 -0
  100. package/tests/noteDoc.test.ts +669 -0
  101. package/tests/schedule.test.ts +693 -0
  102. package/tests/scheduleEvaluation.test.ts +1970 -0
  103. package/tests/scheduleICS.test.ts +208 -0
  104. package/tests/scheduleRuleTemplates.test.ts +176 -0
  105. package/tests/scheduleSweepInvariants.test.ts +428 -0
  106. package/tests/sheetAxisMove.test.ts +343 -0
  107. package/tests/sheetFormulaEvaluator.test.ts +575 -0
  108. package/tests/sheetRegionFilter.test.ts +1135 -0
  109. package/tests/sheetSequence.test.ts +41 -0
  110. package/tests/sheetStructureEdit.test.ts +82 -0
  111. package/tsconfig.json +12 -0
  112. package/vitest.config.ts +8 -0
  113. package/src/constants/log-activityTexts.ts +0 -209
  114. package/src/constants/product.ts +0 -66
  115. package/src/constants/report.ts +0 -25
  116. package/src/schemas/childOrganizationsQuery.ts +0 -44
  117. package/src/schemas/productsQuery.ts +0 -145
  118. package/src/schemas/reportsQuery.ts +0 -107
  119. package/src/types/action.d.ts +0 -42
  120. package/src/types/product.d.ts +0 -173
  121. package/src/types/report.d.ts +0 -203
  122. package/src/utils/product-calEvent.ts +0 -508
  123. package/src/utils/route-helpers.ts +0 -583
@@ -1,41 +1,49 @@
1
1
  import {
2
- COMPLIANCE_DOCUMENT_TYPE_ENUMS,
3
- OPERATION_ENUMS,
4
- ORG_CONTACTS,
5
- ROLE_CATEGORY_ENUMS,
6
- ROLE_ENUMS
2
+ COMPLIANCE_DOCUMENT_TYPE_ENUMS,
3
+ OPERATION_ENUMS,
4
+ ORG_CONTACTS,
5
+ ROLE_CATEGORY_ENUMS,
6
+ ROLE_ENUMS,
7
7
  } from '../constants/organization.ts';
8
- import { PRODUCT_FEATURES } from '../constants/product.ts';
9
8
 
10
- import type { AddressObj } from '@jsb188/app/types/other.d';
11
- import type { StorageData } from '@jsb188/app/types/storage.d';
12
- import type { LogTypeEnum } from '../types/log.d';
9
+ import type { AddressObj } from '@jsb188/app/types/other.d.ts';
10
+ import type {
11
+ IntegrationConnectionData,
12
+ IntegrationConnectionGQL,
13
+ } from './integration.d.ts';
14
+ import type { StorageData, StorageGQL } from './storage.d.ts';
15
+ import type { OrganizationRouteSettingsObj } from '../utils/table-route.ts';
13
16
 
14
17
  /*
15
18
  * Enums
16
19
  */
17
20
 
18
- export type OrganizationFeatureEnum = typeof PRODUCT_FEATURES[number];
19
- export type OrganizationRoleEnum = typeof ROLE_ENUMS[number];
20
- export type OrganizationOperationEnum = typeof OPERATION_ENUMS[number];
21
- export type OrganizationDepartmentEnum = typeof ORG_CONTACTS[number];
22
- export type OrganizationRoleCategoryEnum = typeof ROLE_CATEGORY_ENUMS[number];
23
- export type OrganizationComplianceType = typeof COMPLIANCE_DOCUMENT_TYPE_ENUMS[number];
21
+ export type OrganizationRoleEnum = (typeof ROLE_ENUMS)[number];
22
+ // Known keys retain autocomplete, while registry-launched operations remain
23
+ // valid without requiring a TypeScript/codegen change.
24
+ export type OrganizationOperationEnum =
25
+ | (typeof OPERATION_ENUMS)[number]
26
+ | (string & {});
27
+ export type OrganizationDepartmentEnum = (typeof ORG_CONTACTS)[number];
28
+ export type OrganizationRoleCategoryEnum = (typeof ROLE_CATEGORY_ENUMS)[number];
29
+ export type OrganizationComplianceType =
30
+ (typeof COMPLIANCE_DOCUMENT_TYPE_ENUMS)[number];
24
31
 
25
32
  /**
26
33
  * Query filters
27
34
  */
28
35
 
29
36
  export interface ChildOrgsFilterArgs {
30
- internationalOnly?: boolean;
37
+ childOrgIds?: Array<string | number | bigint>;
38
+ affiliated?: boolean | null;
31
39
  }
32
40
 
33
41
  /*
34
42
  * ACL
35
43
  */
36
44
 
37
- type ACLPermission = 0 | 1 | 2 | 3; // 0: no access, 1: read-only, 2: allow-write, 3: allow-manage
38
- type ACLPermissionEnum = 'NONE' | 'READ' | 'WRITE' | 'MANAGE';
45
+ export type ACLPermission = 0 | 1 | 2 | 3; // 0: no access, 1: read-only, 2: allow-write, 3: allow-manage
46
+ export type ACLPermissionEnum = 'NONE' | 'READ' | 'WRITE' | 'MANAGE';
39
47
 
40
48
  export interface OrganizationACL {
41
49
  billing: ACLPermission;
@@ -74,34 +82,103 @@ export interface OrganizationData {
74
82
  __table: 'organizations';
75
83
  id: bigint;
76
84
  stripeCustomerId: string | null;
85
+ emailHandle: string | null;
77
86
  name: string;
78
87
  commodities: string[] | null;
79
88
  operation: OrganizationOperationEnum;
80
- dailyDigestTime: string | null;
81
- features: OrganizationFeatureEnum[];
82
89
  settings?: OrganizationSettingsObj | null;
90
+ directory?: OrgContact[] | null; // Own organization_contacts rows mapped to contacts (attached by fetch paths)
83
91
  address?:
84
92
  | null
85
- | AddressObj & {
86
- __table: 'organization_addresses';
87
- organizationId: bigint;
88
- };
93
+ | (AddressObj & {
94
+ __table: 'organization_addresses';
95
+ organizationId: bigint;
96
+ });
97
+ integrations?: IntegrationConnectionData[] | null;
89
98
  activated: boolean;
99
+ authorizationEpoch?: number | bigint;
90
100
  }
91
101
 
92
- export interface OrganizationContact {
102
+ /**
103
+ * Organization directory contact row (organization_contacts table).
104
+ * "ownerOrgId" NULL means the org's own directory entry; set means a private
105
+ * per-department override maintained by that parent org for this child org.
106
+ */
107
+
108
+ export interface OrganizationContactData {
109
+ __table: 'organization_contacts';
110
+ id: bigint;
111
+ organizationId: bigint;
112
+ ownerOrgId?: bigint | null;
113
+ department: OrganizationDepartmentEnum;
114
+ name?: string | null;
115
+ emailAddress?: string | null;
116
+ phoneNumber?: string | null;
117
+ createdAt: Date;
118
+ updatedAt: Date;
119
+ }
120
+
121
+ export interface OrganizationSiteData {
122
+ __table: 'organization_sites';
123
+ id: bigint;
124
+ organizationId: bigint;
125
+ parentId?: bigint | null;
126
+ name: string;
127
+ region?: string | null;
128
+ note?: string | null;
129
+ createdAt: Date;
130
+ }
131
+
132
+ export interface OrgContact {
93
133
  department: OrganizationDepartmentEnum;
94
134
  name?: string | null;
95
135
  phoneNumber?: string | null;
96
136
  emailAddress?: string | null;
97
137
  }
98
138
 
139
+ export interface MergedOrgContact extends OrgContact {
140
+ department: OrganizationDepartmentEnum;
141
+ defaultName?: string | null;
142
+ defaultPhoneNumber?: string | null;
143
+ defaultEmailAddress?: string | null;
144
+ officialContact?: boolean;
145
+ locked?: boolean;
146
+ }
147
+
148
+ export type OrganizationSidebarItemKindEnum = 'LINK' | 'BREAK' | 'GROUP';
149
+
150
+ export interface OrganizationSidebarLinkItemObj {
151
+ kind?: 'LINK' | null;
152
+ slug: string;
153
+ label: string;
154
+ iconName: string | null;
155
+ order?: number | null;
156
+ }
157
+
158
+ export interface OrganizationSidebarBreakItemObj {
159
+ kind: 'BREAK';
160
+ order?: number | null;
161
+ }
162
+
163
+ export interface OrganizationSidebarGroupItemObj {
164
+ kind: 'GROUP';
165
+ label: string;
166
+ items: OrganizationSidebarItemObj[];
167
+ order?: number | null;
168
+ }
169
+
170
+ export type OrganizationSidebarItemObj =
171
+ | OrganizationSidebarLinkItemObj
172
+ | OrganizationSidebarBreakItemObj
173
+ | OrganizationSidebarGroupItemObj;
174
+
99
175
  export interface OrganizationSettingsObj {
100
176
  timeZone: string | null;
101
177
  language: string | null;
102
178
  color: string | null;
103
179
  priorityService: boolean;
104
- directory?: OrganizationContact[];
180
+ routes?: Record<string, OrganizationRouteSettingsObj>;
181
+ sidebar?: OrganizationSidebarItemObj[] | null;
105
182
  }
106
183
 
107
184
  export interface OrganizationChildData {
@@ -109,13 +186,15 @@ export interface OrganizationChildData {
109
186
  parentId: number | bigint | null;
110
187
  childId: number | bigint;
111
188
  organization: OrganizationData;
112
- preferredContacts?: {
113
- [key: OrganizationDepartmentEnum]: Partial<{
114
- name: string | null;
115
- phoneNumber: string | null;
116
- emailAddress: string | null;
117
- }>;
118
- };
189
+ preferredContacts?: {
190
+ [key: OrganizationDepartmentEnum]: Partial<{
191
+ name: string | null;
192
+ phoneNumber: string | null;
193
+ emailAddress: string | null;
194
+ }>;
195
+ };
196
+ memory?: string | null;
197
+ affiliated: boolean;
119
198
  addedAt: Date;
120
199
  }
121
200
 
@@ -139,41 +218,81 @@ export interface OrganizationComplianceGQL {
139
218
  __deleted?: boolean;
140
219
 
141
220
  id: string;
142
- number: string;
143
- name: string;
221
+ number: string | null;
222
+ documentName: string | null;
144
223
  type: OrganizationComplianceType;
145
224
  expirationDate: string; // YYYY-MM-DD
146
- notes: string;
147
225
  createdAt: string; // ISO date string
148
226
  updatedAt: string; // ISO date string
149
-
150
- files: {
151
- id: string;
152
- complianceId: string;
153
- storageId: string;
154
- uri: string | null;
155
- contentType: string | null;
156
- order: number;
157
- }[];
227
+ files: StorageGQL[] | null;
158
228
  }
159
229
 
160
230
  export interface OrganizationGQL {
231
+ __deleted?: boolean;
232
+
161
233
  id: string;
234
+ readableId?: string | null;
162
235
  stripeCustomerId: string | null;
236
+ emailHandle: string | null;
163
237
  name: string;
164
238
  commodities: string[] | null;
165
239
  address: AddressObj;
166
240
  operation: OrganizationOperationEnum;
167
241
  compliance: OrganizationComplianceGQL[] | null;
168
- features: OrganizationFeatureEnum[];
242
+ integrations: IntegrationConnectionGQL[] | null;
243
+ logTaxonomy?: import('./log.d.ts').LogTaxonomyGQL | null;
169
244
  settings?: OrganizationSettingsObj | null;
170
- directory: OrganizationContact[];
245
+ directory: OrgContact[];
171
246
  activated: boolean;
172
247
  membersCount: number;
173
248
  }
174
249
 
250
+ export interface OrganizationSiteGQL {
251
+ __deleted?: boolean;
252
+
253
+ id: string;
254
+ readableId?: string | null;
255
+ organizationId: string;
256
+ parentId?: string | null;
257
+ name: string;
258
+ region?: string | null;
259
+ note?: string | null;
260
+ createdAt: string;
261
+ organizationName?: string | null;
262
+ parentName?: string | null;
263
+ }
264
+
265
+ export interface OrganizationRelAccountGQL {
266
+ id: string;
267
+ deleted: boolean;
268
+ color: string | null;
269
+ profile: null | {
270
+ id: string;
271
+ firstName: string | null;
272
+ lastName: string | null;
273
+ photoId: string | null;
274
+ photoUri: string | null;
275
+ };
276
+ settings: Record<string, any> | null;
277
+ email: null | {
278
+ id: string;
279
+ address: string | null;
280
+ verified: boolean;
281
+ };
282
+ phone: null | {
283
+ id: string;
284
+ number: string | null;
285
+ verified: boolean;
286
+ primary: boolean;
287
+ };
288
+ }
289
+
175
290
  export interface OrganizationRelGQL {
291
+ __deleted?: boolean;
292
+
176
293
  id: string;
294
+ organizationId?: string;
295
+ account?: OrganizationRelAccountGQL | null;
177
296
  primary: boolean;
178
297
  role: OrganizationRoleEnum;
179
298
  acl: OrganizationACLGQLData;
@@ -181,8 +300,15 @@ export interface OrganizationRelGQL {
181
300
  }
182
301
 
183
302
  export interface OrganizationChildGQL {
303
+ __deleted?: boolean;
304
+
184
305
  id: string;
306
+ parentId: string;
307
+ cursor: string;
185
308
  organization: OrganizationGQL;
309
+ preferredContacts: OrgContact[];
310
+ memory?: string | null;
311
+ affiliated: boolean;
186
312
  addedAt: Date;
187
313
  }
188
314
 
@@ -192,7 +318,6 @@ export interface OrganizationChildGQL {
192
318
 
193
319
  export interface OrganizationComplianceFileData {
194
320
  __table: 'organization_compliance_files';
195
- id: number;
196
321
  complianceId: number;
197
322
  storageId: number;
198
323
  order: number;
@@ -208,7 +333,8 @@ export interface OrganizationComplianceObj {
208
333
  notes?: string;
209
334
  }
210
335
 
211
- export interface OrganizationComplianceData extends Omit<OrganizationComplianceObj, 'expirationDate'> {
336
+ export interface OrganizationComplianceData
337
+ extends Omit<OrganizationComplianceObj, 'expirationDate'> {
212
338
  __table: 'organization_compliances';
213
339
  id: number;
214
340
  organizationId: number;
@@ -217,30 +343,3 @@ export interface OrganizationComplianceData extends Omit<OrganizationComplianceO
217
343
  createdAt: Date;
218
344
  updatedAt: Date;
219
345
  }
220
-
221
- /**
222
- * Workflow instructions
223
- */
224
-
225
- export interface OrganizationInstructionsData {
226
- __table: 'organization_instructions';
227
- id: bigint | number;
228
- organizationId: bigint | number;
229
- logType: LogTypeEnum;
230
- instructions: string;
231
- summary: string;
232
- createdAt: Date;
233
- updatedAt: Date;
234
- }
235
-
236
- export interface OrganizationInstructionsGQL {
237
- __deleted?: boolean;
238
-
239
- id: string;
240
- organizationId: string;
241
- logType: LogTypeEnum;
242
- instructions: string;
243
- summary: string;
244
- createdAt: string; // ISO date string
245
- updatedAt: string; // ISO date string
246
- }
@@ -0,0 +1,48 @@
1
+ export type PageRouteQueryEnum = 'LOG_ENTRIES' | 'CHILD_ORGANIZATIONS';
2
+
3
+ export interface PageRouteLogEntriesFilterObj {
4
+ siteId?: number | string | null;
5
+ preset?: string | null;
6
+ types?: string[] | null;
7
+ activities?: string[] | null;
8
+ startDate?: string | null;
9
+ endDate?: string | null;
10
+ query?: string | null;
11
+ }
12
+
13
+ export interface PageRouteChildOrgsFilterObj {
14
+ childOrgIds?: (number | string)[] | null;
15
+ affiliated?: boolean | null;
16
+ }
17
+
18
+ export interface PageRouteFiltersObj {
19
+ logEntries?: PageRouteLogEntriesFilterObj | null;
20
+ childOrgs?: PageRouteChildOrgsFilterObj | null;
21
+ }
22
+
23
+ export interface OrganizationPageRouteData {
24
+ id: number | bigint;
25
+ organizationId: number | bigint;
26
+ slug: string;
27
+ query: PageRouteQueryEnum;
28
+ filters: PageRouteFiltersObj;
29
+ columns: string[];
30
+ iconName?: string | null;
31
+ starred: boolean;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ }
35
+
36
+ export interface OrgPageRouteGQL {
37
+ id: string;
38
+ organizationId: string;
39
+ slug: string;
40
+ query: PageRouteQueryEnum;
41
+ logEntriesFilter?: PageRouteLogEntriesFilterObj | null;
42
+ childOrgsFilter?: PageRouteChildOrgsFilterObj | null;
43
+ columns: string[];
44
+ iconName?: string | null;
45
+ starred?: boolean | null;
46
+ createdAt?: string | null;
47
+ updatedAt?: string | null;
48
+ }