@jsb188/graphql 1.1.5 → 1.1.7

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 (39) hide show
  1. package/cache/config.ts +12 -5
  2. package/cache/index.ts +258 -109
  3. package/gql/fragments/actionFragments.ts +16 -0
  4. package/gql/fragments/logFragments.ts +72 -2
  5. package/gql/fragments/organizationFragments.ts +64 -5
  6. package/gql/fragments/otherFragments.ts +10 -8
  7. package/gql/fragments/productFragments.ts +63 -0
  8. package/gql/fragments/reportFragments.ts +48 -0
  9. package/gql/fragments/storageFragments.ts +11 -0
  10. package/gql/mutations/accountMutations.ts +10 -0
  11. package/gql/mutations/authMutations.ts +11 -16
  12. package/gql/mutations/index.ts +2 -1
  13. package/gql/mutations/logMutations.ts +20 -6
  14. package/gql/mutations/organizationMutations.ts +42 -0
  15. package/gql/mutations/storageMutations.ts +36 -0
  16. package/gql/mutations/userAuthMutations.ts +0 -12
  17. package/gql/queries/aiChatQueries.ts +3 -0
  18. package/gql/queries/index.ts +6 -0
  19. package/gql/queries/logQueries.ts +60 -11
  20. package/gql/queries/organizationQueries.ts +61 -1
  21. package/gql/queries/productQueries.ts +70 -0
  22. package/gql/queries/reportQueries.ts +66 -0
  23. package/hooks/index.ts +146 -45
  24. package/hooks/use-account-mtn.ts +26 -1
  25. package/hooks/use-aiChat-mtn.ts +17 -1
  26. package/hooks/use-aiChat-qry.ts +19 -10
  27. package/hooks/use-auth-mtn.ts +25 -2
  28. package/hooks/use-log-mtn.ts +4 -4
  29. package/hooks/use-log-qry.ts +47 -16
  30. package/hooks/use-organization-mtn.ts +105 -0
  31. package/hooks/use-organization-qry.ts +119 -15
  32. package/hooks/use-product-qry.ts +109 -0
  33. package/hooks/use-report-qry.ts +69 -0
  34. package/hooks/use-storage-mtn.ts +56 -0
  35. package/hooks/use-storage-qry.ts +21 -0
  36. package/package.json +14 -11
  37. package/sse.ts +11 -0
  38. package/gql/mutations/otherMutations.ts +0 -46
  39. package/gql/queries/otherQueries.ts +0 -12
@@ -4,12 +4,13 @@ export const logEntryFragment = `fragment logEntryFragment on LogEntry {
4
4
  accountId
5
5
  organizationId
6
6
  cursor
7
+ status
7
8
  date
8
9
  createdAt
9
10
  updatedAt
10
11
  }`;
11
12
 
12
- export const logEntryArableFragment = `fragment logEntryArableFragment on LogEntryArable {
13
+ export const logArableFragment = `fragment logArableFragment on LogArable {
13
14
  __typename
14
15
 
15
16
  id
@@ -17,9 +18,78 @@ export const logEntryArableFragment = `fragment logEntryArableFragment on LogEnt
17
18
  activity
18
19
  concentration
19
20
  concentrationUnit
20
- crop
21
+
22
+ item
21
23
  quantity
22
24
  unit
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
62
+ notes
63
+ }`;
64
+
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
83
+ }
84
+ tax
85
+
86
+ item
87
+ quantity
88
+ unit
23
89
  price
90
+ location
91
+ fieldLocation
92
+
93
+ summary
24
94
  notes
25
95
  }`;
@@ -3,13 +3,53 @@ export const organizationFragment = `fragment organizationFragment on Organizati
3
3
  id
4
4
  stripeCustomerId
5
5
  name
6
+ commodities
6
7
  operation
8
+
7
9
  dailyDigestTime
8
- domains
10
+ activated
11
+
12
+ address {
13
+ line1
14
+ line2
15
+ city
16
+ state
17
+ postalCode
18
+ country
19
+ }
9
20
 
21
+ features
10
22
  settings {
11
- emoji
12
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
39
+ name
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
13
53
  }
14
54
  }`;
15
55
 
@@ -21,12 +61,31 @@ export const organizationRelationshipFragment = `fragment organizationRelationsh
21
61
  acl {
22
62
  id
23
63
  billing
64
+ compliance
24
65
  digests
66
+ finances
67
+ integrations
25
68
  logs
26
69
  members
27
- finances
70
+ orgManagement
71
+ products
28
72
  settings
29
- integrations
30
- reminders
73
+ viewData
31
74
  }
32
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,48 @@
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
+ requireFileUploads
25
+ }`;
26
+
27
+ export const reportRowDataFragment = `fragment reportRowDataFragment on ReportRowData {
28
+ id
29
+ preset
30
+ className
31
+ isHeader
32
+ }`;
33
+
34
+ export const reportColumnDataFragment = `fragment reportColumnDataFragment on ReportColumnData {
35
+ id
36
+ className
37
+ label
38
+ text
39
+ placeholder
40
+ checked
41
+ }`;
42
+
43
+ export const reportAvailabilityFragment = `fragment reportAvailabilityFragment on ReportAvailability {
44
+ id
45
+ organizationId
46
+ type
47
+ periods
48
+ }`;
@@ -0,0 +1,11 @@
1
+
2
+ export const storageFileFragment = `fragment storageFileFragment on StorageFile {
3
+ id
4
+ uri
5
+ size
6
+ contentType
7
+ at
8
+ name
9
+ description
10
+ aiNote
11
+ }`;
@@ -19,3 +19,13 @@ mutation editAccount (
19
19
  }
20
20
  ${accountFragment}
21
21
  `;
22
+
23
+ export const requestChangeEmailMtn = gql`
24
+ mutation requestChangeEmail (
25
+ $emailAddress: String!
26
+ ) {
27
+ requestChangeEmail (
28
+ emailAddress: $emailAddress
29
+ )
30
+ }
31
+ `;
@@ -24,6 +24,17 @@ ${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!
@@ -128,22 +139,6 @@ mutation confirmPhoneVerificationCode (
128
139
  }
129
140
  }`;
130
141
 
131
- export const sendEmailVerificationMtn = gql`
132
- mutation sendEmailVerification (
133
- $userId: UserID!
134
- $email: String!
135
- ) {
136
- sendEmailVerification (
137
- userId: $userId
138
- email: $email
139
- ) {
140
- token
141
- userId
142
- username
143
- emailAddress
144
- }
145
- }`;
146
-
147
142
  export const signUpWithEmailMtn = gql`
148
143
  mutation signUpWithEmail (
149
144
  $emailAddress: String!
@@ -3,5 +3,6 @@ export * from './aiChatMutations';
3
3
  export * from './authMutations';
4
4
  export * from './billingMutations';
5
5
  export * from './logMutations';
6
- export * from './otherMutations';
6
+ export * from './organizationMutations';
7
+ export * from './storageMutations';
7
8
  export * from './userAuthMutations';
@@ -1,42 +1,56 @@
1
1
  import { gql } from 'graphql-tag';
2
- import { logEntryFragment, logEntryArableFragment } from '../fragments/logFragments';
2
+ import { logEntryFragment, logArableFragment, logLivestockFragment, logFarmersMarketFragment } from '../fragments/logFragments';
3
3
 
4
4
  export const editLogEntryMtn = gql`
5
5
  mutation editLogEntry (
6
+ $organizationId: GenericID!
6
7
  $logEntryId: GenericID!
7
8
  $accountId: GenericID
8
9
  $date: DateTime
9
10
 
10
- $arableDetails: LogEntryArableInput
11
- $livestockDetails: LogEntryLivestockInput
11
+ $arableDetails: LogArableInput
12
+ $livestockDetails: LogLivestockInput
13
+ $farmersMarketDetails: LogFarmersMarketInput
12
14
  ) {
13
15
  editLogEntry (
16
+ organizationId: $organizationId
14
17
  logEntryId: $logEntryId
15
18
  accountId: $accountId
16
19
  date: $date
17
20
 
18
21
  arableDetails: $arableDetails
19
22
  livestockDetails: $livestockDetails
23
+ farmersMarketDetails: $farmersMarketDetails
20
24
  ) {
21
25
  ...logEntryFragment
22
26
 
23
27
  details {
24
- ...on LogEntryArable {
25
- ...logEntryArableFragment
28
+ ...on LogArable {
29
+ ...logArableFragment
30
+ }
31
+ ...on LogFarmersMarket {
32
+ ...logFarmersMarketFragment
33
+ }
34
+ ...on LogLivestock {
35
+ ...logLivestockFragment
26
36
  }
27
37
  }
28
38
  }
29
39
  }
30
40
 
31
41
  ${logEntryFragment}
32
- ${logEntryArableFragment}
42
+ ${logArableFragment}
43
+ ${logFarmersMarketFragment}
44
+ ${logLivestockFragment}
33
45
  `;
34
46
 
35
47
  export const deleteLogEntryMtn = gql`
36
48
  mutation deleteLogEntry (
49
+ $organizationId: GenericID!
37
50
  $logEntryId: GenericID!
38
51
  ) {
39
52
  deleteLogEntry (
53
+ organizationId: $organizationId
40
54
  logEntryId: $logEntryId
41
55
  )
42
56
  }
@@ -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
+ `;
@@ -0,0 +1,36 @@
1
+ import { gql } from 'graphql-tag';
2
+
3
+ export const createSignedUploadUrlMtn = gql`
4
+ mutation createSignedUploadUrl (
5
+ $temporaryId: String!
6
+ $organizationId: GenericID!
7
+ $fileName: String!
8
+ $contentType: String!
9
+ $fileSize: Int!
10
+ $uploadIntent: StorageIntentObject!
11
+ ) {
12
+ createSignedUploadUrl (
13
+ temporaryId: $temporaryId
14
+ organizationId: $organizationId
15
+ fileName: $fileName
16
+ contentType: $contentType
17
+ fileSize: $fileSize
18
+ uploadIntent: $uploadIntent
19
+ ) {
20
+ signedUrl
21
+ fileUri
22
+ }
23
+ }
24
+ `;
25
+
26
+ export const deleteStorageFileMtn = gql`
27
+ mutation deleteStorageFile (
28
+ $organizationId: GenericID!
29
+ $fileUri: String!
30
+ ) {
31
+ deleteStorageFile (
32
+ organizationId: $organizationId
33
+ fileUri: $fileUri
34
+ )
35
+ }
36
+ `;
@@ -6,18 +6,6 @@ mutation signOut {
6
6
  }
7
7
  `;
8
8
 
9
- export const updateAppSettingsMtn = gql`
10
- mutation updateAppSettings (
11
- $stickySection: StickySection
12
- ) {
13
- updateAppSettings (
14
- stickySection: $stickySection
15
- ) {
16
- stickySection
17
- }
18
- }
19
- `;
20
-
21
9
  export const consumeTokenMtn = gql`
22
10
  mutation consumeToken (
23
11
  $token: Token!
@@ -10,6 +10,7 @@ query aiChat (
10
10
  aiChatId: $aiChatId
11
11
  ) {
12
12
  cursor
13
+ inProgress
13
14
  ...aiChatFragment
14
15
 
15
16
  messages (
@@ -46,12 +47,14 @@ ${aiChatMessageFragment}
46
47
 
47
48
  export const aiChatsQry = gql`
48
49
  query aiChats (
50
+ $organizationId: GenericID!
49
51
  $filter: AIChatsFilter
50
52
  $cursor: Cursor
51
53
  $after: Boolean!
52
54
  $limit: Int!
53
55
  ) {
54
56
  aiChats (
57
+ organizationId: $organizationId
55
58
  filter: $filter
56
59
  cursor: $cursor
57
60
  after: $after
@@ -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
  `;