@veltdev/sdk-staging 5.0.2-beta.7 → 5.0.2-beta.71

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 (45) hide show
  1. package/app/client/snippyly.model.d.ts +21 -2
  2. package/app/models/data/activity-resolver.data.model.d.ts +27 -0
  3. package/app/models/data/activity.data.model.d.ts +179 -0
  4. package/app/models/data/attachment-resolver.data.model.d.ts +2 -2
  5. package/app/models/data/attachment.model.d.ts +1 -0
  6. package/app/models/data/autocomplete.data.model.d.ts +4 -3
  7. package/app/models/data/base-metadata.data.model.d.ts +3 -0
  8. package/app/models/data/comment-actions.data.model.d.ts +4 -0
  9. package/app/models/data/comment-annotation.data.model.d.ts +18 -2
  10. package/app/models/data/comment-events.data.model.d.ts +11 -2
  11. package/app/models/data/comment-resolver.data.model.d.ts +3 -3
  12. package/app/models/data/comment-sidebar-config.model.d.ts +2 -0
  13. package/app/models/data/config.data.model.d.ts +26 -0
  14. package/app/models/data/core-events.data.model.d.ts +74 -1
  15. package/app/models/data/crdt.data.model.d.ts +51 -0
  16. package/app/models/data/document-paths.data.model.d.ts +1 -0
  17. package/app/models/data/document.data.model.d.ts +2 -0
  18. package/app/models/data/live-state-events.data.model.d.ts +6 -0
  19. package/app/models/data/notification-resolver.data.model.d.ts +39 -0
  20. package/app/models/data/notification.model.d.ts +4 -0
  21. package/app/models/data/presence-user.data.model.d.ts +5 -0
  22. package/app/models/data/provider.data.model.d.ts +8 -1
  23. package/app/models/data/reaction-resolver.data.model.d.ts +3 -3
  24. package/app/models/data/recorder-annotation.data.model.d.ts +11 -0
  25. package/app/models/data/recorder-events.data.model.d.ts +3 -0
  26. package/app/models/data/recorder-resolver.data.model.d.ts +58 -0
  27. package/app/models/data/resolver.data.model.d.ts +1 -0
  28. package/app/models/data/rewriter-events.data.model.d.ts +44 -0
  29. package/app/models/data/suggestion-events.data.model.d.ts +57 -0
  30. package/app/models/data/suggestion.data.model.d.ts +267 -0
  31. package/app/models/data/user-resolver.data.model.d.ts +17 -1
  32. package/app/models/data/user.data.model.d.ts +3 -0
  33. package/app/models/element/activity-element.model.d.ts +33 -0
  34. package/app/models/element/comment-element.model.d.ts +48 -8
  35. package/app/models/element/crdt-element.model.d.ts +88 -1
  36. package/app/models/element/presence-element.model.d.ts +25 -0
  37. package/app/models/element/rewriter-element.model.d.ts +20 -0
  38. package/app/models/element/suggestion-element.model.d.ts +180 -0
  39. package/app/utils/constants.d.ts +224 -0
  40. package/app/utils/enums.d.ts +36 -3
  41. package/models.d.ts +7 -0
  42. package/package.json +1 -1
  43. package/types.d.ts +2 -0
  44. package/velt.css +1 -1
  45. package/velt.js +131 -143
@@ -0,0 +1,33 @@
1
+ // @ts-nocheck
2
+ import { Observable } from "rxjs";
3
+ import { ActivityRecord, ActivitySubscribeConfig, CreateActivityData } from "../data/activity.data.model";
4
+
5
+ export declare class ActivityElement {
6
+
7
+ /**
8
+ * Subscribe to activities with optional filtering configuration.
9
+ * Returns an Observable that, when unsubscribed, automatically cleans up the internal subscription.
10
+ * @param config Optional configuration to filter activities by scope, feature types, action types, etc.
11
+ * @returns Observable<ActivityRecord[] | null>
12
+ */
13
+ getAllActivities: (config?: ActivitySubscribeConfig) => Observable<ActivityRecord[] | null>;
14
+
15
+ /**
16
+ * Create a new activity record.
17
+ * @param data The activity data including feature type, action type, target entity, etc.
18
+ * @returns Promise<void>
19
+ */
20
+ createActivity: (data: CreateActivityData) => Promise<void>;
21
+
22
+ constructor();
23
+
24
+ /**
25
+ * Subscribe to activities with optional filtering configuration.
26
+ */
27
+ private _getAllActivities;
28
+
29
+ /**
30
+ * Create a new activity record.
31
+ */
32
+ private _createActivity;
33
+ }
@@ -291,14 +291,14 @@ export declare class CommentElement {
291
291
  public disableStatus: () => any;
292
292
 
293
293
  /**
294
- * To enable visibility option dropdown on comments
294
+ * To enable visibility options on comments
295
295
  */
296
- public enableVisibilityOptionDropdown: () => any;
296
+ public enableVisibilityOptions: () => any;
297
297
 
298
298
  /**
299
- * To disable visibility option dropdown on comments
299
+ * To disable visibility options on comments
300
300
  */
301
- public disableVisibilityOptionDropdown: () => any;
301
+ public disableVisibilityOptions: () => any;
302
302
 
303
303
  /**
304
304
  * To enable feature to show resolve button
@@ -503,6 +503,16 @@ export declare class CommentElement {
503
503
  */
504
504
  public disableReactions: () => void;
505
505
 
506
+ /**
507
+ * To enable anonymous email mentions in comments
508
+ */
509
+ public enableAnonymousEmail: () => void;
510
+
511
+ /**
512
+ * To disable anonymous email mentions in comments
513
+ */
514
+ public disableAnonymousEmail: () => void;
515
+
506
516
  /**
507
517
  * To set allowed recordings in comments
508
518
  * @param allowedRecordings "all", "none" or "audio", "video", "screen"
@@ -1385,6 +1395,16 @@ export declare class CommentElement {
1385
1395
  */
1386
1396
  public getComposerData: (request: GetComposerDataRequest) => ComposerTextChangeEvent | null;
1387
1397
 
1398
+ /**
1399
+ * To enable pin drag
1400
+ */
1401
+ public enablePinDrag: () => void;
1402
+
1403
+ /**
1404
+ * To disable pin drag
1405
+ */
1406
+ public disablePinDrag: () => void;
1407
+
1388
1408
  constructor();
1389
1409
  /**
1390
1410
  * Subscribe to comments on the current document.
@@ -1626,14 +1646,14 @@ export declare class CommentElement {
1626
1646
  private _disableStatus;
1627
1647
 
1628
1648
  /**
1629
- * To enable visibility option dropdown on comments
1649
+ * To enable visibility options on comments
1630
1650
  */
1631
- private _enableVisibilityOptionDropdown;
1651
+ private _enableVisibilityOptions;
1632
1652
 
1633
1653
  /**
1634
- * To disable visibility option dropdown on comments
1654
+ * To disable visibility options on comments
1635
1655
  */
1636
- private _disableVisibilityOptionDropdown;
1656
+ private _disableVisibilityOptions;
1637
1657
 
1638
1658
  /**
1639
1659
  * To enable feature to show resolve button
@@ -1834,6 +1854,16 @@ export declare class CommentElement {
1834
1854
  */
1835
1855
  private _disableReactions;
1836
1856
 
1857
+ /**
1858
+ * To enable anonymous email mentions in comments
1859
+ */
1860
+ private _enableAnonymousEmail;
1861
+
1862
+ /**
1863
+ * To disable anonymous email mentions in comments
1864
+ */
1865
+ private _disableAnonymousEmail;
1866
+
1837
1867
  /**
1838
1868
  * To set allowed recordings in comments
1839
1869
  * @param allowedRecordings "all", "none" or "audio", "video", "screen"
@@ -2741,4 +2771,14 @@ export declare class CommentElement {
2741
2771
  * @param type 'dropdown' | 'checkbox'
2742
2772
  */
2743
2773
  private _setAssignToType;
2774
+
2775
+ /**
2776
+ * To enable pin drag
2777
+ */
2778
+ private _enablePinDrag;
2779
+
2780
+ /**
2781
+ * To disable pin drag
2782
+ */
2783
+ private _disablePinDrag;
2744
2784
  }
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import { CrdtGetDataQuery, CrdtGetVersionQuery, CrdtOnDataChangeQuery, CrdtOnPresenceChangeQuery, CrdtOnRegisteredUserChangeQuery, CrdtOnStateChangeQuery, CrdtRegisterSyncUserQuery, CrdtSetPresenceQuery, CrdtSaveVersionQuery, CrdtUpdateDataQuery, CrdtUpdateStateQuery } from "../data/crdt.data.model";
2
+ import { CrdtGetDataQuery, CrdtGetMessagesQuery, CrdtGetSnapshotQuery, CrdtGetVersionQuery, CrdtGetVersionsQuery, CrdtMessageData, CrdtOnDataChangeQuery, CrdtOnMessageQuery, CrdtOnPresenceChangeQuery, CrdtOnRegisteredUserChangeQuery, CrdtOnStateChangeQuery, CrdtPruneMessagesQuery, CrdtPushMessageQuery, CrdtRegisterSyncUserQuery, CrdtSaveSnapshotQuery, CrdtSetPresenceQuery, CrdtSaveVersionQuery, CrdtSnapshotData, CrdtUpdateDataQuery, CrdtUpdateStateQuery } from "../data/crdt.data.model";
3
3
  import { CrdtEventTypesMap } from "../data/crdt-events.data.model";
4
4
 
5
5
  export declare class CrdtElement {
@@ -80,6 +80,12 @@ export declare class CrdtElement {
80
80
  */
81
81
  getVersion: (getVersionQuery: CrdtGetVersionQuery) => Promise<any>;
82
82
 
83
+ /**
84
+ * Get all versions of a specific CRDT document
85
+ * @param id Document ID
86
+ */
87
+ getVersions: (getVersionsQuery: CrdtGetVersionsQuery) => Promise<any>;
88
+
83
89
  /**
84
90
  * Enable webhook
85
91
  */
@@ -96,6 +102,51 @@ export declare class CrdtElement {
96
102
  */
97
103
  setWebhookDebounceTime: (time: number) => void;
98
104
 
105
+ /**
106
+ * Push a lib0-encoded message to the unified message stream.
107
+ * Uses Firebase push() for chronologically-ordered keys.
108
+ * Carries both sync (type 0) and awareness (type 1) messages.
109
+ * @param pushMessageQuery - contains id, data (encoded bytes), yjsClientId (Y.Doc client ID), optional messageType and eventData
110
+ */
111
+ pushMessage: (pushMessageQuery: CrdtPushMessageQuery) => Promise<void>;
112
+ /**
113
+ * Subscribe to the unified message stream for real-time sync.
114
+ * Emits each new message individually as it arrives (streaming pattern).
115
+ * Returns an unsubscribe function.
116
+ * @param onMessageQuery - contains id, callback, and optional afterTs for filtering
117
+ */
118
+ onMessage: (onMessageQuery: CrdtOnMessageQuery) => () => void;
119
+ /**
120
+ * Fetch all messages after a given timestamp (one-time read).
121
+ * Used for message replay during initial load (y-redis pattern).
122
+ * @param getMessagesQuery - contains id and optional afterTs
123
+ */
124
+ getMessages: (getMessagesQuery: CrdtGetMessagesQuery) => Promise<CrdtMessageData[]>;
125
+ /**
126
+ * Get the latest full-state snapshot for a document.
127
+ * Used as the baseline for message replay during initial load.
128
+ * @param getSnapshotQuery - contains id
129
+ */
130
+ getSnapshot: (getSnapshotQuery: CrdtGetSnapshotQuery) => Promise<CrdtSnapshotData | null>;
131
+ /**
132
+ * Save a full-state snapshot (state + vector) for fast initial load.
133
+ * Called periodically to create checkpoints, enabling message pruning.
134
+ * @param saveSnapshotQuery - contains id, state (Y.Doc update), and vector (state vector)
135
+ */
136
+ saveSnapshot: (saveSnapshotQuery: CrdtSaveSnapshotQuery) => Promise<void>;
137
+ /**
138
+ * Remove messages older than the given timestamp from the message stream.
139
+ * Called after saving a snapshot to keep the message stream bounded.
140
+ * @param pruneMessagesQuery - contains id and beforeTs
141
+ */
142
+ pruneMessages: (pruneMessagesQuery: CrdtPruneMessagesQuery) => Promise<void>;
143
+
144
+ /**
145
+ * To set activity debounce time for batching CRDT edits (Default value is 10 minutes)
146
+ * @param time debounce time in milliseconds (minimum: 10 seconds)
147
+ */
148
+ setActivityDebounceTime: (time: number) => void;
149
+
99
150
  /**
100
151
  * Subscribe to crdt actions
101
152
  * @param action Action to subscribe to
@@ -188,6 +239,36 @@ export declare class CrdtElement {
188
239
  */
189
240
  private _getVersions;
190
241
 
242
+ /**
243
+ * Push a message to the unified message stream
244
+ */
245
+ private _pushMessage;
246
+
247
+ /**
248
+ * Subscribe to the unified message stream
249
+ */
250
+ private _onMessage;
251
+
252
+ /**
253
+ * Fetch all messages after a given timestamp
254
+ */
255
+ private _getMessages;
256
+
257
+ /**
258
+ * Get the latest snapshot for a document
259
+ */
260
+ private _getSnapshot;
261
+
262
+ /**
263
+ * Save a full-state snapshot
264
+ */
265
+ private _saveSnapshot;
266
+
267
+ /**
268
+ * Remove messages older than a given timestamp
269
+ */
270
+ private _pruneMessages;
271
+
191
272
  /**
192
273
  * Enable webhook
193
274
  */
@@ -204,6 +285,12 @@ export declare class CrdtElement {
204
285
  */
205
286
  private _setWebhookDebounceTime;
206
287
 
288
+ /**
289
+ * Set activity debounce time for batching CRDT edits
290
+ * @param time debounce time in milliseconds (minimum: 10 seconds)
291
+ */
292
+ private _setActivityDebounceTime;
293
+
207
294
  /**
208
295
  * Subscribe to crdt actions
209
296
  * @param action Action to subscribe to
@@ -50,6 +50,21 @@ export declare class PresenceElement {
50
50
  * Subscribe to presence events
51
51
  */
52
52
  on: <T extends keyof PresenceEventTypesMap>(action: T) => Observable<PresenceEventTypesMap[T]>;
53
+
54
+ /**
55
+ * Add a custom user to the presence list (e.g., an AI agent).
56
+ * The user will appear in presence alongside real users.
57
+ * @param request Object containing user data with at least userId required.
58
+ */
59
+ addUser: (request: { user: Partial<PresenceUser>, localOnly?: boolean }) => void;
60
+
61
+ /**
62
+ * Remove a previously added custom user from the presence list.
63
+ * @param request Object containing user data with at least userId required, and optional localOnly flag.
64
+ * @param request.localOnly If true, user is only removed locally (not removed from DB). Default: false.
65
+ */
66
+ removeUser: (request: { user: Partial<PresenceUser>, localOnly?: boolean }) => void;
67
+
53
68
  constructor();
54
69
  /**
55
70
  * Subscribe to a list of all online users who are either active or inactive on the current document.
@@ -95,4 +110,14 @@ export declare class PresenceElement {
95
110
  * Subscribe to presence events
96
111
  */
97
112
  private _on;
113
+
114
+ /**
115
+ * Add a custom user to the presence list
116
+ */
117
+ private _addUser;
118
+
119
+ /**
120
+ * Remove a custom user from the presence list
121
+ */
122
+ private _removeUser;
98
123
  }
@@ -9,6 +9,16 @@ export declare class RewriterElement {
9
9
  * To disable rewriter feature
10
10
  */
11
11
  disableRewriter: () => void;
12
+
13
+ /**
14
+ * To enable the default rewriter UI on text selection
15
+ */
16
+ enableDefaultUI: () => void;
17
+
18
+ /**
19
+ * To disable the default rewriter UI on text selection
20
+ */
21
+ disableDefaultUI: () => void;
12
22
  constructor();
13
23
 
14
24
  /**
@@ -20,4 +30,14 @@ export declare class RewriterElement {
20
30
  * To disable rewriter feature
21
31
  */
22
32
  private _disableRewriter;
33
+
34
+ /**
35
+ * To enable the default rewriter UI on text selection
36
+ */
37
+ private _enableDefaultUI;
38
+
39
+ /**
40
+ * To disable the default rewriter UI on text selection
41
+ */
42
+ private _disableDefaultUI;
23
43
  }
@@ -0,0 +1,180 @@
1
+ // @ts-nocheck
2
+ import { Observable } from "rxjs";
3
+ import { SuggestionEventType } from "../../utils/enums";
4
+ import { SuggestionEventTypesMap } from "../data/suggestion-events.data.model";
5
+ import { CommitSuggestionConfig, EnableSuggestionModeConfig, RegisterTargetConfig, Suggestion, SuggestionGetSuggestionsFilter } from "../data/suggestion.data.model";
6
+
7
+ export declare class SuggestionElement {
8
+
9
+ /**
10
+ * Turn on suggestion mode for this user/session and (optionally) register
11
+ * the onTargetEditStart / onTargetEditCommit callbacks the SDK invokes
12
+ * during the auto-detect edit lifecycle.
13
+ *
14
+ * Re-calling with a new config replaces the previous callbacks.
15
+ */
16
+ enableSuggestionMode: (config?: EnableSuggestionModeConfig) => void;
17
+
18
+ /**
19
+ * Turn off suggestion mode and clear any registered callbacks.
20
+ */
21
+ disableSuggestionMode: () => void;
22
+
23
+ /**
24
+ * Synchronous read of the current enable flag.
25
+ */
26
+ isSuggestionModeEnabled: () => boolean;
27
+
28
+ /**
29
+ * Reactive enable-flag stream; deduplicated.
30
+ */
31
+ isSuggestionModeEnabled$: () => Observable<boolean>;
32
+
33
+ /**
34
+ * Register a getter that returns the current value of a tagged target.
35
+ * Required for non-primitive (wrapper) targets — the SDK calls this on
36
+ * focus to snapshot the pre-edit value, and again on commit for the diff.
37
+ *
38
+ * The getter must reflect edit-time state (typically read from the DOM),
39
+ * not the persisted customer state. See `RegisterTargetConfig`.
40
+ */
41
+ registerTarget: <T = unknown>(config: RegisterTargetConfig<T>) => void;
42
+
43
+ /**
44
+ * Drop the registered getter for a target.
45
+ */
46
+ unregisterTarget: (targetId: string) => void;
47
+
48
+ /**
49
+ * Manually capture the current value as the snapshot for a target.
50
+ * Use for non-focusable elements (custom widgets, virtualized rows)
51
+ * where the auto-focus snapshot does not fire.
52
+ */
53
+ startSuggestion: (targetId: string) => void;
54
+
55
+ /**
56
+ * Programmatically commit a suggestion. Resolves with the new annotation id.
57
+ * Rejects with one of: INVALID_CONFIG, MODE_NOT_SUGGESTING,
58
+ * TARGET_NOT_REGISTERED, NO_GETTER_FOR_COMPLEX, NO_CHANGE_TO_SUGGEST,
59
+ * SNAPSHOT_FAILED.
60
+ */
61
+ commitSuggestion: <T = unknown>(config: CommitSuggestionConfig<T>) => Promise<{ id: string }>;
62
+
63
+ /**
64
+ * Synchronous read of all suggestions on the current document, optionally filtered.
65
+ */
66
+ getSuggestions: (filter?: SuggestionGetSuggestionsFilter) => Suggestion[];
67
+
68
+ /**
69
+ * Reactive variant of getSuggestions. Re-emits on every annotation change,
70
+ * deduplicated via the SDK's standard distinct-until-changed comparator.
71
+ */
72
+ getSuggestions$: (filter?: SuggestionGetSuggestionsFilter) => Observable<Suggestion[]>;
73
+
74
+ /**
75
+ * Newest pending suggestion for a target, or null. Convenience for
76
+ * pending-overlay UX patterns where each input shows the proposed
77
+ * value while a suggestion is awaiting resolution.
78
+ */
79
+ getPendingSuggestion: <T = unknown>(targetId: string) => Suggestion<T> | null;
80
+
81
+ /**
82
+ * Reactive variant of getPendingSuggestion.
83
+ */
84
+ getPendingSuggestion$: <T = unknown>(targetId: string) => Observable<Suggestion<T> | null>;
85
+
86
+ /**
87
+ * Subscribe to a suggestion event. Customers call `.subscribe(handler)`
88
+ * on the returned Observable. Event names: 'suggestionCreated',
89
+ * 'suggestionApproved', 'suggestionRejected', 'suggestionStale',
90
+ * 'targetEditStart', 'targetEditCommit'.
91
+ */
92
+ on: <T extends SuggestionEventType>(action: T) => Observable<SuggestionEventTypesMap[T]>;
93
+
94
+ constructor();
95
+
96
+ /**
97
+ * Turn on suggestion mode for this user/session and (optionally) register
98
+ * the onTargetEditStart / onTargetEditCommit callbacks the SDK invokes
99
+ * during the auto-detect edit lifecycle.
100
+ *
101
+ * Re-calling with a new config replaces the previous callbacks.
102
+ */
103
+ private _enableSuggestionMode;
104
+
105
+ /**
106
+ * Turn off suggestion mode and clear any registered callbacks.
107
+ */
108
+ private _disableSuggestionMode;
109
+
110
+ /**
111
+ * Synchronous read of the current enable flag.
112
+ */
113
+ private _isSuggestionModeEnabled;
114
+
115
+ /**
116
+ * Reactive enable-flag stream; deduplicated.
117
+ */
118
+ private _isSuggestionModeEnabled$;
119
+
120
+ /**
121
+ * Register a getter that returns the current value of a tagged target.
122
+ * Required for non-primitive (wrapper) targets — the SDK calls this on
123
+ * focus to snapshot the pre-edit value, and again on commit for the diff.
124
+ *
125
+ * The getter must reflect edit-time state (typically read from the DOM),
126
+ * not the persisted customer state. See `RegisterTargetConfig`.
127
+ */
128
+ private _registerTarget;
129
+
130
+ /**
131
+ * Drop the registered getter for a target.
132
+ */
133
+ private _unregisterTarget;
134
+
135
+ /**
136
+ * Manually capture the current value as the snapshot for a target.
137
+ * Use for non-focusable elements (custom widgets, virtualized rows)
138
+ * where the auto-focus snapshot does not fire.
139
+ */
140
+ private _startSuggestion;
141
+
142
+ /**
143
+ * Programmatically commit a suggestion. Resolves with the new annotation id.
144
+ * Rejects with one of: INVALID_CONFIG, MODE_NOT_SUGGESTING,
145
+ * TARGET_NOT_REGISTERED, NO_GETTER_FOR_COMPLEX, NO_CHANGE_TO_SUGGEST,
146
+ * SNAPSHOT_FAILED.
147
+ */
148
+ private _commitSuggestion;
149
+
150
+ /**
151
+ * Synchronous read of all suggestions on the current document, optionally filtered.
152
+ */
153
+ private _getSuggestions;
154
+
155
+ /**
156
+ * Reactive variant of getSuggestions. Re-emits on every annotation change,
157
+ * deduplicated via the SDK's standard distinct-until-changed comparator.
158
+ */
159
+ private _getSuggestions$;
160
+
161
+ /**
162
+ * Newest pending suggestion for a target, or null. Convenience for
163
+ * pending-overlay UX patterns where each input shows the proposed
164
+ * value while a suggestion is awaiting resolution.
165
+ */
166
+ private _getPendingSuggestion;
167
+
168
+ /**
169
+ * Reactive variant of getPendingSuggestion.
170
+ */
171
+ private _getPendingSuggestion$;
172
+
173
+ /**
174
+ * Subscribe to a suggestion event. Customers call `.subscribe(handler)`
175
+ * on the returned Observable. Event names: 'suggestionCreated',
176
+ * 'suggestionApproved', 'suggestionRejected', 'suggestionStale',
177
+ * 'targetEditStart', 'targetEditCommit'.
178
+ */
179
+ private _on;
180
+ }