@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
@@ -1,11 +1,9 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import {
3
3
  sheetCellFragment,
4
- sheetCommandResultFragment,
5
4
  sheetFragment,
6
- sheetRangeFragment,
7
- sheetRegionFragment,
8
5
  sheetTabFragment,
6
+ sheetTabMutationResultFragment,
9
7
  sheetViewPatchFragment,
10
8
  } from '../fragments/sheetFragments.ts';
11
9
 
@@ -85,21 +83,20 @@ export const createSheetTabMtn = gql`
85
83
  mutation createSheetTab (
86
84
  $organizationId: GenericID!
87
85
  $sheetId: GenericID!
86
+ $commandId: String!
87
+ $sessionId: String!
88
88
  ) {
89
89
  createSheetTab (
90
90
  organizationId: $organizationId
91
91
  sheetId: $sheetId
92
+ commandId: $commandId
93
+ sessionId: $sessionId
92
94
  ) {
93
- ...sheetFragment
94
-
95
- tabs {
96
- ...sheetTabFragment
97
- }
95
+ ...sheetTabMutationResultFragment
98
96
  }
99
97
  }
100
98
 
101
- ${sheetFragment}
102
- ${sheetTabFragment}
99
+ ${sheetTabMutationResultFragment}
103
100
  `;
104
101
 
105
102
  export const importSheetFromFileMtn = gql`
@@ -154,8 +151,8 @@ mutation updateSheetTab (
154
151
  $sheetId: GenericID!
155
152
  $sheetTabId: GenericID!
156
153
  $name: String
157
- $commandId: String
158
- $sessionId: String
154
+ $commandId: String!
155
+ $sessionId: String!
159
156
  ) {
160
157
  updateSheetTab (
161
158
  organizationId: $organizationId
@@ -165,125 +162,114 @@ mutation updateSheetTab (
165
162
  commandId: $commandId
166
163
  sessionId: $sessionId
167
164
  ) {
168
- ...sheetTabFragment
165
+ ...sheetTabMutationResultFragment
169
166
  }
170
167
  }
171
168
 
172
- ${sheetTabFragment}
169
+ ${sheetTabMutationResultFragment}
173
170
  `;
174
171
 
175
- export const reorderSheetTabsMtn = gql`
176
- mutation reorderSheetTabs (
172
+ export const setSheetTabHiddenMtn = gql`
173
+ mutation setSheetTabHidden (
177
174
  $organizationId: GenericID!
178
175
  $sheetId: GenericID!
179
- $positions: [SheetTabPositionInput!]!
180
- $commandId: String
181
- $sessionId: String
176
+ $sheetTabId: GenericID!
177
+ $hidden: Boolean!
178
+ $commandId: String!
179
+ $sessionId: String!
182
180
  ) {
183
- reorderSheetTabs (
181
+ setSheetTabHidden (
184
182
  organizationId: $organizationId
185
183
  sheetId: $sheetId
186
- positions: $positions
184
+ sheetTabId: $sheetTabId
185
+ hidden: $hidden
187
186
  commandId: $commandId
188
187
  sessionId: $sessionId
189
188
  ) {
190
- ...sheetFragment
191
-
192
- tabs {
193
- ...sheetTabFragment
194
- }
189
+ ...sheetTabMutationResultFragment
195
190
  }
196
191
  }
197
192
 
198
- ${sheetFragment}
199
- ${sheetTabFragment}
193
+ ${sheetTabMutationResultFragment}
200
194
  `;
201
195
 
202
- export const deleteSheetTabMtn = gql`
203
- mutation deleteSheetTab (
196
+ export const reorderSheetTabsMtn = gql`
197
+ mutation reorderSheetTabs (
204
198
  $organizationId: GenericID!
205
199
  $sheetId: GenericID!
206
- $sheetTabId: GenericID!
200
+ $positions: [SheetTabPositionInput!]!
201
+ $commandId: String!
202
+ $sessionId: String!
207
203
  ) {
208
- deleteSheetTab (
204
+ reorderSheetTabs (
209
205
  organizationId: $organizationId
210
206
  sheetId: $sheetId
211
- sheetTabId: $sheetTabId
212
- )
207
+ positions: $positions
208
+ commandId: $commandId
209
+ sessionId: $sessionId
210
+ ) {
211
+ ...sheetTabMutationResultFragment
212
+ }
213
213
  }
214
+
215
+ ${sheetTabMutationResultFragment}
214
216
  `;
215
217
 
216
- export const editSheetRegionCommandMtn = gql`
217
- mutation editSheetRegionCommand (
218
+ export const deleteSheetTabMtn = gql`
219
+ mutation deleteSheetTab (
218
220
  $organizationId: GenericID!
219
221
  $sheetId: GenericID!
220
222
  $sheetTabId: GenericID!
221
- $operation: SheetRegionCommandOperation!
222
- $regionId: GenericID
223
- $region: SheetRegionInput
224
223
  $commandId: String!
225
224
  $sessionId: String!
226
- $sourceClientId: String
227
- $baseRevision: BigInt!
228
- $baseDesignRevision: BigInt!
229
- $includeInOperationalHistory: Boolean
230
225
  ) {
231
- editSheetRegionCommand (
226
+ deleteSheetTab (
232
227
  organizationId: $organizationId
233
228
  sheetId: $sheetId
234
229
  sheetTabId: $sheetTabId
235
- operation: $operation
236
- regionId: $regionId
237
- region: $region
238
230
  commandId: $commandId
239
231
  sessionId: $sessionId
240
- sourceClientId: $sourceClientId
241
- baseRevision: $baseRevision
242
- baseDesignRevision: $baseDesignRevision
243
- includeInOperationalHistory: $includeInOperationalHistory
244
232
  ) {
245
- ...sheetCommandResultFragment
246
-
247
- affectedTabs {
248
- ...sheetTabFragment
249
- }
233
+ ...sheetTabMutationResultFragment
250
234
  }
251
235
  }
252
236
 
253
- ${sheetCommandResultFragment}
254
- ${sheetCellFragment}
255
- ${sheetTabFragment}
237
+ ${sheetTabMutationResultFragment}
256
238
  `;
257
239
 
240
+ // NOTE: editSheetCommandBatch sends one sealed command envelope (wire contract
241
+ // v4): envelopeId is the idempotency key, clientId + clientSeq order the
242
+ // envelopes of one page/document, and sessionId scopes undo only. It is
243
+ // always requested no-store; the client applies the patches to its tab stores.
244
+
258
245
  export const editSheetCommandBatchMtn = gql`
259
246
  mutation editSheetCommandBatch (
247
+ $contractVersion: Int!
260
248
  $organizationId: GenericID!
261
249
  $sheetId: GenericID!
262
250
  $envelopeId: String!
263
- $sourceClientId: String!
264
- $previewSeq: BigInt!
265
- $commands: [SheetCommandBatchItemInput!]!
251
+ $clientId: String!
252
+ $sessionId: String!
253
+ $clientSeq: Int!
254
+ $commands: [SheetCommandInput!]!
266
255
  ) {
267
256
  editSheetCommandBatch (
257
+ contractVersion: $contractVersion
268
258
  organizationId: $organizationId
269
259
  sheetId: $sheetId
270
260
  envelopeId: $envelopeId
271
- sourceClientId: $sourceClientId
272
- previewSeq: $previewSeq
261
+ clientId: $clientId
262
+ sessionId: $sessionId
263
+ clientSeq: $clientSeq
273
264
  commands: $commands
274
265
  ) {
275
266
  actorAccountId
276
267
  envelopeId
277
- sourceClientId
278
- committedPreviewSeq
279
- previewAuthorities {
280
- clientId
281
- envelopeId
282
- previewSeq
283
- serverSeq
284
- sheetTabId
285
- targetKeys
286
- }
268
+ clientId
269
+ clientSeq
270
+ replayed
271
+ committedCommandIds
272
+ noWriteCommandIds
287
273
 
288
274
  settlements {
289
275
  commandId
@@ -294,6 +280,7 @@ mutation editSheetCommandBatch (
294
280
  commandStatus
295
281
  replayed
296
282
  requiresSnapshot
283
+ undoRecorded
297
284
  axisMoveOps {
298
285
  schemaVersion
299
286
  commandId
@@ -326,6 +313,7 @@ mutation editSheetCommandBatch (
326
313
  targetType
327
314
  targetKey
328
315
  }
316
+
329
317
  }
330
318
  }
331
319
 
@@ -337,49 +325,5 @@ mutation editSheetCommandBatch (
337
325
 
338
326
  ${sheetViewPatchFragment}
339
327
  ${sheetCellFragment}
340
- ${sheetRangeFragment}
341
- ${sheetRegionFragment}
342
- ${sheetTabFragment}
343
- `;
344
-
345
- export const editSheetStructureCommandMtn = gql`
346
- mutation editSheetStructureCommand (
347
- $organizationId: GenericID!
348
- $sheetId: GenericID!
349
- $sheetTabId: GenericID!
350
- $operation: SheetStructureOperation!
351
- $index: Int!
352
- $confirmDestructive: Boolean!
353
- $commandId: String!
354
- $sessionId: String!
355
- $sourceClientId: String
356
- $baseRevision: BigInt!
357
- $baseDesignRevision: BigInt!
358
- $includeInOperationalHistory: Boolean
359
- ) {
360
- editSheetStructureCommand (
361
- organizationId: $organizationId
362
- sheetId: $sheetId
363
- sheetTabId: $sheetTabId
364
- operation: $operation
365
- index: $index
366
- confirmDestructive: $confirmDestructive
367
- commandId: $commandId
368
- sessionId: $sessionId
369
- sourceClientId: $sourceClientId
370
- baseRevision: $baseRevision
371
- baseDesignRevision: $baseDesignRevision
372
- includeInOperationalHistory: $includeInOperationalHistory
373
- ) {
374
- ...sheetCommandResultFragment
375
-
376
- affectedTabs {
377
- ...sheetTabFragment
378
- }
379
- }
380
- }
381
-
382
- ${sheetCommandResultFragment}
383
- ${sheetCellFragment}
384
328
  ${sheetTabFragment}
385
329
  `;
@@ -22,6 +22,7 @@ mutation createSignedUploadUrl (
22
22
  fileUri
23
23
  contentCrc32c
24
24
  contentSha256
25
+ createOnly
25
26
  }
26
27
  }
27
28
  `;
@@ -49,7 +50,6 @@ mutation createGeneratedFileDownloadLink (
49
50
  ) {
50
51
  url
51
52
  expiresAt
52
- isPublic
53
53
  }
54
54
  }
55
55
  `;
@@ -1,5 +1,6 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import { workflowFragment } from '../fragments/workflowFragments.ts';
3
+ import { workWaitItemFragment } from '../fragments/workWaitFragments.ts';
3
4
 
4
5
  export const cancelReminderMtn = gql`
5
6
  mutation cancelReminder (
@@ -15,6 +16,7 @@ mutation cancelReminder (
15
16
  }
16
17
 
17
18
  ${workflowFragment}
19
+ ${workWaitItemFragment}
18
20
  `;
19
21
 
20
22
  export const updateReminderMtn = gql`
@@ -39,4 +41,96 @@ mutation updateReminder (
39
41
  }
40
42
 
41
43
  ${workflowFragment}
44
+ ${workWaitItemFragment}
45
+ `;
46
+
47
+ export const editProgramWorkflowMtn = gql`
48
+ mutation editProgramWorkflow (
49
+ $input: EditProgramWorkflowInput!
50
+ ) {
51
+ editProgramWorkflow (input: $input) {
52
+ ...workflowFragment
53
+ }
54
+ }
55
+
56
+ ${workflowFragment}
57
+ ${workWaitItemFragment}
58
+ `;
59
+
60
+ export const deleteWorkflowMtn = gql`
61
+ mutation deleteWorkflow($organizationId: GenericID!, $workflowId: GenericID!) {
62
+ deleteWorkflow(organizationId: $organizationId, workflowId: $workflowId)
63
+ }
64
+ `;
65
+
66
+ export const publishWorkflowMtn = gql`
67
+ mutation publishWorkflow (
68
+ $organizationId: GenericID!
69
+ $workflowId: GenericID!
70
+ $revision: Int!
71
+ ) {
72
+ publishWorkflow (
73
+ organizationId: $organizationId
74
+ workflowId: $workflowId
75
+ revision: $revision
76
+ ) {
77
+ ...workflowFragment
78
+ }
79
+ }
80
+
81
+ ${workflowFragment}
82
+ ${workWaitItemFragment}
83
+ `;
84
+
85
+ export const setWorkflowActiveMtn = gql`
86
+ mutation setWorkflowActive (
87
+ $organizationId: GenericID!
88
+ $workflowId: GenericID!
89
+ $active: Boolean!
90
+ ) {
91
+ setWorkflowActive (
92
+ organizationId: $organizationId
93
+ workflowId: $workflowId
94
+ active: $active
95
+ ) {
96
+ ...workflowFragment
97
+ }
98
+ }
99
+
100
+ ${workflowFragment}
101
+ ${workWaitItemFragment}
102
+ `;
103
+
104
+ export const discardWorkflowDraftMtn = gql`
105
+ mutation discardWorkflowDraft (
106
+ $organizationId: GenericID!
107
+ $workflowId: GenericID!
108
+ ) {
109
+ discardWorkflowDraft (
110
+ organizationId: $organizationId
111
+ workflowId: $workflowId
112
+ ) {
113
+ ...workflowFragment
114
+ }
115
+ }
116
+
117
+ ${workflowFragment}
118
+ ${workWaitItemFragment}
119
+ `;
120
+
121
+ export const removeWorkflowAddedBehaviorMtn = gql`
122
+ mutation removeWorkflowAddedBehavior (
123
+ $organizationId: GenericID!
124
+ $workflowId: GenericID!
125
+ ) {
126
+ removeWorkflowAddedBehavior (
127
+ organizationId: $organizationId
128
+ workflowId: $workflowId
129
+ ) {
130
+ ...workflowFragment
131
+ }
132
+ }
133
+
134
+ ${workflowFragment}
135
+ ${workWaitItemFragment}
42
136
  `;
@@ -1,16 +1,24 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import { agentMemoryFragment } from '../fragments/agentMemoryFragments.ts';
3
+ import { live } from '../reactivity.ts';
3
4
 
4
- export const agentMemoriesQry = gql`
5
+ export const agentMemoriesQry = live(
6
+ gql`
5
7
  query agentMemories (
6
8
  $organizationId: GenericID!
7
9
  $scope: AgentMemoryScope
10
+ $accountId: GenericID
11
+ $inboundContactId: GenericID
12
+ $surface: AgentMemorySurface
8
13
  $status: AgentMemoryStatus
9
14
  $limit: Int
10
15
  ) {
11
16
  agentMemories (
12
17
  organizationId: $organizationId
13
18
  scope: $scope
19
+ accountId: $accountId
20
+ inboundContactId: $inboundContactId
21
+ surface: $surface
14
22
  status: $status
15
23
  limit: $limit
16
24
  ) {
@@ -19,4 +27,6 @@ query agentMemories (
19
27
  }
20
28
 
21
29
  ${agentMemoryFragment}
22
- `;
30
+ `,
31
+ { refresh: 'auto', lists: ['agentMemory'] },
32
+ );
@@ -0,0 +1,86 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { agentNoteDetailFragment, agentNoteFragment } from '../fragments/agentNoteFragments.ts';
3
+ import { live } from '../reactivity.ts';
4
+
5
+ export const agentNoteBootstrapProgressQry = live(
6
+ gql`
7
+ query agentNoteBootstrapProgress ($organizationId: GenericID!) {
8
+ agentNoteBootstrapProgress (organizationId: $organizationId) {
9
+ outcome
10
+ lastReviewedAt
11
+ nextReviewAt
12
+ }
13
+ }
14
+ `,
15
+ { refresh: 'notice', derived: ['agentNoteBootstrap'] },
16
+ );
17
+
18
+ export const agentNotesRevisionQry = live(
19
+ gql`
20
+ query agentNotesRevision ($organizationId: GenericID!) {
21
+ agentNotesRevision (organizationId: $organizationId)
22
+ }
23
+ `,
24
+ { refresh: 'auto' },
25
+ );
26
+
27
+ // One complete homepage collection; groups and "show more" are local display state.
28
+ export const agentNotesQry = live(
29
+ gql`
30
+ query agentNotes ($organizationId: GenericID!) {
31
+ agentNotes (organizationId: $organizationId) {
32
+ ...agentNoteFragment
33
+ }
34
+ }
35
+
36
+ ${agentNoteFragment}
37
+ `,
38
+ { refresh: 'auto', lists: ['agentNote'] },
39
+ );
40
+
41
+ export const searchAgentNotesQry = live(
42
+ gql`
43
+ query searchAgentNotes (
44
+ $organizationId: GenericID!
45
+ $query: String!
46
+ $kinds: [AgentNoteKind!]
47
+ $includeArchived: Boolean
48
+ $limit: Int
49
+ ) {
50
+ searchAgentNotes (
51
+ organizationId: $organizationId
52
+ query: $query
53
+ kinds: $kinds
54
+ includeArchived: $includeArchived
55
+ limit: $limit
56
+ ) {
57
+ items {
58
+ ...agentNoteFragment
59
+ }
60
+ revision
61
+ }
62
+ }
63
+
64
+ ${agentNoteFragment}
65
+ `,
66
+ { refresh: 'auto', lists: ['agentNote'] },
67
+ );
68
+
69
+ export const agentNoteQry = live(
70
+ gql`
71
+ query agentNote (
72
+ $organizationId: GenericID!
73
+ $agentNoteId: GenericID!
74
+ ) {
75
+ agentNote (
76
+ organizationId: $organizationId
77
+ agentNoteId: $agentNoteId
78
+ ) {
79
+ ...agentNoteDetailFragment
80
+ }
81
+ }
82
+
83
+ ${agentNoteDetailFragment}
84
+ `,
85
+ { refresh: 'auto', derived: ['agentNote'] },
86
+ );
@@ -1,10 +1,11 @@
1
1
  import { gql } from 'graphql-tag';
2
- import {
3
- aiChatFragment,
4
- aiChatMessageFragment,
5
- } from '../fragments/aiChatFragments.ts';
2
+ import { aiChatFragment, aiChatMessageFragment, aiChatRunFragment } from '../fragments/aiChatFragments.ts';
3
+ import { aiChatLinkFragment } from '../fragments/aiChatLinkFragments.ts';
4
+ import { storageFileFragment } from '../fragments/storageFragments.ts';
5
+ import { live } from '../reactivity.ts';
6
6
 
7
- export const aiChatMetadataQry = gql`
7
+ export const aiChatMetadataQry = live(
8
+ gql`
8
9
  query aiChatMetadata (
9
10
  $aiChatId: GenericID!
10
11
  ) {
@@ -13,13 +14,21 @@ query aiChatMetadata (
13
14
  ) {
14
15
  id
15
16
  summary
17
+ latestRun {
18
+ ...aiChatRunFragment
19
+ }
16
20
  }
17
21
  }
18
- `;
22
+ ${aiChatRunFragment}
23
+ `,
24
+ { refresh: 'auto' },
25
+ );
19
26
 
20
- export const aiChatQry = gql`
27
+ export const aiChatQry = live(
28
+ gql`
21
29
  query aiChat (
22
30
  $aiChatId: GenericID!
31
+ $includeWork: Boolean! = false
23
32
  $limit: Int
24
33
  ) {
25
34
  aiChat (
@@ -27,10 +36,14 @@ query aiChat (
27
36
  ) {
28
37
  cursor
29
38
  inProgress
39
+ latestRun {
40
+ ...aiChatRunFragment
41
+ }
30
42
  ...aiChatFragment
31
43
 
32
44
  messages (
33
45
  limit: $limit
46
+ includeWork: $includeWork
34
47
  ) {
35
48
  ...aiChatMessageFragment
36
49
  }
@@ -39,11 +52,29 @@ query aiChat (
39
52
 
40
53
  ${aiChatFragment}
41
54
  ${aiChatMessageFragment}
42
- `;
55
+ ${aiChatRunFragment}
56
+ ${storageFileFragment}
57
+ `,
58
+ { refresh: 'auto', lists: ['aiChatMessage'] },
59
+ );
60
+
61
+ export const aiChatLinksQry = live(
62
+ gql`
63
+ query aiChatLinks($aiChatId: GenericID!) {
64
+ aiChatLinks(aiChatId: $aiChatId) {
65
+ ...aiChatLinkFragment
66
+ }
67
+ }
68
+ ${aiChatLinkFragment}
69
+ `,
70
+ { refresh: 'auto', lists: ['aiChatLink'] },
71
+ );
43
72
 
44
- export const aiChatMessagesQry = gql`
73
+ export const aiChatMessagesQry = live(
74
+ gql`
45
75
  query aiChatMessages (
46
76
  $aiChatId: GenericID!
77
+ $includeWork: Boolean! = false
47
78
  $cursor: Cursor
48
79
  $after: Boolean!
49
80
  $limit: Int!
@@ -53,15 +84,20 @@ query aiChatMessages (
53
84
  cursor: $cursor
54
85
  after: $after
55
86
  limit: $limit
87
+ includeWork: $includeWork
56
88
  ) {
57
89
  ...aiChatMessageFragment
58
90
  }
59
91
  }
60
92
 
61
93
  ${aiChatMessageFragment}
62
- `;
94
+ ${storageFileFragment}
95
+ `,
96
+ { refresh: 'auto', lists: ['aiChatMessage'] },
97
+ );
63
98
 
64
- export const aiChatsQry = gql`
99
+ export const aiChatsQry = live(
100
+ gql`
65
101
  query aiChats (
66
102
  $organizationId: GenericID
67
103
  $filter: AIChatsFilter
@@ -82,4 +118,19 @@ query aiChats (
82
118
  }
83
119
 
84
120
  ${aiChatFragment}
85
- `;
121
+ `,
122
+ { refresh: 'auto', lists: ['aiChat'] },
123
+ );
124
+
125
+ export const aiChatWorkMessagesQry = live(
126
+ gql`
127
+ query aiChatMessages($aiChatId: GenericID!, $runId: String!, $cursor: Cursor, $after: Boolean!, $limit: Int!) {
128
+ aiChatMessages(aiChatId: $aiChatId, runId: $runId, cursor: $cursor, after: $after, limit: $limit) {
129
+ ...aiChatMessageFragment
130
+ }
131
+ }
132
+ ${aiChatMessageFragment}
133
+ ${storageFileFragment}
134
+ `,
135
+ { refresh: 'auto', lists: ['aiChatMessage'] },
136
+ );