@jsb188/graphql 1.1.8 → 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 (122) hide show
  1. package/cache/config.ts +66 -42
  2. package/cache/index.test.ts +881 -0
  3. package/cache/index.ts +1815 -979
  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 +4 -2
  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 +973 -143
  16. package/client/sse-ticket.test.ts +26 -0
  17. package/deno.lock +170 -0
  18. package/deno.test.json +10 -0
  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 +1 -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 +17 -0
  28. package/gql/fragments/billingFragments.ts +0 -11
  29. package/gql/fragments/campaignFragments.ts +277 -0
  30. package/gql/fragments/dataTableFragments.ts +102 -0
  31. package/gql/fragments/emailFragments.ts +36 -0
  32. package/gql/fragments/fieldDocFragments.ts +82 -0
  33. package/gql/fragments/inboundContactFragments.ts +15 -0
  34. package/gql/fragments/integrationFragments.ts +22 -0
  35. package/gql/fragments/logFragments.ts +33 -64
  36. package/gql/fragments/organizationFragments.ts +94 -21
  37. package/gql/fragments/scheduleFragments.ts +155 -0
  38. package/gql/fragments/sheetFragments.ts +675 -0
  39. package/gql/fragments/storageFragments.ts +21 -1
  40. package/gql/fragments/workflowFragments.ts +67 -0
  41. package/gql/mutations/accountMutations.ts +24 -4
  42. package/gql/mutations/agentDocMutations.ts +177 -0
  43. package/gql/mutations/agentMemoryMutations.ts +36 -0
  44. package/gql/mutations/aiChatMutations.ts +43 -3
  45. package/gql/mutations/authMutations.ts +160 -19
  46. package/gql/mutations/campaignMutations.ts +215 -0
  47. package/gql/mutations/dataTableMutations.ts +106 -0
  48. package/gql/mutations/fieldDocMutations.ts +24 -0
  49. package/gql/mutations/inboundContactMutations.ts +24 -0
  50. package/gql/mutations/index.ts +17 -8
  51. package/gql/mutations/integrationMutations.ts +25 -0
  52. package/gql/mutations/logMutations.ts +10 -19
  53. package/gql/mutations/organizationMutations.ts +160 -2
  54. package/gql/mutations/scheduleMutations.ts +423 -0
  55. package/gql/mutations/sheetMutations.ts +385 -0
  56. package/gql/mutations/storageMutations.ts +21 -2
  57. package/gql/mutations/workflowMutations.ts +42 -0
  58. package/gql/queries/agentDocQueries.ts +120 -0
  59. package/gql/queries/agentMemoryQueries.ts +22 -0
  60. package/gql/queries/aiChatQueries.ts +18 -2
  61. package/gql/queries/authQueries.ts +41 -0
  62. package/gql/queries/billingQueries.ts +24 -1
  63. package/gql/queries/campaignQueries.ts +127 -0
  64. package/gql/queries/dataTableQueries.ts +134 -0
  65. package/gql/queries/emailQueries.ts +96 -0
  66. package/gql/queries/fieldDocQueries.ts +158 -0
  67. package/gql/queries/inboundContactQueries.ts +40 -0
  68. package/gql/queries/index.ts +17 -6
  69. package/gql/queries/logQueries.ts +42 -32
  70. package/gql/queries/organizationQueries.ts +113 -8
  71. package/gql/queries/scheduleQueries.ts +315 -0
  72. package/gql/queries/sheetQueries.ts +383 -0
  73. package/gql/queries/storageQueries.ts +38 -0
  74. package/gql/queries/workflowQueries.ts +99 -0
  75. package/hooks/index.ts +2104 -860
  76. package/hooks/use-account-mtn.ts +91 -48
  77. package/hooks/use-agentDoc-mtn.ts +285 -0
  78. package/hooks/use-agentDoc-qry.ts +208 -0
  79. package/hooks/use-agentMemory-mtn.ts +73 -0
  80. package/hooks/use-agentMemory-qry.ts +44 -0
  81. package/hooks/use-aiChat-mtn.ts +248 -97
  82. package/hooks/use-aiChat-qry.ts +501 -191
  83. package/hooks/use-app-qry.ts +14 -11
  84. package/hooks/use-auth-mtn.ts +410 -256
  85. package/hooks/use-auth-qry.ts +51 -0
  86. package/hooks/use-campaign-mtn.ts +377 -0
  87. package/hooks/use-campaign-qry.ts +257 -0
  88. package/hooks/use-dataTable-mtn.ts +170 -0
  89. package/hooks/use-dataTable-qry.ts +996 -0
  90. package/hooks/use-email-qry.ts +227 -0
  91. package/hooks/use-fieldDoc-mtn.ts +50 -0
  92. package/hooks/use-fieldDoc-qry.ts +180 -0
  93. package/hooks/use-inboundContact-mtn.ts +34 -0
  94. package/hooks/use-inboundContact-qry.ts +96 -0
  95. package/hooks/use-integration-mtn.ts +77 -0
  96. package/hooks/use-integration-qry.ts +30 -0
  97. package/hooks/use-log-mtn.ts +77 -61
  98. package/hooks/use-log-qry.ts +99 -72
  99. package/hooks/use-organization-mtn.ts +409 -80
  100. package/hooks/use-organization-qry.ts +211 -92
  101. package/hooks/use-schedule-mtn.ts +416 -0
  102. package/hooks/use-schedule-qry.ts +157 -0
  103. package/hooks/use-sheet-mtn.ts +367 -0
  104. package/hooks/use-sheet-qry.ts +440 -0
  105. package/hooks/use-storage-mtn.ts +83 -42
  106. package/hooks/use-storage-qry.ts +104 -13
  107. package/hooks/use-workflow-mtn.ts +55 -0
  108. package/hooks/use-workflow-qry.ts +230 -0
  109. package/loaders/campaign.ts +137 -0
  110. package/package.json +94 -52
  111. package/sse.ts +158 -105
  112. package/tsconfig.json +13 -0
  113. package/types.d.ts +60 -29
  114. package/utils.ts +77 -50
  115. package/gql/fragments/actionFragments.ts +0 -16
  116. package/gql/fragments/productFragments.ts +0 -63
  117. package/gql/fragments/reportFragments.ts +0 -48
  118. package/gql/mutations/billingMutations.ts +0 -34
  119. package/gql/queries/productQueries.ts +0 -70
  120. package/gql/queries/reportQueries.ts +0 -66
  121. package/hooks/use-product-qry.ts +0 -109
  122. package/hooks/use-report-qry.ts +0 -69
@@ -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
+ }`;
@@ -0,0 +1,102 @@
1
+ export const dataTableFragment = `fragment dataTableFragment on DataTable {
2
+ id
3
+ cursor
4
+ organizationId
5
+
6
+ name
7
+ title
8
+ description
9
+ active
10
+ deletedAt
11
+
12
+ design {
13
+ id
14
+ instructions
15
+ cellsOrder
16
+ humansCannotEdit
17
+ rowIdentifier
18
+ stickyTop
19
+ stickyLeft
20
+
21
+ cells {
22
+ key
23
+ label
24
+ humanLabel
25
+ iconName
26
+ fieldType
27
+ format
28
+ instructions
29
+ openLink
30
+ humansOnly
31
+ humansCannotEdit
32
+ hidden
33
+ indexed
34
+ width
35
+
36
+ source {
37
+ path
38
+ table
39
+ }
40
+
41
+ options {
42
+ label
43
+ value
44
+ color
45
+ }
46
+ }
47
+ }
48
+
49
+ createdAt
50
+ updatedAt
51
+ }`;
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
+
68
+ export const dataTableRowFragment = `fragment dataTableRowFragment on DataTableRow {
69
+ id
70
+ cursor
71
+ organizationId
72
+ dataTableId
73
+
74
+ identifier
75
+ metadata
76
+ }`;
77
+
78
+ export const dataTableCellFragment = `fragment dataTableCellFragment on DataTableCell {
79
+ id
80
+ dataTableId
81
+ dataTableRowId
82
+
83
+ cellKey
84
+ iconName
85
+ value
86
+ textValue
87
+ numberValue
88
+ booleanValue
89
+ dateValue
90
+ datetimeValue
91
+ relatedTable
92
+ relatedId
93
+ reference {
94
+ dataTableId
95
+ dataTableRowId
96
+ cellKey
97
+ }
98
+ referenceStatus
99
+
100
+ createdAt
101
+ updatedAt
102
+ }`;
@@ -0,0 +1,36 @@
1
+ export const inboundEmailFragment = `fragment inboundEmailFragment on InboundEmail {
2
+ id
3
+ cursor
4
+ organizationId
5
+ recipientEmail
6
+ senderEmail
7
+ subject
8
+ postmarkMessageId
9
+ status
10
+ statusSummary
11
+ previewText
12
+ bodyFormat
13
+ bodyText
14
+ receivedAt
15
+ processingStartedAt
16
+ processingCompletedAt
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
+ }`;
@@ -0,0 +1,15 @@
1
+ export const inboundContactFragment = `fragment inboundContactFragment on InboundContact {
2
+ id
3
+ organizationId
4
+ cursor
5
+ personName
6
+ email
7
+ phone
8
+ memory
9
+ associated {
10
+ organizationId
11
+ name
12
+ }
13
+ createdAt
14
+ updatedAt
15
+ }`;
@@ -0,0 +1,22 @@
1
+ export const integrationConnectionFragment = `fragment integrationConnectionFragment on IntegrationConnection {
2
+ id
3
+ organizationId
4
+ provider
5
+ externalAccountId
6
+ scopes
7
+ status
8
+ expiresAt
9
+ refreshTokenExpiresAt
10
+ lastSyncedAt
11
+ lastTokenRefreshAt
12
+ lastError
13
+ createdAt
14
+ updatedAt
15
+
16
+ capabilities {
17
+ canReadMerchant
18
+ canReadLocations
19
+ canViewSalesData
20
+ canCreatePaymentRequests
21
+ }
22
+ }`;
@@ -1,95 +1,64 @@
1
-
2
1
  export const logEntryFragment = `fragment logEntryFragment on LogEntry {
3
2
  id
3
+ cursor
4
4
  accountId
5
5
  organizationId
6
- cursor
7
- status
6
+ childOrgId
7
+ childOrgName
8
+ inboundContactId
9
+ inboundContactName
10
+ fieldDocId
11
+ fieldDocSubmissionId
12
+ siteId
13
+ siteName
14
+ location
15
+ inboundContactEmail
16
+ inboundContactPhone
17
+ fieldDocName
18
+ fieldDocSubmissionPeriod
19
+ accountPersonName
20
+ summary
21
+ source
22
+ confidence
23
+ originalMessage
24
+ flagColor
8
25
  date
9
26
  createdAt
10
27
  updatedAt
11
28
  }`;
12
29
 
13
- export const logArableFragment = `fragment logArableFragment on LogArable {
30
+ export const logEntryDetailsFragment = `fragment logEntryDetailsFragment on LogEntryDetails {
14
31
  __typename
15
32
 
16
33
  id
17
34
  type
18
35
  activity
19
- concentration
20
- concentrationUnit
21
36
 
22
37
  item
23
38
  quantity
24
39
  unit
25
- location
26
- fieldLocation
27
-
28
- otherParty
29
- referenceNumber
40
+ price
30
41
  values {
31
42
  label
32
43
  value
33
44
  quantity
45
+ unit
34
46
  }
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
47
+ fields {
48
+ key
49
+ fieldType
50
+ textValue
51
+ numberValue
52
+ booleanValue
53
+ dateValue
54
+ datetimeValue
55
+ unit
57
56
  }
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
57
 
77
58
  otherParty
78
59
  referenceNumber
79
- values {
80
- label
81
- value
82
- quantity
83
- }
84
- tax
85
-
86
- item
87
- quantity
88
- unit
89
- price
90
- location
91
60
  fieldLocation
61
+ voided
92
62
 
93
- summary
94
63
  notes
95
64
  }`;