@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,315 +1,438 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import {
3
+ scheduleActivityAssignmentFragment,
4
+ scheduleActivityFragment,
5
+ scheduleBaselineActivityFragment,
6
+ scheduleBaselineFragment,
3
7
  scheduleCalendarFragment,
4
- scheduleOccurrenceFragment,
5
- scheduleRequestFragment,
8
+ scheduleCodeTypeFragment,
9
+ scheduleProjectFragment,
10
+ scheduleProjectRunFragment,
11
+ scheduleRelationshipFragment,
12
+ scheduleResourceCapacityFragment,
6
13
  scheduleResourceFragment,
7
- scheduleSeriesFragment,
14
+ scheduleRoleFragment,
15
+ scheduleShiftFragment,
16
+ scheduleTaskFragment,
17
+ scheduleTimeOffFragment,
18
+ scheduleViolationFragment,
19
+ scheduleWbsNodeFragment,
20
+ scheduleWorkCalendarExceptionFragment,
21
+ scheduleWorkCalendarFragment,
8
22
  } from '../fragments/scheduleFragments.ts';
23
+ import { live } from '../reactivity.ts';
9
24
 
10
- // NOTE: viewerPermission and viewerCanEditAccess are per-viewer facts the
11
- // server resolves for the requesting account. They are selected outside the
12
- // fragment because realtime emits never carry them — a restricted calendar
13
- // never broadcasts its rows at all — and the fragment must stay aligned with
14
- // the server's emit field list.
25
+ export const scheduleWorkCalendarsQry = live(
26
+ gql`
27
+ query scheduleWorkCalendars($organizationId: GenericID!) {
28
+ scheduleWorkCalendars(organizationId: $organizationId) {
29
+ ...scheduleWorkCalendarFragment
30
+ exceptions {
31
+ ...scheduleWorkCalendarExceptionFragment
32
+ }
33
+ }
34
+ }
35
+ ${scheduleWorkCalendarFragment}
36
+ ${scheduleWorkCalendarExceptionFragment}
37
+ `,
38
+ { refresh: 'auto', lists: ['scheduleWorkCalendar'], derived: ['scheduleWorkCalendar'] },
39
+ );
15
40
 
16
- export const scheduleCalendarsQry = gql`
17
- query scheduleCalendars (
18
- $organizationId: GenericID!
19
- $includeNetwork: Boolean
20
- ) {
21
- scheduleCalendars (
22
- organizationId: $organizationId
23
- includeNetwork: $includeNetwork
24
- ) {
25
- ...scheduleCalendarFragment
41
+ export const scheduleResourcesQry = live(
42
+ gql`
43
+ query scheduleResources($organizationId: GenericID!, $kinds: [ScheduleResourceKind!], $includeRetired: Boolean) {
44
+ scheduleResources(organizationId: $organizationId, kinds: $kinds, includeRetired: $includeRetired) {
45
+ ...scheduleResourceFragment
46
+ viewerNotify {
47
+ channels
48
+ inherited
49
+ }
50
+ capacityPeriods {
51
+ ...scheduleResourceCapacityFragment
52
+ }
53
+ }
54
+ }
55
+ ${scheduleResourceFragment}
56
+ ${scheduleResourceCapacityFragment}
57
+ `,
58
+ { refresh: 'auto', lists: ['scheduleResource'], derived: ['scheduleResource'] },
59
+ );
26
60
 
27
- viewerPermission
28
- viewerCanEditAccess
29
- }
61
+ export const scheduleCodeTypesQry = live(
62
+ gql`
63
+ query scheduleCodeTypes($organizationId: GenericID!, $projectId: GenericID) {
64
+ scheduleCodeTypes(organizationId: $organizationId, projectId: $projectId) {
65
+ ...scheduleCodeTypeFragment
30
66
  }
67
+ }
68
+ ${scheduleCodeTypeFragment}
69
+ `,
70
+ { refresh: 'auto', derived: ['scheduleCodeType', 'scheduleProject'] },
71
+ );
31
72
 
32
- ${scheduleCalendarFragment}
33
- `;
73
+ export const scheduleResourceUsageQry = live(
74
+ gql`
75
+ query scheduleResourceUsage($organizationId: GenericID!, $projectId: GenericID!, $resourceIds: [GenericID!], $from: String!, $to: String!) {
76
+ scheduleResourceUsage(organizationId: $organizationId, projectId: $projectId, resourceIds: $resourceIds, from: $from, to: $to) {
77
+ resourceId
78
+ date
79
+ demandUnits
80
+ externalUnits
81
+ availableUnits
82
+ overallocated
83
+ }
84
+ }
34
85
 
35
- export const scheduleCalendarQry = gql`
36
- query scheduleCalendar (
37
- $calendarId: GenericID!
38
- ) {
39
- scheduleCalendar (
40
- calendarId: $calendarId
41
- ) {
42
- ...scheduleCalendarFragment
86
+ `,
87
+ { refresh: 'auto', derived: ['scheduleProjectNetwork', 'scheduleProject'] },
88
+ );
43
89
 
44
- viewerPermission
45
- viewerCanEditAccess
46
- }
90
+ export const scheduleCalendarsQry = live(
91
+ gql`
92
+ query scheduleCalendars($organizationId: GenericID!) {
93
+ scheduleCalendars(organizationId: $organizationId) {
94
+ ...scheduleCalendarFragment
95
+ viewerPermission
96
+ viewerIsManager
97
+ viewerResourceId
98
+ }
47
99
  }
48
-
49
100
  ${scheduleCalendarFragment}
50
- `;
51
-
52
- // NOTE: This is a WINDOW query, not a cursor page. Its cache entry is keyed by
53
- // the date range the calendar happens to be showing, which is why any
54
- // structural change (a new occurrence, a cancellation, a materialization pass)
55
- // resets it through getScheduleOccurrencesResetQueryTargets rather than trying to
56
- // patch a page the client may never have fetched.
57
- //
58
- // It is deliberately per-calendar rather than taking a list: the reset key is
59
- // an exact per-variable match, so one query per calendar lets an edit on one
60
- // calendar leave every other overlaid calendar's cache untouched.
101
+ `,
102
+ {
103
+ refresh: 'auto',
104
+ lists: ['scheduleCalendar'],
105
+ derived: ['scheduleCalendarWindow', 'scheduleResource', 'scheduleWorkCalendar', 'scheduleTimeOff', 'scheduleRole'],
106
+ },
107
+ );
61
108
 
62
- export const scheduleOccurrencesQry = gql`
63
- query scheduleOccurrences (
64
- $organizationId: GenericID!
65
- $calendarId: GenericID!
66
- $from: DateTime!
67
- $to: DateTime!
68
- $publishedOnly: Boolean
69
- $mineOnly: Boolean
70
- $limit: Int
71
- ) {
72
- scheduleOccurrences (
73
- organizationId: $organizationId
74
- calendarId: $calendarId
75
- from: $from
76
- to: $to
77
- publishedOnly: $publishedOnly
78
- mineOnly: $mineOnly
79
- limit: $limit
80
- ) {
81
- ...scheduleOccurrenceFragment
82
- }
109
+ export const scheduleShiftsQry = live(
110
+ gql`
111
+ query scheduleShifts($organizationId: GenericID!, $calendarId: GenericID!, $fromDate: String!, $toDate: String!) {
112
+ scheduleShifts(organizationId: $organizationId, calendarId: $calendarId, fromDate: $fromDate, toDate: $toDate) {
113
+ shifts {
114
+ ...scheduleShiftFragment
83
115
  }
84
-
85
- ${scheduleOccurrenceFragment}
86
- `;
87
-
88
- export const scheduleOccurrenceQry = gql`
89
- query scheduleOccurrence (
90
- $occurrenceId: GenericID!
91
- ) {
92
- scheduleOccurrence (
93
- occurrenceId: $occurrenceId
94
- ) {
95
- ...scheduleOccurrenceFragment
96
- }
116
+ roles {
117
+ ...scheduleRoleFragment
97
118
  }
98
-
99
- ${scheduleOccurrenceFragment}
100
- `;
101
-
102
- export const scheduleResourcesQry = gql`
103
- query scheduleResources (
104
- $organizationId: GenericID!
105
- ) {
106
- scheduleResources (
107
- organizationId: $organizationId
108
- ) {
109
- ...scheduleResourceFragment
110
- }
119
+ locations {
120
+ ...scheduleResourceFragment
111
121
  }
112
-
122
+ people {
123
+ ...scheduleResourceFragment
124
+ }
125
+ fromDate
126
+ toDate
127
+ }
128
+ }
129
+ ${scheduleShiftFragment}
130
+ ${scheduleRoleFragment}
113
131
  ${scheduleResourceFragment}
114
- `;
132
+ `,
133
+ {
134
+ refresh: 'auto',
135
+ derived: ['scheduleCalendarWindow', 'scheduleResource', 'scheduleWorkCalendar', 'scheduleTimeOff', 'scheduleRole'],
136
+ },
137
+ );
115
138
 
116
- export const scheduleSeriesQry = gql`
117
- query scheduleSeries (
118
- $organizationId: GenericID!
119
- $seriesId: GenericID!
120
- ) {
121
- scheduleSeries (
122
- organizationId: $organizationId
123
- seriesId: $seriesId
124
- ) {
125
- ...scheduleSeriesFragment
126
- }
139
+ export const scheduleMyShiftsQry = live(
140
+ gql`
141
+ query scheduleMyShifts($organizationId: GenericID!, $fromDate: String!, $toDate: String!) {
142
+ scheduleMyShifts(organizationId: $organizationId, fromDate: $fromDate, toDate: $toDate) {
143
+ shifts {
144
+ ...scheduleShiftFragment
145
+ }
146
+ calendars {
147
+ ...scheduleCalendarFragment
148
+ viewerPermission
149
+ viewerIsManager
150
+ viewerResourceId
151
+ }
152
+ roles {
153
+ ...scheduleRoleFragment
154
+ }
155
+ locations {
156
+ ...scheduleResourceFragment
157
+ viewerNotify {
158
+ channels
159
+ inherited
160
+ }
161
+ capacityPeriods {
162
+ ...scheduleResourceCapacityFragment
163
+ }
164
+ }
165
+ me {
166
+ ...scheduleResourceFragment
167
+ viewerNotify {
168
+ channels
169
+ inherited
127
170
  }
171
+ capacityPeriods {
172
+ ...scheduleResourceCapacityFragment
173
+ }
174
+ }
175
+ fromDate
176
+ toDate
177
+ }
178
+ }
179
+ ${scheduleShiftFragment}
180
+ ${scheduleCalendarFragment}
181
+ ${scheduleRoleFragment}
182
+ ${scheduleResourceFragment}
183
+ ${scheduleResourceCapacityFragment}
184
+ `,
185
+ {
186
+ refresh: 'auto',
187
+ derived: [
188
+ 'scheduleCalendarWindow',
189
+ 'scheduleResource',
190
+ 'scheduleWorkCalendar',
191
+ 'scheduleTimeOff',
192
+ 'scheduleRole',
193
+ 'scheduleMyItems',
194
+ ],
195
+ },
196
+ );
128
197
 
129
- ${scheduleSeriesFragment}
130
- `;
198
+ export const scheduleViolationsQry = live(
199
+ gql`
200
+ query scheduleViolations($organizationId: GenericID!, $calendarId: GenericID!, $fromDate: String!, $toDate: String!) {
201
+ scheduleViolations(organizationId: $organizationId, calendarId: $calendarId, fromDate: $fromDate, toDate: $toDate) {
202
+ ...scheduleViolationFragment
203
+ }
204
+ }
205
+ ${scheduleViolationFragment}
206
+ `,
207
+ {
208
+ refresh: 'auto',
209
+ derived: ['scheduleCalendarWindow', 'scheduleResource', 'scheduleWorkCalendar', 'scheduleTimeOff', 'scheduleRole'],
210
+ },
211
+ );
131
212
 
132
- // NOTE: The evaluation is computed on read and never cached server-side — the
133
- // whole value of it is that it reflects the schedule as it stands right now.
134
- // "message" is the breach rendered in this organization's own language,
135
- // resolved from the rule-template registry; it is null only when nothing is
136
- // registered for the rule kind, in which case the client shows generic copy.
213
+ export const scheduleTimeOffListQry = live(
214
+ gql`
215
+ query scheduleTimeOffList($organizationId: GenericID!, $resourceIds: [GenericID!], $statuses: [ScheduleTimeOffStatus!], $mine: Boolean, $from: DateTime, $to: DateTime, $cursor: Cursor, $after: Boolean, $limit: Int) {
216
+ scheduleTimeOffList(organizationId: $organizationId, resourceIds: $resourceIds, statuses: $statuses, mine: $mine, from: $from, to: $to, cursor: $cursor, after: $after, limit: $limit) {
217
+ ...scheduleTimeOffFragment
218
+ conflictingShifts {
219
+ ...scheduleShiftFragment
220
+ }
221
+ releasedShiftIds
222
+ viewerIsRequester
223
+ viewerCanDecide
224
+ }
225
+ }
226
+ ${scheduleTimeOffFragment}
227
+ ${scheduleShiftFragment}
228
+ `,
229
+ {
230
+ refresh: 'auto',
231
+ derived: [
232
+ 'scheduleCalendarWindow',
233
+ 'scheduleResource',
234
+ 'scheduleWorkCalendar',
235
+ 'scheduleTimeOff',
236
+ 'scheduleRole',
237
+ 'scheduleMyItems',
238
+ ],
239
+ },
240
+ );
137
241
 
138
- export const scheduleEvaluationQry = gql`
139
- query scheduleEvaluation (
140
- $organizationId: GenericID!
141
- $calendarId: GenericID!
142
- $from: DateTime!
143
- $to: DateTime!
144
- ) {
145
- scheduleEvaluation (
146
- organizationId: $organizationId
147
- calendarId: $calendarId
148
- from: $from
149
- to: $to
150
- ) {
151
- calendarId
152
- windowStart
153
- windowEnd
154
- segmentCount
155
- blockingCount
156
- draftCount
242
+ export const scheduleTasksQry = live(
243
+ gql`
244
+ query scheduleTasks($organizationId: GenericID!, $calendarId: GenericID, $projectId: GenericID, $statuses: [ScheduleTaskStatus!]) {
245
+ scheduleTasks(organizationId: $organizationId, calendarId: $calendarId, projectId: $projectId, statuses: $statuses) {
246
+ ...scheduleTaskFragment
247
+ }
248
+ }
249
+ ${scheduleTaskFragment}
250
+ `,
251
+ { refresh: 'auto', lists: ['scheduleTask'] },
252
+ );
157
253
 
158
- violations {
159
- ruleId
160
- templateKey
161
- message
162
- kind
163
- severity
164
- resourceId
165
- occurrenceId
166
- actorAccountId
167
- segmentStart
168
- segmentEnd
169
- detail
170
- key
171
- }
172
- }
173
- }
174
- `;
254
+ export const scheduleMyTasksQry = live(
255
+ gql`
256
+ query scheduleMyTasks($organizationId: GenericID!, $statuses: [ScheduleTaskStatus!]) {
257
+ scheduleMyTasks(organizationId: $organizationId, statuses: $statuses) {
258
+ ...scheduleTaskFragment
259
+ }
260
+ }
261
+ ${scheduleTaskFragment}
262
+ `,
263
+ { refresh: 'auto', lists: ['scheduleTask'] },
264
+ );
175
265
 
176
- export const scheduleRulesQry = gql`
177
- query scheduleRules (
178
- $organizationId: GenericID!
179
- $calendarId: GenericID
180
- ) {
181
- scheduleRules (
182
- organizationId: $organizationId
183
- calendarId: $calendarId
184
- ) {
185
- id
186
- organizationId
187
- calendarId
188
- resourceId
189
- kind
190
- label
191
- templateKey
192
- config
193
- severity
194
- effectiveFrom
195
- effectiveTo
196
- ordinal
197
- version
198
- createdAt
199
- updatedAt
200
- }
201
- }
202
- `;
266
+ export const scheduleProjectsQry = live(
267
+ gql`
268
+ query scheduleProjects($organizationId: GenericID!, $statuses: [ScheduleProjectStatus!], $includeArchived: Boolean, $search: String) {
269
+ scheduleProjects(organizationId: $organizationId, statuses: $statuses, includeArchived: $includeArchived, search: $search) {
270
+ ...scheduleProjectFragment
271
+ activityCount
272
+ unreviewedCount
273
+ viewerPermission
274
+ viewerCanEdit
275
+ viewerCanEditAccess
276
+ viewerIsManager
277
+ }
278
+ }
279
+ ${scheduleProjectFragment}
280
+ ${scheduleProjectRunFragment}
281
+ `,
282
+ { refresh: 'auto', lists: ['scheduleProject'], derived: ['scheduleProjectNetwork'] },
283
+ );
203
284
 
204
- // NOTE: Templates have no id — they are resolved most-specific-first from
205
- // three layers and returned flattened — so they are selected inline rather
206
- // than through a fragment.
285
+ export const scheduleProjectNetworkQry = live(
286
+ gql`
287
+ query scheduleProjectNetwork($projectId: GenericID!, $filter: ScheduleNetworkFilter) {
288
+ scheduleProjectNetwork(projectId: $projectId, filter: $filter) {
289
+ project {
290
+ ...scheduleProjectFragment
291
+ activityCount
292
+ unreviewedCount
293
+ viewerPermission
294
+ viewerCanEdit
295
+ viewerCanEditAccess
296
+ viewerIsManager
297
+ }
298
+ wbsNodes {
299
+ ...scheduleWbsNodeFragment
300
+ }
301
+ activities {
302
+ ...scheduleActivityFragment
303
+ }
304
+ relationships {
305
+ ...scheduleRelationshipFragment
306
+ }
307
+ assignments {
308
+ ...scheduleActivityAssignmentFragment
309
+ }
310
+ baselineActivities {
311
+ ...scheduleBaselineActivityFragment
312
+ }
313
+ resources {
314
+ ...scheduleResourceFragment
315
+ viewerNotify {
316
+ channels
317
+ inherited
318
+ }
319
+ capacityPeriods {
320
+ ...scheduleResourceCapacityFragment
321
+ }
322
+ }
323
+ workCalendars {
324
+ ...scheduleWorkCalendarFragment
325
+ exceptions {
326
+ ...scheduleWorkCalendarExceptionFragment
327
+ }
328
+ }
329
+ networkRevision
330
+ totalActivityCount
331
+ filtered
332
+ truncated
333
+ }
334
+ }
335
+ ${scheduleProjectFragment}
336
+ ${scheduleProjectRunFragment}
337
+ ${scheduleWbsNodeFragment}
338
+ ${scheduleActivityFragment}
339
+ ${scheduleRelationshipFragment}
340
+ ${scheduleActivityAssignmentFragment}
341
+ ${scheduleBaselineActivityFragment}
342
+ ${scheduleResourceFragment}
343
+ ${scheduleResourceCapacityFragment}
344
+ ${scheduleWorkCalendarFragment}
345
+ ${scheduleWorkCalendarExceptionFragment}
346
+ `,
347
+ { refresh: 'auto', derived: ['scheduleProjectNetwork'] },
348
+ );
207
349
 
208
- export const scheduleRuleTemplatesQry = gql`
209
- query scheduleRuleTemplates (
210
- $organizationId: GenericID!
211
- ) {
212
- scheduleRuleTemplates (
213
- organizationId: $organizationId
214
- ) {
215
- kind
216
- key
217
- label
218
- description
219
- messageTemplate
220
- defaultConfig
221
- defaultSeverity
222
- ordinal
223
- }
224
- }
225
- `;
350
+ export const scheduleProjectRunsQry = live(
351
+ gql`
352
+ query scheduleProjectRuns($projectId: GenericID!, $cursor: Cursor, $after: Boolean, $limit: Int) {
353
+ scheduleProjectRuns(projectId: $projectId, cursor: $cursor, after: $after, limit: $limit) {
354
+ ...scheduleProjectRunFragment
355
+ }
356
+ }
357
+ ${scheduleProjectRunFragment}
358
+ `,
359
+ { refresh: 'auto', lists: ['scheduleRun'], derived: ['scheduleProject'] },
360
+ );
226
361
 
227
- export const scheduleDemandQry = gql`
228
- query scheduleDemand (
229
- $organizationId: GenericID!
230
- $from: DateTime!
231
- $to: DateTime!
232
- ) {
233
- scheduleDemand (
234
- organizationId: $organizationId
235
- from: $from
236
- to: $to
237
- ) {
238
- id
239
- organizationId
240
- resourceId
241
- category
242
- startAt
243
- endAt
244
- quantity
245
- source
246
- createdAt
247
- updatedAt
248
- }
249
- }
250
- `;
362
+ export const scheduleBaselinesQry = live(
363
+ gql`
364
+ query scheduleBaselines($projectId: GenericID!, $cursor: Cursor, $after: Boolean, $limit: Int) {
365
+ scheduleBaselines(projectId: $projectId, cursor: $cursor, after: $after, limit: $limit) {
366
+ ...scheduleBaselineFragment
367
+ }
368
+ }
369
+ ${scheduleBaselineFragment}
370
+ `,
371
+ { refresh: 'auto', derived: ['scheduleBaseline', 'scheduleProject'] },
372
+ );
251
373
 
252
- // NOTE: Both request lists reset on any request change in the organization
253
- // (getScheduleRequestsResetQueryTargets), because a claim moves a row OFF the
254
- // open board and ONTO the approval queue — a membership change no fragment
255
- // patch can express.
374
+ export const scheduleWorkCalendarQry = live(
375
+ gql`
376
+ query scheduleWorkCalendar($organizationId: GenericID!, $workCalendarId: GenericID!) {
377
+ scheduleWorkCalendar(organizationId: $organizationId, workCalendarId: $workCalendarId) {
378
+ ...scheduleWorkCalendarFragment
379
+ exceptions {
380
+ ...scheduleWorkCalendarExceptionFragment
381
+ }
382
+ }
383
+ }
384
+ ${scheduleWorkCalendarFragment}
385
+ ${scheduleWorkCalendarExceptionFragment}
386
+ `,
387
+ { refresh: 'auto', derived: ['scheduleWorkCalendar'] },
388
+ );
256
389
 
257
- export const scheduleRequestsQry = gql`
258
- query scheduleRequests (
259
- $organizationId: GenericID!
260
- $calendarId: GenericID
261
- $statuses: [String!]
262
- $mineOnly: Boolean
263
- $offeredToMe: Boolean
264
- $limit: Int
265
- ) {
266
- scheduleRequests (
267
- organizationId: $organizationId
268
- calendarId: $calendarId
269
- statuses: $statuses
270
- mineOnly: $mineOnly
271
- offeredToMe: $offeredToMe
272
- limit: $limit
273
- ) {
274
- ...scheduleRequestFragment
275
- }
390
+ export const scheduleResourceQry = live(
391
+ gql`
392
+ query scheduleResource($organizationId: GenericID!, $resourceId: GenericID!) {
393
+ scheduleResource(organizationId: $organizationId, resourceId: $resourceId) {
394
+ ...scheduleResourceFragment
395
+ viewerNotify {
396
+ channels
397
+ inherited
398
+ }
399
+ capacityPeriods {
400
+ ...scheduleResourceCapacityFragment
401
+ }
276
402
  }
403
+ }
404
+ ${scheduleResourceFragment}
405
+ ${scheduleResourceCapacityFragment}
406
+ `,
407
+ { refresh: 'auto', derived: ['scheduleResource'] },
408
+ );
277
409
 
278
- ${scheduleRequestFragment}
279
- `;
410
+ // Revision probes (use-schedule-reactive.ts) read one counter with
411
+ // graphqlRequestNoStore. They never write the cache, so selecting only the id
412
+ // and the counter instead of the shared fragment leaves no partial records.
280
413
 
281
- export const scheduleRequestQry = gql`
282
- query scheduleRequest (
283
- $organizationId: GenericID!
284
- $requestId: GenericID!
285
- ) {
286
- scheduleRequest (
287
- organizationId: $organizationId
288
- requestId: $requestId
289
- ) {
290
- ...scheduleRequestFragment
291
- }
414
+ export const scheduleProjectRevisionQry = live(
415
+ gql`
416
+ query scheduleProjectRevision($projectId: GenericID!) {
417
+ scheduleProject(projectId: $projectId) {
418
+ id
419
+ networkRevision
292
420
  }
421
+ }
422
+
423
+ `,
424
+ { refresh: 'auto' },
425
+ );
293
426
 
294
- ${scheduleRequestFragment}
295
- `;
427
+ export const scheduleCalendarRevisionQry = live(
428
+ gql`
429
+ query scheduleCalendarRevision($calendarId: GenericID!) {
430
+ scheduleCalendar(calendarId: $calendarId) {
431
+ id
432
+ revision
433
+ }
434
+ }
296
435
 
297
- export const scheduleRequestEventsQry = gql`
298
- query scheduleRequestEvents (
299
- $organizationId: GenericID!
300
- $requestId: GenericID!
301
- ) {
302
- scheduleRequestEvents (
303
- organizationId: $organizationId
304
- requestId: $requestId
305
- ) {
306
- id
307
- requestId
308
- fromStatus
309
- toStatus
310
- actorAccountId
311
- detail
312
- createdAt
313
- }
314
- }
315
- `;
436
+ `,
437
+ { refresh: 'auto' },
438
+ );