@jsb188/graphql 1.1.10 → 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 (116) hide show
  1. package/cache/config.ts +64 -50
  2. package/cache/index.test.ts +671 -109
  3. package/cache/index.ts +1700 -1240
  4. package/cache/persist.ts +721 -0
  5. package/cache/store.ts +437 -0
  6. package/client/data-table-realtime-subscriptions.test.ts +740 -0
  7. package/client/data-table-realtime-subscriptions.ts +955 -0
  8. package/client/data-table-realtime.test.ts +792 -0
  9. package/client/data-table-realtime.ts +1218 -0
  10. package/client/fragment-realtime-sequence.ts +52 -0
  11. package/client/index.ts +2 -0
  12. package/client/open-sheet.ts +137 -0
  13. package/client/request-managed-session.test.ts +574 -0
  14. package/client/request-no-store.test.ts +157 -0
  15. package/client/request.ts +954 -163
  16. package/client/sse-ticket.test.ts +26 -0
  17. package/deno.lock +170 -0
  18. package/deno.test.json +8 -4
  19. package/drafts/index.ts +149 -0
  20. package/drafts/store.ts +397 -0
  21. package/gql/eagerQueryMap.ts +12 -0
  22. package/gql/fragments/accountAuthFragments.ts +5 -0
  23. package/gql/fragments/accountFragments.ts +0 -3
  24. package/gql/fragments/accountSessionFragments.ts +16 -0
  25. package/gql/fragments/agentDocFragments.ts +46 -0
  26. package/gql/fragments/agentMemoryFragments.ts +19 -0
  27. package/gql/fragments/aiChatFragments.ts +16 -0
  28. package/gql/fragments/billingFragments.ts +0 -11
  29. package/gql/fragments/campaignFragments.ts +277 -0
  30. package/gql/fragments/dataTableFragments.ts +18 -128
  31. package/gql/fragments/emailFragments.ts +19 -9
  32. package/gql/fragments/fieldDocFragments.ts +82 -0
  33. package/gql/fragments/logFragments.ts +20 -79
  34. package/gql/fragments/organizationFragments.ts +43 -5
  35. package/gql/fragments/scheduleFragments.ts +155 -0
  36. package/gql/fragments/sheetFragments.ts +552 -22
  37. package/gql/fragments/storageFragments.ts +21 -0
  38. package/gql/fragments/workflowFragments.ts +28 -4
  39. package/gql/mutations/accountMutations.ts +0 -2
  40. package/gql/mutations/agentDocMutations.ts +177 -0
  41. package/gql/mutations/agentMemoryMutations.ts +36 -0
  42. package/gql/mutations/aiChatMutations.ts +17 -4
  43. package/gql/mutations/authMutations.ts +158 -17
  44. package/gql/mutations/campaignMutations.ts +215 -0
  45. package/gql/mutations/dataTableMutations.ts +48 -26
  46. package/gql/mutations/fieldDocMutations.ts +24 -0
  47. package/gql/mutations/index.ts +6 -1
  48. package/gql/mutations/logMutations.ts +6 -29
  49. package/gql/mutations/organizationMutations.ts +13 -4
  50. package/gql/mutations/scheduleMutations.ts +423 -0
  51. package/gql/mutations/sheetMutations.ts +273 -56
  52. package/gql/mutations/storageMutations.ts +20 -0
  53. package/gql/mutations/workflowMutations.ts +42 -0
  54. package/gql/queries/agentDocQueries.ts +120 -0
  55. package/gql/queries/agentMemoryQueries.ts +22 -0
  56. package/gql/queries/aiChatQueries.ts +18 -2
  57. package/gql/queries/authQueries.ts +41 -0
  58. package/gql/queries/billingQueries.ts +23 -0
  59. package/gql/queries/campaignQueries.ts +127 -0
  60. package/gql/queries/dataTableQueries.ts +100 -11
  61. package/gql/queries/emailQueries.ts +55 -3
  62. package/gql/queries/fieldDocQueries.ts +158 -0
  63. package/gql/queries/index.ts +8 -2
  64. package/gql/queries/logQueries.ts +11 -28
  65. package/gql/queries/organizationQueries.ts +52 -1
  66. package/gql/queries/scheduleQueries.ts +315 -0
  67. package/gql/queries/sheetQueries.ts +336 -25
  68. package/gql/queries/storageQueries.ts +38 -0
  69. package/gql/queries/workflowQueries.ts +72 -3
  70. package/hooks/index.ts +2065 -971
  71. package/hooks/use-account-mtn.ts +76 -81
  72. package/hooks/use-agentDoc-mtn.ts +285 -0
  73. package/hooks/use-agentDoc-qry.ts +208 -0
  74. package/hooks/use-agentMemory-mtn.ts +73 -0
  75. package/hooks/use-agentMemory-qry.ts +44 -0
  76. package/hooks/use-aiChat-mtn.ts +232 -137
  77. package/hooks/use-aiChat-qry.ts +480 -222
  78. package/hooks/use-app-qry.ts +12 -9
  79. package/hooks/use-auth-mtn.ts +406 -252
  80. package/hooks/use-auth-qry.ts +51 -0
  81. package/hooks/use-campaign-mtn.ts +377 -0
  82. package/hooks/use-campaign-qry.ts +257 -0
  83. package/hooks/use-dataTable-mtn.ts +116 -33
  84. package/hooks/use-dataTable-qry.ts +859 -35
  85. package/hooks/use-email-qry.ts +194 -79
  86. package/hooks/use-fieldDoc-mtn.ts +50 -0
  87. package/hooks/use-fieldDoc-qry.ts +180 -0
  88. package/hooks/use-inboundContact-mtn.ts +19 -16
  89. package/hooks/use-inboundContact-qry.ts +63 -55
  90. package/hooks/use-integration-mtn.ts +56 -38
  91. package/hooks/use-integration-qry.ts +24 -9
  92. package/hooks/use-log-mtn.ts +72 -56
  93. package/hooks/use-log-qry.ts +93 -69
  94. package/hooks/use-organization-mtn.ts +334 -277
  95. package/hooks/use-organization-qry.ts +199 -129
  96. package/hooks/use-schedule-mtn.ts +416 -0
  97. package/hooks/use-schedule-qry.ts +157 -0
  98. package/hooks/use-sheet-mtn.ts +233 -47
  99. package/hooks/use-sheet-qry.ts +353 -70
  100. package/hooks/use-storage-mtn.ts +81 -41
  101. package/hooks/use-storage-qry.ts +104 -13
  102. package/hooks/use-workflow-mtn.ts +55 -0
  103. package/hooks/use-workflow-qry.ts +206 -48
  104. package/loaders/campaign.ts +137 -0
  105. package/package.json +94 -71
  106. package/sse.ts +157 -104
  107. package/tsconfig.json +11 -10
  108. package/types.d.ts +60 -30
  109. package/utils.ts +78 -49
  110. package/gql/fragments/productFragments.ts +0 -39
  111. package/gql/fragments/reportFragments.ts +0 -90
  112. package/gql/mutations/billingMutations.ts +0 -34
  113. package/gql/queries/productQueries.ts +0 -31
  114. package/gql/queries/reportQueries.ts +0 -134
  115. package/hooks/use-product-qry.ts +0 -67
  116. package/hooks/use-report-qry.ts +0 -153
@@ -1,5 +1,13 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { sheetCellFragment, sheetFragment, sheetRangeFragment, sheetRegionFragment } from '../fragments/sheetFragments.ts';
2
+ import {
3
+ sheetCellFragment,
4
+ sheetCommandResultFragment,
5
+ sheetFragment,
6
+ sheetRangeFragment,
7
+ sheetRegionFragment,
8
+ sheetTabFragment,
9
+ sheetViewPatchFragment,
10
+ } from '../fragments/sheetFragments.ts';
3
11
 
4
12
  export const createSheetMtn = gql`
5
13
  mutation createSheet (
@@ -8,7 +16,6 @@ mutation createSheet (
8
16
  $name: String
9
17
  $description: String
10
18
  $position: Float
11
- $design: SheetDesignPatchInput
12
19
  ) {
13
20
  createSheet (
14
21
  organizationId: $organizationId
@@ -16,13 +23,8 @@ mutation createSheet (
16
23
  name: $name
17
24
  description: $description
18
25
  position: $position
19
- design: $design
20
- ) {
21
- ...sheetFragment
22
- }
26
+ )
23
27
  }
24
-
25
- ${sheetFragment}
26
28
  `;
27
29
 
28
30
  export const updateSheetMtn = gql`
@@ -33,8 +35,6 @@ mutation updateSheet (
33
35
  $name: String
34
36
  $description: String
35
37
  $position: Float
36
- $design: SheetDesignPatchInput
37
- $active: Boolean
38
38
  ) {
39
39
  updateSheet (
40
40
  organizationId: $organizationId
@@ -43,8 +43,6 @@ mutation updateSheet (
43
43
  name: $name
44
44
  description: $description
45
45
  position: $position
46
- design: $design
47
- active: $active
48
46
  ) {
49
47
  ...sheetFragment
50
48
  }
@@ -53,116 +51,335 @@ mutation updateSheet (
53
51
  ${sheetFragment}
54
52
  `;
55
53
 
56
- export const editSheetCellsMtn = gql`
57
- mutation editSheetCells (
54
+ export const deleteSheetMtn = gql`
55
+ mutation deleteSheet (
56
+ $organizationId: GenericID!
57
+ $sheetId: GenericID!
58
+ ) {
59
+ deleteSheet (
60
+ organizationId: $organizationId
61
+ sheetId: $sheetId
62
+ )
63
+ }
64
+ `;
65
+
66
+ export const updateSheetAccessMtn = gql`
67
+ mutation updateSheetAccess (
58
68
  $organizationId: GenericID!
59
69
  $sheetId: GenericID!
60
- $cells: [SheetCellEditInput!]!
70
+ $access: DocAccessInput!
61
71
  ) {
62
- editSheetCells (
72
+ updateSheetAccess (
63
73
  organizationId: $organizationId
64
74
  sheetId: $sheetId
65
- cells: $cells
75
+ access: $access
66
76
  ) {
67
- ...sheetCellFragment
77
+ ...sheetFragment
68
78
  }
69
79
  }
70
80
 
71
- ${sheetCellFragment}
81
+ ${sheetFragment}
72
82
  `;
73
83
 
74
- export const clearSheetCellMtn = gql`
75
- mutation clearSheetCell (
84
+ export const createSheetTabMtn = gql`
85
+ mutation createSheetTab (
76
86
  $organizationId: GenericID!
77
87
  $sheetId: GenericID!
78
- $rowIndex: Int!
79
- $columnIndex: Int!
80
88
  ) {
81
- clearSheetCell (
89
+ createSheetTab (
82
90
  organizationId: $organizationId
83
91
  sheetId: $sheetId
84
- rowIndex: $rowIndex
85
- columnIndex: $columnIndex
86
92
  ) {
87
- ...sheetCellFragment
93
+ ...sheetFragment
94
+
95
+ tabs {
96
+ ...sheetTabFragment
97
+ }
88
98
  }
89
99
  }
90
100
 
91
- ${sheetCellFragment}
101
+ ${sheetFragment}
102
+ ${sheetTabFragment}
92
103
  `;
93
104
 
94
- export const upsertSheetRangeMtn = gql`
95
- mutation upsertSheetRange (
105
+ export const importSheetFromFileMtn = gql`
106
+ mutation importSheetFromFile (
107
+ $organizationId: GenericID!
108
+ $fileUri: String!
109
+ $mode: SheetImportMode!
110
+ $sheetId: GenericID
111
+ $title: String
112
+ ) {
113
+ importSheetFromFile (
114
+ organizationId: $organizationId
115
+ fileUri: $fileUri
116
+ mode: $mode
117
+ sheetId: $sheetId
118
+ title: $title
119
+ ) {
120
+ id
121
+ status
122
+ mode
123
+ sheetId
124
+ errorCode
125
+ uncomputedFormulaCells
126
+ }
127
+ }
128
+ `;
129
+
130
+ export const exportSheetToFileMtn = gql`
131
+ mutation exportSheetToFile (
96
132
  $organizationId: GenericID!
97
133
  $sheetId: GenericID!
98
- $rangeId: GenericID
99
- $range: SheetRangeInput!
134
+ $sheetTabId: GenericID
135
+ $format: SheetExportFormat!
100
136
  ) {
101
- upsertSheetRange (
137
+ exportSheetToFile (
102
138
  organizationId: $organizationId
103
139
  sheetId: $sheetId
104
- rangeId: $rangeId
105
- range: $range
140
+ sheetTabId: $sheetTabId
141
+ format: $format
106
142
  ) {
107
- ...sheetRangeFragment
143
+ fileUri
144
+ name
145
+ contentType
146
+ size
108
147
  }
109
148
  }
149
+ `;
110
150
 
111
- ${sheetRangeFragment}
151
+ export const updateSheetTabMtn = gql`
152
+ mutation updateSheetTab (
153
+ $organizationId: GenericID!
154
+ $sheetId: GenericID!
155
+ $sheetTabId: GenericID!
156
+ $name: String
157
+ $commandId: String
158
+ $sessionId: String
159
+ ) {
160
+ updateSheetTab (
161
+ organizationId: $organizationId
162
+ sheetId: $sheetId
163
+ sheetTabId: $sheetTabId
164
+ name: $name
165
+ commandId: $commandId
166
+ sessionId: $sessionId
167
+ ) {
168
+ ...sheetTabFragment
169
+ }
170
+ }
171
+
172
+ ${sheetTabFragment}
112
173
  `;
113
174
 
114
- export const deleteSheetRangeMtn = gql`
115
- mutation deleteSheetRange (
175
+ export const reorderSheetTabsMtn = gql`
176
+ mutation reorderSheetTabs (
116
177
  $organizationId: GenericID!
117
178
  $sheetId: GenericID!
118
- $rangeId: GenericID!
179
+ $positions: [SheetTabPositionInput!]!
180
+ $commandId: String
181
+ $sessionId: String
119
182
  ) {
120
- deleteSheetRange (
183
+ reorderSheetTabs (
121
184
  organizationId: $organizationId
122
185
  sheetId: $sheetId
123
- rangeId: $rangeId
186
+ positions: $positions
187
+ commandId: $commandId
188
+ sessionId: $sessionId
124
189
  ) {
125
- ...sheetRangeFragment
190
+ ...sheetFragment
191
+
192
+ tabs {
193
+ ...sheetTabFragment
194
+ }
126
195
  }
127
196
  }
128
197
 
129
- ${sheetRangeFragment}
198
+ ${sheetFragment}
199
+ ${sheetTabFragment}
200
+ `;
201
+
202
+ export const deleteSheetTabMtn = gql`
203
+ mutation deleteSheetTab (
204
+ $organizationId: GenericID!
205
+ $sheetId: GenericID!
206
+ $sheetTabId: GenericID!
207
+ ) {
208
+ deleteSheetTab (
209
+ organizationId: $organizationId
210
+ sheetId: $sheetId
211
+ sheetTabId: $sheetTabId
212
+ )
213
+ }
130
214
  `;
131
215
 
132
- export const upsertSheetDataTableRegionMtn = gql`
133
- mutation upsertSheetDataTableRegion (
216
+ export const editSheetRegionCommandMtn = gql`
217
+ mutation editSheetRegionCommand (
134
218
  $organizationId: GenericID!
135
219
  $sheetId: GenericID!
220
+ $sheetTabId: GenericID!
221
+ $operation: SheetRegionCommandOperation!
136
222
  $regionId: GenericID
137
- $region: SheetRegionInput!
223
+ $region: SheetRegionInput
224
+ $commandId: String!
225
+ $sessionId: String!
226
+ $sourceClientId: String
227
+ $baseRevision: BigInt!
228
+ $baseDesignRevision: BigInt!
229
+ $includeInOperationalHistory: Boolean
138
230
  ) {
139
- upsertSheetDataTableRegion (
231
+ editSheetRegionCommand (
140
232
  organizationId: $organizationId
141
233
  sheetId: $sheetId
234
+ sheetTabId: $sheetTabId
235
+ operation: $operation
142
236
  regionId: $regionId
143
237
  region: $region
238
+ commandId: $commandId
239
+ sessionId: $sessionId
240
+ sourceClientId: $sourceClientId
241
+ baseRevision: $baseRevision
242
+ baseDesignRevision: $baseDesignRevision
243
+ includeInOperationalHistory: $includeInOperationalHistory
144
244
  ) {
145
- ...sheetRegionFragment
245
+ ...sheetCommandResultFragment
246
+
247
+ affectedTabs {
248
+ ...sheetTabFragment
249
+ }
146
250
  }
147
251
  }
148
252
 
149
- ${sheetRegionFragment}
253
+ ${sheetCommandResultFragment}
254
+ ${sheetCellFragment}
255
+ ${sheetTabFragment}
150
256
  `;
151
257
 
152
- export const deleteSheetRegionMtn = gql`
153
- mutation deleteSheetRegion (
258
+ export const editSheetCommandBatchMtn = gql`
259
+ mutation editSheetCommandBatch (
154
260
  $organizationId: GenericID!
155
261
  $sheetId: GenericID!
156
- $regionId: GenericID!
262
+ $envelopeId: String!
263
+ $sourceClientId: String!
264
+ $previewSeq: BigInt!
265
+ $commands: [SheetCommandBatchItemInput!]!
157
266
  ) {
158
- deleteSheetRegion (
267
+ editSheetCommandBatch (
159
268
  organizationId: $organizationId
160
269
  sheetId: $sheetId
161
- regionId: $regionId
270
+ envelopeId: $envelopeId
271
+ sourceClientId: $sourceClientId
272
+ previewSeq: $previewSeq
273
+ commands: $commands
162
274
  ) {
163
- ...sheetRegionFragment
275
+ actorAccountId
276
+ envelopeId
277
+ sourceClientId
278
+ committedPreviewSeq
279
+ previewAuthorities {
280
+ clientId
281
+ envelopeId
282
+ previewSeq
283
+ serverSeq
284
+ sheetTabId
285
+ targetKeys
286
+ }
287
+
288
+ settlements {
289
+ commandId
290
+ errorCode
291
+
292
+ result {
293
+ commandId
294
+ commandStatus
295
+ replayed
296
+ requiresSnapshot
297
+ axisMoveOps {
298
+ schemaVersion
299
+ commandId
300
+ sheetTabId
301
+ axis
302
+ sourceStartIndex
303
+ sourceEndIndex
304
+ targetStartIndex
305
+ baseRevision
306
+ resultRevision
307
+ baseDesignRevision
308
+ resultDesignRevision
309
+ }
310
+
311
+ tabRevisions {
312
+ sheetTabId
313
+ baseRevision
314
+ resultRevision
315
+ baseDesignRevision
316
+ resultDesignRevision
317
+ journalFromSeq
318
+ journalToSeq
319
+ }
320
+
321
+ conflict {
322
+ code
323
+ message
324
+ historyBoundary
325
+ invalidatesTargetCommandId
326
+ targetType
327
+ targetKey
328
+ }
329
+ }
330
+ }
331
+
332
+ authoritativePatches {
333
+ ...sheetViewPatchFragment
334
+ }
164
335
  }
165
336
  }
166
337
 
338
+ ${sheetViewPatchFragment}
339
+ ${sheetCellFragment}
340
+ ${sheetRangeFragment}
167
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
+ ${sheetTabFragment}
168
385
  `;
@@ -7,6 +7,7 @@ mutation createSignedUploadUrl (
7
7
  $contentType: String!
8
8
  $fileSize: Int!
9
9
  $uploadIntent: StorageIntentObject!
10
+ $moderationToken: String
10
11
  ) {
11
12
  createSignedUploadUrl (
12
13
  organizationId: $organizationId
@@ -14,10 +15,13 @@ mutation createSignedUploadUrl (
14
15
  contentType: $contentType
15
16
  fileSize: $fileSize
16
17
  uploadIntent: $uploadIntent
18
+ moderationToken: $moderationToken
17
19
  ) {
18
20
  id
19
21
  signedUrl
20
22
  fileUri
23
+ contentCrc32c
24
+ contentSha256
21
25
  }
22
26
  }
23
27
  `;
@@ -33,3 +37,19 @@ mutation deleteStorageFile (
33
37
  )
34
38
  }
35
39
  `;
40
+
41
+ export const createGeneratedFileDownloadLinkMtn = gql`
42
+ mutation createGeneratedFileDownloadLink (
43
+ $organizationId: GenericID!
44
+ $code: String!
45
+ ) {
46
+ createGeneratedFileDownloadLink (
47
+ organizationId: $organizationId
48
+ code: $code
49
+ ) {
50
+ url
51
+ expiresAt
52
+ isPublic
53
+ }
54
+ }
55
+ `;
@@ -0,0 +1,42 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { workflowFragment } from '../fragments/workflowFragments.ts';
3
+
4
+ export const cancelReminderMtn = gql`
5
+ mutation cancelReminder (
6
+ $organizationId: GenericID!
7
+ $workflowId: GenericID!
8
+ ) {
9
+ cancelReminder (
10
+ organizationId: $organizationId
11
+ workflowId: $workflowId
12
+ ) {
13
+ ...workflowFragment
14
+ }
15
+ }
16
+
17
+ ${workflowFragment}
18
+ `;
19
+
20
+ export const updateReminderMtn = gql`
21
+ mutation updateReminder (
22
+ $organizationId: GenericID!
23
+ $workflowId: GenericID!
24
+ $title: String
25
+ $schedule: String
26
+ $scheduleInterval: Int
27
+ $nextAt: DateTime
28
+ ) {
29
+ updateReminder (
30
+ organizationId: $organizationId
31
+ workflowId: $workflowId
32
+ title: $title
33
+ schedule: $schedule
34
+ scheduleInterval: $scheduleInterval
35
+ nextAt: $nextAt
36
+ ) {
37
+ ...workflowFragment
38
+ }
39
+ }
40
+
41
+ ${workflowFragment}
42
+ `;
@@ -0,0 +1,120 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { agentDocFragment } from '../fragments/agentDocFragments.ts';
3
+
4
+ export const agentDocMetadataQry = gql`
5
+ query agentDocMetadata (
6
+ $agentDocId: GenericID!
7
+ ) {
8
+ agentDoc (
9
+ agentDocId: $agentDocId
10
+ ) {
11
+ id
12
+ title
13
+ }
14
+ }
15
+ `;
16
+
17
+ // NOTE: viewerPermission and viewerCanEditAccess are per-viewer facts
18
+ // resolved by the server for the requesting account. They are selected
19
+ // outside agentDocFragment because realtime emits never carry them, and the
20
+ // fragment must stay aligned with the server's emit field list.
21
+ // The query takes no organizationId: the server resolves the owner org from
22
+ // the agent doc row (openSheet-style contract), so network-org members and
23
+ // grant holders outside the owner org can open a shared agent doc.
24
+
25
+ export const agentDocQry = gql`
26
+ query agentDoc (
27
+ $agentDocId: GenericID!
28
+ ) {
29
+ agentDoc (
30
+ agentDocId: $agentDocId
31
+ ) {
32
+ ...agentDocFragment
33
+
34
+ viewerPermission
35
+ viewerCanEditAccess
36
+ }
37
+ }
38
+
39
+ ${agentDocFragment}
40
+ `;
41
+
42
+ // NOTE: The list selection intentionally excludes content and files: the
43
+ // list screen only needs row metadata, and merging a content-free selection
44
+ // through the normalized cache must not clobber a full agentDoc fragment,
45
+ // so the heavy fields are simply never selected here.
46
+
47
+ export const agentDocsQry = gql`
48
+ query agentDocs (
49
+ $organizationId: GenericID!
50
+ $folderId: GenericID
51
+ $sort: GridItemSort
52
+ $cursor: Cursor
53
+ $after: Boolean!
54
+ $limit: Int!
55
+ ) {
56
+ agentDocs (
57
+ organizationId: $organizationId
58
+ folderId: $folderId
59
+ sort: $sort
60
+ cursor: $cursor
61
+ after: $after
62
+ limit: $limit
63
+ ) {
64
+ id
65
+ organizationId
66
+ folderId
67
+ title
68
+
69
+ settings {
70
+ aiCannotEdit
71
+ aiCannotRead
72
+ pinned
73
+ hiddenSurfaces
74
+ reviewBy
75
+ }
76
+
77
+ position
78
+ deletedAt
79
+ createdAt
80
+ updatedAt
81
+ }
82
+ }
83
+ `;
84
+
85
+ export const agentDocFoldersQry = gql`
86
+ query agentDocFolders (
87
+ $organizationId: GenericID!
88
+ ) {
89
+ agentDocFolders (
90
+ organizationId: $organizationId
91
+ ) {
92
+ id
93
+ organizationId
94
+ name
95
+ position
96
+ createdAt
97
+ updatedAt
98
+ }
99
+ }
100
+ `;
101
+
102
+ // NOTE: agentDocAccessGrants is owner-org only: the access settings screen
103
+ // loads the grants list with it, on top of the base policy carried by the
104
+ // AgentDoc fragment's "access" selection.
105
+
106
+ export const agentDocAccessGrantsQry = gql`
107
+ query agentDocAccessGrants (
108
+ $organizationId: GenericID!
109
+ $agentDocId: GenericID!
110
+ ) {
111
+ agentDocAccessGrants (
112
+ organizationId: $organizationId
113
+ agentDocId: $agentDocId
114
+ ) {
115
+ granteeType
116
+ granteeId
117
+ permission
118
+ }
119
+ }
120
+ `;
@@ -0,0 +1,22 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { agentMemoryFragment } from '../fragments/agentMemoryFragments.ts';
3
+
4
+ export const agentMemoriesQry = gql`
5
+ query agentMemories (
6
+ $organizationId: GenericID!
7
+ $scope: AgentMemoryScope
8
+ $status: AgentMemoryStatus
9
+ $limit: Int
10
+ ) {
11
+ agentMemories (
12
+ organizationId: $organizationId
13
+ scope: $scope
14
+ status: $status
15
+ limit: $limit
16
+ ) {
17
+ ...agentMemoryFragment
18
+ }
19
+ }
20
+
21
+ ${agentMemoryFragment}
22
+ `;
@@ -1,5 +1,21 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { aiChatFragment, aiChatMessageFragment } from '../fragments/aiChatFragments.ts';
2
+ import {
3
+ aiChatFragment,
4
+ aiChatMessageFragment,
5
+ } from '../fragments/aiChatFragments.ts';
6
+
7
+ export const aiChatMetadataQry = gql`
8
+ query aiChatMetadata (
9
+ $aiChatId: GenericID!
10
+ ) {
11
+ aiChatMetadata (
12
+ aiChatId: $aiChatId
13
+ ) {
14
+ id
15
+ summary
16
+ }
17
+ }
18
+ `;
3
19
 
4
20
  export const aiChatQry = gql`
5
21
  query aiChat (
@@ -47,7 +63,7 @@ ${aiChatMessageFragment}
47
63
 
48
64
  export const aiChatsQry = gql`
49
65
  query aiChats (
50
- $organizationId: GenericID!
66
+ $organizationId: GenericID
51
67
  $filter: AIChatsFilter
52
68
  $cursor: Cursor
53
69
  $after: Boolean!