@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
@@ -3,14 +3,8 @@ export const accountAuthFragment = `fragment accountAuthFragment on AccountAuth
3
3
  primaryOrganizationId
4
4
  activated
5
5
  hasPassword
6
- version
7
6
 
8
- settings {
9
- theme
10
- lightMode
11
- timeZone
12
- showSelfAvatar
13
- isBubbleOther
14
- showOtherAvatar
15
- }
7
+ alertUpdatesOnMount
8
+ webVersion
9
+ mobileVersion
16
10
  }`;
@@ -1,6 +1,7 @@
1
1
  export const accountFragment = `fragment accountFragment on Account {
2
2
  id
3
3
  deleted
4
+ color
4
5
 
5
6
  profile {
6
7
  id
@@ -10,4 +11,14 @@ export const accountFragment = `fragment accountFragment on Account {
10
11
  photoId
11
12
  photoUri
12
13
  }
14
+
15
+ settings {
16
+ theme
17
+ lightMode
18
+ timeZone
19
+ language
20
+ showSelfAvatar
21
+ isBubbleOther
22
+ showOtherAvatar
23
+ }
13
24
  }`;
@@ -0,0 +1,16 @@
1
+
2
+ export const actionTaskFragment = `fragment actionTaskFragment on ActionTask {
3
+ id
4
+ logId
5
+
6
+ title
7
+ message
8
+ instruction
9
+
10
+ scheduledAt
11
+ delay
12
+ completed
13
+
14
+ createdAt
15
+ updatedAt
16
+ }`;
@@ -3,24 +3,93 @@ export const logEntryFragment = `fragment logEntryFragment on LogEntry {
3
3
  id
4
4
  accountId
5
5
  organizationId
6
-
6
+ cursor
7
+ status
8
+ date
7
9
  createdAt
8
10
  updatedAt
9
11
  }`;
10
12
 
11
- export const logEntryArableFragment = `fragment logEntryArableFragment on LogEntryArable {
13
+ export const logArableFragment = `fragment logArableFragment on LogArable {
12
14
  __typename
13
15
 
14
16
  id
15
17
  type
16
18
  activity
19
+ concentration
20
+ concentrationUnit
21
+
22
+ item
17
23
  quantity
18
24
  unit
19
- price
25
+ location
26
+ fieldLocation
27
+
28
+ otherParty
29
+ referenceNumber
30
+ values {
31
+ label
32
+ value
33
+ quantity
34
+ }
35
+ tax
36
+
37
+ summary
38
+ notes
39
+ }`;
40
+
41
+ export const logFarmersMarketFragment = `fragment logFarmersMarketFragment on LogFarmersMarket {
42
+ __typename
43
+
44
+ id
45
+ type
46
+ activity
47
+
48
+ childOrgId
49
+ item
50
+
51
+ otherParty
52
+ referenceNumber
53
+ values {
54
+ label
55
+ value
56
+ quantity
57
+ }
58
+ tax
59
+ voided
60
+
61
+ summary
20
62
  notes
63
+ }`;
21
64
 
22
- crop {
23
- id
24
- name
65
+ export const logLivestockFragment = `fragment logLivestockFragment on LogLivestock {
66
+ __typename
67
+
68
+ id
69
+ type
70
+ activity
71
+
72
+ livestock
73
+ livestockIdentifiers
74
+ livestockGroup
75
+ damIdentifier
76
+
77
+ otherParty
78
+ referenceNumber
79
+ values {
80
+ label
81
+ value
82
+ quantity
25
83
  }
84
+ tax
85
+
86
+ item
87
+ quantity
88
+ unit
89
+ price
90
+ location
91
+ fieldLocation
92
+
93
+ summary
94
+ notes
26
95
  }`;
@@ -2,9 +2,55 @@
2
2
  export const organizationFragment = `fragment organizationFragment on Organization {
3
3
  id
4
4
  stripeCustomerId
5
+ name
6
+ commodities
5
7
  operation
8
+
9
+ dailyDigestTime
10
+ activated
11
+
12
+ address {
13
+ line1
14
+ line2
15
+ city
16
+ state
17
+ postalCode
18
+ country
19
+ }
20
+
21
+ features
22
+ settings {
23
+ timeZone
24
+ language
25
+ color
26
+ }
27
+
28
+ directory {
29
+ department
30
+ name
31
+ emailAddress
32
+ phoneNumber
33
+ }
34
+ }`;
35
+
36
+ export const organizationComplianceFragment = `fragment organizationComplianceFragment on OrganizationCompliance {
37
+ id
38
+ number
6
39
  name
7
- domains
40
+ type
41
+ expirationDate
42
+ notes
43
+ createdAt
44
+ updatedAt
45
+
46
+ files {
47
+ id
48
+ complianceId
49
+ storageId
50
+ order
51
+ uri
52
+ contentType
53
+ }
8
54
  }`;
9
55
 
10
56
  export const organizationRelationshipFragment = `fragment organizationRelationshipFragment on OrganizationRelationship {
@@ -15,11 +61,31 @@ export const organizationRelationshipFragment = `fragment organizationRelationsh
15
61
  acl {
16
62
  id
17
63
  billing
18
- journal
19
- members
64
+ compliance
65
+ digests
20
66
  finances
67
+ integrations
68
+ logs
69
+ members
70
+ orgManagement
21
71
  products
22
72
  settings
23
- integrations
73
+ viewData
24
74
  }
25
75
  }`;
76
+
77
+ export const organizationChildFragment = `fragment organizationChildFragment on OrganizationChild {
78
+ id
79
+ cursor
80
+ addedAt
81
+ }`;
82
+
83
+ export const organizationInstructionsFragment = `fragment organizationInstructionsFragment on OrganizationInstructions {
84
+ id
85
+ organizationId
86
+ logType
87
+ summary
88
+ instructions
89
+ createdAt
90
+ updatedAt
91
+ }`;
@@ -8,15 +8,17 @@ export const phoneFragment = `fragment phoneFragment on Phone {
8
8
  id
9
9
  number
10
10
  verified
11
- primary
12
11
  }`;
13
12
 
14
- export const alertFragment = `fragment alertFragment on Alert {
13
+ export const addressFragment = `fragment addressFragment on Address {
15
14
  id
16
- relatedId
17
- relatedUserId
18
- type
19
- value
20
- createdAt
21
- updatedAt
15
+ organizationId
16
+ line1
17
+ line2
18
+ city
19
+ state
20
+ postalCode
21
+ country
22
+ createdAt
23
+ updatedAt
22
24
  }`;
@@ -0,0 +1,63 @@
1
+
2
+ export const productFragment = `fragment productFragment on Product {
3
+ id
4
+ organizationId
5
+ cursor
6
+
7
+ metadata {
8
+ overview
9
+ }
10
+
11
+ createdAt
12
+ updatedAt
13
+ }`;
14
+
15
+ export const productCalEventFragment = `fragment productCalEventFragment on ProductCalEvent {
16
+ __typename
17
+
18
+ id
19
+ name
20
+
21
+ schedule {
22
+ frequency
23
+ weeksOfMonth
24
+ daysOfWeek
25
+ time
26
+ }
27
+
28
+ address {
29
+ line1
30
+ line2
31
+ city
32
+ state
33
+ postalCode
34
+ country
35
+ }
36
+
37
+ startAt
38
+ endAt
39
+ }`;
40
+
41
+ export const productAttendanceFragment = `fragment productAttendanceFragment on ProductAttendance {
42
+ id
43
+ productId
44
+ organizationId
45
+ calDate
46
+ attended
47
+ }`;
48
+
49
+ export const productLivestockFragment = `fragment productLivestockFragment on ProductLivestock {
50
+ __typename
51
+
52
+ id
53
+ damIdentifier
54
+ livestockIdentifier
55
+ livestockGroup
56
+
57
+ type
58
+ status
59
+ livestockClass
60
+
61
+ birthDate
62
+ deathDate
63
+ }`;
@@ -0,0 +1,47 @@
1
+
2
+ export const reportFragment = `fragment reportFragment on Report {
3
+ id
4
+ organizationId
5
+
6
+ documentName
7
+ title
8
+ description
9
+ type
10
+ period
11
+ evidencesCount
12
+ gridLayoutStyle
13
+
14
+ activityAt
15
+ }`;
16
+
17
+ export const reportSectionFragment = `fragment reportSectionFragment on ReportSection {
18
+ id
19
+ isGroupTitle
20
+ sectionKey
21
+ sectionName
22
+ title
23
+ description
24
+ }`;
25
+
26
+ export const reportRowDataFragment = `fragment reportRowDataFragment on ReportRowData {
27
+ id
28
+ preset
29
+ className
30
+ isHeader
31
+ }`;
32
+
33
+ export const reportColumnDataFragment = `fragment reportColumnDataFragment on ReportColumnData {
34
+ id
35
+ className
36
+ label
37
+ text
38
+ placeholder
39
+ checked
40
+ }`;
41
+
42
+ export const reportAvailabilityFragment = `fragment reportAvailabilityFragment on ReportAvailability {
43
+ id
44
+ organizationId
45
+ type
46
+ periods
47
+ }`;
@@ -0,0 +1,31 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { accountFragment } from '../fragments/accountFragments';
3
+
4
+ export const editAccountMtn = gql`
5
+ mutation editAccount (
6
+ $accountId: GenericID
7
+ $photoId: GenericID
8
+ $profile: AccountProfileInput
9
+ $settings: AccountSettingsInput
10
+ ) {
11
+ editAccount (
12
+ accountId: $accountId
13
+ photoId: $photoId
14
+ profile: $profile
15
+ settings: $settings
16
+ ) {
17
+ ...accountFragment
18
+ }
19
+ }
20
+ ${accountFragment}
21
+ `;
22
+
23
+ export const requestChangeEmailMtn = gql`
24
+ mutation requestChangeEmail (
25
+ $emailAddress: String!
26
+ ) {
27
+ requestChangeEmail (
28
+ emailAddress: $emailAddress
29
+ )
30
+ }
31
+ `;
@@ -12,6 +12,7 @@ mutation startAIChat (
12
12
  ) {
13
13
  sessionKey
14
14
  node {
15
+ cursor
15
16
  ...aiChatFragment
16
17
  }
17
18
  }
@@ -24,13 +24,24 @@ ${emailFragment}
24
24
  ${phoneFragment}
25
25
  `;
26
26
 
27
+ export const confirmPasswordMtn = gql`
28
+ mutation confirmPassword (
29
+ $password: String!
30
+ ) {
31
+ confirmPassword (
32
+ password: $password
33
+ )
34
+ }
35
+ `;
36
+
37
+
27
38
  export const authenticateWithPasswordMtn = gql`
28
39
  mutation authenticateWithPassword (
29
40
  $identifier: String!
30
41
  $password: String!
31
42
  ) {
32
43
  authenticateWithPassword (
33
- identifier: $identifier,
44
+ identifier: $identifier
34
45
  password: $password
35
46
  ) {
36
47
  ${authenticateResultText}
@@ -52,19 +63,79 @@ mutation authenticateWithToken (
52
63
  ${authenticateFragments}
53
64
  `;
54
65
 
55
- export const sendEmailVerificationMtn = gql`
56
- mutation sendEmailVerification (
57
- $userId: UserID!
66
+ export const continueWithGoogleMtn = gql`
67
+ mutation continueWithGoogle (
68
+ $oauthToken: String!
69
+ ) {
70
+ continueWithGoogle (
71
+ oauthToken: $oauthToken
72
+ ) {
73
+ ${authenticateResultText}
74
+ }
75
+ }
76
+ ${authenticateFragments}
77
+ `;
78
+
79
+ export const checkUsernameOrEmailMtn = gql`
80
+ mutation checkUsernameOrEmail (
81
+ $usernameOrEmail: String!
82
+ $authCheck: Boolean
83
+ ) {
84
+ checkUsernameOrEmail (
85
+ usernameOrEmail: $usernameOrEmail
86
+ authCheck: $authCheck
87
+ ) {
88
+ value
89
+ type
90
+ hasPassword
91
+ taken
92
+ }
93
+ }`;
94
+
95
+ export const changeAccountPasswordMtn = gql`
96
+ mutation changeAccountPassword (
97
+ $password: String!
98
+ $currentPassword: String
99
+ $token: Token
100
+ ) {
101
+ changeAccountPassword (
102
+ password: $password
103
+ currentPassword: $currentPassword
104
+ token: $token
105
+ )
106
+ }`;
107
+
108
+ export const requestTokenizedEmailMtn = gql`
109
+ mutation requestTokenizedEmail (
58
110
  $email: String!
111
+ $requestType: TokenType!
59
112
  ) {
60
- sendEmailVerification (
61
- userId: $userId
113
+ requestTokenizedEmail (
62
114
  email: $email
115
+ requestType: $requestType
116
+ )
117
+ }`;
118
+
119
+ export const sendPhoneVerificationCodeMtn = gql`
120
+ mutation sendPhoneVerificationCode (
121
+ $phone: String!
122
+ ) {
123
+ sendPhoneVerificationCode (
124
+ phone: $phone
125
+ )
126
+ }`;
127
+
128
+ export const confirmPhoneVerificationCodeMtn = gql`
129
+ mutation confirmPhoneVerificationCode (
130
+ $phone: String!
131
+ $code: String!
132
+ ) {
133
+ confirmPhoneVerificationCode (
134
+ phone: $phone
135
+ code: $code
63
136
  ) {
137
+ success
64
138
  token
65
- userId
66
- username
67
- emailAddress
68
139
  }
69
140
  }`;
70
141
 
@@ -79,19 +150,6 @@ mutation signUpWithEmail (
79
150
  )
80
151
  }`;
81
152
 
82
- export const signInWithGoogleMtn = gql`
83
- mutation signInWithGoogle (
84
- $oauthToken: String!
85
- ) {
86
- signInWithGoogle (
87
- oauthToken: $oauthToken
88
- ) {
89
- ${authenticateResultText}
90
- }
91
- }
92
- ${authenticateFragments}
93
- `;
94
-
95
153
  export const signInWithAppleMtn = gql`
96
154
  mutation signInWithApple (
97
155
  $code: String!
@@ -0,0 +1,8 @@
1
+ export * from './accountMutations';
2
+ export * from './aiChatMutations';
3
+ export * from './authMutations';
4
+ export * from './billingMutations';
5
+ export * from './logMutations';
6
+ export * from './organizationMutations';
7
+ export * from './otherMutations';
8
+ export * from './userAuthMutations';
@@ -1,2 +1,57 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { logEntryFragment, logArableFragment, logLivestockFragment, logFarmersMarketFragment } from '../fragments/logFragments';
1
3
 
2
- // Insert journal mutations here
4
+ export const editLogEntryMtn = gql`
5
+ mutation editLogEntry (
6
+ $organizationId: GenericID!
7
+ $logEntryId: GenericID!
8
+ $accountId: GenericID
9
+ $date: DateTime
10
+
11
+ $arableDetails: LogArableInput
12
+ $livestockDetails: LogLivestockInput
13
+ $farmersMarketDetails: LogFarmersMarketInput
14
+ ) {
15
+ editLogEntry (
16
+ organizationId: $organizationId
17
+ logEntryId: $logEntryId
18
+ accountId: $accountId
19
+ date: $date
20
+
21
+ arableDetails: $arableDetails
22
+ livestockDetails: $livestockDetails
23
+ farmersMarketDetails: $farmersMarketDetails
24
+ ) {
25
+ ...logEntryFragment
26
+
27
+ details {
28
+ ...on LogArable {
29
+ ...logArableFragment
30
+ }
31
+ ...on LogFarmersMarket {
32
+ ...logFarmersMarketFragment
33
+ }
34
+ ...on LogLivestock {
35
+ ...logLivestockFragment
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ ${logEntryFragment}
42
+ ${logArableFragment}
43
+ ${logFarmersMarketFragment}
44
+ ${logLivestockFragment}
45
+ `;
46
+
47
+ export const deleteLogEntryMtn = gql`
48
+ mutation deleteLogEntry (
49
+ $organizationId: GenericID!
50
+ $logEntryId: GenericID!
51
+ ) {
52
+ deleteLogEntry (
53
+ organizationId: $organizationId
54
+ logEntryId: $logEntryId
55
+ )
56
+ }
57
+ `;
@@ -0,0 +1,42 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { organizationFragment } from '../fragments/organizationFragments';
3
+
4
+ export const switchOrganizationMtn = gql`
5
+ mutation switchOrganization (
6
+ $organizationId: GenericID!
7
+ ) {
8
+ switchOrganization (
9
+ organizationId: $organizationId
10
+ )
11
+ }
12
+ `;
13
+
14
+ export const deleteComplianceDocumentMtn = gql`
15
+ mutation deleteComplianceDocument (
16
+ $organizationId: GenericID!
17
+ $complianceId: GenericID!
18
+ ) {
19
+ deleteComplianceDocument (
20
+ organizationId: $organizationId
21
+ complianceId: $complianceId
22
+ )
23
+ }
24
+ `;
25
+
26
+ export const editOrganizationMtn = gql`
27
+ mutation editOrganization (
28
+ $organizationId: GenericID!
29
+ $name: String
30
+ $address: AddressInput
31
+ ) {
32
+ editOrganization (
33
+ organizationId: $organizationId
34
+ name: $name
35
+ address: $address
36
+ ) {
37
+ ...organizationFragment
38
+ }
39
+ }
40
+
41
+ ${organizationFragment}
42
+ `;
@@ -1,5 +1,4 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { alertFragment } from '../fragments/otherFragments';
3
2
 
4
3
  export const prepareFileUploadMtn = gql`
5
4
  mutation prepareFileUpload (
@@ -28,19 +27,3 @@ mutation finishFileUpload (
28
27
  }
29
28
  }
30
29
  `;
31
-
32
- export const alertCallToActionMtn = gql`
33
- mutation alertCallToAction (
34
- $alertId: GenericID!
35
- $approve: Boolean!
36
- ) {
37
- alertCallToAction (
38
- alertId: $alertId
39
- approve: $approve
40
- ) {
41
- ...alertFragment
42
- }
43
- }
44
-
45
- ${alertFragment}
46
- `;