@jsb188/graphql 1.1.11 → 1.1.13

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/audience.d.ts +205 -0
  3. package/cache/config.ts +65 -28
  4. package/cache/index.helpers.ts +96 -0
  5. package/cache/index.ts +364 -808
  6. package/cache/mounted-queries.ts +33 -0
  7. package/cache/optimistic-ui-runtime.ts +46 -0
  8. package/cache/optimistic-ui.ts +401 -0
  9. package/cache/persist.ts +107 -22
  10. package/cache/realtime-fence.ts +47 -0
  11. package/cache/realtime-live.ts +17 -0
  12. package/cache/store.ts +22 -64
  13. package/cache/value.helpers.ts +17 -0
  14. package/{drafts/store.ts → client/draft-persistence-indexed-db.ts} +19 -3
  15. package/{drafts/index.ts → client/draft-persistence.ts} +13 -39
  16. package/client/index.ts +4 -2
  17. package/client/request.helpers.ts +14 -0
  18. package/client/request.ts +122 -232
  19. package/client/storage-asset.ts +58 -0
  20. package/gql/fragments/accountAuthFragments.ts +0 -4
  21. package/gql/fragments/agentMemoryFragments.ts +5 -1
  22. package/gql/fragments/agentNoteFragments.ts +156 -0
  23. package/gql/fragments/aiChatFragments.ts +35 -11
  24. package/gql/fragments/aiChatLinkFragments.ts +8 -0
  25. package/gql/fragments/audienceFragments.ts +76 -0
  26. package/gql/fragments/dataTableFragments.ts +48 -80
  27. package/gql/fragments/emailFragments.ts +49 -21
  28. package/gql/fragments/emailOutreachFragments.ts +281 -0
  29. package/gql/fragments/fieldDocFragments.ts +222 -40
  30. package/gql/fragments/inboundContactFragments.ts +2 -0
  31. package/gql/fragments/libraryFragments.ts +120 -0
  32. package/gql/fragments/logFragments.ts +93 -2
  33. package/gql/fragments/organizationFragments.ts +12 -0
  34. package/gql/fragments/qrCodeFragments.ts +29 -0
  35. package/gql/fragments/scheduleFragments.ts +574 -145
  36. package/gql/fragments/sheetFragments.ts +86 -424
  37. package/gql/fragments/storageFragments.ts +25 -1
  38. package/gql/fragments/workWaitFragments.ts +13 -0
  39. package/gql/fragments/workflowFragments.ts +32 -4
  40. package/gql/mutations/agentMemoryMutations.ts +32 -0
  41. package/gql/mutations/agentNoteMutations.ts +64 -0
  42. package/gql/mutations/aiChatLinkMutations.ts +13 -0
  43. package/gql/mutations/aiChatMutations.ts +34 -4
  44. package/gql/mutations/audienceMutations.ts +58 -0
  45. package/gql/mutations/authMutations.ts +24 -28
  46. package/gql/mutations/billingMutations.ts +24 -0
  47. package/gql/mutations/contactMutations.ts +23 -0
  48. package/gql/mutations/dataTableMutations.ts +18 -75
  49. package/gql/mutations/emailMutations.ts +22 -0
  50. package/gql/mutations/emailOutreachMutations.ts +139 -0
  51. package/gql/mutations/fieldDocMutations.ts +162 -13
  52. package/gql/mutations/index.ts +10 -5
  53. package/gql/mutations/organizationMutations.ts +6 -0
  54. package/gql/mutations/qrCodeMutations.ts +20 -0
  55. package/gql/mutations/scheduleMutations.ts +389 -417
  56. package/gql/mutations/sheetMutations.ts +62 -118
  57. package/gql/mutations/storageMutations.ts +1 -1
  58. package/gql/mutations/workflowMutations.ts +94 -0
  59. package/gql/queries/agentMemoryQueries.ts +12 -2
  60. package/gql/queries/agentNoteQueries.ts +86 -0
  61. package/gql/queries/aiChatQueries.ts +63 -12
  62. package/gql/queries/audienceQueries.ts +104 -0
  63. package/gql/queries/authQueries.ts +20 -4
  64. package/gql/queries/billingQueries.ts +114 -9
  65. package/gql/queries/dataTableQueries.ts +43 -75
  66. package/gql/queries/emailOutreachQueries.ts +282 -0
  67. package/gql/queries/emailQueries.ts +48 -64
  68. package/gql/queries/emailReplyReportQueries.ts +127 -0
  69. package/gql/queries/fieldDocQueries.ts +128 -98
  70. package/gql/queries/inboundContactQueries.ts +15 -4
  71. package/gql/queries/index.ts +5 -3
  72. package/gql/queries/libraryQueries.ts +112 -0
  73. package/gql/queries/logQueries.ts +86 -12
  74. package/gql/queries/organizationQueries.ts +44 -12
  75. package/gql/queries/qrCodeQueries.ts +27 -0
  76. package/gql/queries/scheduleQueries.ts +401 -278
  77. package/gql/queries/sheetQueries.ts +94 -165
  78. package/gql/queries/storageQueries.ts +11 -4
  79. package/gql/queries/workflowQueries.ts +61 -12
  80. package/gql/reactivity.ts +98 -0
  81. package/gql/recordReads.ts +171 -0
  82. package/hooks/index.helpers.ts +52 -0
  83. package/hooks/index.ts +920 -715
  84. package/hooks/use-agentMemory-mtn.ts +29 -31
  85. package/hooks/use-agentMemory-qry.ts +15 -3
  86. package/hooks/use-agentNote-mtn.ts +89 -0
  87. package/hooks/use-agentNote-qry.ts +162 -0
  88. package/hooks/use-agentNote-recovery.helpers.ts +58 -0
  89. package/hooks/use-agentNote-recovery.ts +57 -0
  90. package/hooks/use-aiChat-mtn.ts +104 -115
  91. package/hooks/use-aiChat-qry.helpers.ts +124 -0
  92. package/hooks/use-aiChat-qry.ts +254 -387
  93. package/hooks/use-aiChat-stream-mtn.ts +14 -0
  94. package/hooks/use-audience-mtn.ts +170 -0
  95. package/hooks/use-audience-qry.helpers.ts +39 -0
  96. package/hooks/use-audience-qry.ts +245 -0
  97. package/hooks/use-auth-mtn.ts +30 -1
  98. package/hooks/use-billing-mtn.ts +31 -0
  99. package/hooks/use-billing-qry.ts +76 -0
  100. package/hooks/use-dataTable-mtn.ts +23 -115
  101. package/hooks/use-dataTable-qry.ts +69 -914
  102. package/hooks/use-email-mtn.ts +26 -0
  103. package/hooks/use-email-qry.helpers.ts +37 -0
  104. package/hooks/use-email-qry.ts +44 -174
  105. package/hooks/use-emailOutreach-mtn.ts +211 -0
  106. package/hooks/use-emailOutreach-qry.helpers.ts +25 -0
  107. package/hooks/use-emailOutreach-qry.ts +367 -0
  108. package/hooks/use-emailOutreachReplyReport-qry.ts +46 -0
  109. package/hooks/use-fieldDoc-mtn.ts +244 -32
  110. package/hooks/use-fieldDoc-qry.helpers.ts +49 -0
  111. package/hooks/use-fieldDoc-qry.ts +134 -102
  112. package/hooks/use-inboundContact-qry.ts +7 -9
  113. package/hooks/use-library-qry.ts +233 -0
  114. package/hooks/use-log-mtn.ts +25 -12
  115. package/hooks/use-log-qry.ts +99 -46
  116. package/hooks/use-organization-qry.ts +16 -60
  117. package/hooks/use-qrCode-mtn.ts +40 -0
  118. package/hooks/use-qrCode-qry.ts +78 -0
  119. package/hooks/use-schedule-mtn.ts +231 -348
  120. package/hooks/use-schedule-qry.ts +208 -139
  121. package/hooks/use-schedule-reactive.ts +218 -0
  122. package/hooks/use-sheet-mtn.ts +91 -199
  123. package/hooks/use-sheet-qry.ts +88 -237
  124. package/hooks/use-storage-qry.ts +84 -61
  125. package/hooks/use-workflow-mtn.ts +84 -23
  126. package/hooks/use-workflow-qry.ts +60 -61
  127. package/libs/ai-chat-link-events.ts +78 -0
  128. package/libs/ai-chat-outgoing.helpers.ts +153 -0
  129. package/libs/ai-chat-outgoing.ts +11 -0
  130. package/libs/ai-chat-outgoing.types.ts +25 -0
  131. package/libs/ai-chat-run-realtime.ts +20 -0
  132. package/libs/ai-chat-submission-realtime.ts +150 -0
  133. package/libs/data-changes.helpers.ts +161 -0
  134. package/libs/data-changes.ts +382 -0
  135. package/libs/fragment-realtime-sequence.ts +55 -0
  136. package/libs/open-sheet.ts +138 -0
  137. package/libs/record-read.ts +327 -0
  138. package/libs/sheet-command-batch.ts +45 -0
  139. package/libs/sheet-realtime-packet.ts +53 -0
  140. package/libs/sheet-view-realtime-router.ts +99 -0
  141. package/loaders/emailPreference.ts +69 -0
  142. package/loaders/rest.ts +12 -0
  143. package/package.json +77 -25
  144. package/schedule.d.ts +1183 -0
  145. package/sse.helpers.ts +19 -0
  146. package/sse.ts +26 -115
  147. package/types.d.ts +48 -25
  148. package/cache/index.test.ts +0 -881
  149. package/client/data-table-realtime-subscriptions.test.ts +0 -740
  150. package/client/data-table-realtime-subscriptions.ts +0 -955
  151. package/client/data-table-realtime.test.ts +0 -792
  152. package/client/data-table-realtime.ts +0 -1218
  153. package/client/fragment-realtime-sequence.ts +0 -52
  154. package/client/open-sheet.ts +0 -137
  155. package/client/request-managed-session.test.ts +0 -574
  156. package/client/request-no-store.test.ts +0 -157
  157. package/client/sse-ticket.test.ts +0 -26
  158. package/deno.lock +0 -170
  159. package/deno.test.json +0 -10
  160. package/gql/fragments/agentDocFragments.ts +0 -46
  161. package/gql/fragments/billingFragments.ts +0 -14
  162. package/gql/fragments/campaignFragments.ts +0 -277
  163. package/gql/mutations/agentDocMutations.ts +0 -177
  164. package/gql/mutations/campaignMutations.ts +0 -215
  165. package/gql/queries/agentDocQueries.ts +0 -120
  166. package/gql/queries/appQueries.ts +0 -14
  167. package/gql/queries/campaignQueries.ts +0 -127
  168. package/hooks/use-agentDoc-mtn.ts +0 -285
  169. package/hooks/use-agentDoc-qry.ts +0 -208
  170. package/hooks/use-app-qry.ts +0 -22
  171. package/hooks/use-campaign-mtn.ts +0 -377
  172. package/hooks/use-campaign-qry.ts +0 -257
  173. package/loaders/campaign.ts +0 -137
  174. package/tsconfig.json +0 -13
@@ -0,0 +1,281 @@
1
+ /*
2
+ * Email outreach fragments.
3
+ *
4
+ * Each fragment NAME is the realtime contract: the cache keys a spread as
5
+ * `$<fragmentName>:<id>`, which is byte-identical to what the server pushes
6
+ * through FRAGMENT_NAMES.emailOutreach / emailOutreachRecipient. Renaming a
7
+ * fragment here silently stops websocket patches from landing on cached rows.
8
+ */
9
+
10
+ /*
11
+ * The complete outreach record, shared by the detail query and every safety-valve
12
+ * mutation response. It spreads workWaitItemFragment (waitingFor), so every
13
+ * document that includes it appends that fragment's text too.
14
+ */
15
+ export const emailOutreachFragment = `fragment emailOutreachFragment on EmailOutreach {
16
+ id
17
+ organizationId
18
+ status
19
+ editVersion
20
+ deliveryVersion
21
+ title
22
+ contentFormat
23
+ subject
24
+ preheader
25
+ bodyText
26
+ definition {
27
+ schemaVersion
28
+ rows {
29
+ key
30
+ order
31
+ settings {
32
+ backgroundColor
33
+ padding
34
+ }
35
+ columns {
36
+ key
37
+ order
38
+ width
39
+ blocks {
40
+ key
41
+ order
42
+ type
43
+ content {
44
+ text
45
+ richText
46
+ url
47
+ altText
48
+ heading
49
+ headingLevel
50
+ buttonLabel
51
+ buttonUrl
52
+ links {
53
+ label
54
+ url
55
+ }
56
+ }
57
+ settings {
58
+ alignment
59
+ textColor
60
+ backgroundColor
61
+ fontSize
62
+ padding
63
+ height
64
+ buttonStyle
65
+ }
66
+ files {
67
+ id
68
+ order
69
+ uri
70
+ contentType
71
+ size
72
+ name
73
+ imageData {
74
+ width
75
+ height
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ design {
83
+ canvasColor
84
+ contentColor
85
+ contentWidth
86
+ fontFamily
87
+ textColor
88
+ linkColor
89
+ padding
90
+ }
91
+ trackOpens
92
+ recipientSource
93
+ exclusions {
94
+ emailAddressIds
95
+ organizationIds
96
+ emails
97
+ }
98
+ audienceListId
99
+ audienceListName
100
+ audienceFrozenAt
101
+ replyToSenders
102
+ replyInstructions
103
+ secondaryReplyToEmail
104
+ agentNoteDisabled
105
+ agentNoteInstructions
106
+ previewedAt
107
+ previewedEditVersion
108
+ previewUrl
109
+ approvedAt
110
+ approvedEditVersion
111
+ approvedBy {
112
+ id
113
+ name
114
+ }
115
+ approvedByAccountId
116
+ createdByAccountId
117
+ aiChatId
118
+ clonedFromId
119
+ followUpOfEmailOutreachId
120
+ reportIntoEmailOutreachId
121
+ waitingFor {
122
+ ...workWaitItemFragment
123
+ }
124
+ scheduledAt
125
+ startedAt
126
+ completedAt
127
+ errorMessage
128
+ sendInfo {
129
+ senderAddress
130
+ replyAddress
131
+ timeZone
132
+ replyDomain
133
+ }
134
+ __deleted: deleted
135
+ archivedAt
136
+ createdAt
137
+ updatedAt
138
+ }`;
139
+
140
+ /*
141
+ * Outreach list row. PARTIALS_MAP stores it under the emailOutreachFragment
142
+ * identity, so realtime lifecycle patches update list and detail consumers alike.
143
+ * It omits content and reply instructions.
144
+ */
145
+ export const emailOutreachSummaryFragment = `fragment emailOutreachSummaryFragment on EmailOutreachSummary {
146
+ id
147
+ organizationId
148
+ status
149
+ deliveryVersion
150
+ title
151
+ contentFormat
152
+ subject
153
+ recipientSource
154
+ audienceListId
155
+ audienceListName
156
+ audienceFrozenAt
157
+ createdByAccountId
158
+ scheduledAt
159
+ startedAt
160
+ completedAt
161
+ errorMessage
162
+ __deleted: deleted
163
+ archivedAt
164
+ metrics {
165
+ recipientCount
166
+ deliveredCount
167
+ openedCount
168
+ respondedCount
169
+ }
170
+ createdAt
171
+ updatedAt
172
+ cursor
173
+ }`;
174
+
175
+ /*
176
+ * One entry of an outreach's append-only progress history (newest first).
177
+ */
178
+ export const emailOutreachEventFragment = `fragment emailOutreachEventFragment on EmailOutreachEvent {
179
+ id
180
+ emailOutreachId
181
+ event
182
+ source
183
+ editVersion
184
+ accountId
185
+ summary
186
+ createdAt
187
+ }`;
188
+
189
+ /* Share current draft audience counts and sending limits across the editor and confirmation screen. */
190
+ export const emailOutreachAudiencePreviewFragment = `fragment emailOutreachAudiencePreviewFragment on EmailOutreachAudiencePreview {
191
+ id
192
+ emailOutreachId
193
+ editVersion
194
+ selectedCount
195
+ eligibleCount
196
+ duplicateCount
197
+ excludedCount
198
+ exclusions { reason count }
199
+ frozenRecipientCount
200
+ sendLimits { recipientLimit monthlyRecipientLimit monthlyRecipientsRemaining sendingPaused }
201
+ }`;
202
+
203
+ /* Share candidate identities and memberships; operations add the canonical nested address fragment beside this spread. */
204
+ export const emailOutreachAudienceMemberFragment = `fragment emailOutreachAudienceMemberFragment on EmailOutreachAudienceMember {
205
+ id
206
+ cursor
207
+ organizationId
208
+ emailOutreachId
209
+ recipientSource
210
+ emailAddressId
211
+ normalizedEmail
212
+ personName
213
+ inboundContactId
214
+ childOrganizationId
215
+ organizationName
216
+ contactId
217
+ reason
218
+ memberships {
219
+ memberId
220
+ audienceListId
221
+ listName
222
+ personName
223
+ subscriptionStatus
224
+ subscriptionVersion
225
+ removedAt
226
+ }
227
+ }`;
228
+
229
+ /*
230
+ * One frozen outreach recipient with its newest delivery outcome.
231
+ */
232
+ export const emailOutreachRecipientFragment = `fragment emailOutreachRecipientFragment on EmailOutreachRecipient {
233
+ id
234
+ cursor
235
+ emailOutreachId
236
+ inboundContactId
237
+ emailAddressId
238
+ outboundEmailId
239
+ emailAddress
240
+ personName
241
+ deliveryStatus
242
+ sentAt
243
+ deliveredAt
244
+ openedAt
245
+ invitedAt
246
+ firstOpenedAt
247
+ respondedAt
248
+ bouncedAt
249
+ bounceType
250
+ spamComplaintAt
251
+ errorMessage
252
+ suppressionReason
253
+ createdAt
254
+ }`;
255
+
256
+ /*
257
+ * Aggregate delivery and engagement counts for one outreach, keyed by the outreach id.
258
+ */
259
+ export const emailOutreachRecipientOverviewFragment = `fragment emailOutreachRecipientOverviewFragment on EmailOutreachRecipientOverview {
260
+ id
261
+ totalCount
262
+ selectedCount
263
+ queuedCount
264
+ processingCount
265
+ sentCount
266
+ deliveredCount
267
+ openedCount
268
+ respondedCount
269
+ notRepliedCount
270
+ bouncedCount
271
+ spamComplaintCount
272
+ failedCount
273
+ retryableCount
274
+ unknownCount
275
+ suppressedCount
276
+ excludedCount
277
+ audienceLists {
278
+ id
279
+ name
280
+ }
281
+ }`;
@@ -1,27 +1,111 @@
1
- export const fieldDocFragment = `fragment fieldDocFragment on FieldDoc {
1
+ // Program-owned group fields shared by program lists, forms and editor sources.
2
+ export const fieldDocProgramGroupFragment = `fragment fieldDocProgramGroupFragment on FieldDocProgramGroup {
3
+ id
4
+ fieldDocProgramId
5
+ name
6
+ order
7
+ }`;
8
+
9
+ // Org-agnostic program fields. Per-organization data (enrollment state, forms)
10
+ // never goes on this fragment: one cache entry is shared by every organization.
11
+ export const fieldDocProgramFragment = `fragment fieldDocProgramFragment on FieldDocProgram {
12
+ id
13
+ isCatalog
14
+ name
15
+ shortName
16
+ description
17
+ categoryKey
18
+ operations
19
+ layout {
20
+ columns
21
+ headers
22
+ gridLayoutStyle
23
+ }
24
+ retired
25
+ }`;
26
+
27
+ // Enrollment scalars only; id is "<organizationId>:<programId>". Program and
28
+ // forms are selected beside it (fieldDocProgramEnrollmentStatement).
29
+ export const fieldDocProgramEnrollmentFragment = `fragment fieldDocProgramEnrollmentFragment on FieldDocProgramEnrollment {
2
30
  id
3
31
  organizationId
32
+ archivedAt
33
+ restorableUntil
34
+ }`;
4
35
 
36
+ // The form; org-agnostic
37
+ export const fieldDocFragment = `fragment fieldDocFragment on FieldDoc {
38
+ order
39
+ id
40
+ fieldDocProgramId
5
41
  documentName
6
42
  title
43
+ draftTitle
7
44
  description
8
- agentHint
9
45
  frequency
10
- fieldDocGroupId
11
- groupName
12
- groupShortName
46
+ isProgramDoc
47
+ retired
48
+ published
49
+ publishedRevisionNumber
50
+ hasDraft
51
+ }`;
52
+
53
+ // The one submission shape, shared by submission lists and the document header.
54
+ // Spread it directly in operations, never inside another fragment.
55
+ export const fieldDocSubmissionFragment = `fragment fieldDocSubmissionFragment on FieldDocSubmission {
56
+ id
57
+ cursor
58
+ readableId
59
+ fieldDocId
60
+ fieldDocProgramId
61
+ programName
62
+ programShortName
63
+ isProgramDoc
64
+ definitionRevisionId
65
+
66
+ organizationId
67
+ organizationName
68
+ childOrgId
69
+ childOrgName
70
+ siteId
71
+ location
72
+
73
+ documentName
74
+ title
75
+ frequency
13
76
  period
77
+ status
78
+ statusOverridden
14
79
  summary
80
+ identifierHint
81
+
82
+ instanceKey
83
+ instanceStatus
84
+ instanceClosedAt
85
+
86
+ activityAt
87
+ createdAt
88
+ updatedAt
15
89
  }`;
16
90
 
17
- export const fieldDocSectionFragment = `fragment fieldDocSectionFragment on FieldDocSection {
91
+ // Immutable definition revision scalars; sections and elements are selected
92
+ // beside it with their own fragments
93
+ export const fieldDocDefinitionFragment = `fragment fieldDocDefinitionFragment on FieldDocDefinition {
94
+ id
95
+ fieldDocId
96
+ revisionNumber
97
+ title
98
+ description
99
+ }`;
100
+
101
+ export const fieldDocDefinitionSectionFragment = `fragment fieldDocDefinitionSectionFragment on FieldDocDefinitionSection {
18
102
  id
19
103
  key
20
104
  title
21
105
  description
22
106
  }`;
23
107
 
24
- export const fieldDocElementDataFragment = `fragment fieldDocElementDataFragment on FieldDocElement {
108
+ export const fieldDocDefinitionElementFragment = `fragment fieldDocDefinitionElementFragment on FieldDocDefinitionElement {
25
109
  id
26
110
  key
27
111
  kind
@@ -31,52 +115,150 @@ export const fieldDocElementDataFragment = `fragment fieldDocElementDataFragment
31
115
  required
32
116
  allowMultipleAnswers
33
117
  doNotAllowNotes
118
+ answerType
119
+ tableColumns {
120
+ key
121
+ label
122
+ type
123
+ required
124
+ options
125
+ }
126
+ lineNumber
127
+ }`;
34
128
 
129
+ // One answer; id is "<submissionId>:<key>". Spread it directly in operations,
130
+ // never inside another fragment.
131
+ export const fieldDocAnswerFragment = `fragment fieldDocAnswerFragment on FieldDocAnswer {
132
+ id
133
+ key
35
134
  text
135
+ tableRows {
136
+ id
137
+ cells {
138
+ key
139
+ text
140
+ isCustomBooleanLabel
141
+ }
142
+ }
143
+ answerState
144
+ answerReason
36
145
  note
37
146
  warningNote
38
147
  referenceIds
39
- lineNumber
40
148
  }`;
41
149
 
42
- export const fieldDocGroupFragment = `fragment fieldDocGroupFragment on FieldDocGroup {
150
+ // Edit session scalars only; id is "<organizationId>:<fieldDocId>". The source,
151
+ // editor and custom instructions are selected beside it (fieldDocEditSessionStatement).
152
+ export const fieldDocEditSessionFragment = `fragment fieldDocEditSessionFragment on FieldDocEditSession {
43
153
  id
44
- name
45
- shortName
46
- layout {
47
- columns
48
- headers
49
- gridLayoutStyle
50
- }
51
- lastSubmissionPeriod
52
- lastSubmissionFieldDocId
154
+ organizationId
155
+ mode
156
+ manageable
53
157
  }`;
54
158
 
55
- export const fieldDocSubmissionFragment = `fragment fieldDocSubmissionFragment on FieldDocSubmission {
159
+ // id is "<organizationId>:<fieldDocId>"
160
+ export const fieldDocEditorSourceFragment = `fragment fieldDocEditorSourceFragment on FieldDocEditorSource {
161
+ order
56
162
  id
57
- fieldDocSubmissionId
58
163
  fieldDocId
59
- value
164
+ organizationId
165
+ fieldDocProgramId
166
+ isProgramDoc
167
+ documentName
60
168
  frequency
61
- fieldDocSubmissionIdEnc
169
+ editVersion
170
+ hasDraft
171
+ draftStale
172
+ publishedRevisionNumber
173
+ draftUpdatedAt
174
+ }`;
62
175
 
63
- organizationId
64
- organizationIdEnc
65
- organizationName
66
- organizationOperation
176
+ // Nested fragments are selected directly by operations, never spread inside another fragment.
177
+ export const fieldDocProgramStatement = `...fieldDocProgramFragment
178
+ groups {
179
+ ...fieldDocProgramGroupFragment
180
+ }`;
67
181
 
68
- childOrgId
69
- childOrgIdEnc
70
- childOrgName
71
- childOrgOperation
182
+ export const fieldDocStatement = `...fieldDocFragment
183
+ group {
184
+ ...fieldDocProgramGroupFragment
185
+ }`;
72
186
 
73
- location
74
- period
75
- status
76
- fieldDocGroupId
77
- groupName
78
- groupShortName
79
- activityAt
80
- createdAt
81
- updatedAt
82
- }`;
187
+ export const fieldDocEditorSourceStatement = `...fieldDocEditorSourceFragment
188
+ group {
189
+ ...fieldDocProgramGroupFragment
190
+ }`;
191
+
192
+ export const fieldDocProgramImports = `${fieldDocProgramFragment}
193
+ ${fieldDocProgramGroupFragment}`;
194
+ export const fieldDocImports = `${fieldDocFragment}
195
+ ${fieldDocProgramGroupFragment}`;
196
+ export const fieldDocEditorSourceImports = `${fieldDocEditorSourceFragment}
197
+ ${fieldDocProgramGroupFragment}`;
198
+
199
+ // The enrollment selection shared by fieldDocProgramEnrollments and every
200
+ // mutation returning FieldDocProgramEnrollment, so all of them cache the same tree
201
+ export const fieldDocProgramEnrollmentStatement = `...fieldDocProgramEnrollmentFragment
202
+
203
+ fieldDocSubmissionUpdates {
204
+ fieldDocId
205
+ lastSubmissionUpdatedAt
206
+ }
207
+
208
+ program {
209
+ ${fieldDocProgramStatement}
210
+ }
211
+
212
+ forms {
213
+ ${fieldDocStatement}
214
+ }`;
215
+
216
+ export const fieldDocProgramEnrollmentImports = `
217
+ ${fieldDocProgramEnrollmentFragment}
218
+ ${fieldDocProgramGroupFragment}
219
+ ${fieldDocProgramFragment}
220
+ ${fieldDocFragment}
221
+ `;
222
+
223
+ // The edit session selection shared by fieldDocEditSession and
224
+ // editFieldDocCustomInstructions, so the mutation result updates the cached session
225
+ export const fieldDocEditSessionStatement = `...fieldDocEditSessionFragment
226
+
227
+ fieldDoc {
228
+ ${fieldDocEditorSourceStatement}
229
+ }
230
+
231
+ editor {
232
+ definition {
233
+ title
234
+ description
235
+ agentHint
236
+ sections {
237
+ key
238
+ label
239
+ description
240
+ hint
241
+ elements {
242
+ key
243
+ kind
244
+ label
245
+ description
246
+ hint
247
+ options
248
+ required
249
+ settings
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ customInstructions {
256
+ elementKey
257
+ instructions
258
+ updatedAt
259
+ }`;
260
+
261
+ export const fieldDocEditSessionImports = `
262
+ ${fieldDocEditSessionFragment}
263
+ ${fieldDocEditorSourceImports}
264
+ `;
@@ -4,6 +4,8 @@ export const inboundContactFragment = `fragment inboundContactFragment on Inboun
4
4
  cursor
5
5
  personName
6
6
  email
7
+ emailEligible
8
+ emailOutreachSuppressed
7
9
  phone
8
10
  memory
9
11
  associated {
@@ -0,0 +1,120 @@
1
+ /*
2
+ * Share the complete light library file record (every field of LibraryFile) across readers and future library views.
3
+ * The first picture URL identifies its protected thumbnail on the assets server.
4
+ */
5
+ export const libraryFileFragment = `fragment libraryFileFragment on LibraryFile {
6
+ id
7
+ organizationId
8
+ kind
9
+ format
10
+ origin
11
+ source
12
+ title
13
+ useWhen
14
+ gist
15
+ scope
16
+ listed
17
+ sensitivity
18
+ folderId
19
+ purposes {
20
+ id
21
+ name
22
+ }
23
+ parties {
24
+ id
25
+ relatedOrgId
26
+ inboundContactId
27
+ name
28
+ relation
29
+ }
30
+ approvedAt
31
+ approvedByAccountId
32
+ archivedAt
33
+ archiveKind
34
+ lifecycleReason
35
+ replacedByFileId
36
+ possibleReplacementFileId
37
+ effectiveFrom
38
+ effectiveUntil
39
+ pinnedFields
40
+ fileName
41
+ fileContentType
42
+ firstImageUrl
43
+ fileCount
44
+ senderName
45
+ senderEmail
46
+ pageCount
47
+ contentRevision
48
+ analysisStatus
49
+ analysisError
50
+ analysisRevision
51
+ analyzedAt
52
+ labeledAt
53
+ organizedAt
54
+ createdByAccountId
55
+ createdByAgent
56
+ createdAt
57
+ updatedAt
58
+ cursor
59
+ }`;
60
+
61
+ export const libraryFileAnalysisFragment = `fragment libraryFileAnalysisFragment on LibraryFileAnalysis {
62
+ id
63
+ revision
64
+ stale
65
+ data
66
+ }`;
67
+
68
+ export const libraryFileContentFragment = `fragment libraryFileContentFragment on LibraryFileContent {
69
+ id
70
+ contentRevision
71
+ content
72
+ }`;
73
+
74
+ /*
75
+ * One window of a cited chunk. The id names the file, the brief's analysisId, the chunk and the span, so a cached
76
+ * window is never shown against another brief's span.
77
+ */
78
+ export const libraryFileCitationFragment = `fragment libraryFileCitationFragment on LibraryFileCitation {
79
+ id
80
+ current
81
+ ordinal
82
+ page
83
+ heading
84
+ ocr
85
+ text
86
+ highlightStart
87
+ highlightEnd
88
+ truncatedBefore
89
+ truncatedAfter
90
+ }`;
91
+
92
+ export const libraryFileNoteFragment = `fragment libraryFileNoteFragment on LibraryFileNote {
93
+ id
94
+ libraryFileId
95
+ text
96
+ accountId
97
+ authorName
98
+ channel
99
+ createdAt
100
+ }`;
101
+
102
+ export const libraryFileObjectFragment = `fragment libraryFileObjectFragment on LibraryFileObject {
103
+ id
104
+ ordinal
105
+ name
106
+ contentType
107
+ size
108
+ url
109
+ }`;
110
+
111
+ export const libraryFolderFragment = `fragment libraryFolderFragment on LibraryFolder {
112
+ id
113
+ organizationId
114
+ parentId
115
+ name
116
+ description
117
+ position
118
+ pinned
119
+ fileCount
120
+ }`;