@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
@@ -1,72 +1,28 @@
1
1
  import type { UseMutationParams } from '@jsb188/graphql/types.d';
2
2
  import type { OpenModalPopUpFn } from '@jsb188/react/states';
3
- import { useCallback } from 'react';
4
3
  import {
5
- createDataTableMtn,
6
4
  deleteDataTableMtn,
7
- deleteDataTableRowsMtn,
8
- editDataTableCellsMtn,
9
- editDataTableDesignMtn,
5
+ exportDataTableToFileMtn,
6
+ renameDataTableMtn,
10
7
  } from '../gql/mutations/dataTableMutations.ts';
11
- import { type GraphQLMutationFn, useMutation } from './index.ts';
12
-
13
- /*
14
- * Add one UUID to a logical DataTable mutation invocation. The lower-level
15
- * mutation hook reuses this same variables object for every transport retry.
16
- */
17
- function useDataTableCommandMutation(mutate: GraphQLMutationFn) {
18
- return useCallback<GraphQLMutationFn>(
19
- (graphqlOptions, triedCount) => {
20
- const commandId =
21
- graphqlOptions?.variables?.commandId ?? crypto.randomUUID();
22
-
23
- return mutate(
24
- {
25
- ...graphqlOptions,
26
- variables: {
27
- ...(graphqlOptions?.variables || {}),
28
- commandId,
29
- },
30
- },
31
- triedCount,
32
- );
33
- },
34
- [mutate],
35
- );
36
- }
37
-
38
- /*
39
- * Keep authoritative DataTable mutation responses out of normalized cache so
40
- * a delayed HTTP response cannot overwrite a newer sequenced websocket event.
41
- */
42
- function useAuthoritativeDataTableMutation(
43
- mutation: any,
44
- params: UseMutationParams,
45
- openModalPopUp?: OpenModalPopUpFn,
46
- ) {
47
- return useMutation(mutation, {
48
- openModalPopUp,
49
- ...params,
50
- cachePolicy: 'no-store',
51
- });
52
- }
8
+ import { useMutation } from './index.ts';
53
9
 
54
10
  /**
55
- * Create a dataTable.
11
+ * Rename a data table. The response updates the shared data table fragment.
56
12
  */
57
13
 
58
- export function useCreateDataTable(
14
+ export function useRenameDataTable(
59
15
  params: UseMutationParams = {},
60
16
  openModalPopUp?: OpenModalPopUpFn,
61
17
  ) {
62
- const [createDataTable, mtnValues, mtnHandlers, updateObservers] =
63
- useMutation(createDataTableMtn, {
18
+ const [renameDataTable, mtnValues, mtnHandlers, updateObservers] =
19
+ useMutation(renameDataTableMtn, {
64
20
  openModalPopUp,
65
21
  ...params,
66
22
  });
67
23
 
68
24
  return {
69
- createDataTable,
25
+ renameDataTable,
70
26
  updateObservers,
71
27
  ...mtnValues,
72
28
  ...mtnHandlers,
@@ -74,7 +30,9 @@ export function useCreateDataTable(
74
30
  }
75
31
 
76
32
  /**
77
- * Delete a dataTable.
33
+ * Delete (archive) a standalone data table. A table that AI notes read or
34
+ * workflows write needs confirmReferenceDependents: true (error 20248 carries
35
+ * their count); a table an AI note owns is refused (error 20243).
78
36
  */
79
37
 
80
38
  export function useDeleteDataTable(
@@ -82,11 +40,10 @@ export function useDeleteDataTable(
82
40
  openModalPopUp?: OpenModalPopUpFn,
83
41
  ) {
84
42
  const [deleteDataTable, mtnValues, mtnHandlers, updateObservers] =
85
- useAuthoritativeDataTableMutation(
86
- deleteDataTableMtn,
87
- params,
43
+ useMutation(deleteDataTableMtn, {
88
44
  openModalPopUp,
89
- );
45
+ ...params,
46
+ });
90
47
 
91
48
  return {
92
49
  deleteDataTable,
@@ -97,72 +54,23 @@ export function useDeleteDataTable(
97
54
  }
98
55
 
99
56
  /**
100
- * Edit multiple dataTable cell values.
101
- */
102
-
103
- export function useEditDataTableCells(
104
- params: UseMutationParams = {},
105
- openModalPopUp?: OpenModalPopUpFn,
106
- ) {
107
- const [mutateDataTableCells, mtnValues, mtnHandlers, updateObservers] =
108
- useAuthoritativeDataTableMutation(
109
- editDataTableCellsMtn,
110
- params,
111
- openModalPopUp,
112
- );
113
- const editDataTableCells = useDataTableCommandMutation(mutateDataTableCells);
114
-
115
- return {
116
- editDataTableCells,
117
- updateObservers,
118
- ...mtnValues,
119
- ...mtnHandlers,
120
- };
121
- }
122
-
123
- /**
124
- * Delete source dataTable rows.
57
+ * Export a data table's live rows to a CSV file the client downloads (the
58
+ * same file shape as a sheet export). A table with more rows than one export
59
+ * holds is refused (error 20249 carries the row cap).
125
60
  */
126
61
 
127
- export function useDeleteDataTableRows(
62
+ export function useExportDataTableToFile(
128
63
  params: UseMutationParams = {},
129
64
  openModalPopUp?: OpenModalPopUpFn,
130
65
  ) {
131
- const [mutateDataTableRows, mtnValues, mtnHandlers] =
132
- useAuthoritativeDataTableMutation(
133
- deleteDataTableRowsMtn,
134
- params,
66
+ const [exportDataTableToFile, mtnValues, mtnHandlers, updateObservers] =
67
+ useMutation(exportDataTableToFileMtn, {
135
68
  openModalPopUp,
136
- );
137
- const deleteDataTableRows = useDataTableCommandMutation(mutateDataTableRows);
138
-
139
- return {
140
- deleteDataTableRows,
141
- ...mtnValues,
142
- ...mtnHandlers,
143
- };
144
- }
145
-
146
- /**
147
- * Edit the saved design object for one dataTable.
148
- */
149
-
150
- export function useEditDataTableDesign(
151
- params: UseMutationParams = {},
152
- openModalPopUp?: OpenModalPopUpFn,
153
- ) {
154
- const [mutateDataTableDesign, mtnValues, mtnHandlers, updateObservers] =
155
- useAuthoritativeDataTableMutation(
156
- editDataTableDesignMtn,
157
- params,
158
- openModalPopUp,
159
- );
160
- const editDataTableDesign = useDataTableCommandMutation(
161
- mutateDataTableDesign,
162
- );
69
+ ...params,
70
+ });
163
71
 
164
72
  return {
165
- editDataTableDesign,
73
+ exportDataTableToFile,
166
74
  updateObservers,
167
75
  ...mtnValues,
168
76
  ...mtnHandlers,