@jsb188/graphql 1.1.4 → 1.1.6

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.
Files changed (49) hide show
  1. package/cache/config.ts +13 -7
  2. package/cache/index.ts +355 -144
  3. package/gql/fragments/accountAuthFragments.ts +3 -9
  4. package/gql/fragments/accountFragments.ts +11 -0
  5. package/gql/fragments/actionFragments.ts +16 -0
  6. package/gql/fragments/logFragments.ts +75 -6
  7. package/gql/fragments/organizationFragments.ts +70 -4
  8. package/gql/fragments/otherFragments.ts +10 -8
  9. package/gql/fragments/productFragments.ts +63 -0
  10. package/gql/fragments/reportFragments.ts +47 -0
  11. package/gql/mutations/accountMutations.ts +31 -0
  12. package/gql/mutations/aiChatMutations.ts +1 -0
  13. package/gql/mutations/authMutations.ts +80 -22
  14. package/gql/mutations/index.ts +8 -0
  15. package/gql/mutations/logMutations.ts +56 -1
  16. package/gql/mutations/organizationMutations.ts +42 -0
  17. package/gql/mutations/otherMutations.ts +0 -17
  18. package/gql/mutations/userAuthMutations.ts +0 -116
  19. package/gql/queries/aiChatQueries.ts +4 -0
  20. package/gql/queries/appQueries.ts +2 -1
  21. package/gql/queries/index.ts +6 -0
  22. package/gql/queries/logQueries.ts +60 -11
  23. package/gql/queries/organizationQueries.ts +62 -1
  24. package/gql/queries/productQueries.ts +70 -0
  25. package/gql/queries/reportQueries.ts +60 -0
  26. package/hooks/index.ts +259 -113
  27. package/hooks/use-account-mtn.ts +68 -0
  28. package/hooks/use-aiChat-mtn.ts +112 -0
  29. package/hooks/use-aiChat-qry.ts +81 -10
  30. package/hooks/use-auth-mtn.ts +114 -63
  31. package/hooks/use-log-mtn.ts +85 -0
  32. package/hooks/use-log-qry.ts +71 -18
  33. package/hooks/use-organization-mtn.ts +105 -0
  34. package/hooks/use-organization-qry.ts +119 -15
  35. package/hooks/use-product-qry.ts +109 -0
  36. package/hooks/use-report-qry.ts +69 -0
  37. package/package.json +15 -25
  38. package/sse.ts +11 -0
  39. package/types.d.ts +1 -0
  40. package/gql/fragments/cardFragments.ts +0 -15
  41. package/gql/fragments/chatFragments.ts +0 -98
  42. package/gql/fragments/userAuthFragments.ts +0 -8
  43. package/gql/fragments/userFragments.ts +0 -69
  44. package/gql/mutations/chatMutations.ts +0 -116
  45. package/gql/mutations/userMutations.ts +0 -89
  46. package/gql/queries/cardQueries.ts +0 -24
  47. package/gql/queries/chatQueries.ts +0 -86
  48. package/gql/queries/otherQueries.ts +0 -12
  49. package/gql/queries/userQueries.ts +0 -104
@@ -1,13 +1,16 @@
1
+ import type { FilterLogEntriesArgs } from '@jsb188/mday/types/log.d';
2
+ import { useQuery, useReactiveFragment } from '../client';
3
+ import { logEntriesQry, logEvidencesQry } from '../gql/queries/logQueries';
1
4
  import type { PaginationArgs, UseQueryParams } from '../types';
2
- import { useQuery } from '../client';
3
- import { logEntriesQry } from '../gql/queries/logQueries';
4
- import type { FilterLogEntriesArgs } from '@jsb188/app/types/log.d';
5
5
 
6
6
  /**
7
7
  * Constants
8
8
  */
9
9
 
10
- const LOG_ENTRIES_LIMIT = 50;
10
+ // I tried 100, but that was way too small.
11
+ // Having less data is better for performance for iPads and low-end devices, because it might reduce brief rendering mishaps,
12
+ // But a decent amount of visual load size is needed for Virtualized List to work well.
13
+ const LOG_ENTRIES_LIMIT = 250;
11
14
 
12
15
  /**
13
16
  * Helper; use this to get/use same filter for logEntries() query everywhere
@@ -16,7 +19,7 @@ const LOG_ENTRIES_LIMIT = 50;
16
19
  export function getDefaultLogEntriesFilter(operation: FilterLogEntriesArgs['operation']): FilterLogEntriesArgs {
17
20
  return {
18
21
  operation,
19
- type: null,
22
+ types: null,
20
23
  startDate: null,
21
24
  endDate: null,
22
25
  query: ''
@@ -27,16 +30,17 @@ export function getDefaultLogEntriesFilter(operation: FilterLogEntriesArgs['oper
27
30
  * Fetch log entries
28
31
  */
29
32
 
30
- interface LogEntriesArgs extends PaginationArgs {
31
- organizationId: string;
32
- accountId?: string;
33
- timeZone: string | null;
34
- filter: FilterLogEntriesArgs;
35
- }
36
-
37
- export function useLogEntries(variables: LogEntriesArgs, params: UseQueryParams = {}) {
38
-
39
- const { data, ...other } = useQuery(logEntriesQry, {
33
+ export function useLogEntries(
34
+ variables: PaginationArgs & {
35
+ organizationId?: string | null;
36
+ accountId?: string;
37
+ timeZone: string | null;
38
+ filter: FilterLogEntriesArgs;
39
+ },
40
+ params: UseQueryParams = {}
41
+ ) {
42
+ const { data, ...rest } = useQuery(logEntriesQry, {
43
+ ...params,
40
44
  variables: {
41
45
  ...variables,
42
46
  cursor: null,
@@ -44,12 +48,61 @@ export function useLogEntries(variables: LogEntriesArgs, params: UseQueryParams
44
48
  limit: LOG_ENTRIES_LIMIT
45
49
  },
46
50
  // If this query is used for virtualized list pagination, set {params.skip=true}
47
- skip: !variables.organizationId || !variables.filter?.operation,
48
- ...params,
51
+ skip: !variables.organizationId || !variables.filter?.operation || params.skip,
49
52
  });
50
53
 
51
54
  return {
52
55
  logEntries: data?.logEntries,
53
- ...other
56
+ ...rest
54
57
  };
55
58
  }
59
+
60
+ /**
61
+ * Fetch logs as evidences for a specific report
62
+ */
63
+
64
+ export function useLogEvidences(
65
+ variables: {
66
+ organizationId: string,
67
+ reportId: string,
68
+ cursor?: string | null,
69
+ after?: boolean,
70
+ limit?: number,
71
+ },
72
+ params: UseQueryParams = {}
73
+ ) {
74
+ const { data, ...rest } = useQuery(logEvidencesQry, {
75
+ ...params,
76
+ variables: {
77
+ ...variables,
78
+ after: variables.after ?? true,
79
+ limit: variables.limit ?? 1000, // Change this when we have pagination support
80
+ },
81
+ skip: !variables.organizationId || !variables.reportId || params.skip,
82
+ });
83
+
84
+ return {
85
+ logEvidences: data?.logEvidences,
86
+ ...rest
87
+ };
88
+ }
89
+
90
+ /**
91
+ * Get reactive log fragment
92
+ */
93
+
94
+ export function useReactiveLogFragment(logEntryId: string, currentData?: any, queryCount?: number) {
95
+ return useReactiveFragment(
96
+ currentData,
97
+ [
98
+ `$logEntryFragment:${logEntryId}`,
99
+
100
+ // By having the second paramter as null, we only observe the reactive changes without setting the data
101
+ // [`$logArableFragment:${logEntryId}`, null],
102
+
103
+ // This is not needed because $logEntryFragment has spread data
104
+ // [`$accountFragment:${logEntryId}`, 'account']
105
+ ],
106
+ queryCount,
107
+ );
108
+ }
@@ -0,0 +1,105 @@
1
+ import type { UseMutationParams } from '@jsb188/graphql/types.d';
2
+ import { OpenModalPopUpFn, useCurrentAccount } from '@jsb188/react/states';
3
+ import { updateFragment } from '../cache/index';
4
+ import { deleteComplianceDocumentMtn, editOrganizationMtn, switchOrganizationMtn } from '../gql/mutations/organizationMutations';
5
+ import { useMutation } from './index';
6
+ import { useOrgRelFromMyOrganizations } from './use-organization-qry';
7
+ import { useMemo } from 'react';
8
+ import { checkACLPermission } from '@jsb188/mday/utils/organization';
9
+
10
+ /**
11
+ * Fetch a single log entry,
12
+ * from cache first; only check server if cache is not found.
13
+ */
14
+
15
+ export function useSwitchOrganization(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
16
+ const { onCompleted, ...otherParams } = params;
17
+ // const navigate = useNavigate();
18
+ const { dispatchApp, account, primaryOrganizationId } = useCurrentAccount();
19
+
20
+ const [switchOrganization, mtnValues, mtnHandlers] = useMutation(switchOrganizationMtn, {
21
+ // checkMountedBeforeCallback: true,
22
+ openModalPopUp,
23
+ onCompleted: (data, error, variables) => {
24
+ const result = data?.switchOrganization;
25
+ if (result) {
26
+ // navigate('/app', { replace: true });
27
+ dispatchApp({
28
+ __type: 'APP_SWITCH_PRIMARY_ORGANIZATION',
29
+ data: {
30
+ primaryOrganizationId: variables.organizationId,
31
+ }
32
+ })
33
+ }
34
+
35
+ onCompleted?.(result, error);
36
+ },
37
+ ...otherParams,
38
+ });
39
+
40
+ return {
41
+ switchOrganization,
42
+ ...mtnValues,
43
+ ...mtnHandlers,
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Delete a compliance document
49
+ */
50
+
51
+ export function useDeleteComplianceDocument(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
52
+ const { onCompleted, ...otherParams } = params;
53
+
54
+ const [deleteComplianceDocument, mtnValues, mtnHandlers, updateObservers] = useMutation(deleteComplianceDocumentMtn,
55
+ {
56
+ // checkMountedBeforeCallback: true,
57
+ openModalPopUp,
58
+ onCompleted: (data, error, variables) => {
59
+ const deleted = data?.deleteComplianceDocument;
60
+ if (deleted) {
61
+ updateFragment(`$organizationComplianceFragment:${variables.complianceId}`, { __deleted: true }, null, false, updateObservers);
62
+ }
63
+
64
+ onCompleted?.(deleted, error);
65
+ },
66
+ ...otherParams,
67
+ }
68
+ );
69
+
70
+ return {
71
+ deleteComplianceDocument,
72
+ ...mtnValues,
73
+ ...mtnHandlers,
74
+ };
75
+ }
76
+
77
+ /**
78
+ * Edit logged in user's organization (if allowed)
79
+ */
80
+
81
+ export function useEditOrganization(
82
+ params?: UseMutationParams | null,
83
+ openModalPopUp?: OpenModalPopUpFn
84
+ ) {
85
+ const { primaryOrganizationId } = useCurrentAccount();
86
+ const { organizationRelationship } = useOrgRelFromMyOrganizations(primaryOrganizationId);
87
+ const allowEdit = useMemo(() =>
88
+ checkACLPermission(organizationRelationship, 'orgManagement', 'MANAGE'),
89
+ [organizationRelationship?.acl, organizationRelationship?.role]
90
+ );
91
+
92
+ const [editOrganization, mtnValues, mtnHandlers] = useMutation(editOrganizationMtn, {
93
+ // checkMountedBeforeCallback: true,
94
+ openModalPopUp,
95
+ ...params,
96
+ });
97
+
98
+ return {
99
+ allowEdit,
100
+ organizationRelationship,
101
+ editOrganization,
102
+ ...mtnValues,
103
+ ...mtnHandlers,
104
+ };
105
+ }
@@ -1,37 +1,141 @@
1
- import { useQuery } from '@jsb188/graphql/client';
2
- import { organizationRelationshipQry, myOrganizationsQry } from '../gql/queries/organizationQueries';
3
- import type { UseQueryParams } from '../types.d';
1
+ import { useQuery, useReactiveFragment } from '@jsb188/graphql/client';
2
+ import { childOrganizationsQry, myOrganizationsQry, organizationWorkflowsQry } from '../gql/queries/organizationQueries';
3
+ import type { PaginationArgs, UseQueryParams } from '../types.d';
4
+ import type { OrganizationOperationEnum } from '@jsb188/mday/types/organization.d';
5
+
6
+ const ORG_CHILDREN_LIMIT = 250;
7
+
8
+ /**
9
+ * Fetch my organizations
10
+ */
11
+
12
+ export function useMyOrganizations(params: UseQueryParams = {}) {
13
+ const { data, ...rest } = useQuery(myOrganizationsQry, params);
14
+
15
+ return {
16
+ myOrganizations: data?.myOrganizations,
17
+ ...rest
18
+ };
19
+ }
4
20
 
5
21
  /**
6
- * Fetch organization relationship
22
+ * Fetch organization workflows
7
23
  */
8
24
 
9
- export function useOrganizationRelationship(organizationId?: string | null, params: UseQueryParams = {}) {
10
- const { data, ...other } = useQuery(organizationRelationshipQry, {
25
+ export function useOrganizationWorkflows(organizationId: string | null, operation: OrganizationOperationEnum | null) {
26
+ const { data, ...rest } = useQuery(organizationWorkflowsQry, {
11
27
  variables: {
12
- organizationId
28
+ organizationId,
29
+ operation,
13
30
  },
31
+ skip: !organizationId || !operation,
32
+ });
33
+
34
+ return {
35
+ organizationWorkflows: data?.organizationWorkflows,
36
+ ...rest
37
+ };
38
+ }
39
+
40
+ /**
41
+ * Get reactive organization fragment
42
+ */
43
+
44
+ export function useReactiveOrganizationWorkflowFragment(workflowId: string, currentData?: any, queryCount?: number) {
45
+ return useReactiveFragment(
46
+ currentData,
47
+ [`$organizationInstructionsFragment:${workflowId}`],
48
+ queryCount,
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Get reactive organization fragment
54
+ */
55
+
56
+ export function useReactiveOrganization(orgId: string, currentData?: any, queryCount?: number) {
57
+ return useReactiveFragment(
58
+ currentData,
59
+ [`$organizationFragment:${orgId}`],
60
+ queryCount,
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Fetch my organizations and then get one by ID
66
+ */
67
+
68
+ export function useOrgRelFromMyOrganizations(organizationId: string | null) {
69
+ const { myOrganizations, ...rest } = useMyOrganizations({
14
70
  skip: !organizationId,
15
- ...params,
16
71
  });
17
72
 
73
+ const orgRel = myOrganizations?.find((orgRel: any) => orgRel.organization?.id === organizationId) || null;
74
+ const organization = useReactiveOrganization(orgRel?.organization?.id, orgRel?.organization);
75
+
18
76
  return {
19
- organizationRelationship: data?.organizationRelationship,
20
- ...other
77
+ organizationRelationship: orgRel,
78
+ organization,
79
+ myOrganizations,
80
+ ...rest
21
81
  };
22
82
  }
23
83
 
24
84
  /**
25
- * Fetch my organizations
85
+ * Fetch child organizations
26
86
  */
27
87
 
28
- export function useMyOrganizations(params: UseQueryParams = {}) {
29
- const { data, ...other } = useQuery(myOrganizationsQry, {
88
+ export function useChildOrganizations(variables: PaginationArgs & {
89
+ organizationId?: string | null;
90
+ // filters: ? not ready yet
91
+ }, params: UseQueryParams = {}) {
92
+ const { data, ...rest } = useQuery(childOrganizationsQry, {
93
+ variables: {
94
+ ...variables,
95
+ cursor: null,
96
+ after: true,
97
+ limit: ORG_CHILDREN_LIMIT
98
+ },
99
+ skip: !variables.organizationId,
30
100
  ...params,
31
101
  });
32
102
 
33
103
  return {
34
- myOrganizations: data?.myOrganizations,
35
- ...other
104
+ childOrganizations: data?.childOrganizations,
105
+ ...rest
36
106
  };
37
107
  }
108
+
109
+ /**
110
+ * Get reactive organization fragment
111
+ */
112
+
113
+ export function useReactiveOrganizationChildFragment(childId: string, currentData?: any, queryCount?: number) {
114
+ return useReactiveFragment(
115
+ currentData,
116
+ [
117
+ `$organizationChildFragment:${childId}`,
118
+ // [`$organizationChildArableFragment:${childId}`, null],
119
+ // By having the second paramter as null, we only observe the reactive changes without setting the data
120
+ // [`$logArableFragment:${logEntryId}`, null],
121
+ ],
122
+ queryCount,
123
+ );
124
+ }
125
+
126
+ /**
127
+ * Get reactive organization compliance document fragment
128
+ */
129
+
130
+ export function useReactiveOrganizationComplianceFragment(complianceId: string, currentData?: any, queryCount?: number) {
131
+ return useReactiveFragment(
132
+ currentData,
133
+ [
134
+ `$organizationComplianceFragment:${complianceId}`,
135
+ // [`$organizationChildArableFragment:${organizationId}`, null],
136
+ // By having the second paramter as null, we only observe the reactive changes without setting the data
137
+ // [`$logArableFragment:${logEntryId}`, null],
138
+ ],
139
+ queryCount,
140
+ );
141
+ }
@@ -0,0 +1,109 @@
1
+ import { checkACLPermission } from '@jsb188/mday/utils/organization';
2
+ import type { ProductsFilterArgs } from '@jsb188/mday/types/product.d';
3
+ import { useMemo } from 'react';
4
+ import { useQuery, useReactiveFragment } from '../client';
5
+ import { productAttendanceListQry, productsListQry } from '../gql/queries/productQueries';
6
+ import type { PaginationArgs, UseQueryParams } from '../types';
7
+ import { useOrgRelFromMyOrganizations } from './use-organization-qry';
8
+
9
+ /**
10
+ * Constants
11
+ */
12
+
13
+ const PRODUCTS_LIST_LIMIT = 200;
14
+
15
+ /**
16
+ * Helper; use this to get/use same filter for productsList() query everywhere
17
+ */
18
+
19
+ // export function getDefaultProductsListFilter(operation: FilterProductsListArgs['operation']): FilterProductsListArgs {
20
+ // return {
21
+ // operation,
22
+ // types: null,
23
+ // startDate: null,
24
+ // endDate: null,
25
+ // query: ''
26
+ // };
27
+ // }
28
+
29
+ /**
30
+ * Fetch log entries
31
+ */
32
+
33
+ export function useProductsList(
34
+ variables: PaginationArgs & {
35
+ organizationId?: string | null;
36
+ filter: ProductsFilterArgs;
37
+ },
38
+ params: UseQueryParams = {}
39
+ ) {
40
+ const { data, ...rest } = useQuery(productsListQry, {
41
+ variables: {
42
+ ...variables,
43
+ cursor: null,
44
+ after: false,
45
+ limit: PRODUCTS_LIST_LIMIT
46
+ },
47
+ // If this query is used for virtualized list pagination, set {params.skip=true}
48
+ skip: !variables.organizationId,
49
+ ...params,
50
+ });
51
+
52
+ return {
53
+ productsList: data?.productsList,
54
+ ...rest
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Get reactive log fragment
60
+ */
61
+
62
+ export function useReactiveProductFragment(productId: string, currentData?: any, queryCount?: number) {
63
+ return useReactiveFragment(
64
+ currentData,
65
+ [
66
+ `$productFragment:${productId}`,
67
+ ],
68
+ queryCount,
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Fetch Org Event attendance, ACL, and Org Event fragment from cache
74
+ */
75
+
76
+ export function useProductAttendance(
77
+ variables: {
78
+ organizationId: string;
79
+ productId: string;
80
+ calDate: string;
81
+ },
82
+ params: UseQueryParams = {},
83
+ ) {
84
+
85
+ const { organizationId, productId, calDate } = variables;
86
+ const { organizationRelationship } = useOrgRelFromMyOrganizations(organizationId);
87
+
88
+ const { data, ...rest } = useQuery(productAttendanceListQry, {
89
+ variables,
90
+ skip: !productId || !calDate || !organizationId,
91
+ ...params,
92
+ });
93
+
94
+ const productAttendanceList = data?.productAttendanceList;
95
+ const notReady = !organizationRelationship || !productAttendanceList;
96
+
97
+ const allowEdit = useMemo(() => {
98
+ return checkACLPermission(organizationRelationship, 'products', 'MANAGE');
99
+ }, [organizationRelationship?.acl, organizationRelationship?.role]);
100
+
101
+ // console.log('viewerAccountId', viewerAccountId, organizationEvent?.accountId, isMyDocument, allowEdit);
102
+
103
+ return {
104
+ productAttendanceList,
105
+ notReady,
106
+ allowEdit,
107
+ ...rest
108
+ };
109
+ }
@@ -0,0 +1,69 @@
1
+ import type { ReportsFilterArgs, ReportsSortEnum } from '@jsb188/mday/types/report.d';
2
+ import { useQuery, useReactiveFragment } from '../client';
3
+ import { availableReportsQry, reportsQry } from '../gql/queries/reportQueries';
4
+ import type { UseQueryParams } from '../types';
5
+
6
+ /**
7
+ * Get reactive log fragment
8
+ */
9
+
10
+ export function useReactiveReportFragment(reportId: string, currentData?: any, queryCount?: number) {
11
+ return useReactiveFragment(
12
+ currentData,
13
+ [
14
+ `$reportFragment:${reportId}`,
15
+ ],
16
+ queryCount,
17
+ );
18
+ }
19
+
20
+ /**
21
+ * Fetch list of reports by type and period
22
+ */
23
+
24
+ export function useReports(
25
+ variables: {
26
+ organizationId: string;
27
+ filter: ReportsFilterArgs;
28
+ sort: ReportsSortEnum;
29
+ },
30
+ params: UseQueryParams = {},
31
+ ) {
32
+
33
+ const { organizationId, filter } = variables;
34
+ const { skip, ...restParams } = params;
35
+ const { data, ...rest } = useQuery(reportsQry, {
36
+ variables,
37
+ skip: skip || !organizationId || !filter,
38
+ ...restParams,
39
+ });
40
+
41
+ return {
42
+ reports: data?.reports,
43
+ ...rest
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Fetch list of available reports statuses
49
+ */
50
+
51
+ export function useAvailableReports(
52
+ organizationId: string | null,
53
+ params: UseQueryParams = {},
54
+ ) {
55
+
56
+ const { skip, ...restParams } = params;
57
+ const { data, ...rest } = useQuery(availableReportsQry, {
58
+ variables: {
59
+ organizationId,
60
+ },
61
+ skip: skip || !organizationId,
62
+ ...restParams,
63
+ });
64
+
65
+ return {
66
+ availableReports: data?.availableReports,
67
+ ...rest
68
+ };
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsb188/graphql",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "GraphQL client for react, using recoil",
5
5
  "license": "ISC",
6
6
  "author": "jsb188",
@@ -11,36 +11,26 @@
11
11
  "./fragments/accountAuth": "./gql/fragments/accountAuthFragments.ts",
12
12
  "./fragments/aiChat": "./gql/fragments/aiChatFragments.ts",
13
13
  "./fragments/billing": "./gql/fragments/billingFragments.ts",
14
- "./fragments/card": "./gql/fragments/cardFragments.ts",
15
- "./fragments/chat": "./gql/fragments/chatFragments.ts",
16
14
  "./fragments/log": "./gql/fragments/logFragments.ts",
17
15
  "./fragments/organization": "./gql/fragments/organizationFragments.ts",
18
16
  "./fragments/other": "./gql/fragments/otherFragments.ts",
19
- "./fragments/user": "./gql/fragments/userFragments.ts",
20
- "./fragments/userAuth": "./gql/fragments/userAuthFragments.ts",
17
+ "./fragments/product": "./gql/fragments/productFragments.ts",
18
+ "./fragments/report": "./gql/fragments/reportFragments.ts",
21
19
  "./hooks": "./hooks/",
20
+ "./hooks/use-action-qry": "./hooks/use-action-qry.ts",
22
21
  "./hooks/use-aiChat-qry": "./hooks/use-aiChat-qry.ts",
23
22
  "./hooks/use-app-qry": "./hooks/use-app-qry.ts",
24
23
  "./hooks/use-log-qry": "./hooks/use-log-qry.ts",
25
24
  "./hooks/use-organization-qry": "./hooks/use-organization-qry.ts",
25
+ "./hooks/use-product-qry": "./hooks/use-product-qry.ts",
26
+ "./hooks/use-report-qry": "./hooks/use-report-qry.ts",
27
+ "./hooks/use-account-mtn": "./hooks/use-account-mtn.ts",
28
+ "./hooks/use-aiChat-mtn": "./hooks/use-aiChat-mtn.ts",
26
29
  "./hooks/use-auth-mtn": "./hooks/use-auth-mtn.ts",
27
- "./mutations/aiChat": "./gql/mutations/aiChatMutations.ts",
28
- "./mutations/auth": "./gql/mutations/authMutations.ts",
29
- "./mutations/billing": "./gql/mutations/billingMutations.ts",
30
- "./mutations/chat": "./gql/mutations/chatMutations.ts",
31
- "./mutations/log": "./gql/mutations/logMutations.ts",
32
- "./mutations/other": "./gql/mutations/otherMutations.ts",
33
- "./mutations/user": "./gql/mutations/userMutations.ts",
34
- "./mutations/userAuth": "./gql/mutations/userAuthMutations.ts",
35
- "./queries/aiChat": "./gql/queries/aiChatQueries.ts",
36
- "./queries/app": "./gql/queries/appQueries.ts",
37
- "./queries/billing": "./gql/queries/billingQueries.ts",
38
- "./queries/card": "./gql/queries/cardQueries.ts",
39
- "./queries/chat": "./gql/queries/chatQueries.ts",
40
- "./queries/log": "./gql/queries/logQueries.ts",
41
- "./queries/organization": "./gql/queries/organizationQueries.ts",
42
- "./queries/other": "./gql/queries/otherQueries.ts",
43
- "./queries/user": "./gql/queries/userQueries.ts",
30
+ "./hooks/use-log-mtn": "./hooks/use-log-mtn.ts",
31
+ "./hooks/use-organization-mtn": "./hooks/use-organization-mtn.ts",
32
+ "./mutations": "./gql/mutations/index.ts",
33
+ "./queries": "./gql/queries/index.ts",
44
34
  "./cache": "./cache/index.ts",
45
35
  "./client": "./client/index.ts",
46
36
  "./sse": "./sse.ts",
@@ -51,11 +41,11 @@
51
41
  "test": "echo \"Error: no test specified\" && exit 1"
52
42
  },
53
43
  "dependencies": {
54
- "graphql": "^16.10.0",
44
+ "graphql": "^16.11.0",
55
45
  "graphql-tag": "^2.12.6"
56
46
  },
57
47
  "peerDependencies": {
58
- "@jsb188/app": "1.1.4",
59
- "@jsb188/react": "1.1.4"
48
+ "@jsb188/app": "1.1.6",
49
+ "@jsb188/react": "1.1.6"
60
50
  }
61
51
  }
package/sse.ts CHANGED
@@ -42,6 +42,16 @@ function handleQueryConcat(payload: PublishPayload, updateObservers?: UpdateObse
42
42
  ) {
43
43
  addFragmentToCache(dataFragmentKey, data);
44
44
  const updatedList = isAppend ? [...currentList, [dataFragmentKey]] : [[dataFragmentKey], ...currentList];
45
+
46
+ // console.log('UPDATED !!!!')
47
+ // console.log('UPDATED !!!!')
48
+ // console.log('UPDATED !!!!')
49
+ // console.log('UPDATED !!!!')
50
+ // console.log(fragmentNamespace, {
51
+ // ...currentData?.[fragmentNamespace],
52
+ // data: updatedList
53
+ // });
54
+
45
55
  return {
46
56
  ...currentData,
47
57
  ...otherData,
@@ -111,6 +121,7 @@ function handleFragmentUpdate(payload: PublishPayload, updateObservers?: UpdateO
111
121
  */
112
122
 
113
123
  function handleSSEData(payload: PublishPayload, updateObservers?: UpdateObserversFn) {
124
+
114
125
  switch (payload.__type) {
115
126
  case 'CONNECTED':
116
127
  // Do nothing
package/types.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface APIRequestOutput {
13
13
  export interface GraphQLHandlers {
14
14
  resetErrors: () => void;
15
15
  setError: (error: SimpleErrorType) => void;
16
+ setSaving: (nextSaving: boolean, resetInMS?: number) => void;
16
17
  refetch: () => void;
17
18
  }
18
19
 
@@ -1,15 +0,0 @@
1
- export const cardFragment = `fragment cardFragment on Card {
2
- id
3
- title
4
- }`;
5
-
6
- export const linkFragment = `fragment linkFragment on Link {
7
- id
8
- relatedId
9
- text
10
- url
11
- type
12
- photoUri
13
- broken
14
- order
15
- }`;