@bitbitpress/client 1.1.0-alpha.1 → 1.1.1

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 (107) hide show
  1. package/README.md +82 -10
  2. package/dist/generated/openapi.d.ts +493 -18
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/react/index.d.ts +29 -54
  6. package/dist/react/index.d.ts.map +1 -1
  7. package/dist/react/index.js +69 -81
  8. package/dist/react/index.js.map +1 -1
  9. package/dist/react-native-expo/index.d.ts +1 -52
  10. package/dist/react-native-expo/index.d.ts.map +1 -1
  11. package/dist/react-native-expo/index.js +1 -91
  12. package/dist/react-native-expo/index.js.map +1 -1
  13. package/dist/runtime/index.d.ts +60 -0
  14. package/dist/runtime/index.d.ts.map +1 -0
  15. package/dist/runtime/index.js +84 -0
  16. package/dist/runtime/index.js.map +1 -0
  17. package/dist/synthesisUi/context.d.ts +18 -0
  18. package/dist/synthesisUi/context.d.ts.map +1 -0
  19. package/dist/synthesisUi/context.js +15 -0
  20. package/dist/synthesisUi/context.js.map +1 -0
  21. package/dist/synthesisUi/types.d.ts +30 -0
  22. package/dist/synthesisUi/types.d.ts.map +1 -0
  23. package/dist/{synthesisView → synthesisUi}/types.js.map +1 -1
  24. package/dist/user/index.d.ts +59 -11
  25. package/dist/user/index.d.ts.map +1 -1
  26. package/dist/user/index.js +12 -6
  27. package/dist/user/index.js.map +1 -1
  28. package/dist/user/interaction.d.ts +7 -0
  29. package/dist/user/interaction.d.ts.map +1 -1
  30. package/dist/user/interaction.js +7 -0
  31. package/dist/user/interaction.js.map +1 -1
  32. package/dist/user/submissions.d.ts +65 -0
  33. package/dist/user/submissions.d.ts.map +1 -1
  34. package/dist/user/submissions.js +57 -0
  35. package/dist/user/submissions.js.map +1 -1
  36. package/dist/user/synthesize-batch-manager.js +3 -0
  37. package/dist/user/synthesize-batch-manager.js.map +1 -1
  38. package/dist/user/synthesize.d.ts +40 -3
  39. package/dist/user/synthesize.d.ts.map +1 -1
  40. package/dist/user/synthesize.js +12 -3
  41. package/dist/user/synthesize.js.map +1 -1
  42. package/dist/user/synthesizeUi.d.ts +67 -0
  43. package/dist/user/synthesizeUi.d.ts.map +1 -0
  44. package/dist/user/synthesizeUi.js +51 -0
  45. package/dist/user/synthesizeUi.js.map +1 -0
  46. package/dist/user/track-batch-manager.d.ts +17 -0
  47. package/dist/user/track-batch-manager.d.ts.map +1 -0
  48. package/dist/user/track-batch-manager.js +52 -0
  49. package/dist/user/track-batch-manager.js.map +1 -0
  50. package/dist/user/track.d.ts +17 -0
  51. package/dist/user/track.d.ts.map +1 -0
  52. package/dist/user/track.js +24 -0
  53. package/dist/user/track.js.map +1 -0
  54. package/dist/user/typeDefs.d.ts +9 -3
  55. package/dist/user/typeDefs.d.ts.map +1 -1
  56. package/package.json +1 -1
  57. package/dist/react/primitives.d.ts +0 -54
  58. package/dist/react/primitives.d.ts.map +0 -1
  59. package/dist/react/primitives.js +0 -223
  60. package/dist/react/primitives.js.map +0 -1
  61. package/dist/react-native-expo/primitives.d.ts +0 -58
  62. package/dist/react-native-expo/primitives.d.ts.map +0 -1
  63. package/dist/react-native-expo/primitives.js +0 -218
  64. package/dist/react-native-expo/primitives.js.map +0 -1
  65. package/dist/synthesisView/context.d.ts +0 -18
  66. package/dist/synthesisView/context.d.ts.map +0 -1
  67. package/dist/synthesisView/context.js +0 -15
  68. package/dist/synthesisView/context.js.map +0 -1
  69. package/dist/synthesisView/createComponentMap.d.ts +0 -18
  70. package/dist/synthesisView/createComponentMap.d.ts.map +0 -1
  71. package/dist/synthesisView/createComponentMap.js +0 -40
  72. package/dist/synthesisView/createComponentMap.js.map +0 -1
  73. package/dist/synthesisView/devLog.d.ts +0 -10
  74. package/dist/synthesisView/devLog.d.ts.map +0 -1
  75. package/dist/synthesisView/devLog.js +0 -23
  76. package/dist/synthesisView/devLog.js.map +0 -1
  77. package/dist/synthesisView/engine.d.ts +0 -35
  78. package/dist/synthesisView/engine.d.ts.map +0 -1
  79. package/dist/synthesisView/engine.js +0 -139
  80. package/dist/synthesisView/engine.js.map +0 -1
  81. package/dist/synthesisView/primitives.d.ts +0 -180
  82. package/dist/synthesisView/primitives.d.ts.map +0 -1
  83. package/dist/synthesisView/primitives.js +0 -29
  84. package/dist/synthesisView/primitives.js.map +0 -1
  85. package/dist/synthesisView/resolve.d.ts +0 -17
  86. package/dist/synthesisView/resolve.d.ts.map +0 -1
  87. package/dist/synthesisView/resolve.js +0 -42
  88. package/dist/synthesisView/resolve.js.map +0 -1
  89. package/dist/synthesisView/types.d.ts +0 -121
  90. package/dist/synthesisView/types.d.ts.map +0 -1
  91. package/dist/synthesisView/useEventDrivenView.d.ts +0 -32
  92. package/dist/synthesisView/useEventDrivenView.d.ts.map +0 -1
  93. package/dist/synthesisView/useEventDrivenView.js +0 -157
  94. package/dist/synthesisView/useEventDrivenView.js.map +0 -1
  95. package/dist/synthesisView/useSynthesisView.d.ts +0 -13
  96. package/dist/synthesisView/useSynthesisView.d.ts.map +0 -1
  97. package/dist/synthesisView/useSynthesisView.js +0 -49
  98. package/dist/synthesisView/useSynthesisView.js.map +0 -1
  99. package/dist/user/synthesize-view-batch-manager.d.ts +0 -17
  100. package/dist/user/synthesize-view-batch-manager.d.ts.map +0 -1
  101. package/dist/user/synthesize-view-batch-manager.js +0 -52
  102. package/dist/user/synthesize-view-batch-manager.js.map +0 -1
  103. package/dist/user/synthesizeView.d.ts +0 -41
  104. package/dist/user/synthesizeView.d.ts.map +0 -1
  105. package/dist/user/synthesizeView.js +0 -26
  106. package/dist/user/synthesizeView.js.map +0 -1
  107. /package/dist/{synthesisView → synthesisUi}/types.js +0 -0
package/README.md CHANGED
@@ -49,6 +49,9 @@ More details can also be found in your control room's API docs @ https://your-co
49
49
  - [report](#report)
50
50
  - [createSubmission](#createsubmission)
51
51
  - [submissions](#submissions)
52
+ - [submit](#submit)
53
+ - [submissionState](#submissionstate)
54
+ - [submissionFeed](#submissionfeed)
52
55
  - [signal](#signal)
53
56
  - [signalItem](#signalitem)
54
57
  - [synthesizeItem](#synthesizeitem)
@@ -428,6 +431,74 @@ console.log('Next cursor:', result.cursor);
428
431
 
429
432
  ---
430
433
 
434
+ #### submit
435
+
436
+ Submit content (a poll vote or a contest entry) tied to a synthesis output. One submission per user per piece — re-submitting overwrites the prior one. Get `synthesisOutputId` from the synthesize response (`result.synthesisOutputId`).
437
+
438
+ ```typescript
439
+ client.user.submit(options: SubmitRequest): Promise<SubmitResponse>
440
+ ```
441
+
442
+ ##### Parameters
443
+
444
+ - `options.synthesisOutputId` (required): The output the submission attaches to
445
+ - `options.data` (required): Structured submission data (e.g. `{ response: 'yes' }` for a poll)
446
+ - `options.synthesisOutputContentKey` (optional): Defaults to `''` (one piece per output)
447
+ - `options.files` (optional): File descriptors for presigned uploads
448
+
449
+ ##### Example
450
+
451
+ ```typescript
452
+ const { synthesisOutputId } = await client.user.synthesizeItem(pollItem);
453
+ await client.user.submit({ synthesisOutputId, data: { response: 'yes' } });
454
+ ```
455
+
456
+ ---
457
+
458
+ #### submissionState
459
+
460
+ Read one submittable piece: the public aggregate and this user's own submission (`null` if none). For a poll: results plus whether the user has voted.
461
+
462
+ ```typescript
463
+ client.user.submissionState(options: {
464
+ synthesisOutputId: string;
465
+ synthesisOutputContentKey?: string;
466
+ }): Promise<SubmissionState>
467
+ ```
468
+
469
+ ##### Returns
470
+
471
+ - `aggregate`: `{ total, submissionCounts?, byState? }` — `submissionCounts` is keyed by the config's `aggregateField` value (e.g. a poll option)
472
+ - `ownSubmission`: this user's submission, or `null`
473
+
474
+ ##### Example
475
+
476
+ ```typescript
477
+ const { aggregate, ownSubmission } = await client.user.submissionState({ synthesisOutputId });
478
+ const hasVoted = ownSubmission != null;
479
+ const counts = aggregate.submissionCounts; // { yes: 12, no: 3 }
480
+ ```
481
+
482
+ ---
483
+
484
+ #### submissionFeed
485
+
486
+ List the public feed of LIVE submissions for a synthesis output (e.g. all contest entries), paginated.
487
+
488
+ ```typescript
489
+ client.user.submissionFeed(options: {
490
+ synthesisOutputId: string;
491
+ first?: number;
492
+ after?: string;
493
+ }): Promise<SubmissionFeed>
494
+ ```
495
+
496
+ ##### Returns
497
+
498
+ - `SubmissionFeed`: `{ cursor, items }` — each item is `{ id, data, files, createdAt }`
499
+
500
+ ---
501
+
431
502
  #### signal
432
503
 
433
504
  Record user signals (e.g., clicked topic, read article) to inform profile interests. Signals are used to power a user's recommendations.
@@ -554,12 +625,12 @@ client.user.synthesizeItem(
554
625
 
555
626
  ##### Parameters
556
627
 
557
- - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `limit` (number of results to return; defaults to `1`), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
628
+ - `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `synthesisHistoryLimit` (how many recent stored outputs to expose in `synthesisHistory`; defaults to `0` — no history emitted), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
558
629
  - `onStreamingData` (optional): Callback invoked with streaming data whenever a stream event has `complete: false` for this item. Type: `(data: unknown) => void`.
559
630
 
560
631
  ##### Returns
561
632
 
562
- - `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `error` is set on failure
633
+ - `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `synthesisHistory` is an array of recent stored `data` payloads when `synthesisHistoryLimit > 0` (most-recent first; the first entry is the current synthesis itself); `error` is set on failure
563
634
 
564
635
  ##### Behavior
565
636
 
@@ -614,7 +685,7 @@ client.user.synthesize(
614
685
  - `inputs` (optional): Context for synthesis — array of `{ type: "externalId" | "text" | "excludeExternalIds", value: string }` (article ID, freeform text, or comma-separated external IDs to exclude)
615
686
  - `output`: `{ schema: string | ZodType }` — output schema as a JSON string or Zod 4 schema (top-level type must be `"object"`; supports object, string, number, boolean, array, and enum)
616
687
  - `configurationKeyName` (optional): Key name for configuration
617
- - `limit` (optional): Number of results to return. Defaults to `1`.
688
+ - `synthesisHistoryLimit` (optional): How many recent stored synthesis outputs to expose in the final data event's `synthesisHistory` field. Defaults to `0` (no history emitted). When `> 0`, the final event includes a `synthesisHistory` array of up to N `data` payloads (most-recent first; first entry is the current synthesis itself).
618
689
  - `searchOptionsOverrides` (optional): Per-request overrides, e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback.
619
690
  - `options` (optional): `{ onStreamingData?: (index: number, data: unknown) => void }` — if provided, `onStreamingData` is called for each data event with `complete: false`, with the item's index and streaming data
620
691
 
@@ -626,7 +697,7 @@ client.user.synthesize(
626
697
 
627
698
  - `{ type: "connected" }`: Connection established
628
699
  - `{ type: "complete" }`: Stream complete
629
- - `{ index, data?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `error` is set on failure.
700
+ - `{ index, data?, synthesisHistory?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `synthesisHistory` (only on the final event, only when `synthesisHistoryLimit > 0`) is an array of recent stored `data` payloads, most-recent first. `error` is set on failure.
630
701
 
631
702
  ##### Example
632
703
 
@@ -995,13 +1066,13 @@ type SignalResponse = {
995
1066
 
996
1067
  #### SynthesizeRequest
997
1068
 
998
- Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, optional `limit` (defaults to `1`), and optional `searchOptionsOverrides`.
1069
+ Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `inputs`, `output`, optional `configurationKeyName`, optional `synthesisHistoryLimit` (defaults to `0`), and optional `searchOptionsOverrides`.
999
1070
 
1000
1071
  ```typescript
1001
1072
  type SynthesizeRequest = {
1002
1073
  items: Array<{
1003
1074
  configurationKeyName?: string;
1004
- limit?: number; // number of results to return; defaults to 1
1075
+ synthesisHistoryLimit?: number; // how many recent stored outputs to include in synthesisHistory; defaults to 0 (no history emitted)
1005
1076
  searchOptionsOverrides?: { lookbackMinutes?: number };
1006
1077
  inputs?: Array<{ type: 'externalId' | 'text' | 'excludeExternalIds'; value: string }>;
1007
1078
  output: {
@@ -1027,10 +1098,10 @@ Stream events (SSE). Connection events use `type`; data events use `index`, opti
1027
1098
  type SynthesizeEvent =
1028
1099
  | { type: 'connected' }
1029
1100
  | { type: 'complete' }
1030
- | { index: number; data?: unknown; complete: boolean; error?: string };
1101
+ | { index: number; data?: unknown; synthesisHistory?: unknown[]; complete: boolean; error?: string };
1031
1102
  ```
1032
1103
 
1033
- When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). `error` is set on failure.
1104
+ When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). When the request set `synthesisHistoryLimit > 0`, the final event also includes `synthesisHistory`: an array of recent stored `data` payloads (most-recent first; first entry is the current synthesis itself — identical to `data` unless user reranking is configured server-side). `error` is set on failure.
1034
1105
 
1035
1106
  #### SynthesizeItemResponse
1036
1107
 
@@ -1038,8 +1109,9 @@ Return type of `synthesizeItem`. Same shape as a data event payload (without `in
1038
1109
 
1039
1110
  ```typescript
1040
1111
  type SynthesizeItemResponse = {
1041
- data?: unknown; // synthesized object when present
1042
- error?: string; // set on failure
1112
+ data?: unknown; // synthesized object when present
1113
+ synthesisHistory?: unknown[]; // recent stored outputs when synthesisHistoryLimit > 0; most-recent first
1114
+ error?: string; // set on failure
1043
1115
  };
1044
1116
  ```
1045
1117