@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,423 @@
1
+ import { gql } from 'graphql-tag';
2
+ import {
3
+ scheduleCalendarFragment,
4
+ scheduleOccurrenceFragment,
5
+ scheduleRequestFragment,
6
+ } from '../fragments/scheduleFragments.ts';
7
+
8
+ // NOTE: Every occurrence mutation returns the full fragment, including the
9
+ // hydrated slots and assignments, so the calendar patches in place rather than
10
+ // refetching the window. "version" is the optimistic-lock token: read it from
11
+ // the occurrence you are editing and echo it back, or a second editor's change
12
+ // is silently overwritten.
13
+
14
+ export const createScheduleOccurrenceMtn = gql`
15
+ mutation createScheduleOccurrence (
16
+ $organizationId: GenericID!
17
+ $calendarId: GenericID!
18
+ $kind: String
19
+ $title: String!
20
+ $note: String
21
+ $location: String
22
+ $resourceId: GenericID
23
+ $siteId: GenericID
24
+ $startAt: DateTime!
25
+ $endAt: DateTime!
26
+ $timeZone: String
27
+ $allDay: Boolean
28
+ $status: String
29
+ $slots: [ScheduleSlotInput!]
30
+ ) {
31
+ createScheduleOccurrence (
32
+ organizationId: $organizationId
33
+ calendarId: $calendarId
34
+ kind: $kind
35
+ title: $title
36
+ note: $note
37
+ location: $location
38
+ resourceId: $resourceId
39
+ siteId: $siteId
40
+ startAt: $startAt
41
+ endAt: $endAt
42
+ timeZone: $timeZone
43
+ allDay: $allDay
44
+ status: $status
45
+ slots: $slots
46
+ ) {
47
+ ...scheduleOccurrenceFragment
48
+ }
49
+ }
50
+
51
+ ${scheduleOccurrenceFragment}
52
+ `;
53
+
54
+ export const updateScheduleOccurrenceMtn = gql`
55
+ mutation updateScheduleOccurrence (
56
+ $organizationId: GenericID!
57
+ $occurrenceId: GenericID!
58
+ $version: String
59
+ $title: String
60
+ $note: String
61
+ $location: String
62
+ $resourceId: GenericID
63
+ $siteId: GenericID
64
+ $startAt: DateTime
65
+ $endAt: DateTime
66
+ $timeZone: String
67
+ $allDay: Boolean
68
+ $status: String
69
+ $slots: [ScheduleSlotInput!]
70
+ ) {
71
+ updateScheduleOccurrence (
72
+ organizationId: $organizationId
73
+ occurrenceId: $occurrenceId
74
+ version: $version
75
+ title: $title
76
+ note: $note
77
+ location: $location
78
+ resourceId: $resourceId
79
+ siteId: $siteId
80
+ startAt: $startAt
81
+ endAt: $endAt
82
+ timeZone: $timeZone
83
+ allDay: $allDay
84
+ status: $status
85
+ slots: $slots
86
+ ) {
87
+ ...scheduleOccurrenceFragment
88
+ }
89
+ }
90
+
91
+ ${scheduleOccurrenceFragment}
92
+ `;
93
+
94
+ // NOTE: Cancelling keeps the row and strikes it through on the calendar.
95
+ // Somebody looking for a shift that was cancelled has to be able to find it,
96
+ // rather than wonder whether they imagined it.
97
+
98
+ export const cancelScheduleOccurrenceMtn = gql`
99
+ mutation cancelScheduleOccurrence (
100
+ $organizationId: GenericID!
101
+ $occurrenceId: GenericID!
102
+ ) {
103
+ cancelScheduleOccurrence (
104
+ organizationId: $organizationId
105
+ occurrenceId: $occurrenceId
106
+ ) {
107
+ ...scheduleOccurrenceFragment
108
+ }
109
+ }
110
+
111
+ ${scheduleOccurrenceFragment}
112
+ `;
113
+
114
+ export const deleteScheduleOccurrenceMtn = gql`
115
+ mutation deleteScheduleOccurrence (
116
+ $organizationId: GenericID!
117
+ $occurrenceId: GenericID!
118
+ ) {
119
+ deleteScheduleOccurrence (
120
+ organizationId: $organizationId
121
+ occurrenceId: $occurrenceId
122
+ )
123
+ }
124
+ `;
125
+
126
+ export const createScheduleCalendarMtn = gql`
127
+ mutation createScheduleCalendar (
128
+ $organizationId: GenericID!
129
+ $kind: String
130
+ $name: String!
131
+ $description: String
132
+ $timeZone: String
133
+ $siteId: GenericID
134
+ $color: String
135
+ ) {
136
+ createScheduleCalendar (
137
+ organizationId: $organizationId
138
+ kind: $kind
139
+ name: $name
140
+ description: $description
141
+ timeZone: $timeZone
142
+ siteId: $siteId
143
+ color: $color
144
+ ) {
145
+ ...scheduleCalendarFragment
146
+
147
+ viewerPermission
148
+ viewerCanEditAccess
149
+ }
150
+ }
151
+
152
+ ${scheduleCalendarFragment}
153
+ `;
154
+
155
+ export const updateScheduleCalendarMtn = gql`
156
+ mutation updateScheduleCalendar (
157
+ $organizationId: GenericID!
158
+ $calendarId: GenericID!
159
+ $name: String
160
+ $description: String
161
+ $timeZone: String
162
+ $siteId: GenericID
163
+ $color: String
164
+ $ordinal: Int
165
+ ) {
166
+ updateScheduleCalendar (
167
+ organizationId: $organizationId
168
+ calendarId: $calendarId
169
+ name: $name
170
+ description: $description
171
+ timeZone: $timeZone
172
+ siteId: $siteId
173
+ color: $color
174
+ ordinal: $ordinal
175
+ ) {
176
+ ...scheduleCalendarFragment
177
+
178
+ viewerPermission
179
+ viewerCanEditAccess
180
+ }
181
+ }
182
+
183
+ ${scheduleCalendarFragment}
184
+ `;
185
+
186
+ export const assignScheduleOccurrenceMtn = gql`
187
+ mutation assignScheduleOccurrence (
188
+ $organizationId: GenericID!
189
+ $occurrenceId: GenericID!
190
+ $slotId: GenericID
191
+ $actorType: String
192
+ $actorAccountId: GenericID
193
+ $actorOrganizationId: GenericID
194
+ $actorContactId: GenericID
195
+ $startAt: DateTime
196
+ $endAt: DateTime
197
+ ) {
198
+ assignScheduleOccurrence (
199
+ organizationId: $organizationId
200
+ occurrenceId: $occurrenceId
201
+ slotId: $slotId
202
+ actorType: $actorType
203
+ actorAccountId: $actorAccountId
204
+ actorOrganizationId: $actorOrganizationId
205
+ actorContactId: $actorContactId
206
+ startAt: $startAt
207
+ endAt: $endAt
208
+ ) {
209
+ id
210
+ organizationId
211
+ occurrenceId
212
+ slotId
213
+ actorType
214
+ actorAccountId
215
+ actorOrganizationId
216
+ actorContactId
217
+ status
218
+ startAt
219
+ endAt
220
+ assignedByAccountId
221
+ releasedAt
222
+ }
223
+ }
224
+ `;
225
+
226
+ export const releaseScheduleAssignmentMtn = gql`
227
+ mutation releaseScheduleAssignment (
228
+ $organizationId: GenericID!
229
+ $assignmentId: GenericID!
230
+ ) {
231
+ releaseScheduleAssignment (
232
+ organizationId: $organizationId
233
+ assignmentId: $assignmentId
234
+ ) {
235
+ id
236
+ organizationId
237
+ occurrenceId
238
+ status
239
+ releasedAt
240
+ }
241
+ }
242
+ `;
243
+
244
+ // NOTE: Publishing is two-phase. It re-evaluates the window and refuses on a
245
+ // blocking breach unless that exact violation key was acknowledged, so the
246
+ // caller sends back the keys it showed the publisher — not a blanket "force".
247
+
248
+ export const publishScheduleMtn = gql`
249
+ mutation publishSchedule (
250
+ $organizationId: GenericID!
251
+ $calendarId: GenericID!
252
+ $from: DateTime!
253
+ $to: DateTime!
254
+ $acknowledgedViolationKeys: [String!]
255
+ ) {
256
+ publishSchedule (
257
+ organizationId: $organizationId
258
+ calendarId: $calendarId
259
+ from: $from
260
+ to: $to
261
+ acknowledgedViolationKeys: $acknowledgedViolationKeys
262
+ ) {
263
+ publicationId
264
+ publishedCount
265
+
266
+ violations {
267
+ ruleId
268
+ templateKey
269
+ message
270
+ kind
271
+ severity
272
+ resourceId
273
+ occurrenceId
274
+ actorAccountId
275
+ segmentStart
276
+ segmentEnd
277
+ detail
278
+ key
279
+ }
280
+ }
281
+ }
282
+ `;
283
+
284
+ export const createScheduleRequestMtn = gql`
285
+ mutation createScheduleRequest (
286
+ $organizationId: GenericID!
287
+ $calendarId: GenericID!
288
+ $kind: String!
289
+ $sourceAssignmentId: GenericID
290
+ $targetAssignmentId: GenericID
291
+ $targetOccurrenceId: GenericID
292
+ $startAt: DateTime
293
+ $endAt: DateTime
294
+ $reason: String
295
+ $expiresAt: DateTime
296
+ ) {
297
+ createScheduleRequest (
298
+ organizationId: $organizationId
299
+ calendarId: $calendarId
300
+ kind: $kind
301
+ sourceAssignmentId: $sourceAssignmentId
302
+ targetAssignmentId: $targetAssignmentId
303
+ targetOccurrenceId: $targetOccurrenceId
304
+ startAt: $startAt
305
+ endAt: $endAt
306
+ reason: $reason
307
+ expiresAt: $expiresAt
308
+ ) {
309
+ ...scheduleRequestFragment
310
+ }
311
+ }
312
+
313
+ ${scheduleRequestFragment}
314
+ `;
315
+
316
+ // NOTE: First accept wins. A losing claimant gets a plain error, which is an
317
+ // ordinary outcome rather than a failure — somebody else took the shift a
318
+ // moment ago — so the UI reports it as news, not as a fault.
319
+
320
+ export const claimScheduleRequestMtn = gql`
321
+ mutation claimScheduleRequest (
322
+ $organizationId: GenericID!
323
+ $requestId: GenericID!
324
+ ) {
325
+ claimScheduleRequest (
326
+ organizationId: $organizationId
327
+ requestId: $requestId
328
+ ) {
329
+ ...scheduleRequestFragment
330
+ }
331
+ }
332
+
333
+ ${scheduleRequestFragment}
334
+ `;
335
+
336
+ export const declineScheduleRequestMtn = gql`
337
+ mutation declineScheduleRequest (
338
+ $organizationId: GenericID!
339
+ $requestId: GenericID!
340
+ $decisionNote: String
341
+ ) {
342
+ declineScheduleRequest (
343
+ organizationId: $organizationId
344
+ requestId: $requestId
345
+ decisionNote: $decisionNote
346
+ ) {
347
+ ...scheduleRequestFragment
348
+ }
349
+ }
350
+
351
+ ${scheduleRequestFragment}
352
+ `;
353
+
354
+ export const withdrawScheduleRequestMtn = gql`
355
+ mutation withdrawScheduleRequest (
356
+ $organizationId: GenericID!
357
+ $requestId: GenericID!
358
+ ) {
359
+ withdrawScheduleRequest (
360
+ organizationId: $organizationId
361
+ requestId: $requestId
362
+ ) {
363
+ ...scheduleRequestFragment
364
+ }
365
+ }
366
+
367
+ ${scheduleRequestFragment}
368
+ `;
369
+
370
+ export const decideScheduleRequestMtn = gql`
371
+ mutation decideScheduleRequest (
372
+ $organizationId: GenericID!
373
+ $requestId: GenericID!
374
+ $approve: Boolean!
375
+ $decisionNote: String
376
+ ) {
377
+ decideScheduleRequest (
378
+ organizationId: $organizationId
379
+ requestId: $requestId
380
+ approve: $approve
381
+ decisionNote: $decisionNote
382
+ ) {
383
+ ...scheduleRequestFragment
384
+ }
385
+ }
386
+
387
+ ${scheduleRequestFragment}
388
+ `;
389
+
390
+ // NOTE: The raw token is returned exactly once, here. Only a hash is stored,
391
+ // so it can never be retrieved again — the UI has to show it now or the
392
+ // subscription is unusable.
393
+
394
+ export const createScheduleFeedTokenMtn = gql`
395
+ mutation createScheduleFeedToken (
396
+ $organizationId: GenericID!
397
+ $calendarId: GenericID
398
+ $scope: String
399
+ ) {
400
+ createScheduleFeedToken (
401
+ organizationId: $organizationId
402
+ calendarId: $calendarId
403
+ scope: $scope
404
+ ) {
405
+ id
406
+ calendarId
407
+ scope
408
+ token
409
+ }
410
+ }
411
+ `;
412
+
413
+ export const revokeScheduleFeedTokenMtn = gql`
414
+ mutation revokeScheduleFeedToken (
415
+ $organizationId: GenericID!
416
+ $feedTokenId: GenericID!
417
+ ) {
418
+ revokeScheduleFeedToken (
419
+ organizationId: $organizationId
420
+ feedTokenId: $feedTokenId
421
+ )
422
+ }
423
+ `;