@jsb188/graphql 1.1.10 → 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 +64 -50
- package/cache/index.test.ts +671 -109
- package/cache/index.ts +1700 -1240
- 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 +2 -0
- 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 +954 -163
- package/client/sse-ticket.test.ts +26 -0
- package/deno.lock +170 -0
- package/deno.test.json +8 -4
- 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 +0 -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 +16 -0
- package/gql/fragments/billingFragments.ts +0 -11
- package/gql/fragments/campaignFragments.ts +277 -0
- package/gql/fragments/dataTableFragments.ts +18 -128
- package/gql/fragments/emailFragments.ts +19 -9
- package/gql/fragments/fieldDocFragments.ts +82 -0
- package/gql/fragments/logFragments.ts +20 -79
- package/gql/fragments/organizationFragments.ts +43 -5
- package/gql/fragments/scheduleFragments.ts +155 -0
- package/gql/fragments/sheetFragments.ts +552 -22
- package/gql/fragments/storageFragments.ts +21 -0
- package/gql/fragments/workflowFragments.ts +28 -4
- package/gql/mutations/accountMutations.ts +0 -2
- package/gql/mutations/agentDocMutations.ts +177 -0
- package/gql/mutations/agentMemoryMutations.ts +36 -0
- package/gql/mutations/aiChatMutations.ts +17 -4
- package/gql/mutations/authMutations.ts +158 -17
- package/gql/mutations/campaignMutations.ts +215 -0
- package/gql/mutations/dataTableMutations.ts +48 -26
- package/gql/mutations/fieldDocMutations.ts +24 -0
- package/gql/mutations/index.ts +6 -1
- package/gql/mutations/logMutations.ts +6 -29
- package/gql/mutations/organizationMutations.ts +13 -4
- package/gql/mutations/scheduleMutations.ts +423 -0
- package/gql/mutations/sheetMutations.ts +273 -56
- package/gql/mutations/storageMutations.ts +20 -0
- 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 +23 -0
- package/gql/queries/campaignQueries.ts +127 -0
- package/gql/queries/dataTableQueries.ts +100 -11
- package/gql/queries/emailQueries.ts +55 -3
- package/gql/queries/fieldDocQueries.ts +158 -0
- package/gql/queries/index.ts +8 -2
- package/gql/queries/logQueries.ts +11 -28
- package/gql/queries/organizationQueries.ts +52 -1
- package/gql/queries/scheduleQueries.ts +315 -0
- package/gql/queries/sheetQueries.ts +336 -25
- package/gql/queries/storageQueries.ts +38 -0
- package/gql/queries/workflowQueries.ts +72 -3
- package/hooks/index.ts +2065 -971
- package/hooks/use-account-mtn.ts +76 -81
- 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 +232 -137
- package/hooks/use-aiChat-qry.ts +480 -222
- package/hooks/use-app-qry.ts +12 -9
- package/hooks/use-auth-mtn.ts +406 -252
- 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 +116 -33
- package/hooks/use-dataTable-qry.ts +859 -35
- package/hooks/use-email-qry.ts +194 -79
- package/hooks/use-fieldDoc-mtn.ts +50 -0
- package/hooks/use-fieldDoc-qry.ts +180 -0
- package/hooks/use-inboundContact-mtn.ts +19 -16
- package/hooks/use-inboundContact-qry.ts +63 -55
- package/hooks/use-integration-mtn.ts +56 -38
- package/hooks/use-integration-qry.ts +24 -9
- package/hooks/use-log-mtn.ts +72 -56
- package/hooks/use-log-qry.ts +93 -69
- package/hooks/use-organization-mtn.ts +334 -277
- package/hooks/use-organization-qry.ts +199 -129
- package/hooks/use-schedule-mtn.ts +416 -0
- package/hooks/use-schedule-qry.ts +157 -0
- package/hooks/use-sheet-mtn.ts +233 -47
- package/hooks/use-sheet-qry.ts +353 -70
- package/hooks/use-storage-mtn.ts +81 -41
- package/hooks/use-storage-qry.ts +104 -13
- package/hooks/use-workflow-mtn.ts +55 -0
- package/hooks/use-workflow-qry.ts +206 -48
- package/loaders/campaign.ts +137 -0
- package/package.json +94 -71
- package/sse.ts +157 -104
- package/tsconfig.json +11 -10
- package/types.d.ts +60 -30
- package/utils.ts +78 -49
- package/gql/fragments/productFragments.ts +0 -39
- package/gql/fragments/reportFragments.ts +0 -90
- package/gql/mutations/billingMutations.ts +0 -34
- package/gql/queries/productQueries.ts +0 -31
- package/gql/queries/reportQueries.ts +0 -134
- package/hooks/use-product-qry.ts +0 -67
- package/hooks/use-report-qry.ts +0 -153
|
@@ -1,23 +1,95 @@
|
|
|
1
1
|
import type { UseMutationParams } from '@jsb188/graphql/types.d';
|
|
2
|
-
import { OpenModalPopUpFn } from '@jsb188/react/states';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { OpenModalPopUpFn } from '@jsb188/react/states';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
createDataTableMtn,
|
|
6
|
+
deleteDataTableMtn,
|
|
7
|
+
deleteDataTableRowsMtn,
|
|
8
|
+
editDataTableCellsMtn,
|
|
9
|
+
editDataTableDesignMtn,
|
|
10
|
+
} from '../gql/mutations/dataTableMutations.ts';
|
|
11
|
+
import { type GraphQLMutationFn, useMutation } from './index.ts';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Add one UUID to a logical DataTable mutation invocation. The lower-level
|
|
15
|
+
* mutation hook reuses this same variables object for every transport retry.
|
|
16
|
+
*/
|
|
17
|
+
function useDataTableCommandMutation(mutate: GraphQLMutationFn) {
|
|
18
|
+
return useCallback<GraphQLMutationFn>(
|
|
19
|
+
(graphqlOptions, triedCount) => {
|
|
20
|
+
const commandId =
|
|
21
|
+
graphqlOptions?.variables?.commandId ?? crypto.randomUUID();
|
|
22
|
+
|
|
23
|
+
return mutate(
|
|
24
|
+
{
|
|
25
|
+
...graphqlOptions,
|
|
26
|
+
variables: {
|
|
27
|
+
...(graphqlOptions?.variables || {}),
|
|
28
|
+
commandId,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
triedCount,
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
[mutate],
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Keep authoritative DataTable mutation responses out of normalized cache so
|
|
40
|
+
* a delayed HTTP response cannot overwrite a newer sequenced websocket event.
|
|
41
|
+
*/
|
|
42
|
+
function useAuthoritativeDataTableMutation(
|
|
43
|
+
mutation: any,
|
|
44
|
+
params: UseMutationParams,
|
|
45
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
46
|
+
) {
|
|
47
|
+
return useMutation(mutation, {
|
|
48
|
+
openModalPopUp,
|
|
49
|
+
...params,
|
|
50
|
+
cachePolicy: 'no-store',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
5
53
|
|
|
6
54
|
/**
|
|
7
|
-
*
|
|
55
|
+
* Create a dataTable.
|
|
8
56
|
*/
|
|
9
57
|
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
58
|
+
export function useCreateDataTable(
|
|
59
|
+
params: UseMutationParams = {},
|
|
60
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
61
|
+
) {
|
|
62
|
+
const [createDataTable, mtnValues, mtnHandlers, updateObservers] =
|
|
63
|
+
useMutation(createDataTableMtn, {
|
|
14
64
|
openModalPopUp,
|
|
15
65
|
...params,
|
|
16
|
-
}
|
|
17
|
-
);
|
|
66
|
+
});
|
|
18
67
|
|
|
19
68
|
return {
|
|
20
|
-
|
|
69
|
+
createDataTable,
|
|
70
|
+
updateObservers,
|
|
71
|
+
...mtnValues,
|
|
72
|
+
...mtnHandlers,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Delete a dataTable.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export function useDeleteDataTable(
|
|
81
|
+
params: UseMutationParams = {},
|
|
82
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
83
|
+
) {
|
|
84
|
+
const [deleteDataTable, mtnValues, mtnHandlers, updateObservers] =
|
|
85
|
+
useAuthoritativeDataTableMutation(
|
|
86
|
+
deleteDataTableMtn,
|
|
87
|
+
params,
|
|
88
|
+
openModalPopUp,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
deleteDataTable,
|
|
21
93
|
updateObservers,
|
|
22
94
|
...mtnValues,
|
|
23
95
|
...mtnHandlers,
|
|
@@ -28,14 +100,17 @@ export function useEditDataTableCell(params: UseMutationParams = {}, openModalPo
|
|
|
28
100
|
* Edit multiple dataTable cell values.
|
|
29
101
|
*/
|
|
30
102
|
|
|
31
|
-
export function useEditDataTableCells(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
103
|
+
export function useEditDataTableCells(
|
|
104
|
+
params: UseMutationParams = {},
|
|
105
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
106
|
+
) {
|
|
107
|
+
const [mutateDataTableCells, mtnValues, mtnHandlers, updateObservers] =
|
|
108
|
+
useAuthoritativeDataTableMutation(
|
|
109
|
+
editDataTableCellsMtn,
|
|
110
|
+
params,
|
|
35
111
|
openModalPopUp,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
112
|
+
);
|
|
113
|
+
const editDataTableCells = useDataTableCommandMutation(mutateDataTableCells);
|
|
39
114
|
|
|
40
115
|
return {
|
|
41
116
|
editDataTableCells,
|
|
@@ -46,20 +121,23 @@ export function useEditDataTableCells(params: UseMutationParams = {}, openModalP
|
|
|
46
121
|
}
|
|
47
122
|
|
|
48
123
|
/**
|
|
49
|
-
* Delete
|
|
124
|
+
* Delete source dataTable rows.
|
|
50
125
|
*/
|
|
51
126
|
|
|
52
|
-
export function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
127
|
+
export function useDeleteDataTableRows(
|
|
128
|
+
params: UseMutationParams = {},
|
|
129
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
130
|
+
) {
|
|
131
|
+
const [mutateDataTableRows, mtnValues, mtnHandlers] =
|
|
132
|
+
useAuthoritativeDataTableMutation(
|
|
133
|
+
deleteDataTableRowsMtn,
|
|
134
|
+
params,
|
|
56
135
|
openModalPopUp,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
136
|
+
);
|
|
137
|
+
const deleteDataTableRows = useDataTableCommandMutation(mutateDataTableRows);
|
|
60
138
|
|
|
61
139
|
return {
|
|
62
|
-
|
|
140
|
+
deleteDataTableRows,
|
|
63
141
|
...mtnValues,
|
|
64
142
|
...mtnHandlers,
|
|
65
143
|
};
|
|
@@ -69,13 +147,18 @@ export function useDeleteDataTableRow(params: UseMutationParams = {}, openModalP
|
|
|
69
147
|
* Edit the saved design object for one dataTable.
|
|
70
148
|
*/
|
|
71
149
|
|
|
72
|
-
export function useEditDataTableDesign(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
150
|
+
export function useEditDataTableDesign(
|
|
151
|
+
params: UseMutationParams = {},
|
|
152
|
+
openModalPopUp?: OpenModalPopUpFn,
|
|
153
|
+
) {
|
|
154
|
+
const [mutateDataTableDesign, mtnValues, mtnHandlers, updateObservers] =
|
|
155
|
+
useAuthoritativeDataTableMutation(
|
|
156
|
+
editDataTableDesignMtn,
|
|
157
|
+
params,
|
|
76
158
|
openModalPopUp,
|
|
77
|
-
|
|
78
|
-
|
|
159
|
+
);
|
|
160
|
+
const editDataTableDesign = useDataTableCommandMutation(
|
|
161
|
+
mutateDataTableDesign,
|
|
79
162
|
);
|
|
80
163
|
|
|
81
164
|
return {
|