@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,90 +1,132 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import {
3
- fieldDocElementDataFragment,
4
- fieldDocFragment,
5
- fieldDocGroupFragment,
6
- fieldDocSectionFragment,
3
+ fieldDocAnswerFragment,
4
+ fieldDocDefinitionElementFragment,
5
+ fieldDocDefinitionFragment,
6
+ fieldDocDefinitionSectionFragment,
7
+ fieldDocEditSessionImports,
8
+ fieldDocEditSessionStatement,
9
+ fieldDocProgramEnrollmentImports,
10
+ fieldDocProgramEnrollmentStatement,
11
+ fieldDocProgramStatement,
12
+ fieldDocProgramImports,
7
13
  fieldDocSubmissionFragment,
8
14
  } from '../fragments/fieldDocFragments.ts';
9
15
  import { storageFileFragment } from '../fragments/storageFragments.ts';
16
+ import { live } from '../reactivity.ts';
10
17
 
11
- export const fieldDocMetadataQry = gql`
12
- query fieldDocMetadata (
13
- $fieldDocSourceId: CursorToIDs!
18
+ export const fieldDocProgramEnrollmentsQry = live(
19
+ gql`
20
+ query fieldDocProgramEnrollments (
21
+ $organizationId: GenericID!
22
+ $fieldDocProgramId: GenericID
14
23
  ) {
15
- fieldDocMetadata (
16
- fieldDocSourceId: $fieldDocSourceId
24
+ fieldDocProgramEnrollments (
25
+ organizationId: $organizationId
26
+ fieldDocProgramId: $fieldDocProgramId
17
27
  ) {
18
- id
19
- title
20
- description
28
+ ${fieldDocProgramEnrollmentStatement}
21
29
  }
22
30
  }
23
- `;
24
31
 
25
- export const fieldDocGroupMetadataQry = gql`
26
- query fieldDocGroupMetadata (
27
- $fieldDocGroupId: GenericID!
32
+ ${fieldDocProgramEnrollmentImports}
33
+ `,
34
+ { refresh: 'auto', derived: ['fieldDocProgramEnrollment', 'fieldDocProgram'] },
35
+ );
36
+
37
+ export const fieldDocProgramCatalogQry = live(
38
+ gql`
39
+ query fieldDocProgramCatalog (
40
+ $organizationId: GenericID!
28
41
  ) {
29
- fieldDocGroupMetadata (
30
- fieldDocGroupId: $fieldDocGroupId
42
+ fieldDocProgramCatalog (
43
+ organizationId: $organizationId
31
44
  ) {
32
- id
33
- name
34
- shortName
45
+ ${fieldDocProgramStatement}
35
46
  }
36
47
  }
37
- `;
38
48
 
39
- export const fieldDocsQry = gql`
40
- query fieldDocs (
49
+ ${fieldDocProgramImports}
50
+ `,
51
+ { refresh: 'auto', lists: ['fieldDocProgram'] },
52
+ );
53
+
54
+ export const fieldDocProgramMetadataQry = live(
55
+ gql`
56
+ query fieldDocProgramMetadata (
57
+ $fieldDocProgramId: GenericID!
58
+ ) {
59
+ fieldDocProgramMetadata (
60
+ fieldDocProgramId: $fieldDocProgramId
61
+ ) {
62
+ ${fieldDocProgramStatement}
63
+ }
64
+ }
65
+
66
+ ${fieldDocProgramImports}
67
+ `,
68
+ { refresh: 'auto' },
69
+ );
70
+
71
+ export const fieldDocSubmissionsQry = live(
72
+ gql`
73
+ query fieldDocSubmissions (
41
74
  $organizationId: GenericID!
42
- $filter: FieldDocsFilter!
43
- $sort: FieldDocsSort
75
+ $filter: FieldDocSubmissionsFilter!
76
+ $cursor: Cursor
77
+ $after: Boolean!
78
+ $limit: Int!
44
79
  ) {
45
- fieldDocs (
80
+ fieldDocSubmissions (
46
81
  organizationId: $organizationId
47
82
  filter: $filter
48
- sort: $sort
83
+ cursor: $cursor
84
+ after: $after
85
+ limit: $limit
86
+ ) {
87
+ ...fieldDocSubmissionFragment
88
+ }
89
+ }
90
+
91
+ ${fieldDocSubmissionFragment}
92
+ `,
93
+ { refresh: 'notice', lists: ['fieldDocSubmission'] },
94
+ );
95
+
96
+ export const fieldDocSubmissionDocumentQry = live(
97
+ gql`
98
+ query fieldDocSubmissionDocument (
99
+ $fieldDocSubmissionId: GenericID!
100
+ ) {
101
+ fieldDocSubmissionDocument (
102
+ fieldDocSubmissionId: $fieldDocSubmissionId
49
103
  ) {
50
- ...fieldDocFragment
104
+ id
105
+ description
51
106
 
52
107
  submission {
53
108
  ...fieldDocSubmissionFragment
54
109
  }
55
110
 
56
- sections {
57
- ...fieldDocSectionFragment
111
+ definition {
112
+ ...fieldDocDefinitionFragment
58
113
 
59
- elements {
60
- ...fieldDocElementDataFragment
114
+ sections {
115
+ ...fieldDocDefinitionSectionFragment
61
116
 
62
- files {
63
- ...storageFileFragment
117
+ elements {
118
+ ...fieldDocDefinitionElementFragment
119
+
120
+ files {
121
+ ...storageFileFragment
122
+ }
64
123
  }
65
124
  }
66
125
  }
67
126
 
68
- }
69
- }
70
-
71
- ${fieldDocFragment}
72
- ${fieldDocSubmissionFragment}
73
- ${fieldDocSectionFragment}
74
- ${storageFileFragment}
75
- ${fieldDocElementDataFragment}
76
- `;
77
-
78
- export const fieldDocQry = gql`
79
- query fieldDoc (
80
- $organizationId: GenericID!
81
- $fieldDocSourceId: CursorToIDs!
82
- ) {
83
- fieldDoc (
84
- organizationId: $organizationId
85
- fieldDocSourceId: $fieldDocSourceId
86
- ) {
87
- ...fieldDocFragment
127
+ answers {
128
+ ...fieldDocAnswerFragment
129
+ }
88
130
 
89
131
  aside {
90
132
  title
@@ -96,63 +138,51 @@ query fieldDoc (
96
138
  text
97
139
  }
98
140
  }
99
-
100
- submission {
101
- ...fieldDocSubmissionFragment
102
- }
103
-
104
- sections {
105
- ...fieldDocSectionFragment
106
-
107
- elements {
108
- ...fieldDocElementDataFragment
109
-
110
- files {
111
- ...storageFileFragment
112
- }
113
- }
114
- }
115
-
116
141
  }
117
142
  }
118
143
 
119
- ${fieldDocFragment}
120
144
  ${fieldDocSubmissionFragment}
121
- ${fieldDocSectionFragment}
145
+ ${fieldDocDefinitionFragment}
146
+ ${fieldDocDefinitionSectionFragment}
147
+ ${fieldDocDefinitionElementFragment}
122
148
  ${storageFileFragment}
123
- ${fieldDocElementDataFragment}
124
- `;
125
-
126
- export const fieldDocGroupsQry = gql`
127
- query fieldDocGroups (
128
- $organizationId: GenericID!
149
+ ${fieldDocAnswerFragment}
150
+ `,
151
+ { refresh: 'auto', derived: ['fieldDocSubmissionDocument'] },
152
+ );
153
+
154
+ export const fieldDocSubmissionMetadataQry = live(
155
+ gql`
156
+ query fieldDocSubmissionMetadata (
157
+ $fieldDocSubmissionId: GenericID!
129
158
  ) {
130
- fieldDocGroups (
131
- organizationId: $organizationId
159
+ fieldDocSubmissionMetadata (
160
+ fieldDocSubmissionId: $fieldDocSubmissionId
132
161
  ) {
133
- ...fieldDocGroupFragment
162
+ id
163
+ title
164
+ description
134
165
  }
135
166
  }
167
+ `,
168
+ { refresh: 'auto' },
169
+ );
136
170
 
137
- ${fieldDocGroupFragment}
138
- `;
139
-
140
- export const fieldDocSubmissionsQry = gql`
141
- query fieldDocSubmissions (
171
+ export const fieldDocEditSessionQry = live(
172
+ gql`
173
+ query fieldDocEditSession (
142
174
  $organizationId: GenericID!
143
- $filter: FieldDocsFilter!
144
- $sort: FieldDocsSort
145
- $limit: Int!
175
+ $fieldDocId: GenericID!
146
176
  ) {
147
- fieldDocSubmissions (
177
+ fieldDocEditSession (
148
178
  organizationId: $organizationId
149
- filter: $filter
150
- sort: $sort
151
- limit: $limit
179
+ fieldDocId: $fieldDocId
152
180
  ) {
153
- ...fieldDocSubmissionFragment
181
+ ${fieldDocEditSessionStatement}
154
182
  }
155
183
  }
156
184
 
157
- ${fieldDocSubmissionFragment}
158
- `;
185
+ ${fieldDocEditSessionImports}
186
+ `,
187
+ { refresh: 'auto', derived: ['fieldDocEditSession'], skipOwnChanges: true },
188
+ );
@@ -1,7 +1,9 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import { inboundContactFragment } from '../fragments/inboundContactFragments.ts';
3
+ import { live } from '../reactivity.ts';
3
4
 
4
- export const inboundContactQry = gql`
5
+ export const inboundContactQry = live(
6
+ gql`
5
7
  query inboundContact (
6
8
  $organizationId: GenericID!
7
9
  $inboundContactId: GenericID!
@@ -15,12 +17,17 @@ query inboundContact (
15
17
  }
16
18
 
17
19
  ${inboundContactFragment}
18
- `;
20
+ `,
21
+ { refresh: 'auto' },
22
+ );
19
23
 
20
- export const inboundContactsQry = gql`
24
+ export const inboundContactsQry = live(
25
+ gql`
21
26
  query inboundContacts (
22
27
  $organizationId: GenericID!
23
28
  $sort: InboundContactsSort
29
+ $query: String
30
+ $emailEligible: Boolean
24
31
  $cursor: Cursor
25
32
  $after: Boolean!
26
33
  $limit: Int!
@@ -28,6 +35,8 @@ query inboundContacts (
28
35
  inboundContacts (
29
36
  organizationId: $organizationId
30
37
  sort: $sort
38
+ query: $query
39
+ emailEligible: $emailEligible
31
40
  cursor: $cursor
32
41
  after: $after
33
42
  limit: $limit
@@ -37,4 +46,6 @@ query inboundContacts (
37
46
  }
38
47
 
39
48
  ${inboundContactFragment}
40
- `;
49
+ `,
50
+ { refresh: 'auto', lists: ['inboundContact'] },
51
+ );
@@ -1,12 +1,14 @@
1
- export * from './campaignQueries.ts';
2
- export * from './agentDocQueries.ts';
1
+ export * from './audienceQueries.ts';
2
+ export * from './libraryQueries.ts';
3
3
  export * from './agentMemoryQueries.ts';
4
+ export * from './agentNoteQueries.ts';
4
5
  export * from './aiChatQueries.ts';
5
- export * from './appQueries.ts';
6
6
  export * from './authQueries.ts';
7
7
  export * from './billingQueries.ts';
8
8
  export * from './dataTableQueries.ts';
9
9
  export * from './emailQueries.ts';
10
+ export * from './emailOutreachQueries.ts';
11
+ export * from './emailReplyReportQueries.ts';
10
12
  export * from './fieldDocQueries.ts';
11
13
  export * from './inboundContactQueries.ts';
12
14
  export * from './logQueries.ts';
@@ -0,0 +1,112 @@
1
+ import { gql } from 'graphql-tag';
2
+ import {
3
+ libraryFolderFragment,
4
+ libraryFileAnalysisFragment,
5
+ libraryFileCitationFragment,
6
+ libraryFileContentFragment,
7
+ libraryFileNoteFragment,
8
+ libraryFileObjectFragment,
9
+ libraryFileFragment,
10
+ } from '../fragments/libraryFragments.ts';
11
+ import { live } from '../reactivity.ts';
12
+
13
+ // The variable is named libraryFileId, the idKey of DATA_TYPES.libraryFile, so a change of this file matches it by scope.
14
+ export const libraryFileQry = live(
15
+ gql`
16
+ query libraryFile ($libraryFileId: GenericID!) {
17
+ libraryFile (id: $libraryFileId) {
18
+ ...libraryFileFragment
19
+ }
20
+ }
21
+ ${libraryFileFragment}
22
+ `,
23
+ { refresh: 'auto' },
24
+ );
25
+
26
+ // Keep the variable named libraryFileId: it is the scope key of the server's `touched` libraryFileContent change, which
27
+ // a new brief, text or note sends.
28
+ export const libraryFileContentQry = live(
29
+ gql`
30
+ query libraryFileContent ($libraryFileId: GenericID!) {
31
+ libraryFileContent (libraryFileId: $libraryFileId) {
32
+ ...libraryFileContentFragment
33
+ }
34
+ libraryFileObjects (libraryFileId: $libraryFileId) {
35
+ ...libraryFileObjectFragment
36
+ }
37
+ }
38
+ ${libraryFileContentFragment}
39
+ ${libraryFileObjectFragment}
40
+ `,
41
+ { refresh: 'auto', derived: ['libraryFileContent'] },
42
+ );
43
+
44
+ /* Analysis completion touches libraryFileContent for this file. */
45
+ export const libraryFileBriefQry = live(
46
+ gql`
47
+ query libraryFileBrief ($libraryFileId: GenericID!) {
48
+ libraryFileAnalysis (libraryFileId: $libraryFileId) {
49
+ ...libraryFileAnalysisFragment
50
+ }
51
+ libraryFileObjects (libraryFileId: $libraryFileId) {
52
+ ...libraryFileObjectFragment
53
+ }
54
+ }
55
+ ${libraryFileAnalysisFragment}
56
+ ${libraryFileObjectFragment}
57
+ `,
58
+ { refresh: 'auto', derived: ['libraryFileContent'] },
59
+ );
60
+
61
+ /*
62
+ * A new brief, text or note touches libraryFileContent for this file, so an open citation refetches; after a
63
+ * reanalysis it returns current: false.
64
+ */
65
+ export const libraryFileCitationQry = live(
66
+ gql`
67
+ query libraryFileCitation ($libraryFileId: GenericID!, $analysisId: String!, $ref: Int!, $start: Int, $end: Int) {
68
+ libraryFileCitation (libraryFileId: $libraryFileId, analysisId: $analysisId, ref: $ref, start: $start, end: $end) {
69
+ ...libraryFileCitationFragment
70
+ }
71
+ }
72
+ ${libraryFileCitationFragment}
73
+ `,
74
+ { refresh: 'auto', derived: ['libraryFileContent'] },
75
+ );
76
+
77
+ /* A note write, with the retention that prunes the oldest notes, touches libraryFileContent for this file. */
78
+ export const libraryFileNotesQry = live(
79
+ gql`
80
+ query libraryFileNotes ($libraryFileId: GenericID!) {
81
+ libraryFileNotes (libraryFileId: $libraryFileId) {
82
+ ...libraryFileNoteFragment
83
+ }
84
+ }
85
+ ${libraryFileNoteFragment}
86
+ `,
87
+ { refresh: 'auto', derived: ['libraryFileContent'] },
88
+ );
89
+
90
+ export const libraryFilesQry = live(
91
+ gql`
92
+ query libraryFiles ($organizationId: GenericID!, $filter: LibraryFilesFilter, $cursor: Cursor, $limit: Int!) {
93
+ libraryFiles (organizationId: $organizationId, filter: $filter, cursor: $cursor, limit: $limit) {
94
+ ...libraryFileFragment
95
+ }
96
+ }
97
+ ${libraryFileFragment}
98
+ `,
99
+ { refresh: 'auto', lists: ['libraryFile'] },
100
+ );
101
+
102
+ export const libraryFoldersQry = live(
103
+ gql`
104
+ query libraryFolders ($organizationId: GenericID!) {
105
+ libraryFolders (organizationId: $organizationId) {
106
+ ...libraryFolderFragment
107
+ }
108
+ }
109
+ ${libraryFolderFragment}
110
+ `,
111
+ { refresh: 'auto', derived: ['libraryFolder'] },
112
+ );
@@ -3,8 +3,11 @@ import { accountFragment } from '../fragments/accountFragments.ts';
3
3
  import {
4
4
  logEntryDetailsFragment,
5
5
  logEntryFragment,
6
+ logRevisionFragment,
7
+ logRevisionSummaryFragment,
6
8
  } from '../fragments/logFragments.ts';
7
9
  import { storageFileFragment } from '../fragments/storageFragments.ts';
10
+ import { live } from '../reactivity.ts';
8
11
 
9
12
  export const logEntryFragmentStatement = `...logEntryFragment
10
13
 
@@ -22,7 +25,8 @@ ${logEntryFragment}
22
25
  ${logEntryDetailsFragment}
23
26
  `;
24
27
 
25
- export const logEntryQry = gql`
28
+ export const logEntryQry = live(
29
+ gql`
26
30
  query logEntry (
27
31
  $organizationId: GenericID!
28
32
  $logEntryId: GenericID!
@@ -41,9 +45,12 @@ query logEntry (
41
45
 
42
46
  ${storageFileFragment}
43
47
  ${logEntryFragmentImports}
44
- `;
48
+ `,
49
+ { refresh: 'auto' },
50
+ );
45
51
 
46
- export const logEntriesQry = gql`
52
+ export const logEntriesQry = live(
53
+ gql`
47
54
  query logEntries (
48
55
  $organizationId: GenericID!
49
56
  $filter: LogEntriesFilter!
@@ -70,17 +77,17 @@ query logEntries (
70
77
 
71
78
  ${storageFileFragment}
72
79
  ${logEntryFragmentImports}
73
- `;
80
+ `,
81
+ { refresh: 'notice', lists: ['logEntry'] },
82
+ );
74
83
 
75
- export const logEntriesForFieldDocQry = gql`
76
- query logEntriesForFieldDoc (
77
- $organizationId: GenericID!
78
- $fieldDocSourceId: CursorToIDs!
84
+ // Lives beside logEntryFragmentStatement so the document page's logs share the log list's shape
85
+ export const fieldDocSubmissionLogsQry = live(
86
+ gql`
87
+ query fieldDocSubmissionLogs (
79
88
  $fieldDocSubmissionId: GenericID!
80
89
  ) {
81
- logEntriesForFieldDoc (
82
- organizationId: $organizationId
83
- fieldDocSourceId: $fieldDocSourceId
90
+ fieldDocSubmissionLogs (
84
91
  fieldDocSubmissionId: $fieldDocSubmissionId
85
92
  ) {
86
93
  ${logEntryFragmentStatement}
@@ -93,4 +100,71 @@ query logEntriesForFieldDoc (
93
100
 
94
101
  ${storageFileFragment}
95
102
  ${logEntryFragmentImports}
96
- `;
103
+ `,
104
+ { refresh: 'auto', derived: ['fieldDocSubmissionLog'] },
105
+ );
106
+
107
+ export const logRevisionsQry = live(
108
+ gql`
109
+ query logRevisions (
110
+ $organizationId: GenericID!
111
+ $logEntryId: GenericID!
112
+ $cursor: Cursor
113
+ $after: Boolean!
114
+ $limit: Int!
115
+ ) {
116
+ logRevisions (
117
+ organizationId: $organizationId
118
+ logEntryId: $logEntryId
119
+ cursor: $cursor
120
+ after: $after
121
+ limit: $limit
122
+ ) {
123
+ ...logRevisionSummaryFragment
124
+ }
125
+ }
126
+
127
+ ${logRevisionSummaryFragment}
128
+ `,
129
+ { refresh: 'auto' },
130
+ );
131
+
132
+ export const logRevisionQry = live(
133
+ gql`
134
+ query logRevision (
135
+ $organizationId: GenericID!
136
+ $revisionId: GenericID!
137
+ ) {
138
+ logRevision (
139
+ organizationId: $organizationId
140
+ revisionId: $revisionId
141
+ ) {
142
+ ...logRevisionFragment
143
+ }
144
+ }
145
+
146
+ ${logRevisionFragment}
147
+ `,
148
+ { refresh: 'auto' },
149
+ );
150
+
151
+ export const logRevisionProofDownloadUrlQry = live(
152
+ gql`
153
+ query logRevisionProofDownloadUrl (
154
+ $organizationId: GenericID!
155
+ $revisionId: GenericID!
156
+ ) {
157
+ logRevisionProofDownloadUrl (
158
+ organizationId: $organizationId
159
+ revisionId: $revisionId
160
+ ) {
161
+ url
162
+ expiresAt
163
+ object
164
+ generation
165
+ hash
166
+ }
167
+ }
168
+ `,
169
+ { refresh: 'auto' },
170
+ );