@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,416 +1,299 @@
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
  */
34
-
35
- function patchOccurrenceFragment(occurrence: any, updateObservers: any) {
36
- if (!occurrence?.id) {
37
- return;
38
- }
39
-
40
- updateFragment(
41
- makeFragmentKey(FRAGMENT_NAMES.scheduleOccurrence, occurrence.id),
42
- occurrence,
43
- null,
44
- false,
45
- updateObservers,
46
- );
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
+ };
47
42
  }
48
43
 
49
44
  /*
50
- * Patch the issuing client's own cached request, for the same reason.
45
+ * Submit createScheduleWorkCalendar through the shared mutation lifecycle.
51
46
  */
52
-
53
- function patchRequestFragment(request: any, updateObservers: any) {
54
- if (!request?.id) {
55
- return;
56
- }
57
-
58
- updateFragment(
59
- makeFragmentKey(FRAGMENT_NAMES.scheduleRequest, request.id),
60
- request,
61
- null,
62
- false,
63
- updateObservers,
64
- );
65
- }
47
+ export const useCreateScheduleWorkCalendar = composeScheduleMutationHook(
48
+ documents.createScheduleWorkCalendarMtn,
49
+ 'createScheduleWorkCalendar',
50
+ );
66
51
 
67
52
  /*
68
- * Create one occurrence.
53
+ * Submit updateScheduleWorkCalendar through the shared mutation lifecycle.
69
54
  */
70
-
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
- }
55
+ export const useUpdateScheduleWorkCalendar = composeScheduleMutationHook(
56
+ documents.updateScheduleWorkCalendarMtn,
57
+ 'updateScheduleWorkCalendar',
58
+ );
85
59
 
86
60
  /*
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.
61
+ * Submit setScheduleWorkCalendarException through the shared mutation lifecycle.
93
62
  */
94
-
95
- export function useUpdateScheduleOccurrence(
96
- params: UseMutationParams = {},
97
- openModalPopUp?: OpenModalPopUpFn,
98
- ) {
99
- const { onCompleted, ...rest } = params;
100
-
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
- });
113
-
114
- return {
115
- updateScheduleOccurrence,
116
- updateObservers,
117
- ...mtnValues,
118
- ...mtnHandlers,
119
- };
120
- }
63
+ export const useSetScheduleWorkCalendarException = composeScheduleMutationHook(
64
+ documents.setScheduleWorkCalendarExceptionMtn,
65
+ 'setScheduleWorkCalendarException',
66
+ );
121
67
 
122
68
  /*
123
- * Cancel one occurrence. The row survives, struck through on the calendar.
69
+ * Submit deleteScheduleWorkCalendar through the shared mutation lifecycle.
124
70
  */
125
-
126
- export function useCancelScheduleOccurrence(
127
- params: UseMutationParams = {},
128
- openModalPopUp?: OpenModalPopUpFn,
129
- ) {
130
- const { onCompleted, ...rest } = params;
131
-
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
- });
144
-
145
- return {
146
- cancelScheduleOccurrence,
147
- updateObservers,
148
- ...mtnValues,
149
- ...mtnHandlers,
150
- };
151
- }
71
+ export const useDeleteScheduleWorkCalendar = composeScheduleMutationHook(
72
+ documents.deleteScheduleWorkCalendarMtn,
73
+ 'deleteScheduleWorkCalendar',
74
+ );
152
75
 
153
76
  /*
154
- * Delete one occurrence outright.
77
+ * Submit createScheduleResource through the shared mutation lifecycle.
155
78
  */
156
-
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
- }
79
+ export const useCreateScheduleResource = composeScheduleMutationHook(
80
+ documents.createScheduleResourceMtn,
81
+ 'createScheduleResource',
82
+ );
171
83
 
172
84
  /*
173
- * Assign somebody to one occurrence.
85
+ * Submit updateScheduleResource through the shared mutation lifecycle.
174
86
  */
175
-
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
- }
87
+ export const useUpdateScheduleResource = composeScheduleMutationHook(
88
+ documents.updateScheduleResourceMtn,
89
+ 'updateScheduleResource',
90
+ );
190
91
 
191
92
  /*
192
- * Release one assignment, keeping the row as history.
93
+ * Submit createScheduleResourceCapacity through the shared mutation lifecycle.
193
94
  */
194
-
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
- }
95
+ export const useCreateScheduleResourceCapacity = composeScheduleMutationHook(
96
+ documents.createScheduleResourceCapacityMtn,
97
+ 'createScheduleResourceCapacity',
98
+ );
209
99
 
210
100
  /*
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.
101
+ * Submit deleteScheduleResourceCapacity through the shared mutation lifecycle.
216
102
  */
217
-
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
- }
103
+ export const useDeleteScheduleResourceCapacity = composeScheduleMutationHook(
104
+ documents.deleteScheduleResourceCapacityMtn,
105
+ 'deleteScheduleResourceCapacity',
106
+ );
232
107
 
233
108
  /*
234
- * Open a request (give away a shift, ask for time off, propose a swap).
109
+ * Submit updateMyScheduleNotifyPrefs through the shared mutation lifecycle.
235
110
  */
111
+ export const useUpdateMyScheduleNotifyPrefs = composeScheduleMutationHook(
112
+ documents.updateMyScheduleNotifyPrefsMtn,
113
+ 'updateMyScheduleNotifyPrefs',
114
+ );
236
115
 
237
- export function useCreateScheduleRequest(
238
- params: UseMutationParams = {},
239
- openModalPopUp?: OpenModalPopUpFn,
240
- ) {
241
- const { onCompleted, ...rest } = params;
116
+ /*
117
+ * Submit createScheduleProject through the shared mutation lifecycle.
118
+ */
119
+ export const useCreateScheduleProject = composeScheduleMutationHook(
120
+ documents.createScheduleProjectMtn,
121
+ 'createScheduleProject',
122
+ );
242
123
 
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
- });
124
+ /*
125
+ * Submit updateScheduleProject through the shared mutation lifecycle.
126
+ */
127
+ export const useUpdateScheduleProject = composeScheduleMutationHook(
128
+ documents.updateScheduleProjectMtn,
129
+ 'updateScheduleProject',
130
+ );
252
131
 
253
- return {
254
- createScheduleRequest,
255
- updateObservers,
256
- ...mtnValues,
257
- ...mtnHandlers,
258
- };
259
- }
132
+ /*
133
+ * Submit deleteScheduleProject through the shared mutation lifecycle.
134
+ */
135
+ export const useDeleteScheduleProject = composeScheduleMutationHook(
136
+ documents.deleteScheduleProjectMtn,
137
+ 'deleteScheduleProject',
138
+ );
260
139
 
261
140
  /*
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.
141
+ * Submit createScheduleWbsNode through the shared mutation lifecycle.
267
142
  */
143
+ export const useCreateScheduleWbsNode = composeScheduleMutationHook(
144
+ documents.createScheduleWbsNodeMtn,
145
+ 'createScheduleWbsNode',
146
+ );
268
147
 
269
- export function useClaimScheduleRequest(
270
- params: UseMutationParams = {},
271
- openModalPopUp?: OpenModalPopUpFn,
272
- ) {
273
- const { onCompleted, ...rest } = params;
148
+ /*
149
+ * Submit updateScheduleWbsNode through the shared mutation lifecycle.
150
+ */
151
+ export const useUpdateScheduleWbsNode = composeScheduleMutationHook(
152
+ documents.updateScheduleWbsNodeMtn,
153
+ 'updateScheduleWbsNode',
154
+ );
274
155
 
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
- });
156
+ /*
157
+ * Submit deleteScheduleWbsNode through the shared mutation lifecycle.
158
+ */
159
+ export const useDeleteScheduleWbsNode = composeScheduleMutationHook(
160
+ documents.deleteScheduleWbsNodeMtn,
161
+ 'deleteScheduleWbsNode',
162
+ );
284
163
 
285
- return {
286
- claimScheduleRequest,
287
- updateObservers,
288
- ...mtnValues,
289
- ...mtnHandlers,
290
- };
291
- }
164
+ /*
165
+ * Submit createScheduleActivities through the shared mutation lifecycle.
166
+ */
167
+ export const useCreateScheduleActivities = composeScheduleMutationHook(
168
+ documents.createScheduleActivitiesMtn,
169
+ 'createScheduleActivities',
170
+ );
292
171
 
293
172
  /*
294
- * Decline one swap, as the colleague it was addressed to.
173
+ * Submit updateScheduleActivity through the shared mutation lifecycle.
295
174
  */
175
+ export const useUpdateScheduleActivity = composeScheduleMutationHook(
176
+ documents.updateScheduleActivityMtn,
177
+ 'updateScheduleActivity',
178
+ );
296
179
 
297
- export function useDeclineScheduleRequest(
298
- params: UseMutationParams = {},
299
- openModalPopUp?: OpenModalPopUpFn,
300
- ) {
301
- const { onCompleted, ...rest } = params;
180
+ /*
181
+ * Submit deleteScheduleActivities through the shared mutation lifecycle.
182
+ */
183
+ export const useDeleteScheduleActivities = composeScheduleMutationHook(
184
+ documents.deleteScheduleActivitiesMtn,
185
+ 'deleteScheduleActivities',
186
+ );
302
187
 
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
- });
188
+ /*
189
+ * Submit moveScheduleActivities through the shared mutation lifecycle.
190
+ */
191
+ export const useMoveScheduleActivities = composeScheduleMutationHook(
192
+ documents.moveScheduleActivitiesMtn,
193
+ 'moveScheduleActivities',
194
+ );
312
195
 
313
- return {
314
- declineScheduleRequest,
315
- updateObservers,
316
- ...mtnValues,
317
- ...mtnHandlers,
318
- };
319
- }
196
+ /*
197
+ * Submit reviewScheduleActivities through the shared mutation lifecycle.
198
+ */
199
+ export const useReviewScheduleActivities = composeScheduleMutationHook(
200
+ documents.reviewScheduleActivitiesMtn,
201
+ 'reviewScheduleActivities',
202
+ );
320
203
 
321
204
  /*
322
- * Withdraw one's own request.
205
+ * Submit createScheduleRelationships through the shared mutation lifecycle.
323
206
  */
207
+ export const useCreateScheduleRelationships = composeScheduleMutationHook(
208
+ documents.createScheduleRelationshipsMtn,
209
+ 'createScheduleRelationships',
210
+ );
324
211
 
325
- export function useWithdrawScheduleRequest(
326
- params: UseMutationParams = {},
327
- openModalPopUp?: OpenModalPopUpFn,
328
- ) {
329
- const { onCompleted, ...rest } = params;
212
+ /*
213
+ * Replace incoming relationships in one versioned transaction.
214
+ */
215
+ export const useReplaceScheduleActivityPredecessors =
216
+ composeScheduleMutationHook(
217
+ documents.replaceScheduleActivityPredecessorsMtn,
218
+ 'replaceScheduleActivityPredecessors',
219
+ );
330
220
 
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
- });
221
+ /*
222
+ * Submit updateScheduleRelationship through the shared mutation lifecycle.
223
+ */
224
+ export const useUpdateScheduleRelationship = composeScheduleMutationHook(
225
+ documents.updateScheduleRelationshipMtn,
226
+ 'updateScheduleRelationship',
227
+ );
340
228
 
341
- return {
342
- withdrawScheduleRequest,
343
- updateObservers,
344
- ...mtnValues,
345
- ...mtnHandlers,
346
- };
347
- }
229
+ /*
230
+ * Submit deleteScheduleRelationships through the shared mutation lifecycle.
231
+ */
232
+ export const useDeleteScheduleRelationships = composeScheduleMutationHook(
233
+ documents.deleteScheduleRelationshipsMtn,
234
+ 'deleteScheduleRelationships',
235
+ );
348
236
 
349
237
  /*
350
- * Approve or deny one request.
238
+ * Submit replaceScheduleActivityAssignment through the shared mutation lifecycle.
351
239
  */
240
+ export const useReplaceScheduleActivityAssignment = composeScheduleMutationHook(
241
+ documents.replaceScheduleActivityAssignmentMtn,
242
+ 'replaceScheduleActivityAssignment',
243
+ );
352
244
 
353
- export function useDecideScheduleRequest(
354
- params: UseMutationParams = {},
355
- openModalPopUp?: OpenModalPopUpFn,
356
- ) {
357
- const { onCompleted, ...rest } = params;
245
+ /*
246
+ * Submit deleteScheduleActivityAssignment through the shared mutation lifecycle.
247
+ */
248
+ export const useDeleteScheduleActivityAssignment = composeScheduleMutationHook(
249
+ documents.deleteScheduleActivityAssignmentMtn,
250
+ 'deleteScheduleActivityAssignment',
251
+ );
358
252
 
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
- });
253
+ /*
254
+ * Submit runScheduleProject through the shared mutation lifecycle.
255
+ */
256
+ export const useRunScheduleProject = composeScheduleMutationHook(
257
+ documents.runScheduleProjectMtn,
258
+ 'runScheduleProject',
259
+ );
368
260
 
369
- return {
370
- decideScheduleRequest,
371
- updateObservers,
372
- ...mtnValues,
373
- ...mtnHandlers,
374
- };
375
- }
261
+ /*
262
+ * Submit cancelScheduleProjectRun through the shared mutation lifecycle.
263
+ */
264
+ export const useCancelScheduleProjectRun = composeScheduleMutationHook(
265
+ documents.cancelScheduleProjectRunMtn,
266
+ 'cancelScheduleProjectRun',
267
+ );
376
268
 
377
269
  /*
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.
270
+ * Submit createScheduleBaseline through the shared mutation lifecycle.
382
271
  */
272
+ export const useCreateScheduleBaseline = composeScheduleMutationHook(
273
+ documents.createScheduleBaselineMtn,
274
+ 'createScheduleBaseline',
275
+ );
383
276
 
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
- }
277
+ /*
278
+ * Submit setScheduleCurrentBaseline through the shared mutation lifecycle.
279
+ */
280
+ export const useSetScheduleCurrentBaseline = composeScheduleMutationHook(
281
+ documents.setScheduleCurrentBaselineMtn,
282
+ 'setScheduleCurrentBaseline',
283
+ );
398
284
 
399
285
  /*
400
- * Revoke one calendar subscription token.
286
+ * Submit deleteScheduleBaseline through the shared mutation lifecycle.
401
287
  */
288
+ export const useDeleteScheduleBaseline = composeScheduleMutationHook(
289
+ documents.deleteScheduleBaselineMtn,
290
+ 'deleteScheduleBaseline',
291
+ );
402
292
 
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
- }
293
+ /*
294
+ * Submit importScheduleProjectPlan through the shared mutation lifecycle.
295
+ */
296
+ export const useImportScheduleProjectPlan = composeScheduleMutationHook(
297
+ documents.importScheduleProjectPlanMtn,
298
+ 'importScheduleProjectPlan',
299
+ );