@jsb188/graphql 1.1.10 → 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.
Files changed (116) hide show
  1. package/cache/config.ts +64 -50
  2. package/cache/index.test.ts +671 -109
  3. package/cache/index.ts +1700 -1240
  4. package/cache/persist.ts +721 -0
  5. package/cache/store.ts +437 -0
  6. package/client/data-table-realtime-subscriptions.test.ts +740 -0
  7. package/client/data-table-realtime-subscriptions.ts +955 -0
  8. package/client/data-table-realtime.test.ts +792 -0
  9. package/client/data-table-realtime.ts +1218 -0
  10. package/client/fragment-realtime-sequence.ts +52 -0
  11. package/client/index.ts +2 -0
  12. package/client/open-sheet.ts +137 -0
  13. package/client/request-managed-session.test.ts +574 -0
  14. package/client/request-no-store.test.ts +157 -0
  15. package/client/request.ts +954 -163
  16. package/client/sse-ticket.test.ts +26 -0
  17. package/deno.lock +170 -0
  18. package/deno.test.json +8 -4
  19. package/drafts/index.ts +149 -0
  20. package/drafts/store.ts +397 -0
  21. package/gql/eagerQueryMap.ts +12 -0
  22. package/gql/fragments/accountAuthFragments.ts +5 -0
  23. package/gql/fragments/accountFragments.ts +0 -3
  24. package/gql/fragments/accountSessionFragments.ts +16 -0
  25. package/gql/fragments/agentDocFragments.ts +46 -0
  26. package/gql/fragments/agentMemoryFragments.ts +19 -0
  27. package/gql/fragments/aiChatFragments.ts +16 -0
  28. package/gql/fragments/billingFragments.ts +0 -11
  29. package/gql/fragments/campaignFragments.ts +277 -0
  30. package/gql/fragments/dataTableFragments.ts +18 -128
  31. package/gql/fragments/emailFragments.ts +19 -9
  32. package/gql/fragments/fieldDocFragments.ts +82 -0
  33. package/gql/fragments/logFragments.ts +20 -79
  34. package/gql/fragments/organizationFragments.ts +43 -5
  35. package/gql/fragments/scheduleFragments.ts +155 -0
  36. package/gql/fragments/sheetFragments.ts +552 -22
  37. package/gql/fragments/storageFragments.ts +21 -0
  38. package/gql/fragments/workflowFragments.ts +28 -4
  39. package/gql/mutations/accountMutations.ts +0 -2
  40. package/gql/mutations/agentDocMutations.ts +177 -0
  41. package/gql/mutations/agentMemoryMutations.ts +36 -0
  42. package/gql/mutations/aiChatMutations.ts +17 -4
  43. package/gql/mutations/authMutations.ts +158 -17
  44. package/gql/mutations/campaignMutations.ts +215 -0
  45. package/gql/mutations/dataTableMutations.ts +48 -26
  46. package/gql/mutations/fieldDocMutations.ts +24 -0
  47. package/gql/mutations/index.ts +6 -1
  48. package/gql/mutations/logMutations.ts +6 -29
  49. package/gql/mutations/organizationMutations.ts +13 -4
  50. package/gql/mutations/scheduleMutations.ts +423 -0
  51. package/gql/mutations/sheetMutations.ts +273 -56
  52. package/gql/mutations/storageMutations.ts +20 -0
  53. package/gql/mutations/workflowMutations.ts +42 -0
  54. package/gql/queries/agentDocQueries.ts +120 -0
  55. package/gql/queries/agentMemoryQueries.ts +22 -0
  56. package/gql/queries/aiChatQueries.ts +18 -2
  57. package/gql/queries/authQueries.ts +41 -0
  58. package/gql/queries/billingQueries.ts +23 -0
  59. package/gql/queries/campaignQueries.ts +127 -0
  60. package/gql/queries/dataTableQueries.ts +100 -11
  61. package/gql/queries/emailQueries.ts +55 -3
  62. package/gql/queries/fieldDocQueries.ts +158 -0
  63. package/gql/queries/index.ts +8 -2
  64. package/gql/queries/logQueries.ts +11 -28
  65. package/gql/queries/organizationQueries.ts +52 -1
  66. package/gql/queries/scheduleQueries.ts +315 -0
  67. package/gql/queries/sheetQueries.ts +336 -25
  68. package/gql/queries/storageQueries.ts +38 -0
  69. package/gql/queries/workflowQueries.ts +72 -3
  70. package/hooks/index.ts +2065 -971
  71. package/hooks/use-account-mtn.ts +76 -81
  72. package/hooks/use-agentDoc-mtn.ts +285 -0
  73. package/hooks/use-agentDoc-qry.ts +208 -0
  74. package/hooks/use-agentMemory-mtn.ts +73 -0
  75. package/hooks/use-agentMemory-qry.ts +44 -0
  76. package/hooks/use-aiChat-mtn.ts +232 -137
  77. package/hooks/use-aiChat-qry.ts +480 -222
  78. package/hooks/use-app-qry.ts +12 -9
  79. package/hooks/use-auth-mtn.ts +406 -252
  80. package/hooks/use-auth-qry.ts +51 -0
  81. package/hooks/use-campaign-mtn.ts +377 -0
  82. package/hooks/use-campaign-qry.ts +257 -0
  83. package/hooks/use-dataTable-mtn.ts +116 -33
  84. package/hooks/use-dataTable-qry.ts +859 -35
  85. package/hooks/use-email-qry.ts +194 -79
  86. package/hooks/use-fieldDoc-mtn.ts +50 -0
  87. package/hooks/use-fieldDoc-qry.ts +180 -0
  88. package/hooks/use-inboundContact-mtn.ts +19 -16
  89. package/hooks/use-inboundContact-qry.ts +63 -55
  90. package/hooks/use-integration-mtn.ts +56 -38
  91. package/hooks/use-integration-qry.ts +24 -9
  92. package/hooks/use-log-mtn.ts +72 -56
  93. package/hooks/use-log-qry.ts +93 -69
  94. package/hooks/use-organization-mtn.ts +334 -277
  95. package/hooks/use-organization-qry.ts +199 -129
  96. package/hooks/use-schedule-mtn.ts +416 -0
  97. package/hooks/use-schedule-qry.ts +157 -0
  98. package/hooks/use-sheet-mtn.ts +233 -47
  99. package/hooks/use-sheet-qry.ts +353 -70
  100. package/hooks/use-storage-mtn.ts +81 -41
  101. package/hooks/use-storage-qry.ts +104 -13
  102. package/hooks/use-workflow-mtn.ts +55 -0
  103. package/hooks/use-workflow-qry.ts +206 -48
  104. package/loaders/campaign.ts +137 -0
  105. package/package.json +94 -71
  106. package/sse.ts +157 -104
  107. package/tsconfig.json +11 -10
  108. package/types.d.ts +60 -30
  109. package/utils.ts +78 -49
  110. package/gql/fragments/productFragments.ts +0 -39
  111. package/gql/fragments/reportFragments.ts +0 -90
  112. package/gql/mutations/billingMutations.ts +0 -34
  113. package/gql/queries/productQueries.ts +0 -31
  114. package/gql/queries/reportQueries.ts +0 -134
  115. package/hooks/use-product-qry.ts +0 -67
  116. package/hooks/use-report-qry.ts +0 -153
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Campaign fragments.
3
+ *
4
+ * Each fragment NAME is the realtime contract: the cache keys one of these
5
+ * spreads as `$<fragmentName>:<id>`, which is byte-identical to what the
6
+ * server pushes through FRAGMENT_NAMES.campaignTemplate / campaign /
7
+ * campaignTemplateElement. Renaming a fragment here silently stops websocket
8
+ * patches from landing on the cached row.
9
+ */
10
+
11
+ /**
12
+ * One element of a template definition. "kind" is the structural role and
13
+ * "type" is how a QUESTION is answered; type is null for SECTION and CONTENT.
14
+ */
15
+
16
+ export const campaignTemplateElementFragment = `fragment campaignTemplateElementFragment on CampaignElement {
17
+ id
18
+ parentId
19
+ kind
20
+ type
21
+ key
22
+ order
23
+ label
24
+ description
25
+ placeholder
26
+ required
27
+ options {
28
+ value
29
+ label
30
+ }
31
+ validation {
32
+ minLength
33
+ maxLength
34
+ min
35
+ max
36
+ pattern
37
+ maxFiles
38
+ acceptedContentTypes
39
+ }
40
+ visibleWhen {
41
+ elementKey
42
+ operator
43
+ values
44
+ }
45
+ settings {
46
+ numbered
47
+ fullWidth
48
+ }
49
+ files {
50
+ id
51
+ uri
52
+ contentType
53
+ }
54
+ }`;
55
+
56
+ /**
57
+ * Org-side reusable campaign template, with its element tree.
58
+ */
59
+
60
+ export const campaignTemplateFragment = `fragment campaignTemplateFragment on CampaignTemplate {
61
+ id
62
+ organizationId
63
+ kind
64
+ status
65
+ generationError
66
+ title
67
+ description
68
+ responseWorkflowId
69
+ siteId
70
+ settings {
71
+ __typename
72
+ ... on EmailCampaignSettings {
73
+ subject
74
+ body
75
+ bodyHTML
76
+ replyToAgentDomain
77
+ secondaryReplyToEmail
78
+ }
79
+ ... on FormCampaignSettings {
80
+ color
81
+ backgroundFillStyle
82
+ confirmationMessage
83
+ }
84
+ }
85
+ headerImage {
86
+ id
87
+ uri
88
+ contentType
89
+ }
90
+ elements {
91
+ ...campaignTemplateElementFragment
92
+ }
93
+ createdAt
94
+ updatedAt
95
+ }`;
96
+
97
+ /**
98
+ * Template list row. Deliberately omits the element tree so a list page does
99
+ * not pull every definition in the organization.
100
+ */
101
+
102
+ export const campaignTemplateSummaryFragment = `fragment campaignTemplateSummaryFragment on CampaignTemplateSummary {
103
+ id
104
+ organizationId
105
+ kind
106
+ status
107
+ generationError
108
+ title
109
+ description
110
+ headerImage {
111
+ id
112
+ uri
113
+ contentType
114
+ }
115
+ createdAt
116
+ updatedAt
117
+ cursor
118
+ }`;
119
+
120
+ /**
121
+ * One published campaign, including its campaign-owned form definition.
122
+ */
123
+
124
+ export const campaignFragment = `fragment campaignFragment on Campaign {
125
+ id
126
+ organizationId
127
+ templateId
128
+ kind
129
+ status
130
+ publicId
131
+ audience
132
+ title
133
+ description
134
+ definitionSnapshot {
135
+ schemaVersion
136
+ snapshotSource
137
+ sections {
138
+ key
139
+ order
140
+ label
141
+ description
142
+ settings {
143
+ numbered
144
+ fullWidth
145
+ }
146
+ elements {
147
+ key
148
+ kind
149
+ type
150
+ order
151
+ label
152
+ description
153
+ placeholder
154
+ options {
155
+ value
156
+ label
157
+ }
158
+ required
159
+ validation {
160
+ minLength
161
+ maxLength
162
+ min
163
+ max
164
+ pattern
165
+ maxFiles
166
+ acceptedContentTypes
167
+ }
168
+ visibleWhen {
169
+ elementKey
170
+ operator
171
+ values
172
+ }
173
+ settings {
174
+ numbered
175
+ fullWidth
176
+ }
177
+ files {
178
+ id
179
+ order
180
+ uri
181
+ contentType
182
+ size
183
+ }
184
+ }
185
+ }
186
+ }
187
+ settings {
188
+ __typename
189
+ ... on EmailCampaignSettings {
190
+ subject
191
+ body
192
+ bodyHTML
193
+ replyToAgentDomain
194
+ secondaryReplyToEmail
195
+ }
196
+ ... on FormCampaignSettings {
197
+ color
198
+ backgroundFillStyle
199
+ confirmationMessage
200
+ }
201
+ }
202
+ siteId
203
+ headerImage {
204
+ id
205
+ uri
206
+ contentType
207
+ }
208
+ scheduledAt
209
+ opensAt
210
+ closesAt
211
+ publishedAt
212
+ completedAt
213
+ errorMessage
214
+ isOpen
215
+ createdAt
216
+ updatedAt
217
+ }`;
218
+
219
+ /**
220
+ * Campaign list row; omits the published snapshot.
221
+ */
222
+
223
+ export const campaignSummaryFragment = `fragment campaignSummaryFragment on CampaignSummary {
224
+ id
225
+ organizationId
226
+ templateId
227
+ kind
228
+ status
229
+ publicId
230
+ audience
231
+ title
232
+ opensAt
233
+ closesAt
234
+ publishedAt
235
+ completedAt
236
+ isOpen
237
+ createdAt
238
+ cursor
239
+ }`;
240
+
241
+ /**
242
+ * One respondent row for the organization-side people list. Answers stay out
243
+ * of this projection until a response detail surface needs them.
244
+ */
245
+
246
+ export const campaignResponseFragment = `fragment campaignResponseFragment on CampaignResponse {
247
+ id
248
+ cursor
249
+ campaignId
250
+ templateId
251
+ respondentName
252
+ respondentEmail
253
+ childOrgId
254
+ childOrgName
255
+ status
256
+ submittedAt
257
+ activityAt
258
+ createdAt
259
+ }`;
260
+
261
+ /**
262
+ * One email campaign recipient snapshot, as the organization sees it.
263
+ */
264
+
265
+ export const campaignRecipientFragment = `fragment campaignRecipientFragment on CampaignRecipient {
266
+ id
267
+ cursor
268
+ campaignId
269
+ inboundContactId
270
+ emailAddress
271
+ personName
272
+ invitedAt
273
+ firstOpenedAt
274
+ respondedAt
275
+ revokedAt
276
+ createdAt
277
+ }`;
@@ -1,19 +1,20 @@
1
1
  export const dataTableFragment = `fragment dataTableFragment on DataTable {
2
2
  id
3
+ cursor
3
4
  organizationId
4
5
 
5
6
  name
6
7
  title
7
8
  description
8
9
  active
10
+ deletedAt
9
11
 
10
12
  design {
11
13
  id
12
14
  instructions
13
15
  cellsOrder
14
- viewsOrder
15
- defaultViewId
16
16
  humansCannotEdit
17
+ rowIdentifier
17
18
  stickyTop
18
19
  stickyLeft
19
20
 
@@ -23,7 +24,6 @@ export const dataTableFragment = `fragment dataTableFragment on DataTable {
23
24
  humanLabel
24
25
  iconName
25
26
  fieldType
26
- humanFieldType
27
27
  format
28
28
  instructions
29
29
  openLink
@@ -44,134 +44,27 @@ export const dataTableFragment = `fragment dataTableFragment on DataTable {
44
44
  color
45
45
  }
46
46
  }
47
-
48
- views {
49
- id
50
- name
51
- layout
52
- iconName
53
- color
54
- description
55
- columnsOrder
56
- stickyTop
57
- stickyLeft
58
- humansCannotEdit
59
-
60
- rowModel {
61
- type
62
-
63
- dimensions {
64
- key
65
- label
66
-
67
- source {
68
- type
69
- cellKey
70
- formulaKey
71
- dimensionKey
72
- table
73
- path
74
- sourceCellKey
75
- sourceCellKeys
76
- operation
77
- }
78
- }
79
-
80
- generator {
81
- keyPrefix
82
-
83
- dateSeries {
84
- key
85
- label
86
- sourceCellKey
87
- grain
88
- weekStart
89
-
90
- range {
91
- type
92
- start
93
- end
94
- }
95
- }
96
-
97
- dimensions {
98
- key
99
- label
100
-
101
- source {
102
- type
103
- cellKey
104
-
105
- values {
106
- value
107
- label
108
- }
109
- }
110
- }
111
-
112
- measures {
113
- key
114
- label
115
- operation
116
- sourceCellKey
117
- }
118
- }
119
- }
120
-
121
- columns {
122
- key
123
- label
124
- humanLabel
125
- iconName
126
- fieldType
127
- humanFieldType
128
- openLink
129
- humansCannotEdit
130
- width
131
-
132
- source {
133
- type
134
- cellKey
135
- formulaKey
136
- dimensionKey
137
- table
138
- path
139
- sourceCellKey
140
- sourceCellKeys
141
- operation
142
- }
143
-
144
- options {
145
- label
146
- value
147
- color
148
- }
149
- }
150
-
151
- filters {
152
- id
153
- columnKey
154
- operator
155
- value
156
- enabled
157
- }
158
-
159
- sorts {
160
- columnKey
161
- direction
162
- }
163
-
164
- groups {
165
- columnKey
166
- direction
167
- }
168
- }
169
47
  }
170
48
 
171
49
  createdAt
172
50
  updatedAt
173
51
  }`;
174
52
 
53
+ export const dataTablePartialFragment = `fragment dataTablePartialFragment on DataTable {
54
+ id
55
+ name
56
+ title
57
+ description
58
+ deletedAt
59
+ }`;
60
+
61
+ export const dataTableMetadataFragment = `fragment dataTableMetadataFragment on DataTableMetadata {
62
+ id
63
+ name
64
+ title
65
+ description
66
+ }`;
67
+
175
68
  export const dataTableRowFragment = `fragment dataTableRowFragment on DataTableRow {
176
69
  id
177
70
  cursor
@@ -179,9 +72,6 @@ export const dataTableRowFragment = `fragment dataTableRowFragment on DataTableR
179
72
  dataTableId
180
73
 
181
74
  identifier
182
- viewId
183
- viewRowKey
184
- position
185
75
  metadata
186
76
  }`;
187
77
 
@@ -1,9 +1,3 @@
1
- export const inboundEmailAttachmentFragment = `fragment inboundEmailAttachmentFragment on InboundEmailAttachment {
2
- name
3
- contentType
4
- contentLength
5
- }`;
6
-
7
1
  export const inboundEmailFragment = `fragment inboundEmailFragment on InboundEmail {
8
2
  id
9
3
  cursor
@@ -17,10 +11,26 @@ export const inboundEmailFragment = `fragment inboundEmailFragment on InboundEma
17
11
  previewText
18
12
  bodyFormat
19
13
  bodyText
20
- attachments {
21
- ...inboundEmailAttachmentFragment
22
- }
23
14
  receivedAt
24
15
  processingStartedAt
25
16
  processingCompletedAt
26
17
  }`;
18
+
19
+ export const outboundEmailFragment = `fragment outboundEmailFragment on OutboundEmail {
20
+ id
21
+ cursor
22
+ organizationId
23
+ sourceInboundEmailId
24
+ toEmail
25
+ replyToEmail
26
+ replyToName
27
+ subject
28
+ body
29
+ status
30
+ postmarkMessageId
31
+ errorMessage
32
+ sentAt
33
+ createdAt
34
+ updatedAt
35
+ relatedLogIds
36
+ }`;
@@ -0,0 +1,82 @@
1
+ export const fieldDocFragment = `fragment fieldDocFragment on FieldDoc {
2
+ id
3
+ organizationId
4
+
5
+ documentName
6
+ title
7
+ description
8
+ agentHint
9
+ frequency
10
+ fieldDocGroupId
11
+ groupName
12
+ groupShortName
13
+ period
14
+ summary
15
+ }`;
16
+
17
+ export const fieldDocSectionFragment = `fragment fieldDocSectionFragment on FieldDocSection {
18
+ id
19
+ key
20
+ title
21
+ description
22
+ }`;
23
+
24
+ export const fieldDocElementDataFragment = `fragment fieldDocElementDataFragment on FieldDocElement {
25
+ id
26
+ key
27
+ kind
28
+ label
29
+ description
30
+ options
31
+ required
32
+ allowMultipleAnswers
33
+ doNotAllowNotes
34
+
35
+ text
36
+ note
37
+ warningNote
38
+ referenceIds
39
+ lineNumber
40
+ }`;
41
+
42
+ export const fieldDocGroupFragment = `fragment fieldDocGroupFragment on FieldDocGroup {
43
+ id
44
+ name
45
+ shortName
46
+ layout {
47
+ columns
48
+ headers
49
+ gridLayoutStyle
50
+ }
51
+ lastSubmissionPeriod
52
+ lastSubmissionFieldDocId
53
+ }`;
54
+
55
+ export const fieldDocSubmissionFragment = `fragment fieldDocSubmissionFragment on FieldDocSubmission {
56
+ id
57
+ fieldDocSubmissionId
58
+ fieldDocId
59
+ value
60
+ frequency
61
+ fieldDocSubmissionIdEnc
62
+
63
+ organizationId
64
+ organizationIdEnc
65
+ organizationName
66
+ organizationOperation
67
+
68
+ childOrgId
69
+ childOrgIdEnc
70
+ childOrgName
71
+ childOrgOperation
72
+
73
+ location
74
+ period
75
+ status
76
+ fieldDocGroupId
77
+ groupName
78
+ groupShortName
79
+ activityAt
80
+ createdAt
81
+ updatedAt
82
+ }`;
@@ -1,4 +1,3 @@
1
-
2
1
  export const logEntryFragment = `fragment logEntryFragment on LogEntry {
3
2
  id
4
3
  cursor
@@ -8,10 +7,16 @@ export const logEntryFragment = `fragment logEntryFragment on LogEntry {
8
7
  childOrgName
9
8
  inboundContactId
10
9
  inboundContactName
11
- reportId
12
- reportSubmissionId
10
+ fieldDocId
11
+ fieldDocSubmissionId
13
12
  siteId
13
+ siteName
14
14
  location
15
+ inboundContactEmail
16
+ inboundContactPhone
17
+ fieldDocName
18
+ fieldDocSubmissionPeriod
19
+ accountPersonName
15
20
  summary
16
21
  source
17
22
  confidence
@@ -22,102 +27,38 @@ export const logEntryFragment = `fragment logEntryFragment on LogEntry {
22
27
  updatedAt
23
28
  }`;
24
29
 
25
- export const logArableFragment = `fragment logArableFragment on LogArable {
30
+ export const logEntryDetailsFragment = `fragment logEntryDetailsFragment on LogEntryDetails {
26
31
  __typename
27
32
 
28
33
  id
29
34
  type
30
35
  activity
31
- concentration
32
- concentrationUnit
33
- fieldLocation
34
36
 
35
37
  item
36
38
  quantity
37
39
  unit
38
-
39
- referenceNumber
40
+ price
40
41
  values {
41
42
  label
42
43
  value
43
44
  quantity
44
45
  unit
45
46
  }
46
- tax
47
- voided
48
-
49
- notes
50
- }`;
51
-
52
- export const logFarmersMarketFragment = `fragment logFarmersMarketFragment on LogFarmersMarket {
53
- __typename
54
-
55
- id
56
- type
57
- activity
58
-
59
- item
60
-
61
- referenceNumber
62
- values {
63
- label
64
- value
65
- quantity
47
+ fields {
48
+ key
49
+ fieldType
50
+ textValue
51
+ numberValue
52
+ booleanValue
53
+ dateValue
54
+ datetimeValue
66
55
  unit
67
56
  }
68
- tax
69
- voided
70
-
71
- notes
72
- }`;
73
-
74
- export const logGrowerNetworkFragment = `fragment logGrowerNetworkFragment on LogGrowerNetwork {
75
- __typename
76
-
77
- id
78
- type
79
- activity
80
-
81
- animalRisk
82
- equipmentRisk
83
- fieldRisk
84
- contaminationRisk
85
- hygieneRisk
86
- pestsRisk
87
- sanitationRisk
88
-
89
- item
90
- fieldLocation
91
-
92
- notes
93
- }`;
94
-
95
- export const logLivestockFragment = `fragment logLivestockFragment on LogLivestock {
96
- __typename
97
-
98
- id
99
- type
100
- activity
101
-
102
- livestock
103
- livestockIdentifiers
104
- livestockGroup
105
- damIdentifier
106
57
 
58
+ otherParty
107
59
  referenceNumber
108
- values {
109
- label
110
- value
111
- quantity
112
- unit
113
- }
114
- tax
115
-
116
- item
117
- quantity
118
- unit
119
- price
120
60
  fieldLocation
61
+ voided
121
62
 
122
63
  notes
123
64
  }`;