@jsb188/graphql 1.1.8 → 1.1.11
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.
- package/cache/config.ts +66 -42
- package/cache/index.test.ts +881 -0
- package/cache/index.ts +1815 -979
- package/cache/persist.ts +721 -0
- package/cache/store.ts +437 -0
- package/client/data-table-realtime-subscriptions.test.ts +740 -0
- package/client/data-table-realtime-subscriptions.ts +955 -0
- package/client/data-table-realtime.test.ts +792 -0
- package/client/data-table-realtime.ts +1218 -0
- package/client/fragment-realtime-sequence.ts +52 -0
- package/client/index.ts +4 -2
- package/client/open-sheet.ts +137 -0
- package/client/request-managed-session.test.ts +574 -0
- package/client/request-no-store.test.ts +157 -0
- package/client/request.ts +973 -143
- package/client/sse-ticket.test.ts +26 -0
- package/deno.lock +170 -0
- package/deno.test.json +10 -0
- package/drafts/index.ts +149 -0
- package/drafts/store.ts +397 -0
- package/gql/eagerQueryMap.ts +12 -0
- package/gql/fragments/accountAuthFragments.ts +5 -0
- package/gql/fragments/accountFragments.ts +1 -3
- package/gql/fragments/accountSessionFragments.ts +16 -0
- package/gql/fragments/agentDocFragments.ts +46 -0
- package/gql/fragments/agentMemoryFragments.ts +19 -0
- package/gql/fragments/aiChatFragments.ts +17 -0
- package/gql/fragments/billingFragments.ts +0 -11
- package/gql/fragments/campaignFragments.ts +277 -0
- package/gql/fragments/dataTableFragments.ts +102 -0
- package/gql/fragments/emailFragments.ts +36 -0
- package/gql/fragments/fieldDocFragments.ts +82 -0
- package/gql/fragments/inboundContactFragments.ts +15 -0
- package/gql/fragments/integrationFragments.ts +22 -0
- package/gql/fragments/logFragments.ts +33 -64
- package/gql/fragments/organizationFragments.ts +94 -21
- package/gql/fragments/scheduleFragments.ts +155 -0
- package/gql/fragments/sheetFragments.ts +675 -0
- package/gql/fragments/storageFragments.ts +21 -1
- package/gql/fragments/workflowFragments.ts +67 -0
- package/gql/mutations/accountMutations.ts +24 -4
- package/gql/mutations/agentDocMutations.ts +177 -0
- package/gql/mutations/agentMemoryMutations.ts +36 -0
- package/gql/mutations/aiChatMutations.ts +43 -3
- package/gql/mutations/authMutations.ts +160 -19
- package/gql/mutations/campaignMutations.ts +215 -0
- package/gql/mutations/dataTableMutations.ts +106 -0
- package/gql/mutations/fieldDocMutations.ts +24 -0
- package/gql/mutations/inboundContactMutations.ts +24 -0
- package/gql/mutations/index.ts +17 -8
- package/gql/mutations/integrationMutations.ts +25 -0
- package/gql/mutations/logMutations.ts +10 -19
- package/gql/mutations/organizationMutations.ts +160 -2
- package/gql/mutations/scheduleMutations.ts +423 -0
- package/gql/mutations/sheetMutations.ts +385 -0
- package/gql/mutations/storageMutations.ts +21 -2
- package/gql/mutations/workflowMutations.ts +42 -0
- package/gql/queries/agentDocQueries.ts +120 -0
- package/gql/queries/agentMemoryQueries.ts +22 -0
- package/gql/queries/aiChatQueries.ts +18 -2
- package/gql/queries/authQueries.ts +41 -0
- package/gql/queries/billingQueries.ts +24 -1
- package/gql/queries/campaignQueries.ts +127 -0
- package/gql/queries/dataTableQueries.ts +134 -0
- package/gql/queries/emailQueries.ts +96 -0
- package/gql/queries/fieldDocQueries.ts +158 -0
- package/gql/queries/inboundContactQueries.ts +40 -0
- package/gql/queries/index.ts +17 -6
- package/gql/queries/logQueries.ts +42 -32
- package/gql/queries/organizationQueries.ts +113 -8
- package/gql/queries/scheduleQueries.ts +315 -0
- package/gql/queries/sheetQueries.ts +383 -0
- package/gql/queries/storageQueries.ts +38 -0
- package/gql/queries/workflowQueries.ts +99 -0
- package/hooks/index.ts +2104 -860
- package/hooks/use-account-mtn.ts +91 -48
- package/hooks/use-agentDoc-mtn.ts +285 -0
- package/hooks/use-agentDoc-qry.ts +208 -0
- package/hooks/use-agentMemory-mtn.ts +73 -0
- package/hooks/use-agentMemory-qry.ts +44 -0
- package/hooks/use-aiChat-mtn.ts +248 -97
- package/hooks/use-aiChat-qry.ts +501 -191
- package/hooks/use-app-qry.ts +14 -11
- package/hooks/use-auth-mtn.ts +410 -256
- package/hooks/use-auth-qry.ts +51 -0
- package/hooks/use-campaign-mtn.ts +377 -0
- package/hooks/use-campaign-qry.ts +257 -0
- package/hooks/use-dataTable-mtn.ts +170 -0
- package/hooks/use-dataTable-qry.ts +996 -0
- package/hooks/use-email-qry.ts +227 -0
- package/hooks/use-fieldDoc-mtn.ts +50 -0
- package/hooks/use-fieldDoc-qry.ts +180 -0
- package/hooks/use-inboundContact-mtn.ts +34 -0
- package/hooks/use-inboundContact-qry.ts +96 -0
- package/hooks/use-integration-mtn.ts +77 -0
- package/hooks/use-integration-qry.ts +30 -0
- package/hooks/use-log-mtn.ts +77 -61
- package/hooks/use-log-qry.ts +99 -72
- package/hooks/use-organization-mtn.ts +409 -80
- package/hooks/use-organization-qry.ts +211 -92
- package/hooks/use-schedule-mtn.ts +416 -0
- package/hooks/use-schedule-qry.ts +157 -0
- package/hooks/use-sheet-mtn.ts +367 -0
- package/hooks/use-sheet-qry.ts +440 -0
- package/hooks/use-storage-mtn.ts +83 -42
- package/hooks/use-storage-qry.ts +104 -13
- package/hooks/use-workflow-mtn.ts +55 -0
- package/hooks/use-workflow-qry.ts +230 -0
- package/loaders/campaign.ts +137 -0
- package/package.json +94 -52
- package/sse.ts +158 -105
- package/tsconfig.json +13 -0
- package/types.d.ts +60 -29
- package/utils.ts +77 -50
- package/gql/fragments/actionFragments.ts +0 -16
- package/gql/fragments/productFragments.ts +0 -63
- package/gql/fragments/reportFragments.ts +0 -48
- package/gql/mutations/billingMutations.ts +0 -34
- package/gql/queries/productQueries.ts +0 -70
- package/gql/queries/reportQueries.ts +0 -66
- package/hooks/use-product-qry.ts +0 -109
- package/hooks/use-report-qry.ts +0 -69
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import type { UseMutationParams } from '@jsb188/graphql/types.d';
|
|
2
|
+
import type { OpenModalPopUpFn } from '@jsb188/react/states';
|
|
3
|
+
import {
|
|
4
|
+
FRAGMENT_NAMES,
|
|
5
|
+
makeFragmentKey,
|
|
6
|
+
} from '@jsb188/mday/constants/graphqlReactivity.ts';
|
|
7
|
+
import { updateFragment } from '../cache/index.ts';
|
|
8
|
+
import {
|
|
9
|
+
createSheetMtn,
|
|
10
|
+
createSheetTabMtn,
|
|
11
|
+
deleteSheetMtn,
|
|
12
|
+
deleteSheetTabMtn,
|
|
13
|
+
editSheetCommandBatchMtn,
|
|
14
|
+
editSheetRegionCommandMtn,
|
|
15
|
+
editSheetStructureCommandMtn,
|
|
16
|
+
exportSheetToFileMtn,
|
|
17
|
+
importSheetFromFileMtn,
|
|
18
|
+
reorderSheetTabsMtn,
|
|
19
|
+
updateSheetAccessMtn,
|
|
20
|
+
updateSheetMtn,
|
|
21
|
+
updateSheetTabMtn,
|
|
22
|
+
} from '../gql/mutations/sheetMutations.ts';
|
|
23
|
+
import { useMutation } from './index.ts';
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Create a sheet.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export function useCreateSheet(
|
|
30
|
+
params: UseMutationParams = {},
|
|
31
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
32
|
+
) {
|
|
33
|
+
const [createSheet, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
34
|
+
createSheetMtn,
|
|
35
|
+
{
|
|
36
|
+
openModalPopUp,
|
|
37
|
+
...params,
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
createSheet,
|
|
43
|
+
updateObservers,
|
|
44
|
+
...mtnValues,
|
|
45
|
+
...mtnHandlers,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Update a sheet.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
export function useUpdateSheet(
|
|
54
|
+
params: UseMutationParams = {},
|
|
55
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
56
|
+
) {
|
|
57
|
+
const [updateSheet, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
58
|
+
updateSheetMtn,
|
|
59
|
+
{
|
|
60
|
+
openModalPopUp,
|
|
61
|
+
...params,
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
updateSheet,
|
|
67
|
+
updateObservers,
|
|
68
|
+
...mtnValues,
|
|
69
|
+
...mtnHandlers,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
* Update a sheet's access settings.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
export function useUpdateSheetAccess(
|
|
78
|
+
params: UseMutationParams = {},
|
|
79
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
80
|
+
) {
|
|
81
|
+
const { onCompleted, ...rest } = params;
|
|
82
|
+
|
|
83
|
+
const [updateSheetAccess, mtnValues, mtnHandlers, updateObservers] =
|
|
84
|
+
useMutation(updateSheetAccessMtn, {
|
|
85
|
+
openModalPopUp,
|
|
86
|
+
onCompleted: (data, error, variables) => {
|
|
87
|
+
const updatedSheet = data?.updateSheetAccess;
|
|
88
|
+
|
|
89
|
+
if (updatedSheet?.id) {
|
|
90
|
+
// The origin socket is excluded from the server's realtime emit,
|
|
91
|
+
// so the mutation issuer refreshes its own cached fragment here
|
|
92
|
+
updateFragment(
|
|
93
|
+
makeFragmentKey(FRAGMENT_NAMES.sheet, updatedSheet.id),
|
|
94
|
+
updatedSheet,
|
|
95
|
+
null,
|
|
96
|
+
false,
|
|
97
|
+
updateObservers,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onCompleted?.(updatedSheet, error, variables);
|
|
102
|
+
},
|
|
103
|
+
...rest,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
updateSheetAccess,
|
|
108
|
+
updateObservers,
|
|
109
|
+
...mtnValues,
|
|
110
|
+
...mtnHandlers,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
* Delete a sheet.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
export function useDeleteSheet(
|
|
119
|
+
params: UseMutationParams = {},
|
|
120
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
121
|
+
) {
|
|
122
|
+
const { onCompleted, ...rest } = params;
|
|
123
|
+
const [deleteSheet, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
124
|
+
deleteSheetMtn,
|
|
125
|
+
{
|
|
126
|
+
openModalPopUp,
|
|
127
|
+
onCompleted: (data, error, variables) => {
|
|
128
|
+
const deletedSheetId = data?.deleteSheet;
|
|
129
|
+
if (deletedSheetId) {
|
|
130
|
+
updateFragment(
|
|
131
|
+
makeFragmentKey(FRAGMENT_NAMES.sheet, deletedSheetId),
|
|
132
|
+
{ __deleted: true },
|
|
133
|
+
null,
|
|
134
|
+
false,
|
|
135
|
+
updateObservers,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onCompleted?.(data, error, variables);
|
|
140
|
+
},
|
|
141
|
+
...rest,
|
|
142
|
+
},
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
deleteSheet,
|
|
147
|
+
updateObservers,
|
|
148
|
+
...mtnValues,
|
|
149
|
+
...mtnHandlers,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
* Create a sheet tab.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
export function useCreateSheetTab(
|
|
158
|
+
params: UseMutationParams = {},
|
|
159
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
160
|
+
) {
|
|
161
|
+
const [createSheetTab, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
162
|
+
createSheetTabMtn,
|
|
163
|
+
{
|
|
164
|
+
openModalPopUp,
|
|
165
|
+
...params,
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
createSheetTab,
|
|
171
|
+
updateObservers,
|
|
172
|
+
...mtnValues,
|
|
173
|
+
...mtnHandlers,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
* Import a spreadsheet file into a new or existing sheet.
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
export function useImportSheetFromFile(
|
|
182
|
+
params: UseMutationParams = {},
|
|
183
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
184
|
+
) {
|
|
185
|
+
const [importSheetFromFile, mtnValues, mtnHandlers, updateObservers] =
|
|
186
|
+
useMutation(importSheetFromFileMtn, {
|
|
187
|
+
openModalPopUp,
|
|
188
|
+
...params,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
importSheetFromFile,
|
|
193
|
+
updateObservers,
|
|
194
|
+
...mtnValues,
|
|
195
|
+
...mtnHandlers,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/*
|
|
200
|
+
* Export a spreadsheet to a downloadable file (CSV/TSV/PDF for one tab, XLSX
|
|
201
|
+
* for the whole workbook).
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
export function useExportSheetToFile(
|
|
205
|
+
params: UseMutationParams = {},
|
|
206
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
207
|
+
) {
|
|
208
|
+
const [exportSheetToFile, mtnValues, mtnHandlers, updateObservers] =
|
|
209
|
+
useMutation(exportSheetToFileMtn, {
|
|
210
|
+
openModalPopUp,
|
|
211
|
+
...params,
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
exportSheetToFile,
|
|
216
|
+
updateObservers,
|
|
217
|
+
...mtnValues,
|
|
218
|
+
...mtnHandlers,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
* Update a sheet tab.
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
export function useUpdateSheetTab(
|
|
227
|
+
params: UseMutationParams = {},
|
|
228
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
229
|
+
) {
|
|
230
|
+
const [updateSheetTab, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
231
|
+
updateSheetTabMtn,
|
|
232
|
+
{
|
|
233
|
+
openModalPopUp,
|
|
234
|
+
...params,
|
|
235
|
+
},
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
updateSheetTab,
|
|
240
|
+
updateObservers,
|
|
241
|
+
...mtnValues,
|
|
242
|
+
...mtnHandlers,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/*
|
|
247
|
+
* Reorder sheet tabs.
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
export function useReorderSheetTabs(
|
|
251
|
+
params: UseMutationParams = {},
|
|
252
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
253
|
+
) {
|
|
254
|
+
const [reorderSheetTabs, mtnValues, mtnHandlers, updateObservers] =
|
|
255
|
+
useMutation(reorderSheetTabsMtn, {
|
|
256
|
+
openModalPopUp,
|
|
257
|
+
...params,
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
reorderSheetTabs,
|
|
262
|
+
updateObservers,
|
|
263
|
+
...mtnValues,
|
|
264
|
+
...mtnHandlers,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/*
|
|
269
|
+
* Delete a sheet tab.
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
export function useDeleteSheetTab(
|
|
273
|
+
params: UseMutationParams = {},
|
|
274
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
275
|
+
) {
|
|
276
|
+
const { onCompleted, ...rest } = params;
|
|
277
|
+
const [deleteSheetTab, mtnValues, mtnHandlers, updateObservers] = useMutation(
|
|
278
|
+
deleteSheetTabMtn,
|
|
279
|
+
{
|
|
280
|
+
openModalPopUp,
|
|
281
|
+
onCompleted: (data, error, variables) => {
|
|
282
|
+
if (data?.deleteSheetTab && variables?.sheetTabId) {
|
|
283
|
+
updateFragment(
|
|
284
|
+
makeFragmentKey(FRAGMENT_NAMES.sheetTab, variables.sheetTabId),
|
|
285
|
+
{ __deleted: true },
|
|
286
|
+
null,
|
|
287
|
+
false,
|
|
288
|
+
updateObservers,
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
onCompleted?.(data, error, variables);
|
|
293
|
+
},
|
|
294
|
+
...rest,
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
return {
|
|
299
|
+
deleteSheetTab,
|
|
300
|
+
updateObservers,
|
|
301
|
+
...mtnValues,
|
|
302
|
+
...mtnHandlers,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/*
|
|
307
|
+
* Apply an ordered batch of Sheet edit and history commands in one mutation.
|
|
308
|
+
*/
|
|
309
|
+
export function useEditSheetCommandBatch(
|
|
310
|
+
params: UseMutationParams = {},
|
|
311
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
312
|
+
) {
|
|
313
|
+
const [editSheetCommandBatch, mtnValues, mtnHandlers, updateObservers] =
|
|
314
|
+
useMutation(editSheetCommandBatchMtn, {
|
|
315
|
+
openModalPopUp,
|
|
316
|
+
...params,
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
return {
|
|
320
|
+
editSheetCommandBatch,
|
|
321
|
+
updateObservers,
|
|
322
|
+
...mtnValues,
|
|
323
|
+
...mtnHandlers,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/*
|
|
328
|
+
* Upsert or delete one Sheet region through the durable command contract.
|
|
329
|
+
*/
|
|
330
|
+
export function useEditSheetRegionCommand(
|
|
331
|
+
params: UseMutationParams = {},
|
|
332
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
333
|
+
) {
|
|
334
|
+
const [editSheetRegionCommand, mtnValues, mtnHandlers, updateObservers] =
|
|
335
|
+
useMutation(editSheetRegionCommandMtn, {
|
|
336
|
+
openModalPopUp,
|
|
337
|
+
...params,
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
editSheetRegionCommand,
|
|
342
|
+
updateObservers,
|
|
343
|
+
...mtnValues,
|
|
344
|
+
...mtnHandlers,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/*
|
|
349
|
+
* Insert or delete one Sheet row or column through durable command history.
|
|
350
|
+
*/
|
|
351
|
+
export function useEditSheetStructureCommand(
|
|
352
|
+
params: UseMutationParams = {},
|
|
353
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
354
|
+
) {
|
|
355
|
+
const [editSheetStructureCommand, mtnValues, mtnHandlers, updateObservers] =
|
|
356
|
+
useMutation(editSheetStructureCommandMtn, {
|
|
357
|
+
openModalPopUp,
|
|
358
|
+
...params,
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
return {
|
|
362
|
+
editSheetStructureCommand,
|
|
363
|
+
updateObservers,
|
|
364
|
+
...mtnValues,
|
|
365
|
+
...mtnHandlers,
|
|
366
|
+
};
|
|
367
|
+
}
|