@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,383 @@
1
+ import { gql } from 'graphql-tag';
2
+ import {
3
+ dataTableCellFragment,
4
+ dataTableRowFragment,
5
+ } from '../fragments/dataTableFragments.ts';
6
+ import {
7
+ sheetFragment,
8
+ sheetMetadataFragment,
9
+ sheetReferencedDataTableSchemaFragment,
10
+ sheetTabFragment,
11
+ sheetTabSummaryFragment,
12
+ } from '../fragments/sheetFragments.ts';
13
+
14
+ export const sheetsQry = gql`
15
+ query sheets (
16
+ $organizationId: GenericID!
17
+ $sort: GridItemSort
18
+ $cursor: Cursor
19
+ $after: Boolean!
20
+ $limit: Int!
21
+ ) {
22
+ sheets (
23
+ organizationId: $organizationId
24
+ sort: $sort
25
+ cursor: $cursor
26
+ after: $after
27
+ limit: $limit
28
+ ) {
29
+ ...sheetFragment
30
+ }
31
+ }
32
+
33
+ ${sheetFragment}
34
+ `;
35
+
36
+ export const publicSheetMetadataQry = gql`
37
+ query publicSheetMetadata (
38
+ $sheetId: GenericID!
39
+ ) {
40
+ publicSheetMetadata (
41
+ sheetId: $sheetId
42
+ ) {
43
+ ...sheetMetadataFragment
44
+ }
45
+ }
46
+
47
+ ${sheetMetadataFragment}
48
+ `;
49
+
50
+ // NOTE: sheetAccess is viewer-specific and works signed out: the public
51
+ // sheet route uses it to learn the owner org and view/edit facts, and the
52
+ // in-app Sheet page uses it for the viewer's effective edit fact (grants
53
+ // are per-viewer overrides, so the base policy alone cannot decide it).
54
+
55
+ export const sheetAccessQry = gql`
56
+ query sheetAccess (
57
+ $sheetId: GenericID!
58
+ ) {
59
+ sheetAccess (
60
+ sheetId: $sheetId
61
+ ) {
62
+ sheetId
63
+ organizationId
64
+ canView
65
+ canEdit
66
+ signInRequired
67
+ }
68
+ }
69
+ `;
70
+
71
+ export const sheetRegionSourcePreviewRowsQry = gql`
72
+ query sheetRegionSourcePreviewRows (
73
+ $organizationId: GenericID!
74
+ $region: SheetRegionInput!
75
+ $limit: Int!
76
+ ) {
77
+ sheetRegionSourcePreviewRows (
78
+ organizationId: $organizationId
79
+ region: $region
80
+ limit: $limit
81
+ ) {
82
+ ...dataTableRowFragment
83
+
84
+ cells {
85
+ ...dataTableCellFragment
86
+ }
87
+ }
88
+ }
89
+
90
+ ${dataTableRowFragment}
91
+ ${dataTableCellFragment}
92
+ `;
93
+
94
+ // NOTE: sheetAccessGrants is owner-org only: the access settings screen
95
+ // loads the grants list with it, on top of the base policy carried by the
96
+ // Sheet fragment's "access" selection.
97
+
98
+ export const sheetAccessGrantsQry = gql`
99
+ query sheetAccessGrants (
100
+ $organizationId: GenericID!
101
+ $sheetId: GenericID!
102
+ ) {
103
+ sheetAccessGrants (
104
+ organizationId: $organizationId
105
+ sheetId: $sheetId
106
+ ) {
107
+ granteeType
108
+ granteeId
109
+ permission
110
+ }
111
+ }
112
+ `;
113
+
114
+ // NOTE: openSheet is the page-bootstrap contract. It derives the owner org
115
+ // from sheetId, folds viewer access into the response, and lets the server
116
+ // choose a compact snapshot or a short contiguous cell-only delta.
117
+
118
+ export const openSheetQry = gql`
119
+ query openSheet (
120
+ $sheetId: GenericID!
121
+ $selectedTabId: GenericID
122
+ $sinceSeq: BigInt
123
+ $baseSnapshotSeq: BigInt
124
+ $baseSnapshotEncodingVersion: Int
125
+ $baseSnapshotChecksum: String
126
+ $viewport: SheetGridViewportInput
127
+ ) {
128
+ openSheet (
129
+ sheetId: $sheetId
130
+ selectedTabId: $selectedTabId
131
+ sinceSeq: $sinceSeq
132
+ baseSnapshotSeq: $baseSnapshotSeq
133
+ baseSnapshotEncodingVersion: $baseSnapshotEncodingVersion
134
+ baseSnapshotChecksum: $baseSnapshotChecksum
135
+ viewport: $viewport
136
+ ) {
137
+ access {
138
+ sheetId
139
+ organizationId
140
+ canView
141
+ canEdit
142
+ signInRequired
143
+ }
144
+
145
+ contractVersion
146
+ realtimeToken
147
+ status
148
+ unavailableReason
149
+ sheet {
150
+ ...sheetFragment
151
+ }
152
+
153
+ tabs {
154
+ ...sheetTabSummaryFragment
155
+ }
156
+
157
+ selectedTab {
158
+ ...sheetTabFragment
159
+ }
160
+
161
+ mode
162
+ currentSeq
163
+ servedViewport {
164
+ startRowIndex
165
+ startColumnIndex
166
+ rowCount
167
+ columnCount
168
+ }
169
+
170
+ snapshot {
171
+ seq
172
+ encodingVersion
173
+ viewport {
174
+ startRowIndex
175
+ startColumnIndex
176
+ rowCount
177
+ columnCount
178
+ }
179
+ payload
180
+ checksum
181
+ cellCount
182
+ payloadBytes
183
+ createdAt
184
+ }
185
+
186
+ changes {
187
+ sheetTabId
188
+ seq
189
+ kind
190
+ payload
191
+ commandId
192
+ causationId
193
+ sessionId
194
+ commandType
195
+ createdAt
196
+ }
197
+
198
+ referencedDataTables {
199
+ ...sheetReferencedDataTableSchemaFragment
200
+ }
201
+ }
202
+ }
203
+
204
+ ${sheetFragment}
205
+ ${sheetTabFragment}
206
+ ${sheetTabSummaryFragment}
207
+ ${sheetReferencedDataTableSchemaFragment}
208
+ `;
209
+
210
+ // NOTE: openSheetTab is the post-manifest bootstrap contract. It intentionally
211
+ // excludes workbook JSON, all-tab summaries, and cross-tab reference metadata.
212
+
213
+ export const openSheetTabQry = gql`
214
+ query openSheetTab (
215
+ $sheetId: GenericID!
216
+ $sheetTabId: GenericID!
217
+ $sinceSeq: BigInt
218
+ $baseSnapshotSeq: BigInt
219
+ $baseSnapshotEncodingVersion: Int
220
+ $baseSnapshotChecksum: String
221
+ $viewport: SheetGridViewportInput
222
+ ) {
223
+ openSheetTab (
224
+ sheetId: $sheetId
225
+ sheetTabId: $sheetTabId
226
+ sinceSeq: $sinceSeq
227
+ baseSnapshotSeq: $baseSnapshotSeq
228
+ baseSnapshotEncodingVersion: $baseSnapshotEncodingVersion
229
+ baseSnapshotChecksum: $baseSnapshotChecksum
230
+ viewport: $viewport
231
+ ) {
232
+ access {
233
+ sheetId
234
+ organizationId
235
+ canView
236
+ canEdit
237
+ signInRequired
238
+ }
239
+
240
+ contractVersion
241
+ realtimeToken
242
+ status
243
+ unavailableReason
244
+ selectedTab {
245
+ ...sheetTabFragment
246
+ }
247
+
248
+ mode
249
+ currentSeq
250
+ servedViewport {
251
+ startRowIndex
252
+ startColumnIndex
253
+ rowCount
254
+ columnCount
255
+ }
256
+
257
+ snapshot {
258
+ seq
259
+ encodingVersion
260
+ viewport {
261
+ startRowIndex
262
+ startColumnIndex
263
+ rowCount
264
+ columnCount
265
+ }
266
+ payload
267
+ checksum
268
+ cellCount
269
+ payloadBytes
270
+ createdAt
271
+ }
272
+
273
+ changes {
274
+ sheetTabId
275
+ seq
276
+ kind
277
+ payload
278
+ commandId
279
+ causationId
280
+ sessionId
281
+ commandType
282
+ createdAt
283
+ }
284
+
285
+ referencedDataTables {
286
+ ...sheetReferencedDataTableSchemaFragment
287
+ }
288
+ }
289
+ }
290
+
291
+ ${sheetTabFragment}
292
+ ${sheetReferencedDataTableSchemaFragment}
293
+ `;
294
+
295
+ // NOTE: sheetTabChanges is the realtime gap-recovery tail read: a client that
296
+ // detects a seq gap in its SheetView fragment deltas fetches every journaled change
297
+ // after its last-seen seq and replays the JSON payloads locally instead of
298
+ // refetching the whole viewport. tailAvailable: false means the tail cannot
299
+ // be served (too long/heavy, truncated, or pre-deployment history) and the
300
+ // client must request a fresh authoritative tab snapshot.
301
+
302
+ export const sheetTabChangesQry = gql`
303
+ query sheetTabChanges (
304
+ $organizationId: GenericID!
305
+ $sheetId: GenericID!
306
+ $sheetTabId: GenericID!
307
+ $afterSeq: BigInt!
308
+ ) {
309
+ sheetTabChanges (
310
+ organizationId: $organizationId
311
+ sheetId: $sheetId
312
+ sheetTabId: $sheetTabId
313
+ afterSeq: $afterSeq
314
+ ) {
315
+ sheetTabId
316
+ currentSeq
317
+ tailAvailable
318
+ changes {
319
+ sheetTabId
320
+ seq
321
+ kind
322
+ payload
323
+ commandId
324
+ causationId
325
+ sessionId
326
+ commandType
327
+ createdAt
328
+ }
329
+ }
330
+ }
331
+ `;
332
+
333
+ // NOTE: operational history exposes only the compact semantic intent needed
334
+ // for instant replay and is scoped by the server to the authenticated actor
335
+ // plus this exact browser-tab session.
336
+
337
+ export const sheetOperationalHistoryQry = gql`
338
+ query sheetOperationalHistory (
339
+ $organizationId: GenericID!
340
+ $sheetId: GenericID!
341
+ $sheetTabId: GenericID!
342
+ $sessionId: String!
343
+ ) {
344
+ sheetOperationalHistory (
345
+ organizationId: $organizationId
346
+ sheetId: $sheetId
347
+ sheetTabId: $sheetTabId
348
+ sessionId: $sessionId
349
+ ) {
350
+ sheetId
351
+ sheetTabId
352
+ sessionId
353
+ truncated
354
+ incompleteBeforeBoundary
355
+ undo {
356
+ commandId
357
+ commandType
358
+ committedAt
359
+ resultRevision
360
+ resultDesignRevision
361
+ axisMove {
362
+ axis
363
+ sourceStartIndex
364
+ sourceEndIndex
365
+ targetStartIndex
366
+ }
367
+ }
368
+ redo {
369
+ commandId
370
+ commandType
371
+ committedAt
372
+ resultRevision
373
+ resultDesignRevision
374
+ axisMove {
375
+ axis
376
+ sourceStartIndex
377
+ sourceEndIndex
378
+ targetStartIndex
379
+ }
380
+ }
381
+ }
382
+ }
383
+ `;
@@ -0,0 +1,38 @@
1
+ import { gql } from 'graphql-tag';
2
+ import { generatedFileFragment } from '../fragments/storageFragments.ts';
3
+
4
+ export const generatedFilesQry = gql`
5
+ query generatedFiles (
6
+ $organizationId: GenericID!
7
+ $cursor: Cursor
8
+ $after: Boolean!
9
+ $limit: Int!
10
+ ) {
11
+ generatedFiles (
12
+ organizationId: $organizationId
13
+ cursor: $cursor
14
+ after: $after
15
+ limit: $limit
16
+ ) {
17
+ ...generatedFileFragment
18
+ }
19
+ }
20
+
21
+ ${generatedFileFragment}
22
+ `;
23
+
24
+ export const generatedFileQry = gql`
25
+ query generatedFile (
26
+ $organizationId: GenericID!
27
+ $code: String!
28
+ ) {
29
+ generatedFile (
30
+ organizationId: $organizationId
31
+ code: $code
32
+ ) {
33
+ ...generatedFileFragment
34
+ }
35
+ }
36
+
37
+ ${generatedFileFragment}
38
+ `;
@@ -0,0 +1,99 @@
1
+ import { gql } from 'graphql-tag';
2
+ import {
3
+ workflowFragment,
4
+ workflowRunFragment,
5
+ } from '../fragments/workflowFragments.ts';
6
+
7
+ export const workflowMetadataQry = gql`
8
+ query workflowMetadata (
9
+ $workflowId: GenericID!
10
+ ) {
11
+ workflowMetadata (
12
+ workflowId: $workflowId
13
+ ) {
14
+ id
15
+ title
16
+ }
17
+ }
18
+ `;
19
+
20
+ export const workflowsQry = gql`
21
+ query workflows (
22
+ $organizationId: GenericID!
23
+ $filter: WorkflowsFilter!
24
+ $sort: WorkflowsSort
25
+ $cursor: Cursor
26
+ $after: Boolean!
27
+ $limit: Int!
28
+ ) {
29
+ workflows (
30
+ organizationId: $organizationId
31
+ filter: $filter
32
+ sort: $sort
33
+ cursor: $cursor
34
+ after: $after
35
+ limit: $limit
36
+ ) {
37
+ ...workflowFragment
38
+
39
+ latestRun {
40
+ ...workflowRunFragment
41
+ }
42
+ }
43
+ }
44
+
45
+ ${workflowFragment}
46
+ ${workflowRunFragment}
47
+ `;
48
+
49
+ export const workflowRunsQry = gql`
50
+ query workflowRuns (
51
+ $organizationId: GenericID!
52
+ $filter: WorkflowRunsFilter!
53
+ $sort: WorkflowRunsSort
54
+ $cursor: Cursor
55
+ $after: Boolean!
56
+ $limit: Int!
57
+ ) {
58
+ workflowRuns (
59
+ organizationId: $organizationId
60
+ filter: $filter
61
+ sort: $sort
62
+ cursor: $cursor
63
+ after: $after
64
+ limit: $limit
65
+ ) {
66
+ ...workflowRunFragment
67
+
68
+ workflow {
69
+ id
70
+ kind
71
+ title
72
+ }
73
+ }
74
+ }
75
+
76
+ ${workflowRunFragment}
77
+ `;
78
+
79
+ export const workflowRunQry = gql`
80
+ query workflowRun (
81
+ $organizationId: GenericID!
82
+ $workflowRunId: GenericID!
83
+ ) {
84
+ workflowRun (
85
+ organizationId: $organizationId
86
+ workflowRunId: $workflowRunId
87
+ ) {
88
+ ...workflowRunFragment
89
+
90
+ workflow {
91
+ id
92
+ kind
93
+ title
94
+ }
95
+ }
96
+ }
97
+
98
+ ${workflowRunFragment}
99
+ `;