@jsb188/graphql 1.1.11 → 1.1.12

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 (165) hide show
  1. package/audience.d.ts +343 -0
  2. package/cache/config.ts +58 -24
  3. package/cache/index.chat-activity.test.ts +119 -0
  4. package/cache/index.chat.test.ts +92 -0
  5. package/cache/index.helpers.ts +96 -0
  6. package/cache/index.regression.test.ts +149 -0
  7. package/cache/index.test.ts +370 -42
  8. package/cache/index.ts +326 -799
  9. package/cache/optimistic-ui-runtime.ts +46 -0
  10. package/cache/optimistic-ui.ts +401 -0
  11. package/cache/persist.ts +98 -19
  12. package/cache/store.ts +22 -64
  13. package/cache/value.helpers.ts +17 -0
  14. package/{drafts/store.ts → client/draft-persistence-indexed-db.ts} +19 -3
  15. package/{drafts/index.ts → client/draft-persistence.ts} +5 -2
  16. package/client/index.ts +3 -2
  17. package/client/request.helpers.ts +14 -0
  18. package/client/request.ts +130 -215
  19. package/deno.lock +17 -0
  20. package/deno.test.json +2 -0
  21. package/gql/fragments/agentMemoryFragments.ts +5 -1
  22. package/gql/fragments/agentNoteFragments.ts +150 -0
  23. package/gql/fragments/aiChatFragments.ts +36 -10
  24. package/gql/fragments/audienceFragments.ts +141 -0
  25. package/gql/fragments/campaignFragments.ts +415 -126
  26. package/gql/fragments/dataTableFragments.ts +48 -80
  27. package/gql/fragments/emailFragments.ts +28 -23
  28. package/gql/fragments/fieldDocFragments.ts +222 -40
  29. package/gql/fragments/inboundContactFragments.ts +2 -0
  30. package/gql/fragments/logFragments.ts +93 -2
  31. package/gql/fragments/organizationFragments.ts +10 -0
  32. package/gql/fragments/qrCodeFragments.ts +29 -0
  33. package/gql/fragments/scheduleFragments.ts +652 -140
  34. package/gql/fragments/sheetFragments.ts +84 -373
  35. package/gql/fragments/storageFragments.ts +25 -1
  36. package/gql/fragments/workflowFragments.ts +13 -1
  37. package/gql/mutations/agentMemoryMutations.ts +32 -0
  38. package/gql/mutations/agentNoteMutations.ts +62 -0
  39. package/gql/mutations/aiChatMutations.ts +36 -4
  40. package/gql/mutations/audienceMutations.ts +71 -0
  41. package/gql/mutations/authMutations.ts +45 -1
  42. package/gql/mutations/billingMutations.ts +24 -0
  43. package/gql/mutations/campaignMutations.ts +170 -127
  44. package/gql/mutations/contactMutations.ts +23 -0
  45. package/gql/mutations/dataTableMutations.ts +18 -75
  46. package/gql/mutations/fieldDocMutations.ts +162 -13
  47. package/gql/mutations/index.ts +8 -5
  48. package/gql/mutations/organizationMutations.ts +6 -0
  49. package/gql/mutations/qrCodeMutations.ts +20 -0
  50. package/gql/mutations/scheduleMutations.ts +1052 -354
  51. package/gql/mutations/sheetMutations.ts +62 -118
  52. package/gql/mutations/storageMutations.ts +0 -1
  53. package/gql/mutations/workflowMutations.ts +18 -0
  54. package/gql/queries/agentMemoryQueries.ts +6 -0
  55. package/gql/queries/agentNoteQueries.ts +89 -0
  56. package/gql/queries/aiChatQueries.ts +56 -4
  57. package/gql/queries/audienceQueries.ts +128 -0
  58. package/gql/queries/authQueries.ts +6 -0
  59. package/gql/queries/billingQueries.ts +95 -6
  60. package/gql/queries/campaignQueries.ts +132 -23
  61. package/gql/queries/dataTableQueries.ts +24 -65
  62. package/gql/queries/emailQueries.ts +18 -61
  63. package/gql/queries/emailReplyReportQueries.ts +76 -0
  64. package/gql/queries/fieldDocQueries.ts +100 -92
  65. package/gql/queries/inboundContactQueries.ts +4 -0
  66. package/gql/queries/index.ts +3 -1
  67. package/gql/queries/logQueries.ts +62 -7
  68. package/gql/queries/organizationQueries.ts +13 -0
  69. package/gql/queries/qrCodeQueries.ts +20 -0
  70. package/gql/queries/scheduleQueries.ts +633 -257
  71. package/gql/queries/sheetQueries.ts +59 -152
  72. package/gql/queries/workflowQueries.ts +10 -4
  73. package/hooks/index.helpers.test.ts +50 -0
  74. package/hooks/index.helpers.ts +52 -0
  75. package/hooks/index.ts +863 -685
  76. package/hooks/use-agentMemory-mtn.ts +29 -31
  77. package/hooks/use-agentMemory-qry.ts +15 -3
  78. package/hooks/use-agentNote-mtn.ts +82 -0
  79. package/hooks/use-agentNote-qry.ts +190 -0
  80. package/hooks/use-agentNote-recovery.helpers.test.ts +68 -0
  81. package/hooks/use-agentNote-recovery.helpers.ts +58 -0
  82. package/hooks/use-agentNote-recovery.ts +72 -0
  83. package/hooks/use-aiChat-mtn.ts +96 -112
  84. package/hooks/use-aiChat-qry.helpers.test.ts +63 -0
  85. package/hooks/use-aiChat-qry.helpers.ts +124 -0
  86. package/hooks/use-aiChat-qry.ts +229 -383
  87. package/hooks/use-aiChat-stream-mtn.ts +14 -0
  88. package/hooks/use-audience-mtn.ts +194 -0
  89. package/hooks/use-audience-qry.helpers.test.ts +80 -0
  90. package/hooks/use-audience-qry.helpers.ts +63 -0
  91. package/hooks/use-audience-qry.ts +330 -0
  92. package/hooks/use-auth-mtn.ts +30 -1
  93. package/hooks/use-billing-mtn.ts +31 -0
  94. package/hooks/use-billing-qry.ts +76 -0
  95. package/hooks/use-campaign-generation-recovery.ts +53 -0
  96. package/hooks/use-campaign-mtn.ts +224 -165
  97. package/hooks/use-campaign-qry.helpers.ts +40 -0
  98. package/hooks/use-campaign-qry.ts +631 -54
  99. package/hooks/use-dataTable-mtn.ts +23 -115
  100. package/hooks/use-dataTable-qry.ts +66 -916
  101. package/hooks/use-email-qry.helpers.ts +37 -0
  102. package/hooks/use-email-qry.ts +33 -178
  103. package/hooks/use-emailCampaignReplyReport-qry.ts +27 -0
  104. package/hooks/use-fieldDoc-mtn.ts +244 -32
  105. package/hooks/use-fieldDoc-qry.helpers.test.ts +65 -0
  106. package/hooks/use-fieldDoc-qry.helpers.ts +49 -0
  107. package/hooks/use-fieldDoc-qry.ts +134 -102
  108. package/hooks/use-inboundContact-qry.ts +7 -9
  109. package/hooks/use-log-mtn.ts +25 -12
  110. package/hooks/use-log-qry.ts +99 -46
  111. package/hooks/use-organization-qry.ts +16 -60
  112. package/hooks/use-publicFormEmail-mtn.ts +27 -0
  113. package/hooks/use-qrCode-mtn.ts +40 -0
  114. package/hooks/use-qrCode-qry.ts +78 -0
  115. package/hooks/use-schedule-mtn.ts +506 -333
  116. package/hooks/use-schedule-qry.ts +682 -101
  117. package/hooks/use-schedule-reactive.ts +486 -0
  118. package/hooks/use-sheet-mtn.ts +91 -199
  119. package/hooks/use-sheet-qry.ts +84 -238
  120. package/hooks/use-storage-qry.ts +84 -61
  121. package/hooks/use-workflow-mtn.ts +39 -22
  122. package/hooks/use-workflow-qry.ts +40 -61
  123. package/libs/ai-chat-outgoing.helpers.ts +153 -0
  124. package/libs/ai-chat-outgoing.ts +11 -0
  125. package/libs/ai-chat-outgoing.types.ts +25 -0
  126. package/libs/ai-chat-run-realtime.ts +20 -0
  127. package/libs/ai-chat-submission-realtime.ts +150 -0
  128. package/libs/fragment-realtime-sequence.ts +55 -0
  129. package/libs/fragment-recovery.test.ts +326 -0
  130. package/libs/fragment-recovery.ts +325 -0
  131. package/libs/open-sheet.ts +138 -0
  132. package/libs/orchestrator-realtime.helpers.test.ts +229 -0
  133. package/libs/orchestrator-realtime.helpers.ts +317 -0
  134. package/libs/orchestrator-realtime.ts +433 -0
  135. package/libs/request-cache-regression.test.ts +122 -0
  136. package/{client → libs}/request-managed-session.test.ts +1 -1
  137. package/libs/request-no-store.test.ts +419 -0
  138. package/libs/sheet-command-batch.ts +44 -0
  139. package/libs/sheet-view-realtime-router.test.ts +214 -0
  140. package/libs/sheet-view-realtime-router.ts +99 -0
  141. package/loaders/campaign.test.ts +186 -0
  142. package/loaders/campaign.ts +56 -83
  143. package/loaders/emailPreference.ts +75 -0
  144. package/loaders/rest.ts +12 -0
  145. package/package.json +42 -17
  146. package/schedule.d.ts +1790 -0
  147. package/sse.helpers.ts +19 -0
  148. package/sse.ts +26 -115
  149. package/tests/agent-note-detail-cache.test.ts +120 -0
  150. package/tests/agent-note-search.test.ts +444 -0
  151. package/types.d.ts +46 -25
  152. package/client/data-table-realtime-subscriptions.test.ts +0 -740
  153. package/client/data-table-realtime-subscriptions.ts +0 -955
  154. package/client/data-table-realtime.test.ts +0 -792
  155. package/client/data-table-realtime.ts +0 -1218
  156. package/client/fragment-realtime-sequence.ts +0 -52
  157. package/client/open-sheet.ts +0 -137
  158. package/client/request-no-store.test.ts +0 -157
  159. package/gql/fragments/agentDocFragments.ts +0 -46
  160. package/gql/fragments/billingFragments.ts +0 -14
  161. package/gql/mutations/agentDocMutations.ts +0 -177
  162. package/gql/queries/agentDocQueries.ts +0 -120
  163. package/hooks/use-agentDoc-mtn.ts +0 -285
  164. package/hooks/use-agentDoc-qry.ts +0 -208
  165. /package/{client → libs}/sse-ticket.test.ts +0 -0
package/deno.test.json CHANGED
@@ -4,6 +4,8 @@
4
4
  "@jsb188/app/": "../@jsb188:app/src/",
5
5
  "@jsb188/mday/": "../@jsb188:mday/src/",
6
6
  "@jsb188/react/": "../@jsb188:react/src/",
7
+ "graphql": "npm:graphql@^16.14.2",
8
+ "graphql-tag": "npm:graphql-tag@^2.12.7",
7
9
  "luxon": "npm:luxon@3.7.2",
8
10
  "node-polyglot": "npm:node-polyglot@^2.6.0"
9
11
  }
@@ -2,17 +2,21 @@ export const agentMemoryFragment = `fragment agentMemoryFragment on AgentMemory
2
2
  id
3
3
  organizationId
4
4
  scope
5
+ accountId
6
+ accountName
7
+ counterpartyId
8
+ inboundContactId
5
9
  category
6
10
  content
7
11
  status
8
12
  permanent
9
13
  observedCount
10
14
  surface
11
- surfaceKey
12
15
  createdVia
13
16
  createdByName
14
17
  counterpartyName
15
18
  sourceMessageId
19
+ sourceInboundEmailId
16
20
  expiresAt
17
21
  createdAt
18
22
  updatedAt
@@ -0,0 +1,150 @@
1
+ // The list and detail projections share this normalized cache identity.
2
+ // Realtime fragments update shared note content and metadata; viewer-specific
3
+ // canManage and canPin permissions remain supplied by authorized GraphQL reads.
4
+ // priority is the effective homepage priority computed when the note was read;
5
+ // the client uses it only to restore homepage order after a fragment change.
6
+ // resultBlocks are the server-rendered saved query results shown below the
7
+ // body; ownedDataTableId is the listed table an INSIGHT note links to.
8
+ export const agentNoteFragment = `fragment agentNoteFragment on AgentNote {
9
+ id
10
+ organizationId
11
+ kind
12
+ canManage
13
+ canRefreshWithoutCooldown
14
+ canPin
15
+ campaignId
16
+ fieldDocId
17
+ fieldDocProgramId
18
+ reminderWorkflowId
19
+ emoji
20
+ headline
21
+ focus
22
+ needsAttention
23
+ pinned
24
+ importance
25
+ priority
26
+ archivedAt
27
+ archiveReason
28
+ publishedAt
29
+ dataChangedAt
30
+ refreshing
31
+ refreshAvailableAt
32
+ refreshedAt
33
+ refreshOutcome {
34
+ lastAttempt {
35
+ status
36
+ completedAt
37
+ error
38
+ }
39
+ published {
40
+ status
41
+ completedAt
42
+ truncated
43
+ queries {
44
+ total
45
+ succeeded
46
+ failed
47
+ errors {
48
+ name
49
+ code
50
+ message
51
+ }
52
+ }
53
+ }
54
+ }
55
+ resultBlocks {
56
+ name
57
+ title
58
+ display
59
+ markdown
60
+ computedAt
61
+ timeZone
62
+ shownCount
63
+ matchedCount
64
+ dataTableId
65
+ truncated
66
+ error
67
+ }
68
+ ownedDataTableId
69
+ createdAt
70
+ updatedAt
71
+ }`;
72
+
73
+ // Full note for its detail view. PARTIALS_MAP stores it under the same cache
74
+ // identity as agentNoteFragment. Links have no id, so they stay inline.
75
+ export const agentNoteDetailFragment = `fragment agentNoteDetailFragment on AgentNote {
76
+ id
77
+ organizationId
78
+ kind
79
+ canManage
80
+ canRefreshWithoutCooldown
81
+ canPin
82
+ campaignId
83
+ fieldDocId
84
+ fieldDocProgramId
85
+ reminderWorkflowId
86
+ emoji
87
+ headline
88
+ body
89
+ focus
90
+ focusUpdatedAt
91
+ needsAttention
92
+ pinned
93
+ importance
94
+ priority
95
+ archivedAt
96
+ archiveReason
97
+ lastReadAt
98
+ retainedAt
99
+ publishedAt
100
+ dataChangedAt
101
+ refreshing
102
+ refreshAvailableAt
103
+ refreshedAt
104
+ refreshOutcome {
105
+ lastAttempt {
106
+ status
107
+ completedAt
108
+ error
109
+ }
110
+ published {
111
+ status
112
+ completedAt
113
+ truncated
114
+ queries {
115
+ total
116
+ succeeded
117
+ failed
118
+ errors {
119
+ name
120
+ code
121
+ message
122
+ }
123
+ }
124
+ }
125
+ }
126
+ resultBlocks {
127
+ name
128
+ title
129
+ display
130
+ markdown
131
+ computedAt
132
+ timeZone
133
+ shownCount
134
+ matchedCount
135
+ dataTableId
136
+ truncated
137
+ error
138
+ }
139
+ ownedDataTableId
140
+ createdAt
141
+ updatedAt
142
+ links {
143
+ entityType
144
+ entityId
145
+ watch
146
+ owned
147
+ title
148
+ fieldDocProgramId
149
+ }
150
+ }`;
@@ -1,6 +1,8 @@
1
1
  export const aiChatFragment = `fragment aiChatFragment on AIChat {
2
2
  id
3
+ type
3
4
  organizationId
5
+ agentNoteId
4
6
  accountId
5
7
  calDate
6
8
  summary
@@ -8,30 +10,54 @@ export const aiChatFragment = `fragment aiChatFragment on AIChat {
8
10
  archivedAt
9
11
  createdAt
10
12
  updatedAt
13
+ activityOrder
11
14
  }`;
12
15
 
16
+ // Note: Normally "...fragment" spread inside a a fragment spread is forbidden;
17
+ // But this is the only way we can get file attachments to show properly.
13
18
  export const aiChatMessageFragment = `fragment aiChatMessageFragment on AIChatMessage {
14
19
  id
20
+ clientRequestId
15
21
  accountId
16
22
  type
17
23
  cursor
18
24
  text
19
25
  photoUri
26
+ runId
27
+ sequence
28
+ run {
29
+ id
30
+ sourceMessageIds
31
+ status
32
+ inProgress
33
+ createdAt
34
+ claimedAt
35
+ finishedAt
36
+ updatedAt
37
+ }
38
+ phase
39
+ generationStatus
40
+ revision
41
+ updatedAt
20
42
  finished
43
+ errorType
21
44
  at
45
+ qrCodes
22
46
  attachments {
23
47
  ordinal
24
48
  file {
25
- id
26
- uri
27
- size
28
- contentType
29
- at
30
- intent
31
- name
32
- description
33
- aiNote
34
- uploadStatus
49
+ ...storageFileFragment
35
50
  }
36
51
  }
37
52
  }`;
53
+
54
+ export const aiChatRunFragment = `fragment aiChatRunFragment on AIChatRun {
55
+ id
56
+ sourceMessageIds
57
+ status
58
+ inProgress
59
+ createdAt
60
+ claimedAt
61
+ finishedAt
62
+ updatedAt
63
+ }`;
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Reusable list metadata; each list has its own cache identity.
3
+ */
4
+ export const audienceListFragment = `fragment audienceListFragment on AudienceList {
5
+ id
6
+ cursor
7
+ organizationId
8
+ name
9
+ description
10
+ archivedAt
11
+ editVersion
12
+ createdByAccountId
13
+ createdAt
14
+ updatedAt
15
+ }`;
16
+
17
+ /*
18
+ * Current organization preference and delivery health for one immutable address.
19
+ */
20
+ export const audienceEmailAddressFragment = `fragment audienceEmailAddressFragment on AudienceEmailAddress {
21
+ id
22
+ organizationId
23
+ normalizedEmail
24
+ inboundContactId
25
+ campaignStatus
26
+ campaignStatusAt
27
+ deliveryStatus
28
+ deliveryStatusAt
29
+ cleanedReason
30
+ lastDeliveredAt
31
+ lastBounceAt
32
+ consecutiveSoftBounceCount
33
+ complaintSuppressedAt
34
+ manuallySuppressedAt
35
+ details
36
+ createdAt
37
+ updatedAt
38
+ }`;
39
+
40
+ /*
41
+ * Membership state excludes nested spreads so callers explicitly select address health.
42
+ */
43
+ export const audienceListMemberFragment = `fragment audienceListMemberFragment on AudienceListMember {
44
+ id
45
+ cursor
46
+ organizationId
47
+ audienceListId
48
+ emailAddressId
49
+ subscriptionStatus
50
+ subscriptionStatusAt
51
+ subscriptionVersion
52
+ removedAt
53
+ details
54
+ createdAt
55
+ updatedAt
56
+ }`;
57
+
58
+ /*
59
+ * Append-only audience history, including migrated preference events.
60
+ */
61
+ export const audienceEventFragment = `fragment audienceEventFragment on AudienceEvent {
62
+ id
63
+ organizationId
64
+ normalizedEmail
65
+ emailAddressId
66
+ audienceListId
67
+ audienceListMemberId
68
+ eventType
69
+ source
70
+ actorAccountId
71
+ campaignId
72
+ outboundEmailId
73
+ metadata
74
+ occurredAt
75
+ createdAt
76
+ }`;
77
+
78
+ /*
79
+ * One unique address across every list a campaign selected. The id is campaign-scoped,
80
+ * so normalized rows never leak between campaigns that share an address. Membership
81
+ * details are inline (no id) and are only ever replaced by a RESET_ONLY query reset.
82
+ */
83
+ export const campaignAudienceMemberFragment = `fragment campaignAudienceMemberFragment on CampaignAudienceMember {
84
+ id
85
+ cursor
86
+ organizationId
87
+ campaignId
88
+ emailAddressId
89
+ normalizedEmail
90
+ personName
91
+ inboundContactId
92
+ reason
93
+ memberships {
94
+ memberId
95
+ audienceListId
96
+ listName
97
+ personName
98
+ subscriptionStatus
99
+ subscriptionVersion
100
+ removedAt
101
+ }
102
+ }`;
103
+
104
+ /*
105
+ * One campaign's selected lists and edit version, keyed by the campaign id so the
106
+ * setCampaignAudienceLists result updates the cached session in place.
107
+ */
108
+ export const campaignAudienceSessionFragment = `fragment campaignAudienceSessionFragment on CampaignAudienceSession {
109
+ id
110
+ campaignId
111
+ organizationId
112
+ editVersion
113
+ editable
114
+ selectedAudienceListIds
115
+ excludedEmailAddressIds
116
+ }`;
117
+
118
+ /*
119
+ * One campaign's deduplicated eligibility counts, keyed by the campaign id and
120
+ * version-stamped so consumers can pair it with the matching session.
121
+ */
122
+ export const campaignAudiencePreviewFragment = `fragment campaignAudiencePreviewFragment on CampaignAudiencePreview {
123
+ id
124
+ campaignId
125
+ editVersion
126
+ selectedCount
127
+ eligibleCount
128
+ duplicateCount
129
+ excludedCount
130
+ exclusions {
131
+ reason
132
+ count
133
+ }
134
+ frozenRecipientCount
135
+ sendLimits {
136
+ recipientLimit
137
+ monthlyRecipientLimit
138
+ monthlyRecipientsRemaining
139
+ sendingPaused
140
+ }
141
+ }`;