@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
package/cache/config.ts
CHANGED
|
@@ -1,58 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FRAGMENT_NAMES,
|
|
3
|
+
getFragmentBaseName,
|
|
4
|
+
} from '@jsb188/mday/constants/graphqlReactivity.ts';
|
|
1
5
|
|
|
2
6
|
/**
|
|
3
7
|
* Rules for GraphQL server that's hard-coded to this package
|
|
4
8
|
* NOTE: Allow config setup for this later
|
|
5
9
|
*/
|
|
6
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Version of the persisted cache record layout. Bump when the shape of what
|
|
13
|
+
* the cache stores changes incompatibly; a mismatch wipes the IndexedDB
|
|
14
|
+
* snapshot on boot. (Stale-but-compatible data self-heals at read time via
|
|
15
|
+
* fetchCachedData's selection completeness check.)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const CACHE_SCHEMA_VERSION = 5;
|
|
19
|
+
|
|
7
20
|
export const QUERY_EXPIRE_TIMES = {
|
|
8
|
-
|
|
9
|
-
|
|
21
|
+
__default: 1.08e7, // 3 hours
|
|
22
|
+
// 5.4e+6, // 1.5 hours
|
|
23
|
+
// 2.88e+7, // 8 hours
|
|
24
|
+
// 6.48e+7, // 18 hours
|
|
25
|
+
|
|
26
|
+
// Sheets
|
|
27
|
+
sheets: 1.08e7,
|
|
28
|
+
sheetAccess: 2.88e7,
|
|
29
|
+
sheetRegionSourcePreviewRows: 2.88e7,
|
|
30
|
+
sheetAccessGrants: 2.88e7,
|
|
31
|
+
openSheet: 2.88e7,
|
|
32
|
+
openSheetTab: 2.88e7,
|
|
33
|
+
sheetTabChanges: 2.88e7,
|
|
34
|
+
sheetOperationalHistory: 2.88e7,
|
|
35
|
+
|
|
36
|
+
// Data tables
|
|
37
|
+
dataTables: 1.08e7,
|
|
38
|
+
dataTable: 2.88e7,
|
|
39
|
+
dataTableMetadata: 2.88e7,
|
|
40
|
+
dataTableRowsSnapshot: 2.88e7,
|
|
41
|
+
dataTableChanges: 2.88e7,
|
|
10
42
|
} as {
|
|
11
|
-
|
|
43
|
+
[key: string]: number;
|
|
12
44
|
};
|
|
13
45
|
|
|
14
46
|
export const RULES = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
eventAttendanceList: true,
|
|
30
|
-
parentOrganization: true,
|
|
31
|
-
logEntries: true,
|
|
32
|
-
logEvidences: true,
|
|
33
|
-
myChats: true,
|
|
34
|
-
myOrganizations: true,
|
|
35
|
-
organizationRelationship: true,
|
|
36
|
-
organizationWorkflows: true,
|
|
37
|
-
platformProducts: true,
|
|
38
|
-
productAttendanceList: true,
|
|
39
|
-
productsList: true,
|
|
40
|
-
reports: true,
|
|
41
|
-
availableReports: true,
|
|
42
|
-
searchUsers: true,
|
|
43
|
-
updateNote: true,
|
|
44
|
-
userIdToChatId: true,
|
|
45
|
-
|
|
46
|
-
// All fragments are cached,
|
|
47
|
-
// but if you want to skip some, add it here
|
|
48
|
-
accountAuthFragment: false,
|
|
47
|
+
// __limit: 8000, // 8000: approximately 5.15 MB; calculated at 644.666666668 bytes for 30 objects
|
|
48
|
+
__limit: 100000, // 12000: approximately 7.725 MB; calculated at 644.666666668 bytes for 30 objects
|
|
49
|
+
// __limit: 50, // 12000: approximately 7.725 MB; calculated at 644.666666668 bytes for 30 objects
|
|
50
|
+
|
|
51
|
+
// NOTE: ALL fragments are cached by default,
|
|
52
|
+
// but if you want to skip some, add it here
|
|
53
|
+
accountAuthFragment: false,
|
|
54
|
+
|
|
55
|
+
// NOTE: ALL queries are cached by default,
|
|
56
|
+
// but if you want to skip some, add it here
|
|
57
|
+
// e.g.: someQueryName: false,
|
|
58
|
+
|
|
59
|
+
// Respondent identity travels via header/cookie (not query variables), so
|
|
60
|
+
// the cache key cannot distinguish viewers; never cache per-viewer results
|
|
49
61
|
} as {
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
__limit: number;
|
|
63
|
+
[key: string]: boolean | number;
|
|
52
64
|
};
|
|
53
65
|
|
|
54
66
|
export const PARTIALS_MAP = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
// Partial fragments are supported if you map them to its original fragment name
|
|
68
|
+
dataTablePartialFragment: getFragmentBaseName(FRAGMENT_NAMES.dataTable),
|
|
69
|
+
sheetViewPatchFragment: getFragmentBaseName(FRAGMENT_NAMES.sheetView),
|
|
70
|
+
// List rows are a narrower projection of the same record. Without these the
|
|
71
|
+
// server's $campaignTemplateFragment / $campaignFragment patches would only
|
|
72
|
+
// reach a detail view, and a GENERATING card in a list would never settle to
|
|
73
|
+
// ACTIVE.
|
|
74
|
+
campaignTemplateSummaryFragment: getFragmentBaseName(
|
|
75
|
+
FRAGMENT_NAMES.campaignTemplate,
|
|
76
|
+
),
|
|
77
|
+
campaignSummaryFragment: getFragmentBaseName(FRAGMENT_NAMES.campaign),
|
|
58
78
|
} as Record<string, string>;
|
|
79
|
+
|
|
80
|
+
export const PARTIAL_NULL_PRESERVE_FIELDS = {
|
|
81
|
+
sheetViewPatchFragment: ['ranges', 'sheetTab'],
|
|
82
|
+
} as Record<string, string[]>;
|