@jsb188/graphql 1.1.11 → 1.1.12

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 (165) hide show
  1. package/audience.d.ts +343 -0
  2. package/cache/config.ts +58 -24
  3. package/cache/index.chat-activity.test.ts +119 -0
  4. package/cache/index.chat.test.ts +92 -0
  5. package/cache/index.helpers.ts +96 -0
  6. package/cache/index.regression.test.ts +149 -0
  7. package/cache/index.test.ts +370 -42
  8. package/cache/index.ts +326 -799
  9. package/cache/optimistic-ui-runtime.ts +46 -0
  10. package/cache/optimistic-ui.ts +401 -0
  11. package/cache/persist.ts +98 -19
  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} +5 -2
  16. package/client/index.ts +3 -2
  17. package/client/request.helpers.ts +14 -0
  18. package/client/request.ts +130 -215
  19. package/deno.lock +17 -0
  20. package/deno.test.json +2 -0
  21. package/gql/fragments/agentMemoryFragments.ts +5 -1
  22. package/gql/fragments/agentNoteFragments.ts +150 -0
  23. package/gql/fragments/aiChatFragments.ts +36 -10
  24. package/gql/fragments/audienceFragments.ts +141 -0
  25. package/gql/fragments/campaignFragments.ts +415 -126
  26. package/gql/fragments/dataTableFragments.ts +48 -80
  27. package/gql/fragments/emailFragments.ts +28 -23
  28. package/gql/fragments/fieldDocFragments.ts +222 -40
  29. package/gql/fragments/inboundContactFragments.ts +2 -0
  30. package/gql/fragments/logFragments.ts +93 -2
  31. package/gql/fragments/organizationFragments.ts +10 -0
  32. package/gql/fragments/qrCodeFragments.ts +29 -0
  33. package/gql/fragments/scheduleFragments.ts +652 -140
  34. package/gql/fragments/sheetFragments.ts +84 -373
  35. package/gql/fragments/storageFragments.ts +25 -1
  36. package/gql/fragments/workflowFragments.ts +13 -1
  37. package/gql/mutations/agentMemoryMutations.ts +32 -0
  38. package/gql/mutations/agentNoteMutations.ts +62 -0
  39. package/gql/mutations/aiChatMutations.ts +36 -4
  40. package/gql/mutations/audienceMutations.ts +71 -0
  41. package/gql/mutations/authMutations.ts +45 -1
  42. package/gql/mutations/billingMutations.ts +24 -0
  43. package/gql/mutations/campaignMutations.ts +170 -127
  44. package/gql/mutations/contactMutations.ts +23 -0
  45. package/gql/mutations/dataTableMutations.ts +18 -75
  46. package/gql/mutations/fieldDocMutations.ts +162 -13
  47. package/gql/mutations/index.ts +8 -5
  48. package/gql/mutations/organizationMutations.ts +6 -0
  49. package/gql/mutations/qrCodeMutations.ts +20 -0
  50. package/gql/mutations/scheduleMutations.ts +1052 -354
  51. package/gql/mutations/sheetMutations.ts +62 -118
  52. package/gql/mutations/storageMutations.ts +0 -1
  53. package/gql/mutations/workflowMutations.ts +18 -0
  54. package/gql/queries/agentMemoryQueries.ts +6 -0
  55. package/gql/queries/agentNoteQueries.ts +89 -0
  56. package/gql/queries/aiChatQueries.ts +56 -4
  57. package/gql/queries/audienceQueries.ts +128 -0
  58. package/gql/queries/authQueries.ts +6 -0
  59. package/gql/queries/billingQueries.ts +95 -6
  60. package/gql/queries/campaignQueries.ts +132 -23
  61. package/gql/queries/dataTableQueries.ts +24 -65
  62. package/gql/queries/emailQueries.ts +18 -61
  63. package/gql/queries/emailReplyReportQueries.ts +76 -0
  64. package/gql/queries/fieldDocQueries.ts +100 -92
  65. package/gql/queries/inboundContactQueries.ts +4 -0
  66. package/gql/queries/index.ts +3 -1
  67. package/gql/queries/logQueries.ts +62 -7
  68. package/gql/queries/organizationQueries.ts +13 -0
  69. package/gql/queries/qrCodeQueries.ts +20 -0
  70. package/gql/queries/scheduleQueries.ts +633 -257
  71. package/gql/queries/sheetQueries.ts +59 -152
  72. package/gql/queries/workflowQueries.ts +10 -4
  73. package/hooks/index.helpers.test.ts +50 -0
  74. package/hooks/index.helpers.ts +52 -0
  75. package/hooks/index.ts +863 -685
  76. package/hooks/use-agentMemory-mtn.ts +29 -31
  77. package/hooks/use-agentMemory-qry.ts +15 -3
  78. package/hooks/use-agentNote-mtn.ts +82 -0
  79. package/hooks/use-agentNote-qry.ts +190 -0
  80. package/hooks/use-agentNote-recovery.helpers.test.ts +68 -0
  81. package/hooks/use-agentNote-recovery.helpers.ts +58 -0
  82. package/hooks/use-agentNote-recovery.ts +72 -0
  83. package/hooks/use-aiChat-mtn.ts +96 -112
  84. package/hooks/use-aiChat-qry.helpers.test.ts +63 -0
  85. package/hooks/use-aiChat-qry.helpers.ts +124 -0
  86. package/hooks/use-aiChat-qry.ts +229 -383
  87. package/hooks/use-aiChat-stream-mtn.ts +14 -0
  88. package/hooks/use-audience-mtn.ts +194 -0
  89. package/hooks/use-audience-qry.helpers.test.ts +80 -0
  90. package/hooks/use-audience-qry.helpers.ts +63 -0
  91. package/hooks/use-audience-qry.ts +330 -0
  92. package/hooks/use-auth-mtn.ts +30 -1
  93. package/hooks/use-billing-mtn.ts +31 -0
  94. package/hooks/use-billing-qry.ts +76 -0
  95. package/hooks/use-campaign-generation-recovery.ts +53 -0
  96. package/hooks/use-campaign-mtn.ts +224 -165
  97. package/hooks/use-campaign-qry.helpers.ts +40 -0
  98. package/hooks/use-campaign-qry.ts +631 -54
  99. package/hooks/use-dataTable-mtn.ts +23 -115
  100. package/hooks/use-dataTable-qry.ts +66 -916
  101. package/hooks/use-email-qry.helpers.ts +37 -0
  102. package/hooks/use-email-qry.ts +33 -178
  103. package/hooks/use-emailCampaignReplyReport-qry.ts +27 -0
  104. package/hooks/use-fieldDoc-mtn.ts +244 -32
  105. package/hooks/use-fieldDoc-qry.helpers.test.ts +65 -0
  106. package/hooks/use-fieldDoc-qry.helpers.ts +49 -0
  107. package/hooks/use-fieldDoc-qry.ts +134 -102
  108. package/hooks/use-inboundContact-qry.ts +7 -9
  109. package/hooks/use-log-mtn.ts +25 -12
  110. package/hooks/use-log-qry.ts +99 -46
  111. package/hooks/use-organization-qry.ts +16 -60
  112. package/hooks/use-publicFormEmail-mtn.ts +27 -0
  113. package/hooks/use-qrCode-mtn.ts +40 -0
  114. package/hooks/use-qrCode-qry.ts +78 -0
  115. package/hooks/use-schedule-mtn.ts +506 -333
  116. package/hooks/use-schedule-qry.ts +682 -101
  117. package/hooks/use-schedule-reactive.ts +486 -0
  118. package/hooks/use-sheet-mtn.ts +91 -199
  119. package/hooks/use-sheet-qry.ts +84 -238
  120. package/hooks/use-storage-qry.ts +84 -61
  121. package/hooks/use-workflow-mtn.ts +39 -22
  122. package/hooks/use-workflow-qry.ts +40 -61
  123. package/libs/ai-chat-outgoing.helpers.ts +153 -0
  124. package/libs/ai-chat-outgoing.ts +11 -0
  125. package/libs/ai-chat-outgoing.types.ts +25 -0
  126. package/libs/ai-chat-run-realtime.ts +20 -0
  127. package/libs/ai-chat-submission-realtime.ts +150 -0
  128. package/libs/fragment-realtime-sequence.ts +55 -0
  129. package/libs/fragment-recovery.test.ts +326 -0
  130. package/libs/fragment-recovery.ts +325 -0
  131. package/libs/open-sheet.ts +138 -0
  132. package/libs/orchestrator-realtime.helpers.test.ts +229 -0
  133. package/libs/orchestrator-realtime.helpers.ts +317 -0
  134. package/libs/orchestrator-realtime.ts +433 -0
  135. package/libs/request-cache-regression.test.ts +122 -0
  136. package/{client → libs}/request-managed-session.test.ts +1 -1
  137. package/libs/request-no-store.test.ts +419 -0
  138. package/libs/sheet-command-batch.ts +44 -0
  139. package/libs/sheet-view-realtime-router.test.ts +214 -0
  140. package/libs/sheet-view-realtime-router.ts +99 -0
  141. package/loaders/campaign.test.ts +186 -0
  142. package/loaders/campaign.ts +56 -83
  143. package/loaders/emailPreference.ts +75 -0
  144. package/loaders/rest.ts +12 -0
  145. package/package.json +42 -17
  146. package/schedule.d.ts +1790 -0
  147. package/sse.helpers.ts +19 -0
  148. package/sse.ts +26 -115
  149. package/tests/agent-note-detail-cache.test.ts +120 -0
  150. package/tests/agent-note-search.test.ts +444 -0
  151. package/types.d.ts +46 -25
  152. package/client/data-table-realtime-subscriptions.test.ts +0 -740
  153. package/client/data-table-realtime-subscriptions.ts +0 -955
  154. package/client/data-table-realtime.test.ts +0 -792
  155. package/client/data-table-realtime.ts +0 -1218
  156. package/client/fragment-realtime-sequence.ts +0 -52
  157. package/client/open-sheet.ts +0 -137
  158. package/client/request-no-store.test.ts +0 -157
  159. package/gql/fragments/agentDocFragments.ts +0 -46
  160. package/gql/fragments/billingFragments.ts +0 -14
  161. package/gql/mutations/agentDocMutations.ts +0 -177
  162. package/gql/queries/agentDocQueries.ts +0 -120
  163. package/hooks/use-agentDoc-mtn.ts +0 -285
  164. package/hooks/use-agentDoc-qry.ts +0 -208
  165. /package/{client → libs}/sse-ticket.test.ts +0 -0
@@ -1,157 +1,738 @@
1
1
  import { useQuery } from '@jsb188/graphql/client';
2
- import {
3
- scheduleCalendarsQry,
4
- scheduleEvaluationQry,
5
- scheduleOccurrencesQry,
6
- scheduleRequestsQry,
7
- } from '../gql/queries/scheduleQueries.ts';
2
+ import * as documents from '../gql/queries/scheduleQueries.ts';
3
+ import type * as Schedule from '../schedule.d.ts';
8
4
  import type { UseQueryParams } from '../types.d.ts';
9
5
 
10
6
  /*
11
- * Fetch the calendars one organization can see, optionally including the ones
12
- * its network shares with it.
7
+ * Read scheduleWorkCalendars with top-level variables aligned to server reset targets.
13
8
  */
9
+ export function useScheduleWorkCalendars(
10
+ p:
11
+ | Partial<Schedule.ScheduleWorkCalendarsVariables>
12
+ | string
13
+ | null
14
+ | undefined,
15
+ params: UseQueryParams = {},
16
+ ) {
17
+ const variables: Partial<Schedule.ScheduleWorkCalendarsVariables> =
18
+ typeof p === 'string' ? { organizationId: p } : p || {};
19
+ const { data, ...rest } = useQuery(documents.scheduleWorkCalendarsQry, {
20
+ ...params,
21
+ variables: { ...variables, ...params.variables },
22
+ skip: !variables.organizationId || !!params.skip,
23
+ });
24
+ return {
25
+ ...rest,
26
+ scheduleWorkCalendars: (data?.scheduleWorkCalendars ??
27
+ null) as Array<Schedule.ScheduleWorkCalendarGQL> | null,
28
+ };
29
+ }
14
30
 
15
- export function useScheduleCalendars(
16
- organizationId?: string | null,
17
- includeNetwork?: boolean,
31
+ /*
32
+ * Read scheduleResources with top-level variables aligned to server reset targets.
33
+ */
34
+ export function useScheduleResources(
35
+ p: Partial<Schedule.ScheduleResourcesVariables>,
18
36
  params: UseQueryParams = {},
19
37
  ) {
20
- const { data, ...rest } = useQuery(scheduleCalendarsQry, {
21
- variables: {
22
- organizationId,
23
- includeNetwork: !!includeNetwork,
24
- },
38
+ const variables: Partial<Schedule.ScheduleResourcesVariables> = p;
39
+ const { data, ...rest } = useQuery(documents.scheduleResourcesQry, {
25
40
  ...params,
26
- skip: !organizationId || !!params.skip,
41
+ variables: { ...variables, ...params.variables },
42
+ skip: !variables.organizationId || !!params.skip,
27
43
  });
44
+ return {
45
+ ...rest,
46
+ scheduleResources: (data?.scheduleResources ??
47
+ null) as Array<Schedule.ScheduleResourceGQL> | null,
48
+ };
49
+ }
28
50
 
51
+ /*
52
+ * Read scheduleCodeTypes with top-level variables aligned to server reset targets.
53
+ */
54
+ export function useScheduleCodeTypes(
55
+ p: Partial<Schedule.ScheduleCodeTypesVariables> | string | null | undefined,
56
+ params: UseQueryParams = {},
57
+ ) {
58
+ const variables: Partial<Schedule.ScheduleCodeTypesVariables> =
59
+ typeof p === 'string' ? { organizationId: p } : p || {};
60
+ const { data, ...rest } = useQuery(documents.scheduleCodeTypesQry, {
61
+ ...params,
62
+ variables: { ...variables, ...params.variables },
63
+ skip: !variables.organizationId || !!params.skip,
64
+ });
65
+ return {
66
+ ...rest,
67
+ scheduleCodeTypes: (data?.scheduleCodeTypes ??
68
+ null) as Array<Schedule.ScheduleCodeTypeGQL> | null,
69
+ };
70
+ }
71
+
72
+ /*
73
+ * Read scheduleResourceUsage with top-level variables aligned to server reset targets.
74
+ */
75
+ export function useScheduleResourceUsage(
76
+ p: Partial<Schedule.ScheduleResourceUsageVariables>,
77
+ params: UseQueryParams = {},
78
+ ) {
79
+ const variables: Partial<Schedule.ScheduleResourceUsageVariables> = p;
80
+ const { data, ...rest } = useQuery(documents.scheduleResourceUsageQry, {
81
+ ...params,
82
+ variables: { ...variables, ...params.variables },
83
+ skip:
84
+ !variables.organizationId ||
85
+ !variables.projectId ||
86
+ !variables.from ||
87
+ !variables.to ||
88
+ !!params.skip,
89
+ });
90
+ return {
91
+ ...rest,
92
+ scheduleResourceUsage: (data?.scheduleResourceUsage ??
93
+ null) as Array<Schedule.ScheduleResourceUsageDayGQL> | null,
94
+ };
95
+ }
96
+
97
+ /*
98
+ * Read scheduleCalendars with top-level variables aligned to server reset targets.
99
+ */
100
+ export function useScheduleCalendars(
101
+ p: Partial<Schedule.ScheduleCalendarsVariables> | string | null | undefined,
102
+ params: UseQueryParams = {},
103
+ ) {
104
+ const variables: Partial<Schedule.ScheduleCalendarsVariables> =
105
+ typeof p === 'string' ? { organizationId: p } : p || {};
106
+ const { data, ...rest } = useQuery(documents.scheduleCalendarsQry, {
107
+ ...params,
108
+ variables: { ...variables, ...params.variables },
109
+ skip: !variables.organizationId || !!params.skip,
110
+ });
29
111
  return {
30
112
  ...rest,
31
- scheduleCalendars: data?.scheduleCalendars || null,
113
+ scheduleCalendars: (data?.scheduleCalendars ??
114
+ null) as Array<Schedule.ScheduleCalendarGQL> | null,
32
115
  };
33
116
  }
34
117
 
35
118
  /*
36
- * Fetch every occurrence overlapping one window on one calendar.
37
- *
38
- * Deliberately one calendar per call rather than a list: the realtime reset
39
- * key matches on an exact per-variable value, so a change on one calendar
40
- * leaves every other overlaid calendar's cached window untouched. A page
41
- * showing three calendars runs three of these.
42
- *
43
- * The window bounds are passed as ISO strings so the cache key is stable —
44
- * two Date objects for the same instant are different cache keys.
119
+ * Read scheduleCalendar with top-level variables aligned to server reset targets.
45
120
  */
121
+ export function useScheduleCalendar(
122
+ p: Partial<Schedule.ScheduleCalendarVariables>,
123
+ params: UseQueryParams = {},
124
+ ) {
125
+ const variables: Partial<Schedule.ScheduleCalendarVariables> = p;
126
+ const { data, ...rest } = useQuery(documents.scheduleCalendarQry, {
127
+ ...params,
128
+ variables: { ...variables, ...params.variables },
129
+ skip: !variables.calendarId || !!params.skip,
130
+ });
131
+ return {
132
+ ...rest,
133
+ scheduleCalendar: (data?.scheduleCalendar ??
134
+ null) as Schedule.ScheduleCalendarGQL | null,
135
+ };
136
+ }
46
137
 
138
+ /*
139
+ * Read scheduleOccurrences with top-level variables aligned to server reset targets.
140
+ */
47
141
  export function useScheduleOccurrences(
48
- p: {
49
- organizationId?: string | null;
50
- calendarId?: string | null;
51
- fromISO?: string | null;
52
- toISO?: string | null;
53
- publishedOnly?: boolean;
54
- mineOnly?: boolean;
55
- limit?: number | null;
56
- },
57
- params: UseQueryParams = {},
58
- ) {
59
- const { data, ...rest } = useQuery(scheduleOccurrencesQry, {
60
- variables: {
61
- organizationId: p.organizationId,
62
- calendarId: p.calendarId,
63
- from: p.fromISO,
64
- to: p.toISO,
65
- publishedOnly: !!p.publishedOnly,
66
- mineOnly: !!p.mineOnly,
67
- limit: p.limit ?? null,
68
- },
142
+ p: Partial<Schedule.ScheduleOccurrencesVariables>,
143
+ params: UseQueryParams = {},
144
+ ) {
145
+ const variables: Partial<Schedule.ScheduleOccurrencesVariables> = p;
146
+ const { data, ...rest } = useQuery(documents.scheduleOccurrencesQry, {
69
147
  ...params,
148
+ variables: { ...variables, ...params.variables },
70
149
  skip:
71
- !p.organizationId ||
72
- !p.calendarId ||
73
- !p.fromISO ||
74
- !p.toISO ||
150
+ !variables.organizationId ||
151
+ !variables.calendarId ||
152
+ !variables.from ||
153
+ !variables.to ||
75
154
  !!params.skip,
76
155
  });
156
+ return {
157
+ ...rest,
158
+ scheduleOccurrences: (data?.scheduleOccurrences ??
159
+ null) as Schedule.ScheduleOccurrenceWindowGQL | null,
160
+ };
161
+ }
77
162
 
163
+ /*
164
+ * Read scheduleOccurrence with top-level variables aligned to server reset targets.
165
+ */
166
+ export function useScheduleOccurrence(
167
+ p: Partial<Schedule.ScheduleOccurrenceVariables>,
168
+ params: UseQueryParams = {},
169
+ ) {
170
+ const variables: Partial<Schedule.ScheduleOccurrenceVariables> = p;
171
+ const { data, ...rest } = useQuery(documents.scheduleOccurrenceQry, {
172
+ ...params,
173
+ variables: { ...variables, ...params.variables },
174
+ skip: !variables.organizationId || !variables.occurrenceId || !!params.skip,
175
+ });
78
176
  return {
79
177
  ...rest,
80
- scheduleOccurrences: data?.scheduleOccurrences || null,
178
+ scheduleOccurrence: (data?.scheduleOccurrence ??
179
+ null) as Schedule.ScheduleOccurrenceGQL | null,
81
180
  };
82
181
  }
83
182
 
84
183
  /*
85
- * Evaluate one calendar window for constraint breaches.
86
- *
87
- * Never cached: the entire value of this query is that it reflects the
88
- * schedule as it stands right now, so a stale verdict is worse than no
89
- * verdict — it would tell a manager the roster is legal after somebody else
90
- * broke it.
184
+ * Read scheduleMyShifts with top-level variables aligned to server reset targets.
91
185
  */
186
+ export function useScheduleMyShifts(
187
+ p: Partial<Schedule.ScheduleMyShiftsVariables>,
188
+ params: UseQueryParams = {},
189
+ ) {
190
+ const variables: Partial<Schedule.ScheduleMyShiftsVariables> = p;
191
+ const { data, ...rest } = useQuery(documents.scheduleMyShiftsQry, {
192
+ ...params,
193
+ variables: { ...variables, ...params.variables },
194
+ skip:
195
+ !variables.organizationId ||
196
+ !variables.from ||
197
+ !variables.to ||
198
+ !!params.skip,
199
+ });
200
+ return {
201
+ ...rest,
202
+ scheduleMyShifts: (data?.scheduleMyShifts ??
203
+ null) as Schedule.ScheduleOccurrenceWindowGQL | null,
204
+ };
205
+ }
92
206
 
93
- export function useScheduleEvaluation(
94
- p: {
95
- organizationId?: string | null;
96
- calendarId?: string | null;
97
- fromISO?: string | null;
98
- toISO?: string | null;
99
- },
207
+ /*
208
+ * Read scheduleOpenShifts with top-level variables aligned to server reset targets.
209
+ */
210
+ export function useScheduleOpenShifts(
211
+ p: Partial<Schedule.ScheduleOpenShiftsVariables>,
100
212
  params: UseQueryParams = {},
101
213
  ) {
102
- const { data, ...rest } = useQuery(scheduleEvaluationQry, {
103
- variables: {
104
- organizationId: p.organizationId,
105
- calendarId: p.calendarId,
106
- from: p.fromISO,
107
- to: p.toISO,
108
- },
214
+ const variables: Partial<Schedule.ScheduleOpenShiftsVariables> = p;
215
+ const { data, ...rest } = useQuery(documents.scheduleOpenShiftsQry, {
109
216
  ...params,
217
+ variables: { ...variables, ...params.variables },
110
218
  skip:
111
- !p.organizationId ||
112
- !p.calendarId ||
113
- !p.fromISO ||
114
- !p.toISO ||
219
+ !variables.organizationId ||
220
+ !variables.from ||
221
+ !variables.to ||
115
222
  !!params.skip,
116
223
  });
224
+ return {
225
+ ...rest,
226
+ scheduleOpenShifts: (data?.scheduleOpenShifts ??
227
+ null) as Array<Schedule.ScheduleOpenShiftGQL> | null,
228
+ };
229
+ }
230
+
231
+ /*
232
+ * Read scheduleShiftEligibility with top-level variables aligned to server reset targets.
233
+ */
234
+ export function useScheduleShiftEligibility(
235
+ p: Partial<Schedule.ScheduleShiftEligibilityVariables>,
236
+ params: UseQueryParams = {},
237
+ ) {
238
+ const variables: Partial<Schedule.ScheduleShiftEligibilityVariables> = p;
239
+ const { data, ...rest } = useQuery(documents.scheduleShiftEligibilityQry, {
240
+ ...params,
241
+ variables: { ...variables, ...params.variables },
242
+ skip: !variables.organizationId || !variables.occurrenceId || !!params.skip,
243
+ });
244
+ return {
245
+ ...rest,
246
+ scheduleShiftEligibility: (data?.scheduleShiftEligibility ??
247
+ null) as Schedule.ScheduleEligibilityGQL | null,
248
+ };
249
+ }
117
250
 
251
+ /*
252
+ * Read scheduleShiftCandidates with top-level variables aligned to server reset targets.
253
+ */
254
+ export function useScheduleShiftCandidates(
255
+ p: Partial<Schedule.ScheduleShiftCandidatesVariables>,
256
+ params: UseQueryParams = {},
257
+ ) {
258
+ const variables: Partial<Schedule.ScheduleShiftCandidatesVariables> = p;
259
+ const { data, ...rest } = useQuery(documents.scheduleShiftCandidatesQry, {
260
+ ...params,
261
+ variables: { ...variables, ...params.variables },
262
+ skip: !variables.organizationId || !variables.occurrenceId || !!params.skip,
263
+ });
118
264
  return {
119
265
  ...rest,
120
- scheduleEvaluation: data?.scheduleEvaluation || null,
266
+ scheduleShiftCandidates: (data?.scheduleShiftCandidates ??
267
+ null) as Array<Schedule.ScheduleShiftCandidateGQL> | null,
121
268
  };
122
269
  }
123
270
 
124
271
  /*
125
- * Fetch schedule requests: the approval queue, one's own, or the open shifts
126
- * offered to the viewer.
272
+ * Read scheduleSeriesList with top-level variables aligned to server reset targets.
127
273
  */
274
+ export function useScheduleSeriesList(
275
+ p: Partial<Schedule.ScheduleSeriesListVariables>,
276
+ params: UseQueryParams = {},
277
+ ) {
278
+ const variables: Partial<Schedule.ScheduleSeriesListVariables> = p;
279
+ const { data, ...rest } = useQuery(documents.scheduleSeriesListQry, {
280
+ ...params,
281
+ variables: { ...variables, ...params.variables },
282
+ skip: !variables.organizationId || !variables.calendarId || !!params.skip,
283
+ });
284
+ return {
285
+ ...rest,
286
+ scheduleSeriesList: (data?.scheduleSeriesList ??
287
+ null) as Array<Schedule.ScheduleSeriesGQL> | null,
288
+ };
289
+ }
290
+
291
+ /*
292
+ * Read scheduleDemands with top-level variables aligned to server reset targets.
293
+ */
294
+ export function useScheduleDemands(
295
+ p: Partial<Schedule.ScheduleDemandsVariables>,
296
+ params: UseQueryParams = {},
297
+ ) {
298
+ const variables: Partial<Schedule.ScheduleDemandsVariables> = p;
299
+ const { data, ...rest } = useQuery(documents.scheduleDemandsQry, {
300
+ ...params,
301
+ variables: { ...variables, ...params.variables },
302
+ skip:
303
+ !variables.organizationId ||
304
+ !variables.calendarId ||
305
+ !variables.from ||
306
+ !variables.to ||
307
+ !!params.skip,
308
+ });
309
+ return {
310
+ ...rest,
311
+ scheduleDemands: (data?.scheduleDemands ??
312
+ null) as Array<Schedule.ScheduleDemandGQL> | null,
313
+ };
314
+ }
315
+
316
+ /*
317
+ * Read scheduleRules with top-level variables aligned to server reset targets.
318
+ */
319
+ export function useScheduleRules(
320
+ p: Partial<Schedule.ScheduleRulesVariables> | string | null | undefined,
321
+ params: UseQueryParams = {},
322
+ ) {
323
+ const variables: Partial<Schedule.ScheduleRulesVariables> =
324
+ typeof p === 'string' ? { organizationId: p } : p || {};
325
+ const { data, ...rest } = useQuery(documents.scheduleRulesQry, {
326
+ ...params,
327
+ variables: { ...variables, ...params.variables },
328
+ skip: !variables.organizationId || !!params.skip,
329
+ });
330
+ return {
331
+ ...rest,
332
+ scheduleRules: (data?.scheduleRules ??
333
+ null) as Array<Schedule.ScheduleRuleGQL> | null,
334
+ };
335
+ }
336
+
337
+ /*
338
+ * Read scheduleViolations with top-level variables aligned to server reset targets.
339
+ */
340
+ export function useScheduleViolations(
341
+ p: Partial<Schedule.ScheduleViolationsVariables>,
342
+ params: UseQueryParams = {},
343
+ ) {
344
+ const variables: Partial<Schedule.ScheduleViolationsVariables> = p;
345
+ const { data, ...rest } = useQuery(documents.scheduleViolationsQry, {
346
+ ...params,
347
+ variables: { ...variables, ...params.variables },
348
+ skip:
349
+ !variables.organizationId ||
350
+ !variables.calendarId ||
351
+ !variables.from ||
352
+ !variables.to ||
353
+ !!params.skip,
354
+ });
355
+ return {
356
+ ...rest,
357
+ scheduleViolations: (data?.scheduleViolations ??
358
+ null) as Array<Schedule.ScheduleViolationGQL> | null,
359
+ };
360
+ }
361
+
362
+ /*
363
+ * Read schedulePublishPreflight with top-level variables aligned to server reset targets.
364
+ */
365
+ export function useSchedulePublishPreflight(
366
+ p: Partial<Schedule.SchedulePublishPreflightVariables>,
367
+ params: UseQueryParams = {},
368
+ ) {
369
+ const variables: Partial<Schedule.SchedulePublishPreflightVariables> = p;
370
+ const { data, ...rest } = useQuery(documents.schedulePublishPreflightQry, {
371
+ ...params,
372
+ variables: { ...variables, ...params.variables },
373
+ skip:
374
+ !variables.organizationId ||
375
+ !variables.calendarId ||
376
+ !variables.from ||
377
+ !variables.to ||
378
+ !!params.skip,
379
+ });
380
+ return {
381
+ ...rest,
382
+ schedulePublishPreflight: (data?.schedulePublishPreflight ??
383
+ null) as Schedule.SchedulePublishPreflightGQL | null,
384
+ };
385
+ }
386
+
387
+ /*
388
+ * Read schedulePublications with top-level variables aligned to server reset targets.
389
+ */
390
+ export function useSchedulePublications(
391
+ p: Partial<Schedule.SchedulePublicationsVariables>,
392
+ params: UseQueryParams = {},
393
+ ) {
394
+ const variables: Partial<Schedule.SchedulePublicationsVariables> = p;
395
+ const { data, ...rest } = useQuery(documents.schedulePublicationsQry, {
396
+ ...params,
397
+ variables: { ...variables, ...params.variables },
398
+ skip: !variables.organizationId || !variables.calendarId || !!params.skip,
399
+ });
400
+ return {
401
+ ...rest,
402
+ schedulePublications: (data?.schedulePublications ??
403
+ null) as Array<Schedule.SchedulePublicationGQL> | null,
404
+ };
405
+ }
128
406
 
407
+ /*
408
+ * Read scheduleRequests with top-level variables aligned to server reset targets.
409
+ */
129
410
  export function useScheduleRequests(
130
- p: {
131
- organizationId?: string | null;
132
- calendarId?: string | null;
133
- statuses?: string[] | null;
134
- mineOnly?: boolean;
135
- offeredToMe?: boolean;
136
- limit?: number | null;
137
- },
138
- params: UseQueryParams = {},
139
- ) {
140
- const { data, ...rest } = useQuery(scheduleRequestsQry, {
141
- variables: {
142
- organizationId: p.organizationId,
143
- calendarId: p.calendarId ?? null,
144
- statuses: p.statuses ?? null,
145
- mineOnly: !!p.mineOnly,
146
- offeredToMe: !!p.offeredToMe,
147
- limit: p.limit ?? null,
148
- },
411
+ p: Partial<Schedule.ScheduleRequestsVariables>,
412
+ params: UseQueryParams = {},
413
+ ) {
414
+ const variables: Partial<Schedule.ScheduleRequestsVariables> = p;
415
+ const { data, ...rest } = useQuery(documents.scheduleRequestsQry, {
416
+ ...params,
417
+ variables: { ...variables, ...params.variables },
418
+ skip: !variables.organizationId || !!params.skip,
419
+ });
420
+ return {
421
+ ...rest,
422
+ scheduleRequests: (data?.scheduleRequests ??
423
+ null) as Array<Schedule.ScheduleRequestGQL> | null,
424
+ };
425
+ }
426
+
427
+ /*
428
+ * Read scheduleRequest with top-level variables aligned to server reset targets.
429
+ */
430
+ export function useScheduleRequest(
431
+ p: Partial<Schedule.ScheduleRequestVariables>,
432
+ params: UseQueryParams = {},
433
+ ) {
434
+ const variables: Partial<Schedule.ScheduleRequestVariables> = p;
435
+ const { data, ...rest } = useQuery(documents.scheduleRequestQry, {
436
+ ...params,
437
+ variables: { ...variables, ...params.variables },
438
+ skip: !variables.organizationId || !variables.requestId || !!params.skip,
439
+ });
440
+ return {
441
+ ...rest,
442
+ scheduleRequest: (data?.scheduleRequest ??
443
+ null) as Schedule.ScheduleRequestGQL | null,
444
+ };
445
+ }
446
+
447
+ /*
448
+ * Read scheduleTimeOffList with top-level variables aligned to server reset targets.
449
+ */
450
+ export function useScheduleTimeOffList(
451
+ p: Partial<Schedule.ScheduleTimeOffListVariables>,
452
+ params: UseQueryParams = {},
453
+ ) {
454
+ const variables: Partial<Schedule.ScheduleTimeOffListVariables> = p;
455
+ const { data, ...rest } = useQuery(documents.scheduleTimeOffListQry, {
456
+ ...params,
457
+ variables: { ...variables, ...params.variables },
458
+ skip: !variables.organizationId || !!params.skip,
459
+ });
460
+ return {
461
+ ...rest,
462
+ scheduleTimeOffList: (data?.scheduleTimeOffList ??
463
+ null) as Array<Schedule.ScheduleTimeOffGQL> | null,
464
+ };
465
+ }
466
+
467
+ /*
468
+ * Read scheduleProjects with top-level variables aligned to server reset targets.
469
+ */
470
+ export function useScheduleProjects(
471
+ p: Partial<Schedule.ScheduleProjectsVariables> | string | null | undefined,
472
+ params: UseQueryParams = {},
473
+ ) {
474
+ const variables: Partial<Schedule.ScheduleProjectsVariables> =
475
+ typeof p === 'string' ? { organizationId: p } : p || {};
476
+ const { data, ...rest } = useQuery(documents.scheduleProjectsQry, {
477
+ ...params,
478
+ variables: { ...variables, ...params.variables },
479
+ skip: !variables.organizationId || !!params.skip,
480
+ });
481
+ return {
482
+ ...rest,
483
+ scheduleProjects: (data?.scheduleProjects ??
484
+ null) as Array<Schedule.ScheduleProjectGQL> | null,
485
+ };
486
+ }
487
+
488
+ /*
489
+ * Read scheduleProject with top-level variables aligned to server reset targets.
490
+ */
491
+ export function useScheduleProject(
492
+ p: Partial<Schedule.ScheduleProjectVariables> | string | null | undefined,
493
+ params: UseQueryParams = {},
494
+ ) {
495
+ const variables: Partial<Schedule.ScheduleProjectVariables> =
496
+ typeof p === 'string' ? { projectId: p } : p || {};
497
+ const { data, ...rest } = useQuery(documents.scheduleProjectQry, {
149
498
  ...params,
150
- skip: !p.organizationId || !!params.skip,
499
+ variables: { ...variables, ...params.variables },
500
+ skip: !variables.projectId || !!params.skip,
151
501
  });
502
+ return {
503
+ ...rest,
504
+ scheduleProject: (data?.scheduleProject ??
505
+ null) as Schedule.ScheduleProjectGQL | null,
506
+ };
507
+ }
152
508
 
509
+ /*
510
+ * Read scheduleProjectNetwork with top-level variables aligned to server reset targets.
511
+ */
512
+ export function useScheduleProjectNetwork(
513
+ p:
514
+ | Partial<Schedule.ScheduleProjectNetworkVariables>
515
+ | string
516
+ | null
517
+ | undefined,
518
+ params: UseQueryParams = {},
519
+ ) {
520
+ const variables: Partial<Schedule.ScheduleProjectNetworkVariables> =
521
+ typeof p === 'string' ? { projectId: p } : p || {};
522
+ const { data, ...rest } = useQuery(documents.scheduleProjectNetworkQry, {
523
+ ...params,
524
+ variables: { ...variables, ...params.variables },
525
+ skip: !variables.projectId || !!params.skip,
526
+ });
527
+ return {
528
+ ...rest,
529
+ scheduleProjectNetwork: (data?.scheduleProjectNetwork ??
530
+ null) as Schedule.ScheduleProjectNetworkGQL | null,
531
+ };
532
+ }
533
+
534
+ /*
535
+ * Read scheduleProjectRuns with top-level variables aligned to server reset targets.
536
+ */
537
+ export function useScheduleProjectRuns(
538
+ p: Partial<Schedule.ScheduleProjectRunsVariables> | string | null | undefined,
539
+ params: UseQueryParams = {},
540
+ ) {
541
+ const variables: Partial<Schedule.ScheduleProjectRunsVariables> =
542
+ typeof p === 'string' ? { projectId: p } : p || {};
543
+ const { data, ...rest } = useQuery(documents.scheduleProjectRunsQry, {
544
+ ...params,
545
+ variables: { ...variables, ...params.variables },
546
+ skip: !variables.projectId || !!params.skip,
547
+ });
548
+ return {
549
+ ...rest,
550
+ scheduleProjectRuns: (data?.scheduleProjectRuns ??
551
+ null) as Array<Schedule.ScheduleProjectRunGQL> | null,
552
+ };
553
+ }
554
+
555
+ /*
556
+ * Read scheduleProjectRun with top-level variables aligned to server reset targets.
557
+ */
558
+ export function useScheduleProjectRun(
559
+ p: Partial<Schedule.ScheduleProjectRunVariables>,
560
+ params: UseQueryParams = {},
561
+ ) {
562
+ const variables: Partial<Schedule.ScheduleProjectRunVariables> = p;
563
+ const { data, ...rest } = useQuery(documents.scheduleProjectRunQry, {
564
+ ...params,
565
+ variables: { ...variables, ...params.variables },
566
+ skip: !variables.projectId || !variables.runId || !!params.skip,
567
+ });
568
+ return {
569
+ ...rest,
570
+ scheduleProjectRun: (data?.scheduleProjectRun ??
571
+ null) as Schedule.ScheduleProjectRunGQL | null,
572
+ };
573
+ }
574
+
575
+ /*
576
+ * Read scheduleBaselines with top-level variables aligned to server reset targets.
577
+ */
578
+ export function useScheduleBaselines(
579
+ p: Partial<Schedule.ScheduleBaselinesVariables> | string | null | undefined,
580
+ params: UseQueryParams = {},
581
+ ) {
582
+ const variables: Partial<Schedule.ScheduleBaselinesVariables> =
583
+ typeof p === 'string' ? { projectId: p } : p || {};
584
+ const { data, ...rest } = useQuery(documents.scheduleBaselinesQry, {
585
+ ...params,
586
+ variables: { ...variables, ...params.variables },
587
+ skip: !variables.projectId || !!params.skip,
588
+ });
589
+ return {
590
+ ...rest,
591
+ scheduleBaselines: (data?.scheduleBaselines ??
592
+ null) as Array<Schedule.ScheduleBaselineGQL> | null,
593
+ };
594
+ }
595
+
596
+ /*
597
+ * Read scheduleBaselineActivities with top-level variables aligned to server reset targets.
598
+ */
599
+ export function useScheduleBaselineActivities(
600
+ p: Partial<Schedule.ScheduleBaselineActivitiesVariables>,
601
+ params: UseQueryParams = {},
602
+ ) {
603
+ const variables: Partial<Schedule.ScheduleBaselineActivitiesVariables> = p;
604
+ const { data, ...rest } = useQuery(documents.scheduleBaselineActivitiesQry, {
605
+ ...params,
606
+ variables: { ...variables, ...params.variables },
607
+ skip: !variables.projectId || !variables.baselineId || !!params.skip,
608
+ });
609
+ return {
610
+ ...rest,
611
+ scheduleBaselineActivities: (data?.scheduleBaselineActivities ??
612
+ null) as Array<Schedule.ScheduleBaselineActivityGQL> | null,
613
+ };
614
+ }
615
+
616
+ /*
617
+ * Read scheduleBaselineVariance with top-level variables aligned to server reset targets.
618
+ */
619
+ export function useScheduleBaselineVariance(
620
+ p: Partial<Schedule.ScheduleBaselineVarianceVariables>,
621
+ params: UseQueryParams = {},
622
+ ) {
623
+ const variables: Partial<Schedule.ScheduleBaselineVarianceVariables> = p;
624
+ const { data, ...rest } = useQuery(documents.scheduleBaselineVarianceQry, {
625
+ ...params,
626
+ variables: { ...variables, ...params.variables },
627
+ skip: !variables.projectId || !!params.skip,
628
+ });
629
+ return {
630
+ ...rest,
631
+ scheduleBaselineVariance: (data?.scheduleBaselineVariance ??
632
+ null) as Schedule.ScheduleBaselineVarianceGQL | null,
633
+ };
634
+ }
635
+
636
+ /*
637
+ * Read scheduleWorkCalendar with top-level variables aligned to server reset targets.
638
+ */
639
+ export function useScheduleWorkCalendar(
640
+ p: Partial<Schedule.ScheduleWorkCalendarVariables>,
641
+ params: UseQueryParams = {},
642
+ ) {
643
+ const variables: Partial<Schedule.ScheduleWorkCalendarVariables> = p;
644
+ const { data, ...rest } = useQuery(documents.scheduleWorkCalendarQry, {
645
+ ...params,
646
+ variables: { ...variables, ...params.variables },
647
+ skip:
648
+ !variables.organizationId || !variables.workCalendarId || !!params.skip,
649
+ });
650
+ return {
651
+ ...rest,
652
+ scheduleWorkCalendar: (data?.scheduleWorkCalendar ??
653
+ null) as Schedule.ScheduleWorkCalendarGQL | null | null,
654
+ };
655
+ }
656
+
657
+ /*
658
+ * Read scheduleResource with top-level variables aligned to server reset targets.
659
+ */
660
+ export function useScheduleResource(
661
+ p: Partial<Schedule.ScheduleResourceVariables>,
662
+ params: UseQueryParams = {},
663
+ ) {
664
+ const variables: Partial<Schedule.ScheduleResourceVariables> = p;
665
+ const { data, ...rest } = useQuery(documents.scheduleResourceQry, {
666
+ ...params,
667
+ variables: { ...variables, ...params.variables },
668
+ skip: !variables.organizationId || !variables.resourceId || !!params.skip,
669
+ });
670
+ return {
671
+ ...rest,
672
+ scheduleResource: (data?.scheduleResource ??
673
+ null) as Schedule.ScheduleResourceGQL | null | null,
674
+ };
675
+ }
676
+
677
+ /*
678
+ * Read scheduleSeries with top-level variables aligned to server reset targets.
679
+ */
680
+ export function useScheduleSeries(
681
+ p: Partial<Schedule.ScheduleSeriesVariables>,
682
+ params: UseQueryParams = {},
683
+ ) {
684
+ const variables: Partial<Schedule.ScheduleSeriesVariables> = p;
685
+ const { data, ...rest } = useQuery(documents.scheduleSeriesQry, {
686
+ ...params,
687
+ variables: { ...variables, ...params.variables },
688
+ skip: !variables.organizationId || !variables.seriesId || !!params.skip,
689
+ });
690
+ return {
691
+ ...rest,
692
+ scheduleSeries: (data?.scheduleSeries ??
693
+ null) as Schedule.ScheduleSeriesGQL | null | null,
694
+ };
695
+ }
696
+
697
+ /*
698
+ * Read scheduleCalendarAccessGrants with top-level variables aligned to server reset targets.
699
+ */
700
+ export function useScheduleCalendarAccessGrants(
701
+ p: Partial<Schedule.ScheduleCalendarAccessGrantsVariables>,
702
+ params: UseQueryParams = {},
703
+ ) {
704
+ const variables: Partial<Schedule.ScheduleCalendarAccessGrantsVariables> = p;
705
+ const { data, ...rest } = useQuery(
706
+ documents.scheduleCalendarAccessGrantsQry,
707
+ {
708
+ ...params,
709
+ variables: { ...variables, ...params.variables },
710
+ skip: !variables.organizationId || !variables.calendarId || !!params.skip,
711
+ },
712
+ );
713
+ return {
714
+ ...rest,
715
+ scheduleCalendarAccessGrants: (data?.scheduleCalendarAccessGrants ??
716
+ null) as Array<Schedule.ScheduleDocAccessGrantGQL> | null,
717
+ };
718
+ }
719
+
720
+ /*
721
+ * Read scheduleProjectAccessGrants with top-level variables aligned to server reset targets.
722
+ */
723
+ export function useScheduleProjectAccessGrants(
724
+ p: Partial<Schedule.ScheduleProjectAccessGrantsVariables>,
725
+ params: UseQueryParams = {},
726
+ ) {
727
+ const variables: Partial<Schedule.ScheduleProjectAccessGrantsVariables> = p;
728
+ const { data, ...rest } = useQuery(documents.scheduleProjectAccessGrantsQry, {
729
+ ...params,
730
+ variables: { ...variables, ...params.variables },
731
+ skip: !variables.organizationId || !variables.projectId || !!params.skip,
732
+ });
153
733
  return {
154
734
  ...rest,
155
- scheduleRequests: data?.scheduleRequests || null,
735
+ scheduleProjectAccessGrants: (data?.scheduleProjectAccessGrants ??
736
+ null) as Array<Schedule.ScheduleDocAccessGrantGQL> | null,
156
737
  };
157
738
  }