@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,67 +1,4 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { userAuthFragment } from '../fragments/userAuthFragments';
3
- import { emailFragment, phoneFragment } from '../fragments/otherFragments';
4
- import { plusFragment, userFragment, userPersonaFragment } from '../fragments/userFragments';
5
-
6
- const signInResultText = `...userAuthFragment
7
-
8
- user {
9
- ...userFragment
10
- lightMode
11
-
12
- plus {
13
- ...plusFragment
14
- }
15
-
16
- email {
17
- ...emailFragment
18
- }
19
-
20
- phone {
21
- ...phoneFragment
22
- }
23
-
24
- personas {
25
- ...userPersonaFragment
26
- }
27
- }`;
28
-
29
- const signInFragments = `
30
- ${userAuthFragment}
31
- ${userFragment}
32
- ${plusFragment}
33
- ${emailFragment}
34
- ${userPersonaFragment}
35
- ${phoneFragment}
36
- `;
37
-
38
- export const signInWithTokenMtn = gql`
39
- mutation signInWithToken (
40
- $token: Token!
41
- ) {
42
- signInWithToken (
43
- token: $token
44
- ) {
45
- ${signInResultText}
46
- }
47
- }
48
- ${signInFragments}
49
- `;
50
-
51
- export const checkUsernameOrEmailMtn = gql`
52
- mutation checkUsernameOrEmail (
53
- $usernameOrEmail: String!
54
- $authCheck: Boolean
55
- ) {
56
- checkUsernameOrEmail (
57
- usernameOrEmail: $usernameOrEmail
58
- authCheck: $authCheck
59
- ) {
60
- value
61
- type
62
- taken
63
- }
64
- }`;
65
2
 
66
3
  export const signOutMtn = gql`
67
4
  mutation signOut {
@@ -69,59 +6,6 @@ mutation signOut {
69
6
  }
70
7
  `;
71
8
 
72
- export const updateAppSettingsMtn = gql`
73
- mutation updateAppSettings (
74
- $stickySection: StickySection
75
- ) {
76
- updateAppSettings (
77
- stickySection: $stickySection
78
- ) {
79
- stickySection
80
- }
81
- }
82
- `;
83
-
84
- export const signInMtn = gql`
85
- mutation signIn (
86
- $usernameOrEmail: String!
87
- $password: String!
88
- ) {
89
- signIn (
90
- usernameOrEmail: $usernameOrEmail,
91
- password: $password
92
- ) {
93
- ${signInResultText}
94
- }
95
- }
96
- ${signInFragments}
97
- `;
98
-
99
- export const changePasswordMtn = gql`
100
- mutation changePassword (
101
- $currentPassword: String!
102
- $password: String!
103
- $passwordRepeat: String!
104
- $token: Token
105
- ) {
106
- changePassword (
107
- currentPassword: $currentPassword
108
- password: $password
109
- passwordRepeat: $passwordRepeat
110
- token: $token
111
- )
112
- }`;
113
-
114
- export const requestTokenizedEmailMtn = gql`
115
- mutation requestTokenizedEmail (
116
- $email: String!
117
- $requestType: TokenType!
118
- ) {
119
- requestTokenizedEmail (
120
- email: $email
121
- requestType: $requestType
122
- )
123
- }`;
124
-
125
9
  export const consumeTokenMtn = gql`
126
10
  mutation consumeToken (
127
11
  $token: Token!
@@ -9,6 +9,8 @@ query aiChat (
9
9
  aiChat (
10
10
  aiChatId: $aiChatId
11
11
  ) {
12
+ cursor
13
+ inProgress
12
14
  ...aiChatFragment
13
15
 
14
16
  messages (
@@ -45,12 +47,14 @@ ${aiChatMessageFragment}
45
47
 
46
48
  export const aiChatsQry = gql`
47
49
  query aiChats (
50
+ $organizationId: GenericID!
48
51
  $filter: AIChatsFilter
49
52
  $cursor: Cursor
50
53
  $after: Boolean!
51
54
  $limit: Int!
52
55
  ) {
53
56
  aiChats (
57
+ organizationId: $organizationId
54
58
  filter: $filter
55
59
  cursor: $cursor
56
60
  after: $after
@@ -3,7 +3,8 @@ import { gql } from 'graphql-tag';
3
3
  export const updateNoteQry = gql`
4
4
  query updateNote {
5
5
  updateNote {
6
- version
6
+ webVersion
7
+ mobileVersion
7
8
  emoji
8
9
  title
9
10
  at
@@ -0,0 +1,6 @@
1
+ export * from './aiChatQueries';
2
+ export * from './appQueries';
3
+ export * from './billingQueries';
4
+ export * from './logQueries';
5
+ export * from './organizationQueries';
6
+ export * from './productQueries';
@@ -1,11 +1,39 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import { accountFragment } from '../fragments/accountFragments';
3
- import { logEntryFragment, logEntryArableFragment } from '../fragments/logFragments';
3
+ import { logEntryFragment, logArableFragment, logLivestockFragment, logFarmersMarketFragment } from '../fragments/logFragments';
4
+ import { actionTaskFragment } from '../fragments/actionFragments';
5
+
6
+ export const logEntryFragmentStatement = `...logEntryFragment
7
+
8
+ details {
9
+ ...on LogArable {
10
+ ...logArableFragment
11
+ }
12
+ ...on LogFarmersMarket {
13
+ ...logFarmersMarketFragment
14
+ }
15
+ ...on LogLivestock {
16
+ ...logLivestockFragment
17
+ }
18
+ }
19
+
20
+ account {
21
+ ...accountFragment
22
+ }`;
23
+
24
+ export const logEntryFragmentImports = `
25
+ ${accountFragment}
26
+ ${logEntryFragment}
27
+ ${logArableFragment}
28
+ ${logFarmersMarketFragment}
29
+ ${logLivestockFragment}
30
+ `;
4
31
 
5
32
  export const logEntriesQry = gql`
6
33
  query logEntries (
7
34
  $organizationId: GenericID!
8
35
  $filter: LogEntriesFilter!
36
+ $sort: LogEntriesSort
9
37
  $cursor: Cursor
10
38
  $after: Boolean!
11
39
  $limit: Int!
@@ -13,25 +41,46 @@ query logEntries (
13
41
  logEntries (
14
42
  organizationId: $organizationId
15
43
  filter: $filter
44
+ sort: $sort
16
45
  cursor: $cursor
17
46
  after: $after
18
47
  limit: $limit
19
48
  ) {
20
- ...logEntryFragment
49
+ ${logEntryFragmentStatement}
21
50
 
22
- details {
23
- ...on LogEntryArable {
24
- ...logEntryArableFragment
25
- }
51
+ actions {
52
+ ...actionTaskFragment
26
53
  }
54
+ }
55
+ }
27
56
 
28
- account {
29
- ...accountFragment
57
+ ${actionTaskFragment}
58
+ ${logEntryFragmentImports}
59
+ `;
60
+
61
+ export const logEvidencesQry = gql`
62
+ query logEvidences (
63
+ $organizationId: GenericID!
64
+ $reportId: CursorToID!
65
+ $cursor: Cursor
66
+ $after: Boolean!
67
+ $limit: Int!
68
+ ) {
69
+ logEvidences (
70
+ organizationId: $organizationId
71
+ reportId: $reportId
72
+ cursor: $cursor
73
+ after: $after
74
+ limit: $limit
75
+ ) {
76
+ ${logEntryFragmentStatement}
77
+
78
+ actions {
79
+ ...actionTaskFragment
30
80
  }
31
81
  }
32
82
  }
33
83
 
34
- ${accountFragment}
35
- ${logEntryFragment}
36
- ${logEntryArableFragment}
84
+ ${actionTaskFragment}
85
+ ${logEntryFragmentImports}
37
86
  `;
@@ -1,5 +1,5 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { organizationFragment, organizationRelationshipFragment } from '../fragments/organizationFragments';
2
+ import { organizationChildFragment, organizationComplianceFragment, organizationFragment, organizationInstructionsFragment, organizationRelationshipFragment } from '../fragments/organizationFragments';
3
3
 
4
4
  // Always use organizationRelationship() instead
5
5
 
@@ -28,11 +28,17 @@ query organizationRelationship (
28
28
 
29
29
  organization {
30
30
  ...organizationFragment
31
+ membersCount
32
+
33
+ compliance {
34
+ ...organizationComplianceFragment
35
+ }
31
36
  }
32
37
  }
33
38
  }
34
39
 
35
40
  ${organizationFragment}
41
+ ${organizationComplianceFragment}
36
42
  ${organizationRelationshipFragment}
37
43
  `;
38
44
 
@@ -43,10 +49,65 @@ query myOrganizations {
43
49
 
44
50
  organization {
45
51
  ...organizationFragment
52
+ membersCount
53
+
54
+ compliance {
55
+ ...organizationComplianceFragment
56
+ }
46
57
  }
47
58
  }
48
59
  }
49
60
 
50
61
  ${organizationFragment}
62
+ ${organizationComplianceFragment}
51
63
  ${organizationRelationshipFragment}
52
64
  `;
65
+
66
+ export const childOrganizationsQry = gql`
67
+ query childOrganizations (
68
+ $organizationId: GenericID!
69
+ $filter: ChildOrgsFilter
70
+ $cursor: Cursor
71
+ $after: Boolean!
72
+ $limit: Int!
73
+ ) {
74
+ childOrganizations (
75
+ organizationId: $organizationId
76
+ filter: $filter
77
+ cursor: $cursor
78
+ after: $after
79
+ limit: $limit
80
+ ) {
81
+ ...organizationChildFragment
82
+
83
+ organization {
84
+ ...organizationFragment
85
+ membersCount
86
+
87
+ compliance {
88
+ ...organizationComplianceFragment
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ ${organizationChildFragment}
95
+ ${organizationFragment}
96
+ ${organizationComplianceFragment}
97
+ `;
98
+
99
+ export const organizationWorkflowsQry = gql`
100
+ query organizationWorkflows (
101
+ $organizationId: GenericID!
102
+ $operation: OrganizationOperation!
103
+ ) {
104
+ organizationWorkflows (
105
+ organizationId: $organizationId
106
+ operation: $operation
107
+ ) {
108
+ ...organizationInstructionsFragment
109
+ }
110
+ }
111
+
112
+ ${organizationInstructionsFragment}
113
+ `;
@@ -0,0 +1,70 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { accountFragment } from '../fragments/accountFragments';
3
+ import { organizationComplianceFragment, organizationFragment } from '../fragments/organizationFragments';
4
+ import { productAttendanceFragment, productCalEventFragment, productFragment, productLivestockFragment } from '../fragments/productFragments';
5
+
6
+ export const productsListQry = gql`
7
+ query productsList (
8
+ $organizationId: GenericID!
9
+ $filter: ProductsFilter!
10
+ $cursor: Cursor
11
+ $after: Boolean!
12
+ $limit: Int!
13
+ ) {
14
+ productsList (
15
+ organizationId: $organizationId
16
+ filter: $filter
17
+ cursor: $cursor
18
+ after: $after
19
+ limit: $limit
20
+ ) {
21
+ ...productFragment
22
+
23
+ details {
24
+ ...on ProductCalEvent {
25
+ ...productCalEventFragment
26
+ }
27
+ ...on ProductLivestock {
28
+ ...productLivestockFragment
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ ${productFragment}
35
+ ${productCalEventFragment}
36
+ ${productLivestockFragment}
37
+ `;
38
+
39
+ export const productAttendanceListQry = gql`
40
+ query productAttendanceList (
41
+ $productId: GenericID!
42
+ $organizationId: GenericID!
43
+ $calDate: CalDateString!
44
+ ) {
45
+ productAttendanceList (
46
+ productId: $productId
47
+ organizationId: $organizationId
48
+ calDate: $calDate
49
+ ) {
50
+ ...productAttendanceFragment
51
+
52
+ organization {
53
+ ...organizationFragment
54
+
55
+ compliance {
56
+ ...organizationComplianceFragment
57
+ }
58
+ }
59
+
60
+ checkedBy {
61
+ ...accountFragment
62
+ }
63
+ }
64
+ }
65
+
66
+ ${productAttendanceFragment}
67
+ ${organizationFragment}
68
+ ${organizationComplianceFragment}
69
+ ${accountFragment}
70
+ `;
@@ -0,0 +1,60 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { reportColumnDataFragment, reportFragment, reportAvailabilityFragment, reportRowDataFragment, reportSectionFragment } from '../fragments/reportFragments';
3
+
4
+ export const reportsQry = gql`
5
+ query reports (
6
+ $organizationId: GenericID!
7
+ $filter: ReportsFilter!
8
+ $sort: ReportsSort
9
+ ) {
10
+ reports (
11
+ organizationId: $organizationId
12
+ filter: $filter
13
+ sort: $sort
14
+ ) {
15
+ ...reportFragment
16
+
17
+ sections {
18
+ ...reportSectionFragment
19
+
20
+ rows {
21
+ ...reportRowDataFragment
22
+
23
+ columns {
24
+ ...reportColumnDataFragment
25
+ }
26
+ }
27
+ }
28
+
29
+ # This needs to be deprecated and merged to sections
30
+ # Its only used for cleaning logs right now
31
+
32
+ rows {
33
+ ...reportRowDataFragment
34
+
35
+ columns {
36
+ ...reportColumnDataFragment
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ ${reportFragment}
43
+ ${reportSectionFragment}
44
+ ${reportRowDataFragment}
45
+ ${reportColumnDataFragment}
46
+ `;
47
+
48
+ export const availableReportsQry = gql`
49
+ query availableReports (
50
+ $organizationId: GenericID!
51
+ ) {
52
+ availableReports (
53
+ organizationId: $organizationId
54
+ ) {
55
+ ...reportAvailabilityFragment
56
+ }
57
+ }
58
+
59
+ ${reportAvailabilityFragment}
60
+ `;