@jsb188/mday 1.1.2

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 (202) hide show
  1. package/package.json +142 -0
  2. package/src/constants/agentMemory.ts +166 -0
  3. package/src/constants/agentNote.ts +212 -0
  4. package/src/constants/aiChat.ts +10 -0
  5. package/src/constants/billing.ts +126 -0
  6. package/src/constants/campaign.ts +236 -0
  7. package/src/constants/contact.ts +72 -0
  8. package/src/constants/csvExport.ts +133 -0
  9. package/src/constants/dataTable.ts +22 -0
  10. package/src/constants/dataTableFieldTypes.generated.ts +59 -0
  11. package/src/constants/docAccess.ts +33 -0
  12. package/src/constants/dt.ts +234 -0
  13. package/src/constants/email.ts +146 -0
  14. package/src/constants/fieldDoc.ts +104 -0
  15. package/src/constants/graphqlReactivity.ts +196 -0
  16. package/src/constants/inboundContact.ts +8 -0
  17. package/src/constants/integration.ts +13 -0
  18. package/src/constants/log.ts +21 -0
  19. package/src/constants/logDisplay/README.md +88 -0
  20. package/src/constants/logDisplay/defaults.ts +39 -0
  21. package/src/constants/logDisplay/index.ts +27 -0
  22. package/src/constants/logDisplay/operations/arable.ts +16 -0
  23. package/src/constants/logDisplay/operations/farmersMarket.ts +10 -0
  24. package/src/constants/logDisplay/operations/foodManufacturing.ts +13 -0
  25. package/src/constants/logDisplay/shared/accounting.ts +13 -0
  26. package/src/constants/logDisplay/shared/interactions.ts +13 -0
  27. package/src/constants/logDisplay/shared/rackTemperatures.ts +42 -0
  28. package/src/constants/logTaxonomy.generated.ts +2199 -0
  29. package/src/constants/noteDoc.ts +77 -0
  30. package/src/constants/organization.ts +60 -0
  31. package/src/constants/pageRoute.ts +23 -0
  32. package/src/constants/qrCode.ts +30 -0
  33. package/src/constants/sheet.ts +132 -0
  34. package/src/constants/sms.ts +18 -0
  35. package/src/constants/square.ts +16 -0
  36. package/src/constants/storage.ts +85 -0
  37. package/src/constants/usage.ts +82 -0
  38. package/src/constants/workflowSteps.ts +60 -0
  39. package/src/schemas/editLogEntry.ts +879 -0
  40. package/src/schemas/inboundContact.ts +77 -0
  41. package/src/schemas/logsQuery.ts +93 -0
  42. package/src/types/account.d.ts +81 -0
  43. package/src/types/agentMemory.d.ts +100 -0
  44. package/src/types/agentNote.d.ts +441 -0
  45. package/src/types/billing.d.ts +537 -0
  46. package/src/types/campaign.d.ts +1533 -0
  47. package/src/types/contact.d.ts +15 -0
  48. package/src/types/csvExport.d.ts +213 -0
  49. package/src/types/dataAnalysis.d.ts +44 -0
  50. package/src/types/dataTable.d.ts +159 -0
  51. package/src/types/definitionElement.d.ts +35 -0
  52. package/src/types/docAccess.d.ts +96 -0
  53. package/src/types/dt.d.ts +257 -0
  54. package/src/types/email.d.ts +231 -0
  55. package/src/types/emailReplyReport.d.ts +76 -0
  56. package/src/types/fieldDoc.d.ts +702 -0
  57. package/src/types/fieldDocContract.d.ts +90 -0
  58. package/src/types/inboundContact.d.ts +65 -0
  59. package/src/types/integration.d.ts +42 -0
  60. package/src/types/log.d.ts +338 -0
  61. package/src/types/logDisplay.types.ts +85 -0
  62. package/src/types/organization.d.ts +350 -0
  63. package/src/types/pageRoute.d.ts +48 -0
  64. package/src/types/qrCode.d.ts +96 -0
  65. package/src/types/richText.d.ts +81 -0
  66. package/src/types/sheet.d.ts +847 -0
  67. package/src/types/sms.d.ts +38 -0
  68. package/src/types/storage.d.ts +481 -0
  69. package/src/types/usage.d.ts +106 -0
  70. package/src/types/workflow.d.ts +435 -0
  71. package/src/utils/agentMemory.ts +15 -0
  72. package/src/utils/agentNote.ts +850 -0
  73. package/src/utils/aiChat.ts +43 -0
  74. package/src/utils/aiChatWork.ts +64 -0
  75. package/src/utils/billing.ts +37 -0
  76. package/src/utils/campaign.ts +1173 -0
  77. package/src/utils/campaignAI.ts +72 -0
  78. package/src/utils/campaignAccess.ts +239 -0
  79. package/src/utils/campaignEmail.ts +601 -0
  80. package/src/utils/campaignEmailCompiler.ts +372 -0
  81. package/src/utils/campaignEmailImages.ts +60 -0
  82. package/src/utils/campaignEmailStyles.ts +544 -0
  83. package/src/utils/campaignLifecycle.ts +104 -0
  84. package/src/utils/campaignPreview.ts +285 -0
  85. package/src/utils/contact.ts +50 -0
  86. package/src/utils/csvExport.ts +19 -0
  87. package/src/utils/dataTable.ts +311 -0
  88. package/src/utils/dataTableFieldTypeRegistry.ts +106 -0
  89. package/src/utils/dataTableRelativeDate.ts +447 -0
  90. package/src/utils/definitionElement.ts +84 -0
  91. package/src/utils/docAccess.ts +383 -0
  92. package/src/utils/documentName.ts +53 -0
  93. package/src/utils/email.ts +379 -0
  94. package/src/utils/emailReplyReport.test.ts +187 -0
  95. package/src/utils/emailReplyReport.ts +143 -0
  96. package/src/utils/fieldDoc.ts +157 -0
  97. package/src/utils/fieldDocAnswers.ts +128 -0
  98. package/src/utils/fieldDocDefaults.ts +36 -0
  99. package/src/utils/fieldDocProgram.ts +36 -0
  100. package/src/utils/fieldDocSummary.ts +30 -0
  101. package/src/utils/log.ts +357 -0
  102. package/src/utils/logDisplay.helpers.ts +177 -0
  103. package/src/utils/logDisplay.ts +87 -0
  104. package/src/utils/logRegistryValue.ts +90 -0
  105. package/src/utils/logStoreRead.ts +262 -0
  106. package/src/utils/logTaxonomy.helpers.ts +17 -0
  107. package/src/utils/logTaxonomy.ts +76 -0
  108. package/src/utils/logTaxonomyDisplay.ts +395 -0
  109. package/src/utils/noteDoc.ts +609 -0
  110. package/src/utils/organization.ts +669 -0
  111. package/src/utils/pageRoute.ts +71 -0
  112. package/src/utils/qrCode.helpers.ts +189 -0
  113. package/src/utils/qrCode.test.ts +519 -0
  114. package/src/utils/qrCode.ts +273 -0
  115. package/src/utils/richTextHTML.ts +385 -0
  116. package/src/utils/sheet.ts +262 -0
  117. package/src/utils/sheetAxisMove.ts +616 -0
  118. package/src/utils/sheetBootstrap.ts +1402 -0
  119. package/src/utils/sheetCellLiteral.ts +101 -0
  120. package/src/utils/sheetCommand.ts +358 -0
  121. package/src/utils/sheetDesign.ts +705 -0
  122. package/src/utils/sheetExport.ts +186 -0
  123. package/src/utils/sheetFeatureReference.ts +183 -0
  124. package/src/utils/sheetFormulaArgs.ts +168 -0
  125. package/src/utils/sheetFormulaCompile.ts +475 -0
  126. package/src/utils/sheetFormulaConditionalAggregate.ts +254 -0
  127. package/src/utils/sheetFormulaCriteria.ts +656 -0
  128. package/src/utils/sheetFormulaDate.ts +444 -0
  129. package/src/utils/sheetFormulaEvaluation.ts +899 -0
  130. package/src/utils/sheetFormulaEvaluator.ts +997 -0
  131. package/src/utils/sheetFormulaFunctionHandlers.ts +403 -0
  132. package/src/utils/sheetFormulaLogical.ts +116 -0
  133. package/src/utils/sheetFormulaLookup.ts +488 -0
  134. package/src/utils/sheetFormulaMath.ts +48 -0
  135. package/src/utils/sheetFormulaParser.ts +729 -0
  136. package/src/utils/sheetFormulaRange.ts +330 -0
  137. package/src/utils/sheetFormulaReference.ts +703 -0
  138. package/src/utils/sheetFormulaReferenceAggregates.ts +313 -0
  139. package/src/utils/sheetFormulaReferenceDates.ts +237 -0
  140. package/src/utils/sheetFormulaReferenceLogical.ts +330 -0
  141. package/src/utils/sheetFormulaReferenceLookup.ts +341 -0
  142. package/src/utils/sheetFormulaReferenceMath.ts +95 -0
  143. package/src/utils/sheetFormulaReferenceRewrite.ts +220 -0
  144. package/src/utils/sheetFormulaReferenceText.ts +462 -0
  145. package/src/utils/sheetFormulaSyntax.ts +1027 -0
  146. package/src/utils/sheetFormulaText.ts +430 -0
  147. package/src/utils/sheetJournal.ts +200 -0
  148. package/src/utils/sheetNumberFormat.ts +1012 -0
  149. package/src/utils/sheetPreview.ts +68 -0
  150. package/src/utils/sheetSequence.ts +118 -0
  151. package/src/utils/sheetSnapshot.ts +739 -0
  152. package/src/utils/sheetStructureEdit.ts +914 -0
  153. package/src/utils/sheetStructureReferences.ts +389 -0
  154. package/src/utils/square.ts +32 -0
  155. package/src/utils/storage.ts +198 -0
  156. package/src/utils/table-route.ts +262 -0
  157. package/src/utils/time.ts +12 -0
  158. package/src/utils/workflow.ts +506 -0
  159. package/src/utils/workflowLogFingerprint.ts +302 -0
  160. package/src/utils/workflowLogRevisionSnapshot.ts +424 -0
  161. package/src/utils/workflowProgress.ts +280 -0
  162. package/src/utils/workflowTriggers.ts +61 -0
  163. package/tests/agentNote.test.ts +395 -0
  164. package/tests/campaignAI.test.ts +119 -0
  165. package/tests/campaignAccess.test.ts +239 -0
  166. package/tests/campaignEmail.test.ts +441 -0
  167. package/tests/campaignLifecycle.test.ts +134 -0
  168. package/tests/campaignPublication.test.ts +309 -0
  169. package/tests/dataTableFieldTypeRegistry.test.ts +111 -0
  170. package/tests/dataTableRelativeDate.test.ts +412 -0
  171. package/tests/docAccess.test.ts +525 -0
  172. package/tests/editLogEntry.test.ts +112 -0
  173. package/tests/email.test.ts +39 -0
  174. package/tests/fieldDocProgram.test.ts +114 -0
  175. package/tests/logDisplay.fixtures.ts +67 -0
  176. package/tests/logDisplay.test.ts +227 -0
  177. package/tests/noteDoc.test.ts +514 -0
  178. package/tests/richTextHTML.test.ts +185 -0
  179. package/tests/sheetAxisMove.test.ts +352 -0
  180. package/tests/sheetBootstrap.test.ts +1967 -0
  181. package/tests/sheetFeatureReference.test.ts +22 -0
  182. package/tests/sheetFormulaCriteria.test.ts +269 -0
  183. package/tests/sheetFormulaEvaluator.test.ts +468 -0
  184. package/tests/sheetFormulaFunctions.test.ts +538 -0
  185. package/tests/sheetFormulaLanguage.test.ts +361 -0
  186. package/tests/sheetFormulaParity.fixtures.ts +872 -0
  187. package/tests/sheetFormulaParity.test.ts +188 -0
  188. package/tests/sheetFormulaRange.test.ts +167 -0
  189. package/tests/sheetFormulaReference.test.ts +78 -0
  190. package/tests/sheetFormulaReferenceRewrite.test.ts +117 -0
  191. package/tests/sheetFormulaTextDate.test.ts +512 -0
  192. package/tests/sheetSequence.test.ts +22 -0
  193. package/tests/sheetSnapshot.test.ts +134 -0
  194. package/tests/sheetStructureEdit.test.ts +537 -0
  195. package/tests/sheetStructureReferences.test.ts +589 -0
  196. package/tests/workflowLifecycleStatus.test.ts +60 -0
  197. package/tests/workflowLogFingerprint.test.ts +203 -0
  198. package/tests/workflowLogRevisionSnapshot.test.ts +96 -0
  199. package/tests/workflowProgress.test.ts +180 -0
  200. package/tests/workflowTriggers.test.ts +29 -0
  201. package/tsconfig.json +12 -0
  202. package/vitest.config.ts +8 -0
@@ -0,0 +1,350 @@
1
+ import type { SupportedLogLanguage } from '@jsb188/app/constants/app.ts';
2
+
3
+ import type { AddressObj } from '@jsb188/app/types/other.d.ts';
4
+ import {
5
+ COMPLIANCE_DOCUMENT_TYPE_ENUMS,
6
+ OPERATION_ENUMS,
7
+ ORG_CONTACTS,
8
+ ROLE_CATEGORY_ENUMS,
9
+ ROLE_ENUMS,
10
+ } from '../constants/organization.ts';
11
+ import type { OrganizationRouteSettingsObj } from '../utils/table-route.ts';
12
+ import type {
13
+ IntegrationConnectionData,
14
+ IntegrationConnectionGQL,
15
+ } from './integration.d.ts';
16
+ import type { StorageData, StorageGQL } from './storage.d.ts';
17
+
18
+ /*
19
+ * Enums
20
+ */
21
+
22
+ export type OrganizationRoleEnum = (typeof ROLE_ENUMS)[number];
23
+ // Known keys retain autocomplete, while registry-launched operations remain
24
+ // valid without requiring a TypeScript/codegen change.
25
+ export type OrganizationOperationEnum =
26
+ | (typeof OPERATION_ENUMS)[number]
27
+ | (string & {});
28
+ export type OrganizationDepartmentEnum = (typeof ORG_CONTACTS)[number];
29
+ export type OrganizationRoleCategoryEnum = (typeof ROLE_CATEGORY_ENUMS)[number];
30
+ export type OrganizationComplianceType =
31
+ (typeof COMPLIANCE_DOCUMENT_TYPE_ENUMS)[number];
32
+
33
+ /**
34
+ * Query filters
35
+ */
36
+
37
+ export interface ChildOrgsFilterArgs {
38
+ childOrgIds?: Array<string | number | bigint>;
39
+ affiliated?: boolean | null;
40
+ }
41
+
42
+ /*
43
+ * ACL
44
+ */
45
+
46
+ export type ACLPermission = 0 | 1 | 2 | 3; // 0: no access, 1: read-only, 2: allow-write, 3: allow-manage
47
+ export type ACLPermissionEnum = 'NONE' | 'READ' | 'WRITE' | 'MANAGE';
48
+
49
+ export interface OrganizationACL {
50
+ billing: ACLPermission;
51
+ logs: ACLPermission;
52
+ members: ACLPermission;
53
+ finances: ACLPermission;
54
+ settings: ACLPermission;
55
+ integrations: ACLPermission;
56
+ digests: ACLPermission;
57
+ reminders: ACLPermission;
58
+ }
59
+
60
+ export interface OrganizationACLGQLData {
61
+ billing: ACLPermissionEnum;
62
+ logs: ACLPermissionEnum;
63
+ members: ACLPermissionEnum;
64
+ finances: ACLPermissionEnum;
65
+ settings: ACLPermissionEnum;
66
+ integrations: ACLPermissionEnum;
67
+ digests: ACLPermissionEnum;
68
+ reminders: ACLPermissionEnum;
69
+ }
70
+
71
+ /**
72
+ * Organization object
73
+ */
74
+
75
+ export interface OrganizationShortData {
76
+ id: string;
77
+ name: string;
78
+ primary: boolean;
79
+ acl: OrganizationACL;
80
+ }
81
+
82
+ export interface OrganizationData {
83
+ __table: 'organizations';
84
+ id: bigint;
85
+ stripeCustomerId: string | null;
86
+ emailHandle: string | null;
87
+ name: string;
88
+ commodities: string[] | null;
89
+ operation: OrganizationOperationEnum;
90
+ settings?: OrganizationSettingsObj | null;
91
+ directory?: OrgContact[] | null; // Own organization_contacts rows mapped to contacts (attached by fetch paths)
92
+ address?:
93
+ | null
94
+ | (AddressObj & {
95
+ __table: 'organization_addresses';
96
+ organizationId: bigint;
97
+ });
98
+ integrations?: IntegrationConnectionData[] | null;
99
+ activated: boolean;
100
+ authorizationEpoch?: number | bigint;
101
+ }
102
+
103
+ /**
104
+ * Organization directory contact row (organization_contacts table).
105
+ * "ownerOrgId" NULL means the org's own directory entry; set means a private
106
+ * per-department override maintained by that parent org for this child org.
107
+ */
108
+
109
+ export interface OrganizationContactData {
110
+ __table: 'organization_contacts';
111
+ id: bigint;
112
+ organizationId: bigint;
113
+ ownerOrgId?: bigint | null;
114
+ department: OrganizationDepartmentEnum;
115
+ name?: string | null;
116
+ emailAddress?: string | null;
117
+ phoneNumber?: string | null;
118
+ createdAt: Date;
119
+ updatedAt: Date;
120
+ }
121
+
122
+ export interface OrganizationSiteData {
123
+ __table: 'organization_sites';
124
+ id: bigint;
125
+ organizationId: bigint;
126
+ parentId?: bigint | null;
127
+ name: string;
128
+ region?: string | null;
129
+ note?: string | null;
130
+ createdAt: Date;
131
+ }
132
+
133
+ export interface OrgContact {
134
+ department: OrganizationDepartmentEnum;
135
+ name?: string | null;
136
+ phoneNumber?: string | null;
137
+ emailAddress?: string | null;
138
+ }
139
+
140
+ export interface MergedOrgContact extends OrgContact {
141
+ department: OrganizationDepartmentEnum;
142
+ defaultName?: string | null;
143
+ defaultPhoneNumber?: string | null;
144
+ defaultEmailAddress?: string | null;
145
+ officialContact?: boolean;
146
+ locked?: boolean;
147
+ }
148
+
149
+ export type OrganizationSidebarItemKindEnum = 'LINK' | 'BREAK' | 'GROUP';
150
+
151
+ export interface OrganizationSidebarLinkItemObj {
152
+ kind?: 'LINK' | null;
153
+ slug: string;
154
+ label: string;
155
+ iconName: string | null;
156
+ order?: number | null;
157
+ }
158
+
159
+ export interface OrganizationSidebarBreakItemObj {
160
+ kind: 'BREAK';
161
+ order?: number | null;
162
+ }
163
+
164
+ export interface OrganizationSidebarGroupItemObj {
165
+ kind: 'GROUP';
166
+ label: string;
167
+ items: OrganizationSidebarItemObj[];
168
+ order?: number | null;
169
+ }
170
+
171
+ export type OrganizationSidebarItemObj =
172
+ | OrganizationSidebarLinkItemObj
173
+ | OrganizationSidebarBreakItemObj
174
+ | OrganizationSidebarGroupItemObj;
175
+
176
+ export interface OrganizationSettingsObj {
177
+ schedule?: { defaultSurface?: 'PROJECT' | 'COVERAGE' | null };
178
+ timeZone: string | null;
179
+ language: string | null;
180
+ displayTranslatedLogs: boolean;
181
+ translateLanguage: SupportedLogLanguage | null;
182
+ logRevisionsProof?: boolean;
183
+ color: string | null;
184
+ priorityService: boolean;
185
+ routes?: Record<string, OrganizationRouteSettingsObj>;
186
+ sidebar?: OrganizationSidebarItemObj[] | null;
187
+ }
188
+
189
+ export interface OrganizationChildData {
190
+ __table: 'organization_rels';
191
+ parentId: number | bigint | null;
192
+ childId: number | bigint;
193
+ organization: OrganizationData;
194
+ preferredContacts?: {
195
+ [key: OrganizationDepartmentEnum]: Partial<{
196
+ name: string | null;
197
+ phoneNumber: string | null;
198
+ emailAddress: string | null;
199
+ }>;
200
+ };
201
+ memory?: string | null;
202
+ affiliated: boolean;
203
+ addedAt: Date;
204
+ }
205
+
206
+ /**
207
+ * Full organization object with relationship
208
+ */
209
+
210
+ export interface OrganizationRelData {
211
+ id: string;
212
+ primary: boolean;
213
+ role: OrganizationRoleEnum;
214
+ acl: OrganizationACL;
215
+ organization: OrganizationData;
216
+ }
217
+
218
+ /**
219
+ * GraphQL data for organization types
220
+ */
221
+
222
+ export interface OrganizationComplianceGQL {
223
+ __deleted?: boolean;
224
+
225
+ id: string;
226
+ number: string | null;
227
+ documentName: string | null;
228
+ type: OrganizationComplianceType;
229
+ expirationDate: string; // YYYY-MM-DD
230
+ createdAt: string; // ISO date string
231
+ updatedAt: string; // ISO date string
232
+ files: StorageGQL[] | null;
233
+ }
234
+
235
+ export interface OrganizationGQL {
236
+ __deleted?: boolean;
237
+
238
+ id: string;
239
+ readableId?: string | null;
240
+ stripeCustomerId: string | null;
241
+ emailHandle: string | null;
242
+ name: string;
243
+ commodities: string[] | null;
244
+ address: AddressObj;
245
+ operation: OrganizationOperationEnum;
246
+ compliance: OrganizationComplianceGQL[] | null;
247
+ integrations: IntegrationConnectionGQL[] | null;
248
+ logTaxonomy?: import('./log.d.ts').LogTaxonomyGQL | null;
249
+ settings?: OrganizationSettingsObj | null;
250
+ directory: OrgContact[];
251
+ activated: boolean;
252
+ membersCount: number;
253
+ }
254
+
255
+ export interface OrganizationSiteGQL {
256
+ __deleted?: boolean;
257
+
258
+ id: string;
259
+ readableId?: string | null;
260
+ organizationId: string;
261
+ parentId?: string | null;
262
+ name: string;
263
+ region?: string | null;
264
+ note?: string | null;
265
+ createdAt: string;
266
+ organizationName?: string | null;
267
+ parentName?: string | null;
268
+ }
269
+
270
+ export interface OrganizationRelAccountGQL {
271
+ id: string;
272
+ deleted: boolean;
273
+ color: string | null;
274
+ profile: null | {
275
+ id: string;
276
+ firstName: string | null;
277
+ lastName: string | null;
278
+ photoId: string | null;
279
+ photoUri: string | null;
280
+ };
281
+ settings: Record<string, any> | null;
282
+ email: null | {
283
+ id: string;
284
+ address: string | null;
285
+ verified: boolean;
286
+ };
287
+ phone: null | {
288
+ id: string;
289
+ number: string | null;
290
+ verified: boolean;
291
+ primary: boolean;
292
+ };
293
+ }
294
+
295
+ export interface OrganizationRelGQL {
296
+ __deleted?: boolean;
297
+
298
+ id: string;
299
+ organizationId?: string;
300
+ account?: OrganizationRelAccountGQL | null;
301
+ primary: boolean;
302
+ role: OrganizationRoleEnum;
303
+ acl: OrganizationACLGQLData;
304
+ organization: OrganizationGQL;
305
+ }
306
+
307
+ export interface OrganizationChildGQL {
308
+ __deleted?: boolean;
309
+
310
+ id: string;
311
+ parentId: string;
312
+ cursor: string;
313
+ organization: OrganizationGQL;
314
+ preferredContacts: OrgContact[];
315
+ memory?: string | null;
316
+ affiliated: boolean;
317
+ addedAt: Date;
318
+ }
319
+
320
+ /**
321
+ * Compliances
322
+ */
323
+
324
+ export interface OrganizationComplianceFileData {
325
+ __table: 'organization_compliance_files';
326
+ complianceId: number;
327
+ storageId: number;
328
+ order: number;
329
+ file: StorageData;
330
+ }
331
+
332
+ export interface OrganizationComplianceObj {
333
+ storageIds: number[] | null;
334
+ number: string;
335
+ name: string;
336
+ type: OrganizationComplianceType;
337
+ expirationDate: string; // cast as date: "YYYY-MM-DD" format (in database)
338
+ notes?: string;
339
+ }
340
+
341
+ export interface OrganizationComplianceData
342
+ extends Omit<OrganizationComplianceObj, 'expirationDate'> {
343
+ __table: 'organization_compliances';
344
+ id: number;
345
+ organizationId: number;
346
+ expirationDate: Date; // in runtime deno-postgres converts it into JS Date (apparently because it has to)
347
+ documents: OrganizationComplianceFileData[] | null;
348
+ createdAt: Date;
349
+ updatedAt: Date;
350
+ }
@@ -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
+ }
@@ -0,0 +1,96 @@
1
+ /* JSON envelopes scanned from external QR images; issued field values use QrCodeValue below. */
2
+ export type QrCodeJSONValue = null | string | number | boolean | QrCodeJSONValue[] | { [key: string]: QrCodeJSONValue };
3
+
4
+ export type QrCodeValue = string | number | boolean;
5
+
6
+ export type QrCodeReferenceType = 'ORGANIZATION_SITE' | 'CHILD_ORGANIZATION';
7
+
8
+ export type QrCodeCodecErrorCode = 'TOO_LARGE' | 'INVALID' | 'UNSUPPORTED_VERSION';
9
+
10
+ export interface QrCodeValueField {
11
+ key: string;
12
+ description?: string;
13
+ kind: 'VALUE';
14
+ value: QrCodeValue;
15
+ }
16
+
17
+ export interface QrCodeReferenceField {
18
+ key: string;
19
+ description?: string;
20
+ kind: 'REFERENCE';
21
+ reference: {
22
+ type: QrCodeReferenceType;
23
+ /* Decimal database ID in storage; GraphQL and legacy v1 payloads use numeric GenericIDs. */
24
+ id: string;
25
+ };
26
+ displayNameSnapshot: string;
27
+ }
28
+
29
+ export type QrCodeField = QrCodeValueField | QrCodeReferenceField;
30
+
31
+ export interface QrCodePayloadReferenceField extends Omit<QrCodeReferenceField, 'reference'> {
32
+ reference: {
33
+ type: QrCodeReferenceType;
34
+ /* Typed readable site/org ID in v2/v3 public payloads; never a database ID or GenericID. */
35
+ id: string;
36
+ };
37
+ }
38
+
39
+ export type QrCodePayloadField = QrCodeValueField | QrCodePayloadReferenceField;
40
+
41
+ export type QrCodePayloadVersion = 1 | 2 | 3;
42
+
43
+ export type QrCodePayload =
44
+ | { v: 1; publicId: string; fields: QrCodeField[] }
45
+ | { v: 2; publicId: string; fields: QrCodePayloadField[] }
46
+ | { v: 3; publicId: string; organizationId: string; createdAt: string; fields: QrCodePayloadField[] };
47
+
48
+ /* Public GraphQL fields include nullable selections that the compact offline payload omits. */
49
+ export type QrCodeGQLField =
50
+ | (Omit<QrCodeValueField, 'description' | 'value'> & {
51
+ description: string | null;
52
+ value: QrCodeValue | null;
53
+ reference: null;
54
+ displayNameSnapshot: null;
55
+ })
56
+ | (Omit<QrCodeReferenceField, 'description'> & { description: string | null; value: null });
57
+
58
+ export interface QrCodeGQL {
59
+ id: string;
60
+ cursor: string;
61
+ organizationId: string;
62
+ publicId: string;
63
+ name: string;
64
+ fields: QrCodeGQLField[];
65
+ payloadVersion: number;
66
+ qrText: string;
67
+ createdByAccountId: string | null;
68
+ createdAt: string;
69
+ updatedAt: string;
70
+ archivedAt: string | null;
71
+ }
72
+
73
+ /* Reference display names are resolved on the server and cannot be supplied by callers. */
74
+ export type QrCodeFieldInput =
75
+ | (Omit<QrCodeValueField, 'description'> & { description?: string | null })
76
+ | (Omit<QrCodeReferenceField, 'displayNameSnapshot' | 'description'> & { description?: string | null });
77
+
78
+ export interface CreateQrCodeInput {
79
+ organizationId: string;
80
+ name: string;
81
+ fields: QrCodeFieldInput[];
82
+ }
83
+
84
+ export interface EditQrCodeInput {
85
+ organizationId: string;
86
+ qrCodeId: string;
87
+ name?: string;
88
+ archived?: boolean;
89
+ }
90
+
91
+ export interface QrCodesQueryArgs {
92
+ organizationId?: string | null;
93
+ filter?: { includeArchived?: boolean | null } | null;
94
+ cursor?: string | null;
95
+ limit?: number;
96
+ }
@@ -0,0 +1,81 @@
1
+ import type { NOTE_BLOCK_TYPES, NOTE_INLINE_TYPES, NOTE_MARK_TYPES } from '../constants/noteDoc.ts';
2
+
3
+ export type RichTextContentType = (typeof NOTE_BLOCK_TYPES)[number];
4
+ export type RichTextInlineContentType = (typeof NOTE_INLINE_TYPES)[number];
5
+ export type RichTextMarkType = (typeof NOTE_MARK_TYPES)[number];
6
+
7
+ // Heading depth; sanitizeNoteDoc clamps anything else into this range
8
+ export type RichTextHeadingLevel = 1 | 2 | 3;
9
+
10
+ /**
11
+ * Attributes carried by one "image" void block. storageId is the string form
12
+ * of the storage row id that owns the image. fileUri locates the GCS object
13
+ * for rendering.
14
+ */
15
+
16
+ export interface RichTextImageAttributes {
17
+ storageId: string;
18
+ fileUri: string;
19
+ alt?: string;
20
+ width?: number;
21
+ }
22
+
23
+ /**
24
+ * One inline mark on a text run. color/highlight marks carry a palette token
25
+ * from NOTE_COLOR_TOKENS; link marks carry an http(s)/mailto href; every other
26
+ * mark type carries no attributes.
27
+ */
28
+
29
+ export interface RichTextMark {
30
+ type: RichTextMarkType;
31
+ attrs?: {
32
+ token?: string;
33
+ href?: string;
34
+ };
35
+ }
36
+
37
+ /**
38
+ * One inline content node inside a text-bearing block: a styled text run, or a
39
+ * hard line break (which carries neither text nor marks).
40
+ */
41
+
42
+ export interface RichTextInlineContent {
43
+ type: RichTextInlineContentType;
44
+ text?: string;
45
+ marks?: RichTextMark[];
46
+ }
47
+
48
+ /**
49
+ * Attributes a block node may carry: "level" on headings and image attributes
50
+ * on image blocks. Every other block type carries no attributes.
51
+ */
52
+
53
+ export interface RichTextContentAttributes extends Partial<RichTextImageAttributes> {
54
+ level?: RichTextHeadingLevel;
55
+ }
56
+
57
+ /**
58
+ * One block-level content node. Containers (bulletList, orderedList, listItem,
59
+ * blockquote) hold block children; paragraph/heading hold inline children;
60
+ * divider/image hold none. _key and _uploading are client-editor-only fields,
61
+ * always stripped by sanitizeNoteDoc before persistence.
62
+ */
63
+
64
+ export interface RichTextContent {
65
+ type: RichTextContentType;
66
+ attrs?: RichTextContentAttributes;
67
+ content?: Array<RichTextContent | RichTextInlineContent>;
68
+ _key?: string;
69
+ _uploading?: boolean;
70
+ }
71
+
72
+ /**
73
+ * The root document used by persisted rich-text fields. It is always
74
+ * non-empty after sanitizing, with at least one possibly-empty paragraph.
75
+ */
76
+
77
+ export interface RichTextDocument {
78
+ type: 'doc';
79
+ version: number;
80
+ content: RichTextContent[];
81
+ }