@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
@@ -1,7 +1,14 @@
1
1
  import { gql } from 'graphql-tag';
2
2
  import { accountFragment } from '../fragments/accountFragments.ts';
3
3
  import { integrationConnectionFragment } from '../fragments/integrationFragments.ts';
4
- import { organizationChildFragment, organizationComplianceFragment, organizationFragment, organizationRelationshipFragment, organizationSiteFragment } from '../fragments/organizationFragments.ts';
4
+ import {
5
+ organizationChildFragment,
6
+ organizationComplianceFragment,
7
+ organizationFragment,
8
+ organizationRelationshipFragment,
9
+ organizationSiteFragment,
10
+ orgPageRouteFragment,
11
+ } from '../fragments/organizationFragments.ts';
5
12
  import { emailFragment, phoneFragment } from '../fragments/otherFragments.ts';
6
13
  import { storageFileFragment } from '../fragments/storageFragments.ts';
7
14
 
@@ -60,6 +67,36 @@ query myOrganizations {
60
67
  ...organizationFragment
61
68
  membersCount
62
69
 
70
+ logTaxonomy {
71
+ operation
72
+ groups {
73
+ key
74
+ label
75
+ ordinal
76
+ requiredFields
77
+ orRequiredFields
78
+ }
79
+ activities {
80
+ key
81
+ groupKey
82
+ agentText
83
+ ordinal
84
+ requiredFields
85
+ orRequiredFields
86
+ }
87
+ fieldDefs {
88
+ key
89
+ fieldType
90
+ required
91
+ ordinal
92
+ agentHint
93
+ options
94
+ allowedUnits
95
+ groupKey
96
+ activityKey
97
+ }
98
+ }
99
+
63
100
  compliance {
64
101
  ...organizationComplianceFragment
65
102
 
@@ -165,3 +202,17 @@ query organizationSites (
165
202
 
166
203
  ${organizationSiteFragment}
167
204
  `;
205
+
206
+ export const pageRoutesQry = gql`
207
+ query pageRoutes (
208
+ $organizationId: GenericID!
209
+ ) {
210
+ pageRoutes (
211
+ organizationId: $organizationId
212
+ ) {
213
+ ...orgPageRouteFragment
214
+ }
215
+ }
216
+
217
+ ${orgPageRouteFragment}
218
+ `;
@@ -0,0 +1,315 @@
1
+ import { gql } from 'graphql-tag';
2
+ import {
3
+ scheduleCalendarFragment,
4
+ scheduleOccurrenceFragment,
5
+ scheduleRequestFragment,
6
+ scheduleResourceFragment,
7
+ scheduleSeriesFragment,
8
+ } from '../fragments/scheduleFragments.ts';
9
+
10
+ // NOTE: viewerPermission and viewerCanEditAccess are per-viewer facts the
11
+ // server resolves for the requesting account. They are selected outside the
12
+ // fragment because realtime emits never carry them — a restricted calendar
13
+ // never broadcasts its rows at all — and the fragment must stay aligned with
14
+ // the server's emit field list.
15
+
16
+ export const scheduleCalendarsQry = gql`
17
+ query scheduleCalendars (
18
+ $organizationId: GenericID!
19
+ $includeNetwork: Boolean
20
+ ) {
21
+ scheduleCalendars (
22
+ organizationId: $organizationId
23
+ includeNetwork: $includeNetwork
24
+ ) {
25
+ ...scheduleCalendarFragment
26
+
27
+ viewerPermission
28
+ viewerCanEditAccess
29
+ }
30
+ }
31
+
32
+ ${scheduleCalendarFragment}
33
+ `;
34
+
35
+ export const scheduleCalendarQry = gql`
36
+ query scheduleCalendar (
37
+ $calendarId: GenericID!
38
+ ) {
39
+ scheduleCalendar (
40
+ calendarId: $calendarId
41
+ ) {
42
+ ...scheduleCalendarFragment
43
+
44
+ viewerPermission
45
+ viewerCanEditAccess
46
+ }
47
+ }
48
+
49
+ ${scheduleCalendarFragment}
50
+ `;
51
+
52
+ // NOTE: This is a WINDOW query, not a cursor page. Its cache entry is keyed by
53
+ // the date range the calendar happens to be showing, which is why any
54
+ // structural change (a new occurrence, a cancellation, a materialization pass)
55
+ // resets it through getScheduleOccurrencesResetQueryTargets rather than trying to
56
+ // patch a page the client may never have fetched.
57
+ //
58
+ // It is deliberately per-calendar rather than taking a list: the reset key is
59
+ // an exact per-variable match, so one query per calendar lets an edit on one
60
+ // calendar leave every other overlaid calendar's cache untouched.
61
+
62
+ export const scheduleOccurrencesQry = gql`
63
+ query scheduleOccurrences (
64
+ $organizationId: GenericID!
65
+ $calendarId: GenericID!
66
+ $from: DateTime!
67
+ $to: DateTime!
68
+ $publishedOnly: Boolean
69
+ $mineOnly: Boolean
70
+ $limit: Int
71
+ ) {
72
+ scheduleOccurrences (
73
+ organizationId: $organizationId
74
+ calendarId: $calendarId
75
+ from: $from
76
+ to: $to
77
+ publishedOnly: $publishedOnly
78
+ mineOnly: $mineOnly
79
+ limit: $limit
80
+ ) {
81
+ ...scheduleOccurrenceFragment
82
+ }
83
+ }
84
+
85
+ ${scheduleOccurrenceFragment}
86
+ `;
87
+
88
+ export const scheduleOccurrenceQry = gql`
89
+ query scheduleOccurrence (
90
+ $occurrenceId: GenericID!
91
+ ) {
92
+ scheduleOccurrence (
93
+ occurrenceId: $occurrenceId
94
+ ) {
95
+ ...scheduleOccurrenceFragment
96
+ }
97
+ }
98
+
99
+ ${scheduleOccurrenceFragment}
100
+ `;
101
+
102
+ export const scheduleResourcesQry = gql`
103
+ query scheduleResources (
104
+ $organizationId: GenericID!
105
+ ) {
106
+ scheduleResources (
107
+ organizationId: $organizationId
108
+ ) {
109
+ ...scheduleResourceFragment
110
+ }
111
+ }
112
+
113
+ ${scheduleResourceFragment}
114
+ `;
115
+
116
+ export const scheduleSeriesQry = gql`
117
+ query scheduleSeries (
118
+ $organizationId: GenericID!
119
+ $seriesId: GenericID!
120
+ ) {
121
+ scheduleSeries (
122
+ organizationId: $organizationId
123
+ seriesId: $seriesId
124
+ ) {
125
+ ...scheduleSeriesFragment
126
+ }
127
+ }
128
+
129
+ ${scheduleSeriesFragment}
130
+ `;
131
+
132
+ // NOTE: The evaluation is computed on read and never cached server-side — the
133
+ // whole value of it is that it reflects the schedule as it stands right now.
134
+ // "message" is the breach rendered in this organization's own language,
135
+ // resolved from the rule-template registry; it is null only when nothing is
136
+ // registered for the rule kind, in which case the client shows generic copy.
137
+
138
+ export const scheduleEvaluationQry = gql`
139
+ query scheduleEvaluation (
140
+ $organizationId: GenericID!
141
+ $calendarId: GenericID!
142
+ $from: DateTime!
143
+ $to: DateTime!
144
+ ) {
145
+ scheduleEvaluation (
146
+ organizationId: $organizationId
147
+ calendarId: $calendarId
148
+ from: $from
149
+ to: $to
150
+ ) {
151
+ calendarId
152
+ windowStart
153
+ windowEnd
154
+ segmentCount
155
+ blockingCount
156
+ draftCount
157
+
158
+ violations {
159
+ ruleId
160
+ templateKey
161
+ message
162
+ kind
163
+ severity
164
+ resourceId
165
+ occurrenceId
166
+ actorAccountId
167
+ segmentStart
168
+ segmentEnd
169
+ detail
170
+ key
171
+ }
172
+ }
173
+ }
174
+ `;
175
+
176
+ export const scheduleRulesQry = gql`
177
+ query scheduleRules (
178
+ $organizationId: GenericID!
179
+ $calendarId: GenericID
180
+ ) {
181
+ scheduleRules (
182
+ organizationId: $organizationId
183
+ calendarId: $calendarId
184
+ ) {
185
+ id
186
+ organizationId
187
+ calendarId
188
+ resourceId
189
+ kind
190
+ label
191
+ templateKey
192
+ config
193
+ severity
194
+ effectiveFrom
195
+ effectiveTo
196
+ ordinal
197
+ version
198
+ createdAt
199
+ updatedAt
200
+ }
201
+ }
202
+ `;
203
+
204
+ // NOTE: Templates have no id — they are resolved most-specific-first from
205
+ // three layers and returned flattened — so they are selected inline rather
206
+ // than through a fragment.
207
+
208
+ export const scheduleRuleTemplatesQry = gql`
209
+ query scheduleRuleTemplates (
210
+ $organizationId: GenericID!
211
+ ) {
212
+ scheduleRuleTemplates (
213
+ organizationId: $organizationId
214
+ ) {
215
+ kind
216
+ key
217
+ label
218
+ description
219
+ messageTemplate
220
+ defaultConfig
221
+ defaultSeverity
222
+ ordinal
223
+ }
224
+ }
225
+ `;
226
+
227
+ export const scheduleDemandQry = gql`
228
+ query scheduleDemand (
229
+ $organizationId: GenericID!
230
+ $from: DateTime!
231
+ $to: DateTime!
232
+ ) {
233
+ scheduleDemand (
234
+ organizationId: $organizationId
235
+ from: $from
236
+ to: $to
237
+ ) {
238
+ id
239
+ organizationId
240
+ resourceId
241
+ category
242
+ startAt
243
+ endAt
244
+ quantity
245
+ source
246
+ createdAt
247
+ updatedAt
248
+ }
249
+ }
250
+ `;
251
+
252
+ // NOTE: Both request lists reset on any request change in the organization
253
+ // (getScheduleRequestsResetQueryTargets), because a claim moves a row OFF the
254
+ // open board and ONTO the approval queue — a membership change no fragment
255
+ // patch can express.
256
+
257
+ export const scheduleRequestsQry = gql`
258
+ query scheduleRequests (
259
+ $organizationId: GenericID!
260
+ $calendarId: GenericID
261
+ $statuses: [String!]
262
+ $mineOnly: Boolean
263
+ $offeredToMe: Boolean
264
+ $limit: Int
265
+ ) {
266
+ scheduleRequests (
267
+ organizationId: $organizationId
268
+ calendarId: $calendarId
269
+ statuses: $statuses
270
+ mineOnly: $mineOnly
271
+ offeredToMe: $offeredToMe
272
+ limit: $limit
273
+ ) {
274
+ ...scheduleRequestFragment
275
+ }
276
+ }
277
+
278
+ ${scheduleRequestFragment}
279
+ `;
280
+
281
+ export const scheduleRequestQry = gql`
282
+ query scheduleRequest (
283
+ $organizationId: GenericID!
284
+ $requestId: GenericID!
285
+ ) {
286
+ scheduleRequest (
287
+ organizationId: $organizationId
288
+ requestId: $requestId
289
+ ) {
290
+ ...scheduleRequestFragment
291
+ }
292
+ }
293
+
294
+ ${scheduleRequestFragment}
295
+ `;
296
+
297
+ export const scheduleRequestEventsQry = gql`
298
+ query scheduleRequestEvents (
299
+ $organizationId: GenericID!
300
+ $requestId: GenericID!
301
+ ) {
302
+ scheduleRequestEvents (
303
+ organizationId: $organizationId
304
+ requestId: $requestId
305
+ ) {
306
+ id
307
+ requestId
308
+ fromStatus
309
+ toStatus
310
+ actorAccountId
311
+ detail
312
+ createdAt
313
+ }
314
+ }
315
+ `;