@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,416 +1,589 @@
1
- import type { UseMutationParams } from '@jsb188/graphql/types.d';
2
- import {
3
- FRAGMENT_NAMES,
4
- makeFragmentKey,
5
- } from '@jsb188/mday/constants/graphqlReactivity.ts';
1
+ import type { UseMutationParams } from '../types.d.ts';
6
2
  import type { OpenModalPopUpFn } from '@jsb188/react/states';
7
- import { updateFragment } from '../cache/index.ts';
8
- import {
9
- assignScheduleOccurrenceMtn,
10
- cancelScheduleOccurrenceMtn,
11
- claimScheduleRequestMtn,
12
- declineScheduleRequestMtn,
13
- createScheduleFeedTokenMtn,
14
- createScheduleOccurrenceMtn,
15
- createScheduleRequestMtn,
16
- decideScheduleRequestMtn,
17
- deleteScheduleOccurrenceMtn,
18
- publishScheduleMtn,
19
- releaseScheduleAssignmentMtn,
20
- revokeScheduleFeedTokenMtn,
21
- updateScheduleOccurrenceMtn,
22
- withdrawScheduleRequestMtn,
23
- } from '../gql/mutations/scheduleMutations.ts';
3
+ import type { DocumentNode } from 'graphql';
4
+ import * as documents from '../gql/mutations/scheduleMutations.ts';
24
5
  import { useMutation } from './index.ts';
25
6
 
26
7
  /*
27
- * Patch the issuing client's own cached occurrence.
28
- *
29
- * The server deliberately excludes the originating socket from its realtime
30
- * emit — that socket already holds the mutation response — so the issuer has
31
- * to refresh its own fragment or it would be the last client to see its own
32
- * edit.
8
+ * Compose the standard mutation lifecycle. Server fragments and membership resets
9
+ * reach the writer, so mutation hooks do not mutate the client cache themselves.
33
10
  */
11
+ function composeScheduleMutationHook<K extends string>(
12
+ mutation: DocumentNode,
13
+ resultKey: K,
14
+ ) {
15
+ /*
16
+ * Execute one schedule command and deliver its domain payload to the caller.
17
+ */
18
+ return function useScheduleMutation(
19
+ params: UseMutationParams = {},
20
+ openModalPopUp?: OpenModalPopUpFn,
21
+ ) {
22
+ const { onCompleted, ...rest } = params;
23
+ const [mutate, values, handlers, updateObservers] = useMutation(mutation, {
24
+ openModalPopUp,
25
+ ...rest,
26
+ onCompleted: (data, error, variables) => {
27
+ onCompleted?.(data?.[resultKey], error, variables);
28
+ },
29
+ });
30
+ return {
31
+ ...values,
32
+ ...handlers,
33
+ mutate,
34
+ updateObservers,
35
+ [resultKey]: mutate,
36
+ } as typeof values &
37
+ typeof handlers & {
38
+ mutate: typeof mutate;
39
+ updateObservers: typeof updateObservers;
40
+ } & Record<K, typeof mutate>;
41
+ };
42
+ }
34
43
 
35
- function patchOccurrenceFragment(occurrence: any, updateObservers: any) {
36
- if (!occurrence?.id) {
37
- return;
38
- }
44
+ /*
45
+ * Submit createScheduleWorkCalendar through the shared mutation lifecycle.
46
+ */
47
+ export const useCreateScheduleWorkCalendar = composeScheduleMutationHook(
48
+ documents.createScheduleWorkCalendarMtn,
49
+ 'createScheduleWorkCalendar',
50
+ );
39
51
 
40
- updateFragment(
41
- makeFragmentKey(FRAGMENT_NAMES.scheduleOccurrence, occurrence.id),
42
- occurrence,
43
- null,
44
- false,
45
- updateObservers,
46
- );
47
- }
52
+ /*
53
+ * Submit updateScheduleWorkCalendar through the shared mutation lifecycle.
54
+ */
55
+ export const useUpdateScheduleWorkCalendar = composeScheduleMutationHook(
56
+ documents.updateScheduleWorkCalendarMtn,
57
+ 'updateScheduleWorkCalendar',
58
+ );
48
59
 
49
60
  /*
50
- * Patch the issuing client's own cached request, for the same reason.
61
+ * Submit setScheduleWorkCalendarException through the shared mutation lifecycle.
51
62
  */
63
+ export const useSetScheduleWorkCalendarException = composeScheduleMutationHook(
64
+ documents.setScheduleWorkCalendarExceptionMtn,
65
+ 'setScheduleWorkCalendarException',
66
+ );
52
67
 
53
- function patchRequestFragment(request: any, updateObservers: any) {
54
- if (!request?.id) {
55
- return;
56
- }
68
+ /*
69
+ * Submit deleteScheduleWorkCalendar through the shared mutation lifecycle.
70
+ */
71
+ export const useDeleteScheduleWorkCalendar = composeScheduleMutationHook(
72
+ documents.deleteScheduleWorkCalendarMtn,
73
+ 'deleteScheduleWorkCalendar',
74
+ );
75
+
76
+ /*
77
+ * Submit createScheduleResource through the shared mutation lifecycle.
78
+ */
79
+ export const useCreateScheduleResource = composeScheduleMutationHook(
80
+ documents.createScheduleResourceMtn,
81
+ 'createScheduleResource',
82
+ );
83
+
84
+ /*
85
+ * Submit updateScheduleResource through the shared mutation lifecycle.
86
+ */
87
+ export const useUpdateScheduleResource = composeScheduleMutationHook(
88
+ documents.updateScheduleResourceMtn,
89
+ 'updateScheduleResource',
90
+ );
57
91
 
58
- updateFragment(
59
- makeFragmentKey(FRAGMENT_NAMES.scheduleRequest, request.id),
60
- request,
61
- null,
62
- false,
63
- updateObservers,
92
+ /*
93
+ * Submit createScheduleResourceAvailability through the shared mutation lifecycle.
94
+ */
95
+ export const useCreateScheduleResourceAvailability =
96
+ composeScheduleMutationHook(
97
+ documents.createScheduleResourceAvailabilityMtn,
98
+ 'createScheduleResourceAvailability',
64
99
  );
65
- }
66
100
 
67
101
  /*
68
- * Create one occurrence.
102
+ * Submit deleteScheduleResourceAvailability through the shared mutation lifecycle.
69
103
  */
104
+ export const useDeleteScheduleResourceAvailability =
105
+ composeScheduleMutationHook(
106
+ documents.deleteScheduleResourceAvailabilityMtn,
107
+ 'deleteScheduleResourceAvailability',
108
+ );
70
109
 
71
- export function useCreateScheduleOccurrence(
72
- params: UseMutationParams = {},
73
- openModalPopUp?: OpenModalPopUpFn,
74
- ) {
75
- const [createScheduleOccurrence, mtnValues, mtnHandlers, updateObservers] =
76
- useMutation(createScheduleOccurrenceMtn, { openModalPopUp, ...params });
77
-
78
- return {
79
- createScheduleOccurrence,
80
- updateObservers,
81
- ...mtnValues,
82
- ...mtnHandlers,
83
- };
84
- }
110
+ /*
111
+ * Submit updateMyScheduleNotifyPrefs through the shared mutation lifecycle.
112
+ */
113
+ export const useUpdateMyScheduleNotifyPrefs = composeScheduleMutationHook(
114
+ documents.updateMyScheduleNotifyPrefsMtn,
115
+ 'updateMyScheduleNotifyPrefs',
116
+ );
85
117
 
86
118
  /*
87
- * Update one occurrence.
88
- *
89
- * Callers must pass the "version" they read from the occurrence. It is the
90
- * optimistic-lock token: the server rejects the write if somebody else has
91
- * edited the row since, which is what stops two managers dragging the same
92
- * shift from silently overwriting each other.
119
+ * Submit createScheduleCalendar through the shared mutation lifecycle.
93
120
  */
121
+ export const useCreateScheduleCalendar = composeScheduleMutationHook(
122
+ documents.createScheduleCalendarMtn,
123
+ 'createScheduleCalendar',
124
+ );
94
125
 
95
- export function useUpdateScheduleOccurrence(
96
- params: UseMutationParams = {},
97
- openModalPopUp?: OpenModalPopUpFn,
98
- ) {
99
- const { onCompleted, ...rest } = params;
126
+ /*
127
+ * Submit updateScheduleCalendar through the shared mutation lifecycle.
128
+ */
129
+ export const useUpdateScheduleCalendar = composeScheduleMutationHook(
130
+ documents.updateScheduleCalendarMtn,
131
+ 'updateScheduleCalendar',
132
+ );
100
133
 
101
- const [updateScheduleOccurrence, mtnValues, mtnHandlers, updateObservers] =
102
- useMutation(updateScheduleOccurrenceMtn, {
103
- openModalPopUp,
104
- onCompleted: (data: any, error: any, variables: any) => {
105
- patchOccurrenceFragment(
106
- data?.updateScheduleOccurrence,
107
- updateObservers,
108
- );
109
- onCompleted?.(data?.updateScheduleOccurrence, error, variables);
110
- },
111
- ...rest,
112
- });
134
+ /*
135
+ * Submit updateScheduleCalendarAccess through the shared mutation lifecycle.
136
+ */
137
+ export const useUpdateScheduleCalendarAccess = composeScheduleMutationHook(
138
+ documents.updateScheduleCalendarAccessMtn,
139
+ 'updateScheduleCalendarAccess',
140
+ );
113
141
 
114
- return {
115
- updateScheduleOccurrence,
116
- updateObservers,
117
- ...mtnValues,
118
- ...mtnHandlers,
119
- };
120
- }
142
+ /*
143
+ * Submit deleteScheduleCalendar through the shared mutation lifecycle.
144
+ */
145
+ export const useDeleteScheduleCalendar = composeScheduleMutationHook(
146
+ documents.deleteScheduleCalendarMtn,
147
+ 'deleteScheduleCalendar',
148
+ );
121
149
 
122
150
  /*
123
- * Cancel one occurrence. The row survives, struck through on the calendar.
151
+ * Submit createScheduleSeries through the shared mutation lifecycle.
124
152
  */
153
+ export const useCreateScheduleSeries = composeScheduleMutationHook(
154
+ documents.createScheduleSeriesMtn,
155
+ 'createScheduleSeries',
156
+ );
125
157
 
126
- export function useCancelScheduleOccurrence(
127
- params: UseMutationParams = {},
128
- openModalPopUp?: OpenModalPopUpFn,
129
- ) {
130
- const { onCompleted, ...rest } = params;
158
+ /*
159
+ * Submit updateScheduleSeries through the shared mutation lifecycle.
160
+ */
161
+ export const useUpdateScheduleSeries = composeScheduleMutationHook(
162
+ documents.updateScheduleSeriesMtn,
163
+ 'updateScheduleSeries',
164
+ );
131
165
 
132
- const [cancelScheduleOccurrence, mtnValues, mtnHandlers, updateObservers] =
133
- useMutation(cancelScheduleOccurrenceMtn, {
134
- openModalPopUp,
135
- onCompleted: (data: any, error: any, variables: any) => {
136
- patchOccurrenceFragment(
137
- data?.cancelScheduleOccurrence,
138
- updateObservers,
139
- );
140
- onCompleted?.(data?.cancelScheduleOccurrence, error, variables);
141
- },
142
- ...rest,
143
- });
166
+ /*
167
+ * Submit deleteScheduleSeries through the shared mutation lifecycle.
168
+ */
169
+ export const useDeleteScheduleSeries = composeScheduleMutationHook(
170
+ documents.deleteScheduleSeriesMtn,
171
+ 'deleteScheduleSeries',
172
+ );
144
173
 
145
- return {
146
- cancelScheduleOccurrence,
147
- updateObservers,
148
- ...mtnValues,
149
- ...mtnHandlers,
150
- };
151
- }
174
+ /*
175
+ * Submit createScheduleOccurrence through the shared mutation lifecycle.
176
+ */
177
+ export const useCreateScheduleOccurrence = composeScheduleMutationHook(
178
+ documents.createScheduleOccurrenceMtn,
179
+ 'createScheduleOccurrence',
180
+ );
152
181
 
153
182
  /*
154
- * Delete one occurrence outright.
183
+ * Submit updateScheduleOccurrence through the shared mutation lifecycle.
155
184
  */
185
+ export const useUpdateScheduleOccurrence = composeScheduleMutationHook(
186
+ documents.updateScheduleOccurrenceMtn,
187
+ 'updateScheduleOccurrence',
188
+ );
156
189
 
157
- export function useDeleteScheduleOccurrence(
158
- params: UseMutationParams = {},
159
- openModalPopUp?: OpenModalPopUpFn,
160
- ) {
161
- const [deleteScheduleOccurrence, mtnValues, mtnHandlers, updateObservers] =
162
- useMutation(deleteScheduleOccurrenceMtn, { openModalPopUp, ...params });
163
-
164
- return {
165
- deleteScheduleOccurrence,
166
- updateObservers,
167
- ...mtnValues,
168
- ...mtnHandlers,
169
- };
170
- }
190
+ /*
191
+ * Submit cancelScheduleOccurrence through the shared mutation lifecycle.
192
+ */
193
+ export const useCancelScheduleOccurrence = composeScheduleMutationHook(
194
+ documents.cancelScheduleOccurrenceMtn,
195
+ 'cancelScheduleOccurrence',
196
+ );
171
197
 
172
198
  /*
173
- * Assign somebody to one occurrence.
199
+ * Submit deleteScheduleOccurrence through the shared mutation lifecycle.
174
200
  */
201
+ export const useDeleteScheduleOccurrence = composeScheduleMutationHook(
202
+ documents.deleteScheduleOccurrenceMtn,
203
+ 'deleteScheduleOccurrence',
204
+ );
175
205
 
176
- export function useAssignScheduleOccurrence(
177
- params: UseMutationParams = {},
178
- openModalPopUp?: OpenModalPopUpFn,
179
- ) {
180
- const [assignScheduleOccurrence, mtnValues, mtnHandlers, updateObservers] =
181
- useMutation(assignScheduleOccurrenceMtn, { openModalPopUp, ...params });
182
-
183
- return {
184
- assignScheduleOccurrence,
185
- updateObservers,
186
- ...mtnValues,
187
- ...mtnHandlers,
188
- };
189
- }
206
+ /*
207
+ * Submit assignScheduleOccurrence through the shared mutation lifecycle.
208
+ */
209
+ export const useAssignScheduleOccurrence = composeScheduleMutationHook(
210
+ documents.assignScheduleOccurrenceMtn,
211
+ 'assignScheduleOccurrence',
212
+ );
190
213
 
191
214
  /*
192
- * Release one assignment, keeping the row as history.
215
+ * Submit releaseScheduleAssignment through the shared mutation lifecycle.
193
216
  */
217
+ export const useReleaseScheduleAssignment = composeScheduleMutationHook(
218
+ documents.releaseScheduleAssignmentMtn,
219
+ 'releaseScheduleAssignment',
220
+ );
194
221
 
195
- export function useReleaseScheduleAssignment(
196
- params: UseMutationParams = {},
197
- openModalPopUp?: OpenModalPopUpFn,
198
- ) {
199
- const [releaseScheduleAssignment, mtnValues, mtnHandlers, updateObservers] =
200
- useMutation(releaseScheduleAssignmentMtn, { openModalPopUp, ...params });
201
-
202
- return {
203
- releaseScheduleAssignment,
204
- updateObservers,
205
- ...mtnValues,
206
- ...mtnHandlers,
207
- };
208
- }
222
+ /*
223
+ * Submit publishScheduleWindow through the shared mutation lifecycle.
224
+ */
225
+ export const usePublishScheduleWindow = composeScheduleMutationHook(
226
+ documents.publishScheduleWindowMtn,
227
+ 'publishScheduleWindow',
228
+ );
209
229
 
210
230
  /*
211
- * Publish a window.
212
- *
213
- * Two-phase: the server re-evaluates and refuses on a blocking breach unless
214
- * that exact violation key was acknowledged, so the caller sends back the keys
215
- * it actually showed the publisher rather than a blanket override.
231
+ * Submit acknowledgeSchedulePublication through the shared mutation lifecycle.
216
232
  */
233
+ export const useAcknowledgeSchedulePublication = composeScheduleMutationHook(
234
+ documents.acknowledgeSchedulePublicationMtn,
235
+ 'acknowledgeSchedulePublication',
236
+ );
217
237
 
218
- export function usePublishSchedule(
219
- params: UseMutationParams = {},
220
- openModalPopUp?: OpenModalPopUpFn,
221
- ) {
222
- const [publishSchedule, mtnValues, mtnHandlers, updateObservers] =
223
- useMutation(publishScheduleMtn, { openModalPopUp, ...params });
224
-
225
- return {
226
- publishSchedule,
227
- updateObservers,
228
- ...mtnValues,
229
- ...mtnHandlers,
230
- };
231
- }
238
+ /*
239
+ * Submit evaluateScheduleWindow through the shared mutation lifecycle.
240
+ */
241
+ export const useEvaluateScheduleWindow = composeScheduleMutationHook(
242
+ documents.evaluateScheduleWindowMtn,
243
+ 'evaluateScheduleWindow',
244
+ );
232
245
 
233
246
  /*
234
- * Open a request (give away a shift, ask for time off, propose a swap).
247
+ * Submit createScheduleRule through the shared mutation lifecycle.
235
248
  */
249
+ export const useCreateScheduleRule = composeScheduleMutationHook(
250
+ documents.createScheduleRuleMtn,
251
+ 'createScheduleRule',
252
+ );
236
253
 
237
- export function useCreateScheduleRequest(
238
- params: UseMutationParams = {},
239
- openModalPopUp?: OpenModalPopUpFn,
240
- ) {
241
- const { onCompleted, ...rest } = params;
254
+ /*
255
+ * Submit updateScheduleRule through the shared mutation lifecycle.
256
+ */
257
+ export const useUpdateScheduleRule = composeScheduleMutationHook(
258
+ documents.updateScheduleRuleMtn,
259
+ 'updateScheduleRule',
260
+ );
242
261
 
243
- const [createScheduleRequest, mtnValues, mtnHandlers, updateObservers] =
244
- useMutation(createScheduleRequestMtn, {
245
- openModalPopUp,
246
- onCompleted: (data: any, error: any, variables: any) => {
247
- patchRequestFragment(data?.createScheduleRequest, updateObservers);
248
- onCompleted?.(data?.createScheduleRequest, error, variables);
249
- },
250
- ...rest,
251
- });
262
+ /*
263
+ * Submit deleteScheduleRule through the shared mutation lifecycle.
264
+ */
265
+ export const useDeleteScheduleRule = composeScheduleMutationHook(
266
+ documents.deleteScheduleRuleMtn,
267
+ 'deleteScheduleRule',
268
+ );
252
269
 
253
- return {
254
- createScheduleRequest,
255
- updateObservers,
256
- ...mtnValues,
257
- ...mtnHandlers,
258
- };
259
- }
270
+ /*
271
+ * Submit createScheduleDemand through the shared mutation lifecycle.
272
+ */
273
+ export const useCreateScheduleDemand = composeScheduleMutationHook(
274
+ documents.createScheduleDemandMtn,
275
+ 'createScheduleDemand',
276
+ );
260
277
 
261
278
  /*
262
- * Claim an open shift.
263
- *
264
- * First accept wins. A losing claimant gets error 20154, which is an ORDINARY
265
- * outcome — somebody took the shift a moment ago — so callers should report it
266
- * as news rather than as a failure.
279
+ * Submit deleteScheduleDemand through the shared mutation lifecycle.
267
280
  */
281
+ export const useDeleteScheduleDemand = composeScheduleMutationHook(
282
+ documents.deleteScheduleDemandMtn,
283
+ 'deleteScheduleDemand',
284
+ );
268
285
 
269
- export function useClaimScheduleRequest(
270
- params: UseMutationParams = {},
271
- openModalPopUp?: OpenModalPopUpFn,
272
- ) {
273
- const { onCompleted, ...rest } = params;
286
+ /*
287
+ * Submit createScheduleRequest through the shared mutation lifecycle.
288
+ */
289
+ export const useCreateScheduleRequest = composeScheduleMutationHook(
290
+ documents.createScheduleRequestMtn,
291
+ 'createScheduleRequest',
292
+ );
274
293
 
275
- const [claimScheduleRequest, mtnValues, mtnHandlers, updateObservers] =
276
- useMutation(claimScheduleRequestMtn, {
277
- openModalPopUp,
278
- onCompleted: (data: any, error: any, variables: any) => {
279
- patchRequestFragment(data?.claimScheduleRequest, updateObservers);
280
- onCompleted?.(data?.claimScheduleRequest, error, variables);
281
- },
282
- ...rest,
283
- });
294
+ /*
295
+ * Submit respondScheduleRequest through the shared mutation lifecycle.
296
+ */
297
+ export const useRespondScheduleRequest = composeScheduleMutationHook(
298
+ documents.respondScheduleRequestMtn,
299
+ 'respondScheduleRequest',
300
+ );
284
301
 
285
- return {
286
- claimScheduleRequest,
287
- updateObservers,
288
- ...mtnValues,
289
- ...mtnHandlers,
290
- };
291
- }
302
+ /*
303
+ * Submit withdrawScheduleRequest through the shared mutation lifecycle.
304
+ */
305
+ export const useWithdrawScheduleRequest = composeScheduleMutationHook(
306
+ documents.withdrawScheduleRequestMtn,
307
+ 'withdrawScheduleRequest',
308
+ );
292
309
 
293
310
  /*
294
- * Decline one swap, as the colleague it was addressed to.
311
+ * Submit decideScheduleRequest through the shared mutation lifecycle.
295
312
  */
313
+ export const useDecideScheduleRequest = composeScheduleMutationHook(
314
+ documents.decideScheduleRequestMtn,
315
+ 'decideScheduleRequest',
316
+ );
296
317
 
297
- export function useDeclineScheduleRequest(
298
- params: UseMutationParams = {},
299
- openModalPopUp?: OpenModalPopUpFn,
300
- ) {
301
- const { onCompleted, ...rest } = params;
318
+ /*
319
+ * Submit createScheduleTimeOff through the shared mutation lifecycle.
320
+ */
321
+ export const useCreateScheduleTimeOff = composeScheduleMutationHook(
322
+ documents.createScheduleTimeOffMtn,
323
+ 'createScheduleTimeOff',
324
+ );
302
325
 
303
- const [declineScheduleRequest, mtnValues, mtnHandlers, updateObservers] =
304
- useMutation(declineScheduleRequestMtn, {
305
- openModalPopUp,
306
- onCompleted: (data: any, error: any, variables: any) => {
307
- patchRequestFragment(data?.declineScheduleRequest, updateObservers);
308
- onCompleted?.(data?.declineScheduleRequest, error, variables);
309
- },
310
- ...rest,
311
- });
326
+ /*
327
+ * Submit decideScheduleTimeOff through the shared mutation lifecycle.
328
+ */
329
+ export const useDecideScheduleTimeOff = composeScheduleMutationHook(
330
+ documents.decideScheduleTimeOffMtn,
331
+ 'decideScheduleTimeOff',
332
+ );
312
333
 
313
- return {
314
- declineScheduleRequest,
315
- updateObservers,
316
- ...mtnValues,
317
- ...mtnHandlers,
318
- };
319
- }
334
+ /*
335
+ * Submit cancelScheduleTimeOff through the shared mutation lifecycle.
336
+ */
337
+ export const useCancelScheduleTimeOff = composeScheduleMutationHook(
338
+ documents.cancelScheduleTimeOffMtn,
339
+ 'cancelScheduleTimeOff',
340
+ );
320
341
 
321
342
  /*
322
- * Withdraw one's own request.
343
+ * Submit createScheduleProject through the shared mutation lifecycle.
323
344
  */
345
+ export const useCreateScheduleProject = composeScheduleMutationHook(
346
+ documents.createScheduleProjectMtn,
347
+ 'createScheduleProject',
348
+ );
324
349
 
325
- export function useWithdrawScheduleRequest(
326
- params: UseMutationParams = {},
327
- openModalPopUp?: OpenModalPopUpFn,
328
- ) {
329
- const { onCompleted, ...rest } = params;
350
+ /*
351
+ * Submit updateScheduleProject through the shared mutation lifecycle.
352
+ */
353
+ export const useUpdateScheduleProject = composeScheduleMutationHook(
354
+ documents.updateScheduleProjectMtn,
355
+ 'updateScheduleProject',
356
+ );
330
357
 
331
- const [withdrawScheduleRequest, mtnValues, mtnHandlers, updateObservers] =
332
- useMutation(withdrawScheduleRequestMtn, {
333
- openModalPopUp,
334
- onCompleted: (data: any, error: any, variables: any) => {
335
- patchRequestFragment(data?.withdrawScheduleRequest, updateObservers);
336
- onCompleted?.(data?.withdrawScheduleRequest, error, variables);
337
- },
338
- ...rest,
339
- });
358
+ /*
359
+ * Submit updateScheduleProjectAccess through the shared mutation lifecycle.
360
+ */
361
+ export const useUpdateScheduleProjectAccess = composeScheduleMutationHook(
362
+ documents.updateScheduleProjectAccessMtn,
363
+ 'updateScheduleProjectAccess',
364
+ );
340
365
 
341
- return {
342
- withdrawScheduleRequest,
343
- updateObservers,
344
- ...mtnValues,
345
- ...mtnHandlers,
346
- };
347
- }
366
+ /*
367
+ * Submit deleteScheduleProject through the shared mutation lifecycle.
368
+ */
369
+ export const useDeleteScheduleProject = composeScheduleMutationHook(
370
+ documents.deleteScheduleProjectMtn,
371
+ 'deleteScheduleProject',
372
+ );
348
373
 
349
374
  /*
350
- * Approve or deny one request.
375
+ * Submit createScheduleWbsNode through the shared mutation lifecycle.
351
376
  */
377
+ export const useCreateScheduleWbsNode = composeScheduleMutationHook(
378
+ documents.createScheduleWbsNodeMtn,
379
+ 'createScheduleWbsNode',
380
+ );
352
381
 
353
- export function useDecideScheduleRequest(
354
- params: UseMutationParams = {},
355
- openModalPopUp?: OpenModalPopUpFn,
356
- ) {
357
- const { onCompleted, ...rest } = params;
382
+ /*
383
+ * Submit updateScheduleWbsNode through the shared mutation lifecycle.
384
+ */
385
+ export const useUpdateScheduleWbsNode = composeScheduleMutationHook(
386
+ documents.updateScheduleWbsNodeMtn,
387
+ 'updateScheduleWbsNode',
388
+ );
358
389
 
359
- const [decideScheduleRequest, mtnValues, mtnHandlers, updateObservers] =
360
- useMutation(decideScheduleRequestMtn, {
361
- openModalPopUp,
362
- onCompleted: (data: any, error: any, variables: any) => {
363
- patchRequestFragment(data?.decideScheduleRequest, updateObservers);
364
- onCompleted?.(data?.decideScheduleRequest, error, variables);
365
- },
366
- ...rest,
367
- });
390
+ /*
391
+ * Submit deleteScheduleWbsNode through the shared mutation lifecycle.
392
+ */
393
+ export const useDeleteScheduleWbsNode = composeScheduleMutationHook(
394
+ documents.deleteScheduleWbsNodeMtn,
395
+ 'deleteScheduleWbsNode',
396
+ );
368
397
 
369
- return {
370
- decideScheduleRequest,
371
- updateObservers,
372
- ...mtnValues,
373
- ...mtnHandlers,
374
- };
375
- }
398
+ /*
399
+ * Submit createScheduleActivity through the shared mutation lifecycle.
400
+ */
401
+ export const useCreateScheduleActivity = composeScheduleMutationHook(
402
+ documents.createScheduleActivityMtn,
403
+ 'createScheduleActivity',
404
+ );
376
405
 
377
406
  /*
378
- * Issue one calendar subscription token.
379
- *
380
- * The raw token comes back exactly once — only a hash is stored — so the
381
- * caller must show it immediately or the subscription is unusable.
407
+ * Submit createScheduleActivities through the shared mutation lifecycle.
382
408
  */
409
+ export const useCreateScheduleActivities = composeScheduleMutationHook(
410
+ documents.createScheduleActivitiesMtn,
411
+ 'createScheduleActivities',
412
+ );
383
413
 
384
- export function useCreateScheduleFeedToken(
385
- params: UseMutationParams = {},
386
- openModalPopUp?: OpenModalPopUpFn,
387
- ) {
388
- const [createScheduleFeedToken, mtnValues, mtnHandlers, updateObservers] =
389
- useMutation(createScheduleFeedTokenMtn, { openModalPopUp, ...params });
390
-
391
- return {
392
- createScheduleFeedToken,
393
- updateObservers,
394
- ...mtnValues,
395
- ...mtnHandlers,
396
- };
397
- }
414
+ /*
415
+ * Submit updateScheduleActivity through the shared mutation lifecycle.
416
+ */
417
+ export const useUpdateScheduleActivity = composeScheduleMutationHook(
418
+ documents.updateScheduleActivityMtn,
419
+ 'updateScheduleActivity',
420
+ );
398
421
 
399
422
  /*
400
- * Revoke one calendar subscription token.
423
+ * Submit updateScheduleActivitiesProgress through the shared mutation lifecycle.
401
424
  */
425
+ export const useUpdateScheduleActivitiesProgress = composeScheduleMutationHook(
426
+ documents.updateScheduleActivitiesProgressMtn,
427
+ 'updateScheduleActivitiesProgress',
428
+ );
402
429
 
403
- export function useRevokeScheduleFeedToken(
404
- params: UseMutationParams = {},
405
- openModalPopUp?: OpenModalPopUpFn,
406
- ) {
407
- const [revokeScheduleFeedToken, mtnValues, mtnHandlers, updateObservers] =
408
- useMutation(revokeScheduleFeedTokenMtn, { openModalPopUp, ...params });
409
-
410
- return {
411
- revokeScheduleFeedToken,
412
- updateObservers,
413
- ...mtnValues,
414
- ...mtnHandlers,
415
- };
416
- }
430
+ /*
431
+ * Submit deleteScheduleActivities through the shared mutation lifecycle.
432
+ */
433
+ export const useDeleteScheduleActivities = composeScheduleMutationHook(
434
+ documents.deleteScheduleActivitiesMtn,
435
+ 'deleteScheduleActivities',
436
+ );
437
+
438
+ /*
439
+ * Submit moveScheduleActivities through the shared mutation lifecycle.
440
+ */
441
+ export const useMoveScheduleActivities = composeScheduleMutationHook(
442
+ documents.moveScheduleActivitiesMtn,
443
+ 'moveScheduleActivities',
444
+ );
445
+
446
+ /*
447
+ * Submit reviewScheduleActivities through the shared mutation lifecycle.
448
+ */
449
+ export const useReviewScheduleActivities = composeScheduleMutationHook(
450
+ documents.reviewScheduleActivitiesMtn,
451
+ 'reviewScheduleActivities',
452
+ );
453
+
454
+ /*
455
+ * Submit createScheduleRelationships through the shared mutation lifecycle.
456
+ */
457
+ export const useCreateScheduleRelationships = composeScheduleMutationHook(
458
+ documents.createScheduleRelationshipsMtn,
459
+ 'createScheduleRelationships',
460
+ );
461
+
462
+ /*
463
+ * Replace incoming relationships in one versioned transaction.
464
+ */
465
+ export const useReplaceScheduleActivityPredecessors =
466
+ composeScheduleMutationHook(
467
+ documents.replaceScheduleActivityPredecessorsMtn,
468
+ 'replaceScheduleActivityPredecessors',
469
+ );
470
+
471
+ /*
472
+ * Submit updateScheduleRelationship through the shared mutation lifecycle.
473
+ */
474
+ export const useUpdateScheduleRelationship = composeScheduleMutationHook(
475
+ documents.updateScheduleRelationshipMtn,
476
+ 'updateScheduleRelationship',
477
+ );
478
+
479
+ /*
480
+ * Submit deleteScheduleRelationships through the shared mutation lifecycle.
481
+ */
482
+ export const useDeleteScheduleRelationships = composeScheduleMutationHook(
483
+ documents.deleteScheduleRelationshipsMtn,
484
+ 'deleteScheduleRelationships',
485
+ );
486
+
487
+ /*
488
+ * Submit replaceScheduleActivityAssignment through the shared mutation lifecycle.
489
+ */
490
+ export const useReplaceScheduleActivityAssignment = composeScheduleMutationHook(
491
+ documents.replaceScheduleActivityAssignmentMtn,
492
+ 'replaceScheduleActivityAssignment',
493
+ );
494
+
495
+ /*
496
+ * Submit deleteScheduleActivityAssignment through the shared mutation lifecycle.
497
+ */
498
+ export const useDeleteScheduleActivityAssignment = composeScheduleMutationHook(
499
+ documents.deleteScheduleActivityAssignmentMtn,
500
+ 'deleteScheduleActivityAssignment',
501
+ );
502
+
503
+ /*
504
+ * Submit runScheduleProject through the shared mutation lifecycle.
505
+ */
506
+ export const useRunScheduleProject = composeScheduleMutationHook(
507
+ documents.runScheduleProjectMtn,
508
+ 'runScheduleProject',
509
+ );
510
+
511
+ /*
512
+ * Submit cancelScheduleProjectRun through the shared mutation lifecycle.
513
+ */
514
+ export const useCancelScheduleProjectRun = composeScheduleMutationHook(
515
+ documents.cancelScheduleProjectRunMtn,
516
+ 'cancelScheduleProjectRun',
517
+ );
518
+
519
+ /*
520
+ * Submit createScheduleBaseline through the shared mutation lifecycle.
521
+ */
522
+ export const useCreateScheduleBaseline = composeScheduleMutationHook(
523
+ documents.createScheduleBaselineMtn,
524
+ 'createScheduleBaseline',
525
+ );
526
+
527
+ /*
528
+ * Submit setScheduleCurrentBaseline through the shared mutation lifecycle.
529
+ */
530
+ export const useSetScheduleCurrentBaseline = composeScheduleMutationHook(
531
+ documents.setScheduleCurrentBaselineMtn,
532
+ 'setScheduleCurrentBaseline',
533
+ );
534
+
535
+ /*
536
+ * Submit deleteScheduleBaseline through the shared mutation lifecycle.
537
+ */
538
+ export const useDeleteScheduleBaseline = composeScheduleMutationHook(
539
+ documents.deleteScheduleBaselineMtn,
540
+ 'deleteScheduleBaseline',
541
+ );
542
+
543
+ /*
544
+ * Submit replaceScheduleCodeType through the shared mutation lifecycle.
545
+ */
546
+ export const useReplaceScheduleCodeType = composeScheduleMutationHook(
547
+ documents.replaceScheduleCodeTypeMtn,
548
+ 'replaceScheduleCodeType',
549
+ );
550
+
551
+ /*
552
+ * Submit deleteScheduleCodeType through the shared mutation lifecycle.
553
+ */
554
+ export const useDeleteScheduleCodeType = composeScheduleMutationHook(
555
+ documents.deleteScheduleCodeTypeMtn,
556
+ 'deleteScheduleCodeType',
557
+ );
558
+
559
+ /*
560
+ * Submit importScheduleProjectPlan through the shared mutation lifecycle.
561
+ */
562
+ export const useImportScheduleProjectPlan = composeScheduleMutationHook(
563
+ documents.importScheduleProjectPlanMtn,
564
+ 'importScheduleProjectPlan',
565
+ );
566
+
567
+ /*
568
+ * Submit deleteScheduleActivity through the shared mutation lifecycle.
569
+ */
570
+ export const useDeleteScheduleActivity = composeScheduleMutationHook(
571
+ documents.deleteScheduleActivityMtn,
572
+ 'deleteScheduleActivity',
573
+ );
574
+
575
+ /*
576
+ * Submit createScheduleRelationship through the shared mutation lifecycle.
577
+ */
578
+ export const useCreateScheduleRelationship = composeScheduleMutationHook(
579
+ documents.createScheduleRelationshipMtn,
580
+ 'createScheduleRelationship',
581
+ );
582
+
583
+ /*
584
+ * Submit deleteScheduleRelationship through the shared mutation lifecycle.
585
+ */
586
+ export const useDeleteScheduleRelationship = composeScheduleMutationHook(
587
+ documents.deleteScheduleRelationshipMtn,
588
+ 'deleteScheduleRelationship',
589
+ );