@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
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { useQuery, useReactiveFragment } from '@jsb188/graphql/client';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import type { ChildOrgsFilterArgs } from '@jsb188/mday/types/organization.d.ts';
|
|
3
|
+
import {
|
|
4
|
+
FRAGMENT_NAMES,
|
|
5
|
+
makeFragmentKey,
|
|
6
|
+
} from '@jsb188/mday/constants/graphqlReactivity.ts';
|
|
7
|
+
export {
|
|
8
|
+
useInboundContact,
|
|
9
|
+
useInboundContacts,
|
|
10
|
+
useReactiveInboundContactFragment,
|
|
11
|
+
} from './use-inboundContact-qry.ts';
|
|
12
|
+
import {
|
|
13
|
+
childOrganizationsQry,
|
|
14
|
+
myOrganizationsQry,
|
|
15
|
+
organizationMembersQry,
|
|
16
|
+
organizationSitesQry,
|
|
17
|
+
pageRoutesQry,
|
|
18
|
+
} from '../gql/queries/organizationQueries.ts';
|
|
19
|
+
import type { PaginationArgs, UseQueryParams } from '../types.d.ts';
|
|
5
20
|
|
|
6
21
|
const ORG_CHILDREN_LIMIT = 250;
|
|
7
22
|
|
|
@@ -10,55 +25,98 @@ const ORG_CHILDREN_LIMIT = 250;
|
|
|
10
25
|
*/
|
|
11
26
|
|
|
12
27
|
export function useMyOrganizations(params: UseQueryParams = {}) {
|
|
13
|
-
|
|
28
|
+
const { data, ...rest } = useQuery(myOrganizationsQry, {
|
|
29
|
+
...params,
|
|
30
|
+
persistTime: params.persistTime ?? 15 * 60 * 1000,
|
|
31
|
+
});
|
|
14
32
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
return {
|
|
34
|
+
myOrganizations: data?.myOrganizations,
|
|
35
|
+
...rest,
|
|
36
|
+
};
|
|
19
37
|
}
|
|
20
38
|
|
|
21
39
|
/**
|
|
22
|
-
* Fetch organization
|
|
40
|
+
* Fetch organization members
|
|
23
41
|
*/
|
|
24
42
|
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
export function useOrganizationMembers(
|
|
44
|
+
organizationId: string | null,
|
|
45
|
+
paramsOrShowGuests: UseQueryParams | boolean = {},
|
|
46
|
+
showGuests_: boolean = false,
|
|
47
|
+
) {
|
|
48
|
+
const params =
|
|
49
|
+
typeof paramsOrShowGuests === 'boolean' ? {} : paramsOrShowGuests;
|
|
50
|
+
const showGuests =
|
|
51
|
+
typeof paramsOrShowGuests === 'boolean' ? paramsOrShowGuests : showGuests_;
|
|
52
|
+
|
|
53
|
+
const { data, ...rest } = useQuery(organizationMembersQry, {
|
|
54
|
+
variables: {
|
|
55
|
+
organizationId,
|
|
56
|
+
showGuests,
|
|
57
|
+
},
|
|
58
|
+
skip: !organizationId || params.skip,
|
|
59
|
+
...params,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
organizationMembers: data?.organizationMembers,
|
|
64
|
+
...rest,
|
|
65
|
+
};
|
|
38
66
|
}
|
|
39
67
|
|
|
40
68
|
/**
|
|
41
|
-
*
|
|
69
|
+
* Fetch organization sites
|
|
42
70
|
*/
|
|
43
71
|
|
|
44
|
-
export function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
export function useOrganizationSites(
|
|
73
|
+
organizationId: string | null,
|
|
74
|
+
parentId: string | null,
|
|
75
|
+
params: UseQueryParams = {},
|
|
76
|
+
) {
|
|
77
|
+
const { data, ...rest } = useQuery(organizationSitesQry, {
|
|
78
|
+
variables: {
|
|
79
|
+
organizationId,
|
|
80
|
+
parentId,
|
|
81
|
+
},
|
|
82
|
+
skip: !organizationId || params.skip,
|
|
83
|
+
...params,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
organizationSites: data?.organizationSites,
|
|
88
|
+
...rest,
|
|
89
|
+
};
|
|
50
90
|
}
|
|
51
91
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
export function useReactiveOrganization(
|
|
93
|
+
orgId: string,
|
|
94
|
+
currentData?: any,
|
|
95
|
+
queryCount?: number,
|
|
96
|
+
) {
|
|
97
|
+
return useReactiveFragment(
|
|
98
|
+
currentData,
|
|
99
|
+
[makeFragmentKey(FRAGMENT_NAMES.organization, orgId)],
|
|
100
|
+
queryCount,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
55
103
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
104
|
+
/*
|
|
105
|
+
* Get reactive organization settings fragment data.
|
|
106
|
+
*/
|
|
107
|
+
export function useReactiveOrganizationSettings(
|
|
108
|
+
orgId: string | null | undefined,
|
|
109
|
+
currentData?: any,
|
|
110
|
+
queryCount?: number,
|
|
111
|
+
) {
|
|
112
|
+
return useReactiveFragment(
|
|
113
|
+
currentData,
|
|
114
|
+
orgId ? [makeFragmentKey(FRAGMENT_NAMES.organizationSettings, orgId)] : [],
|
|
115
|
+
queryCount,
|
|
116
|
+
undefined,
|
|
117
|
+
undefined,
|
|
118
|
+
true,
|
|
119
|
+
);
|
|
62
120
|
}
|
|
63
121
|
|
|
64
122
|
/**
|
|
@@ -66,76 +124,137 @@ export function useReactiveOrganization(orgId: string, currentData?: any, queryC
|
|
|
66
124
|
*/
|
|
67
125
|
|
|
68
126
|
export function useOrgRelFromMyOrganizations(organizationId: string | null) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
127
|
+
const { myOrganizations, ...rest } = useMyOrganizations({
|
|
128
|
+
skip: !organizationId,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const orgRel =
|
|
132
|
+
myOrganizations?.find(
|
|
133
|
+
(orgRel: any) => orgRel.organization?.id === organizationId,
|
|
134
|
+
) || null;
|
|
135
|
+
const reactiveOrganization = useReactiveOrganization(
|
|
136
|
+
orgRel?.organization?.id,
|
|
137
|
+
orgRel?.organization,
|
|
138
|
+
);
|
|
139
|
+
const reactiveSettings = useReactiveOrganizationSettings(
|
|
140
|
+
reactiveOrganization?.id,
|
|
141
|
+
reactiveOrganization?.settings,
|
|
142
|
+
);
|
|
143
|
+
const organization =
|
|
144
|
+
reactiveOrganization && reactiveSettings
|
|
145
|
+
? {
|
|
146
|
+
...reactiveOrganization,
|
|
147
|
+
settings: reactiveSettings,
|
|
148
|
+
}
|
|
149
|
+
: reactiveOrganization;
|
|
150
|
+
const organizationRelationship =
|
|
151
|
+
orgRel && organization
|
|
152
|
+
? {
|
|
153
|
+
...orgRel,
|
|
154
|
+
organization,
|
|
155
|
+
}
|
|
156
|
+
: orgRel;
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
organizationRelationship,
|
|
160
|
+
organization,
|
|
161
|
+
myOrganizations,
|
|
162
|
+
...rest,
|
|
163
|
+
};
|
|
82
164
|
}
|
|
83
165
|
|
|
84
166
|
/**
|
|
85
167
|
* Fetch child organizations
|
|
86
168
|
*/
|
|
87
169
|
|
|
88
|
-
export function useChildOrganizations(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
170
|
+
export function useChildOrganizations(
|
|
171
|
+
variables: PaginationArgs & {
|
|
172
|
+
organizationId?: string | null;
|
|
173
|
+
filter?: ChildOrgsFilterArgs;
|
|
174
|
+
},
|
|
175
|
+
params: UseQueryParams = {},
|
|
176
|
+
) {
|
|
177
|
+
const { data, ...rest } = useQuery(childOrganizationsQry, {
|
|
178
|
+
variables: {
|
|
179
|
+
...variables,
|
|
180
|
+
cursor: null,
|
|
181
|
+
after: true,
|
|
182
|
+
limit: ORG_CHILDREN_LIMIT,
|
|
183
|
+
},
|
|
184
|
+
skip: !variables.organizationId,
|
|
185
|
+
...params,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
childOrganizations: data?.childOrganizations,
|
|
190
|
+
...rest,
|
|
191
|
+
};
|
|
107
192
|
}
|
|
108
193
|
|
|
109
194
|
/**
|
|
110
195
|
* Get reactive organization fragment
|
|
111
196
|
*/
|
|
112
197
|
|
|
113
|
-
export function useReactiveOrganizationChildFragment(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
198
|
+
export function useReactiveOrganizationChildFragment(
|
|
199
|
+
childId: string,
|
|
200
|
+
currentData?: any,
|
|
201
|
+
queryCount?: number,
|
|
202
|
+
mainPrioritizedFields?: string[],
|
|
203
|
+
) {
|
|
204
|
+
const organizationId = currentData?.organization?.id;
|
|
205
|
+
|
|
206
|
+
return useReactiveFragment(
|
|
207
|
+
currentData,
|
|
208
|
+
[
|
|
209
|
+
makeFragmentKey(FRAGMENT_NAMES.organizationChild, childId),
|
|
210
|
+
organizationId
|
|
211
|
+
? [
|
|
212
|
+
makeFragmentKey(FRAGMENT_NAMES.organization, organizationId),
|
|
213
|
+
'organization',
|
|
214
|
+
]
|
|
215
|
+
: null,
|
|
216
|
+
].filter(Boolean) as Array<string | [string, string | null]>,
|
|
217
|
+
queryCount,
|
|
218
|
+
undefined,
|
|
219
|
+
mainPrioritizedFields,
|
|
220
|
+
);
|
|
124
221
|
}
|
|
125
222
|
|
|
126
223
|
/**
|
|
127
224
|
* Get reactive organization compliance document fragment
|
|
128
225
|
*/
|
|
129
226
|
|
|
130
|
-
export function useReactiveOrganizationComplianceFragment(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
227
|
+
export function useReactiveOrganizationComplianceFragment(
|
|
228
|
+
complianceId: string,
|
|
229
|
+
currentData?: any,
|
|
230
|
+
queryCount?: number,
|
|
231
|
+
) {
|
|
232
|
+
return useReactiveFragment(
|
|
233
|
+
currentData,
|
|
234
|
+
[makeFragmentKey(FRAGMENT_NAMES.organizationCompliance, complianceId)],
|
|
235
|
+
queryCount,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Fetch custom page routes for organization
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
export function usePageRoutes(
|
|
244
|
+
organizationId: string | null,
|
|
245
|
+
params: UseQueryParams = {},
|
|
246
|
+
) {
|
|
247
|
+
const { skip, ...restParams } = params;
|
|
248
|
+
const { data, ...rest } = useQuery(pageRoutesQry, {
|
|
249
|
+
variables: {
|
|
250
|
+
organizationId,
|
|
251
|
+
},
|
|
252
|
+
skip: skip || !organizationId,
|
|
253
|
+
...restParams,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
pageRoutes: data?.pageRoutes,
|
|
258
|
+
...rest,
|
|
259
|
+
};
|
|
141
260
|
}
|