@jsb188/graphql 1.1.10 → 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.
- package/audience.d.ts +343 -0
- package/cache/config.ts +98 -50
- package/cache/index.chat-activity.test.ts +119 -0
- package/cache/index.chat.test.ts +92 -0
- package/cache/index.helpers.ts +96 -0
- package/cache/index.regression.test.ts +149 -0
- package/cache/index.test.ts +1017 -127
- package/cache/index.ts +1256 -1269
- package/cache/optimistic-ui-runtime.ts +46 -0
- package/cache/optimistic-ui.ts +401 -0
- package/cache/persist.ts +800 -0
- package/cache/store.ts +395 -0
- package/cache/value.helpers.ts +17 -0
- package/client/draft-persistence-indexed-db.ts +413 -0
- package/client/draft-persistence.ts +152 -0
- package/client/index.ts +3 -0
- package/client/request.helpers.ts +14 -0
- package/client/request.ts +870 -164
- package/deno.lock +187 -0
- package/deno.test.json +10 -4
- 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/agentMemoryFragments.ts +23 -0
- package/gql/fragments/agentNoteFragments.ts +150 -0
- package/gql/fragments/aiChatFragments.ts +42 -0
- package/gql/fragments/audienceFragments.ts +141 -0
- package/gql/fragments/campaignFragments.ts +566 -0
- package/gql/fragments/dataTableFragments.ts +50 -192
- package/gql/fragments/emailFragments.ts +32 -17
- package/gql/fragments/fieldDocFragments.ts +264 -0
- package/gql/fragments/inboundContactFragments.ts +2 -0
- package/gql/fragments/logFragments.ts +101 -69
- package/gql/fragments/organizationFragments.ts +53 -5
- package/gql/fragments/qrCodeFragments.ts +29 -0
- package/gql/fragments/scheduleFragments.ts +667 -0
- package/gql/fragments/sheetFragments.ts +304 -63
- package/gql/fragments/storageFragments.ts +45 -0
- package/gql/fragments/workflowFragments.ts +41 -5
- package/gql/mutations/accountMutations.ts +0 -2
- package/gql/mutations/agentMemoryMutations.ts +68 -0
- package/gql/mutations/agentNoteMutations.ts +62 -0
- package/gql/mutations/aiChatMutations.ts +49 -4
- package/gql/mutations/audienceMutations.ts +71 -0
- package/gql/mutations/authMutations.ts +203 -18
- package/gql/mutations/billingMutations.ts +17 -27
- package/gql/mutations/campaignMutations.ts +258 -0
- package/gql/mutations/contactMutations.ts +23 -0
- package/gql/mutations/dataTableMutations.ts +19 -54
- package/gql/mutations/fieldDocMutations.ts +173 -0
- package/gql/mutations/index.ts +10 -2
- package/gql/mutations/logMutations.ts +6 -29
- package/gql/mutations/organizationMutations.ts +19 -4
- package/gql/mutations/qrCodeMutations.ts +20 -0
- package/gql/mutations/scheduleMutations.ts +1121 -0
- package/gql/mutations/sheetMutations.ts +221 -60
- package/gql/mutations/storageMutations.ts +19 -0
- package/gql/mutations/workflowMutations.ts +60 -0
- package/gql/queries/agentMemoryQueries.ts +28 -0
- package/gql/queries/agentNoteQueries.ts +89 -0
- package/gql/queries/aiChatQueries.ts +70 -2
- package/gql/queries/audienceQueries.ts +128 -0
- package/gql/queries/authQueries.ts +47 -0
- package/gql/queries/billingQueries.ts +118 -6
- package/gql/queries/campaignQueries.ts +236 -0
- package/gql/queries/dataTableQueries.ts +61 -13
- package/gql/queries/emailQueries.ts +26 -17
- package/gql/queries/emailReplyReportQueries.ts +76 -0
- package/gql/queries/fieldDocQueries.ts +166 -0
- package/gql/queries/inboundContactQueries.ts +4 -0
- package/gql/queries/index.ts +10 -2
- package/gql/queries/logQueries.ts +68 -30
- package/gql/queries/organizationQueries.ts +65 -1
- package/gql/queries/qrCodeQueries.ts +20 -0
- package/gql/queries/scheduleQueries.ts +691 -0
- package/gql/queries/sheetQueries.ts +244 -26
- package/gql/queries/storageQueries.ts +38 -0
- package/gql/queries/workflowQueries.ts +77 -2
- package/hooks/index.helpers.test.ts +50 -0
- package/hooks/index.helpers.ts +52 -0
- package/hooks/index.ts +2254 -982
- package/hooks/use-account-mtn.ts +76 -81
- package/hooks/use-agentMemory-mtn.ts +71 -0
- package/hooks/use-agentMemory-qry.ts +56 -0
- package/hooks/use-agentNote-mtn.ts +82 -0
- package/hooks/use-agentNote-qry.ts +190 -0
- package/hooks/use-agentNote-recovery.helpers.test.ts +68 -0
- package/hooks/use-agentNote-recovery.helpers.ts +58 -0
- package/hooks/use-agentNote-recovery.ts +72 -0
- package/hooks/use-aiChat-mtn.ts +220 -141
- package/hooks/use-aiChat-qry.helpers.test.ts +63 -0
- package/hooks/use-aiChat-qry.helpers.ts +124 -0
- package/hooks/use-aiChat-qry.ts +341 -237
- package/hooks/use-aiChat-stream-mtn.ts +14 -0
- package/hooks/use-app-qry.ts +12 -9
- package/hooks/use-audience-mtn.ts +194 -0
- package/hooks/use-audience-qry.helpers.test.ts +80 -0
- package/hooks/use-audience-qry.helpers.ts +63 -0
- package/hooks/use-audience-qry.ts +330 -0
- package/hooks/use-auth-mtn.ts +435 -252
- package/hooks/use-auth-qry.ts +51 -0
- package/hooks/use-billing-mtn.ts +31 -0
- package/hooks/use-billing-qry.ts +76 -0
- package/hooks/use-campaign-generation-recovery.ts +53 -0
- package/hooks/use-campaign-mtn.ts +436 -0
- package/hooks/use-campaign-qry.helpers.ts +40 -0
- package/hooks/use-campaign-qry.ts +834 -0
- package/hooks/use-dataTable-mtn.ts +37 -46
- package/hooks/use-dataTable-qry.ts +102 -128
- package/hooks/use-email-qry.helpers.ts +37 -0
- package/hooks/use-email-qry.ts +56 -86
- package/hooks/use-emailCampaignReplyReport-qry.ts +27 -0
- package/hooks/use-fieldDoc-mtn.ts +262 -0
- package/hooks/use-fieldDoc-qry.helpers.test.ts +65 -0
- package/hooks/use-fieldDoc-qry.helpers.ts +49 -0
- package/hooks/use-fieldDoc-qry.ts +212 -0
- package/hooks/use-inboundContact-mtn.ts +19 -16
- package/hooks/use-inboundContact-qry.ts +62 -56
- package/hooks/use-integration-mtn.ts +56 -38
- package/hooks/use-integration-qry.ts +24 -9
- package/hooks/use-log-mtn.ts +88 -59
- package/hooks/use-log-qry.ts +150 -73
- package/hooks/use-organization-mtn.ts +334 -277
- package/hooks/use-organization-qry.ts +155 -129
- package/hooks/use-publicFormEmail-mtn.ts +27 -0
- package/hooks/use-qrCode-mtn.ts +40 -0
- package/hooks/use-qrCode-qry.ts +78 -0
- package/hooks/use-schedule-mtn.ts +589 -0
- package/hooks/use-schedule-qry.ts +738 -0
- package/hooks/use-schedule-reactive.ts +486 -0
- package/hooks/use-sheet-mtn.ts +157 -79
- package/hooks/use-sheet-qry.ts +221 -92
- package/hooks/use-storage-mtn.ts +81 -41
- package/hooks/use-storage-qry.ts +128 -14
- package/hooks/use-workflow-mtn.ts +72 -0
- package/hooks/use-workflow-qry.ts +184 -47
- package/libs/ai-chat-outgoing.helpers.ts +153 -0
- package/libs/ai-chat-outgoing.ts +11 -0
- package/libs/ai-chat-outgoing.types.ts +25 -0
- package/libs/ai-chat-run-realtime.ts +20 -0
- package/libs/ai-chat-submission-realtime.ts +150 -0
- package/libs/fragment-realtime-sequence.ts +55 -0
- package/libs/fragment-recovery.test.ts +326 -0
- package/libs/fragment-recovery.ts +325 -0
- package/libs/open-sheet.ts +138 -0
- package/libs/orchestrator-realtime.helpers.test.ts +229 -0
- package/libs/orchestrator-realtime.helpers.ts +317 -0
- package/libs/orchestrator-realtime.ts +433 -0
- package/libs/request-cache-regression.test.ts +122 -0
- package/libs/request-managed-session.test.ts +574 -0
- package/libs/request-no-store.test.ts +419 -0
- package/libs/sheet-command-batch.ts +44 -0
- package/libs/sheet-view-realtime-router.test.ts +214 -0
- package/libs/sheet-view-realtime-router.ts +99 -0
- package/libs/sse-ticket.test.ts +26 -0
- package/loaders/campaign.test.ts +186 -0
- package/loaders/campaign.ts +110 -0
- package/loaders/emailPreference.ts +75 -0
- package/loaders/rest.ts +12 -0
- package/package.json +119 -71
- package/schedule.d.ts +1790 -0
- package/sse.helpers.ts +19 -0
- package/sse.ts +70 -106
- package/tests/agent-note-detail-cache.test.ts +120 -0
- package/tests/agent-note-search.test.ts +444 -0
- package/tsconfig.json +11 -10
- package/types.d.ts +77 -26
- package/utils.ts +78 -49
- package/gql/fragments/billingFragments.ts +0 -25
- package/gql/fragments/productFragments.ts +0 -39
- package/gql/fragments/reportFragments.ts +0 -90
- 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
package/hooks/use-log-qry.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FRAGMENT_NAMES, makeFragmentKey } from '@jsb188/mday/constants/graphqlReactivity.ts';
|
|
2
|
+
import type { FilterLogEntriesArgs, LogSortEnum } from '@jsb188/mday/types/log.d.ts';
|
|
2
3
|
import { useQuery, useReactiveFragment } from '../client/index.ts';
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fieldDocSubmissionLogsQry,
|
|
6
|
+
logEntriesQry,
|
|
7
|
+
logEntryQry,
|
|
8
|
+
logRevisionProofDownloadUrlQry,
|
|
9
|
+
logRevisionQry,
|
|
10
|
+
logRevisionsQry,
|
|
11
|
+
} from '../gql/queries/logQueries.ts';
|
|
4
12
|
import type { PaginationArgs, UseQueryParams } from '../types.d.ts';
|
|
5
13
|
|
|
6
14
|
/**
|
|
@@ -11,30 +19,49 @@ import type { PaginationArgs, UseQueryParams } from '../types.d.ts';
|
|
|
11
19
|
// Having less data is better for performance for iPads and low-end devices, because it might reduce brief rendering mishaps,
|
|
12
20
|
// But a decent amount of visual load size is needed for Virtualized List to work well.
|
|
13
21
|
const LOG_ENTRIES_LIMIT = 250;
|
|
22
|
+
const LOG_REVISIONS_LIMIT = 50;
|
|
23
|
+
|
|
24
|
+
export type LogRevisionsVariables = PaginationArgs & {
|
|
25
|
+
organizationId?: string | null;
|
|
26
|
+
logEntryId?: string | null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type LogRevisionVariables = {
|
|
30
|
+
organizationId?: string | null;
|
|
31
|
+
revisionId?: string | null;
|
|
32
|
+
};
|
|
14
33
|
|
|
15
34
|
/**
|
|
16
|
-
*
|
|
35
|
+
* Reuse the requested reactive log from cache and only query when it is absent.
|
|
17
36
|
*/
|
|
18
37
|
|
|
19
38
|
export function useLogEntry(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
variables: {
|
|
40
|
+
organizationId?: string | null;
|
|
41
|
+
logEntryId?: string | null;
|
|
42
|
+
},
|
|
43
|
+
params: UseQueryParams = {},
|
|
25
44
|
) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
const { logEntryId, organizationId } = variables;
|
|
46
|
+
// Read the reactive fragment first; it already loads and observes the log and details in cache.
|
|
47
|
+
// A separate loadFragment() call would duplicate that cache lookup.
|
|
48
|
+
const observedLogEntry = useReactiveLogFragment(logEntryId || '');
|
|
49
|
+
// The observer can retain the previous log until its effect runs after an ID change.
|
|
50
|
+
// Only the requested log may satisfy this read or prevent its query from running.
|
|
51
|
+
const reactiveLogEntry = observedLogEntry?.id === logEntryId ? observedLogEntry : null;
|
|
52
|
+
// Always call the query hook to preserve hook order, but skip its automatic request when
|
|
53
|
+
// the requested log is cached, required IDs are absent, or the caller explicitly skips.
|
|
54
|
+
const { data, ...rest } = useQuery(logEntryQry, {
|
|
55
|
+
...params,
|
|
56
|
+
variables,
|
|
57
|
+
skip: !!reactiveLogEntry || !organizationId || !logEntryId || params.skip,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
// Prefer the reactive cache; otherwise use a matching query result while the cache observer catches up.
|
|
62
|
+
logEntry: reactiveLogEntry || (data?.logEntry?.id === logEntryId ? data.logEntry : null),
|
|
63
|
+
...rest,
|
|
64
|
+
};
|
|
38
65
|
}
|
|
39
66
|
|
|
40
67
|
/**
|
|
@@ -42,54 +69,110 @@ export function useLogEntry(
|
|
|
42
69
|
*/
|
|
43
70
|
|
|
44
71
|
export function useLogEntries(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
variables: PaginationArgs & {
|
|
73
|
+
organizationId?: string | null;
|
|
74
|
+
accountId?: string;
|
|
75
|
+
filter: FilterLogEntriesArgs;
|
|
76
|
+
sort?: LogSortEnum;
|
|
77
|
+
},
|
|
78
|
+
params: UseQueryParams = {},
|
|
51
79
|
) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
const { data, ...rest } = useQuery(logEntriesQry, {
|
|
81
|
+
...params,
|
|
82
|
+
variables: {
|
|
83
|
+
...variables,
|
|
84
|
+
cursor: null,
|
|
85
|
+
after: true,
|
|
86
|
+
limit: variables.limit ?? LOG_ENTRIES_LIMIT,
|
|
87
|
+
},
|
|
88
|
+
// If this query is used for virtualized list pagination, set {params.skip=true}
|
|
89
|
+
skip: !variables.organizationId || params.skip,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
logEntries: data?.logEntries,
|
|
94
|
+
...rest,
|
|
95
|
+
};
|
|
68
96
|
}
|
|
69
97
|
|
|
70
98
|
/**
|
|
71
|
-
* Fetch
|
|
99
|
+
* Fetch every log linked to one field doc submission (the document page loads it beside the document).
|
|
72
100
|
*/
|
|
73
101
|
|
|
74
|
-
export function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
export function useFieldDocSubmissionLogs(fieldDocSubmissionId: string | null | undefined, params: UseQueryParams = {}) {
|
|
103
|
+
const { data, ...rest } = useQuery(fieldDocSubmissionLogsQry, {
|
|
104
|
+
...params,
|
|
105
|
+
variables: {
|
|
106
|
+
fieldDocSubmissionId,
|
|
107
|
+
},
|
|
108
|
+
skip: !fieldDocSubmissionId || params.skip,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
fieldDocSubmissionLogs: data?.fieldDocSubmissionLogs,
|
|
113
|
+
...rest,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Reuse cached revision-history pages without automatically revalidating them on each modal open.
|
|
119
|
+
*/
|
|
120
|
+
export function useLogRevisions(variables: LogRevisionsVariables, params: UseQueryParams = {}) {
|
|
121
|
+
const { data, ...rest } = useQuery(logRevisionsQry, {
|
|
122
|
+
...params,
|
|
123
|
+
// useQuery already reads its normalized cache for these exact log and pagination variables.
|
|
124
|
+
// Keep cached pages fresh indefinitely and disable mount revalidation so reopening does not refetch them.
|
|
125
|
+
revalidateOnMount: params.revalidateOnMount ?? false,
|
|
126
|
+
persistTime: params.persistTime ?? Infinity,
|
|
127
|
+
variables: {
|
|
128
|
+
...variables,
|
|
129
|
+
cursor: variables.cursor ?? null,
|
|
130
|
+
after: variables.after ?? false,
|
|
131
|
+
limit: variables.limit ?? LOG_REVISIONS_LIMIT,
|
|
132
|
+
},
|
|
133
|
+
// Unlike the single-log read, a cached page must not set skip: true: useQuery also gates
|
|
134
|
+
// fetchMore() and refetch() on skip. Only missing IDs or an explicit caller skip disable those requests.
|
|
135
|
+
skip: !variables.organizationId || !variables.logEntryId || params.skip,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
// Return the cache-backed page from useQuery; a missing page is populated by its normal server request.
|
|
140
|
+
logRevisions: data?.logRevisions,
|
|
141
|
+
...rest,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Fetch one full immutable log revision.
|
|
147
|
+
*/
|
|
148
|
+
export function useLogRevision(variables: LogRevisionVariables, params: UseQueryParams = {}) {
|
|
149
|
+
const { data, ...rest } = useQuery(logRevisionQry, {
|
|
150
|
+
...params,
|
|
151
|
+
variables,
|
|
152
|
+
skip: !variables.organizationId || !variables.revisionId || params.skip,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
logRevision: data?.logRevision,
|
|
157
|
+
...rest,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Request a fresh short-lived download URL for one archived proof.
|
|
163
|
+
*/
|
|
164
|
+
export function useLogRevisionProofDownloadUrl(variables: LogRevisionVariables, params: UseQueryParams = {}) {
|
|
165
|
+
const { data, ...rest } = useQuery(logRevisionProofDownloadUrlQry, {
|
|
166
|
+
...params,
|
|
167
|
+
persistTime: params.persistTime ?? 0,
|
|
168
|
+
variables,
|
|
169
|
+
skip: !variables.organizationId || !variables.revisionId || params.skip,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
logRevisionProofDownloadUrl: data?.logRevisionProofDownloadUrl,
|
|
174
|
+
...rest,
|
|
175
|
+
};
|
|
93
176
|
}
|
|
94
177
|
|
|
95
178
|
/**
|
|
@@ -97,15 +180,9 @@ export function useLogEntriesForReport(
|
|
|
97
180
|
*/
|
|
98
181
|
|
|
99
182
|
export function useReactiveLogFragment(logEntryId: string, currentData?: any, queryCount?: number) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
[`$logFarmersMarketFragment:${logEntryId}`, 'details'],
|
|
106
|
-
[`$logGrowerNetworkFragment:${logEntryId}`, 'details'],
|
|
107
|
-
[`$logLivestockFragment:${logEntryId}`, 'details'],
|
|
108
|
-
],
|
|
109
|
-
queryCount,
|
|
110
|
-
);
|
|
183
|
+
return useReactiveFragment(
|
|
184
|
+
currentData,
|
|
185
|
+
[makeFragmentKey(FRAGMENT_NAMES.logEntry, logEntryId), [makeFragmentKey(FRAGMENT_NAMES.logEntryDetails, logEntryId), 'details']],
|
|
186
|
+
queryCount,
|
|
187
|
+
);
|
|
111
188
|
}
|