@veltdev/sdk-staging 5.0.2-beta.8 → 5.0.2-beta.80

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 (48) 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 +181 -0
  4. package/app/models/data/agent-suggestion.data.model.d.ts +57 -0
  5. package/app/models/data/attachment-resolver.data.model.d.ts +2 -2
  6. package/app/models/data/attachment.model.d.ts +1 -0
  7. package/app/models/data/autocomplete.data.model.d.ts +4 -3
  8. package/app/models/data/base-metadata.data.model.d.ts +3 -0
  9. package/app/models/data/comment-actions.data.model.d.ts +14 -0
  10. package/app/models/data/comment-annotation.data.model.d.ts +62 -2
  11. package/app/models/data/comment-events.data.model.d.ts +27 -2
  12. package/app/models/data/comment-resolver.data.model.d.ts +3 -3
  13. package/app/models/data/comment-sidebar-config.model.d.ts +2 -0
  14. package/app/models/data/config.data.model.d.ts +26 -0
  15. package/app/models/data/core-events.data.model.d.ts +74 -1
  16. package/app/models/data/crdt.data.model.d.ts +51 -0
  17. package/app/models/data/document-paths.data.model.d.ts +1 -0
  18. package/app/models/data/document.data.model.d.ts +2 -0
  19. package/app/models/data/live-state-events.data.model.d.ts +6 -0
  20. package/app/models/data/notification-resolver.data.model.d.ts +39 -0
  21. package/app/models/data/notification.model.d.ts +4 -0
  22. package/app/models/data/presence-user.data.model.d.ts +5 -0
  23. package/app/models/data/provider.data.model.d.ts +8 -1
  24. package/app/models/data/reaction-resolver.data.model.d.ts +3 -3
  25. package/app/models/data/recorder-annotation.data.model.d.ts +11 -0
  26. package/app/models/data/recorder-events.data.model.d.ts +3 -0
  27. package/app/models/data/recorder-resolver.data.model.d.ts +58 -0
  28. package/app/models/data/resolver.data.model.d.ts +1 -0
  29. package/app/models/data/rewriter-events.data.model.d.ts +44 -0
  30. package/app/models/data/suggestion-events.data.model.d.ts +57 -0
  31. package/app/models/data/suggestion.data.model.d.ts +267 -0
  32. package/app/models/data/user-resolver.data.model.d.ts +17 -1
  33. package/app/models/data/user.data.model.d.ts +3 -0
  34. package/app/models/element/activity-element.model.d.ts +33 -0
  35. package/app/models/element/comment-element.model.d.ts +48 -8
  36. package/app/models/element/crdt-element.model.d.ts +88 -1
  37. package/app/models/element/cross-organization-config.model.d.ts +17 -0
  38. package/app/models/element/notification-element.model.d.ts +15 -0
  39. package/app/models/element/presence-element.model.d.ts +25 -0
  40. package/app/models/element/rewriter-element.model.d.ts +20 -0
  41. package/app/models/element/suggestion-element.model.d.ts +180 -0
  42. package/app/utils/constants.d.ts +226 -0
  43. package/app/utils/enums.d.ts +41 -4
  44. package/models.d.ts +8 -0
  45. package/package.json +1 -1
  46. package/types.d.ts +3 -0
  47. package/velt.css +1 -1
  48. package/velt.js +132 -143
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Suggestions feature — public type surface for v1.
3
+ *
4
+ * Source contract: docs/suggestions-api-contract.md
5
+ * Source flows: docs/suggestions-implementation-flows.md
6
+ *
7
+ * Types are exported from the SDK's public barrel. Customer code interacts
8
+ * with these via Snippyly.getSuggestionElement(); the SDK constructs all
9
+ * Suggestion objects internally and customers do not build them directly.
10
+ */
11
+ import { User } from './user.data.model';
12
+ /**
13
+ * Lifecycle state machine for a Suggestion.
14
+ *
15
+ * - pending: Just created, awaiting owner action.
16
+ * - approved: Owner clicked Approve. Customer apply handler ran successfully.
17
+ * - rejected: Owner clicked Reject (with optional reason).
18
+ * - stale: Target was unresolvable at approve time. Owner can dismiss.
19
+ * - apply_failed: Customer apply handler threw during a suggestionApproved event.
20
+ * Status set by the SDK after the throw was caught.
21
+ */
22
+ export type SuggestionStatus = 'pending' | 'accepted' | 'rejected' | 'stale' | 'apply_failed';
23
+ /**
24
+ * Global per-user-per-session suggestion mode. Not persisted; reload returns to 'editing'.
25
+ */
26
+ export type SuggestionMode = 'editing' | 'suggesting';
27
+ /**
28
+ * Discriminator for the substrate that produced a suggestion. v1: always 'custom'.
29
+ * Wrapper libraries (e.g. tiptap-velt-comments) widen this union when they integrate.
30
+ *
31
+ * Customers should treat unknown values as opaque; the field exists so customer code
32
+ * can differentiate substrate when domain-specific rendering matters.
33
+ */
34
+ export type SuggestionTargetType = 'custom';
35
+ /**
36
+ * Single-arg config passed to `SuggestionElement.registerTarget(config)`.
37
+ * Carrying both `targetId` and `getter` in one object so the API can grow
38
+ * (e.g., metadata, target-specific options) without breaking customers.
39
+ */
40
+ export interface RegisterTargetConfig<T = unknown> {
41
+ targetId: string;
42
+ getter: TargetGetter<T>;
43
+ }
44
+ /**
45
+ * Function the customer registers via SuggestionElement.registerTarget(config).
46
+ * Required for any non-primitive (wrapper) target.
47
+ *
48
+ * The SDK calls this getter twice in a typical edit cycle:
49
+ * 1. On focus of the tagged element — to snapshot the pre-edit value.
50
+ * 2. On commit (focusout / change) — to read the current value for the diff.
51
+ *
52
+ * IMPORTANT — edit-time state, not persisted state: the getter must reflect
53
+ * what the user is currently editing, not what's persisted in the customer's
54
+ * app store. If the customer's state is only updated on commit/approve (as
55
+ * is typical when suggesting mode is on), reading from that state would
56
+ * return the snapshot value at commit time, the diff check would short-
57
+ * circuit, and no suggestion would ever fire.
58
+ *
59
+ * Recommended: read from the DOM (controlled or uncontrolled inputs) so the
60
+ * getter always returns what's visible to the user.
61
+ *
62
+ * el.registerTarget('row.123', () => ({
63
+ * qty: parseInt(qtyInput.value, 10),
64
+ * price: parseInt(priceInput.value, 10),
65
+ * }));
66
+ *
67
+ * For controlled inputs (state updates on every keystroke), reading from
68
+ * the customer state is fine: `() => myState.row123`. The contract is
69
+ * "edit-time state" — whichever source of truth has it.
70
+ */
71
+ export type TargetGetter<T = unknown> = () => T;
72
+ /**
73
+ * Returned from SuggestionElement.on(...). Calling it removes the handler.
74
+ */
75
+ export type Unsubscribe = () => void;
76
+ /**
77
+ * Details about a target edit, passed to the customer's resolver handler and
78
+ * to subscribers of `targetEditStart` / `targetEditCommit` events.
79
+ *
80
+ * `element` is the DOM element that produced the edit. It's the tagged
81
+ * descendant — or, for wrappers that nest interactive controls inside a
82
+ * tagged container, the inner element that actually fired the event. In
83
+ * either case the SDK walks up to the nearest ancestor carrying
84
+ * `data-velt-suggestion-target` to resolve `targetId`.
85
+ *
86
+ * `element` is provided for read access only — customers should not retain
87
+ * the reference past the synchronous handler call.
88
+ */
89
+ export interface TargetEditDetails<T = unknown> {
90
+ targetId: string;
91
+ oldValue: T;
92
+ newValue: T;
93
+ element: Element | null;
94
+ }
95
+ /**
96
+ * Return type of `onTargetEditCommit`. Returning a value auto-commits the
97
+ * suggestion using the (optional) overrides; returning null skips the
98
+ * auto-commit so a subscriber to `targetEditCommit` can drive it explicitly.
99
+ */
100
+ export interface TargetEditCommitResult {
101
+ /** Override the SDK's default `${targetId}: ${old} → ${new}` summary. */
102
+ summary?: string;
103
+ /** Customer metadata persisted on the resulting Suggestion. */
104
+ metadata?: Record<string, unknown>;
105
+ }
106
+ /**
107
+ * Return type of `onTargetEditStart`. Reserved for future fields; v1 has
108
+ * no behavior-bearing return values, so customers may omit a return.
109
+ *
110
+ * Roadmap: future versions may accept `{ oldValue }` here so customers can
111
+ * override the SDK's auto-snapshot with a domain-canonical value.
112
+ */
113
+ export interface TargetEditStartResult {
114
+ }
115
+ export type TargetEditStartHandler<T = unknown> = (details: TargetEditDetails<T>) => TargetEditStartResult | void | null;
116
+ export type TargetEditCommitHandler<T = unknown> = (details: TargetEditDetails<T>) => TargetEditCommitResult | null;
117
+ /**
118
+ * Config passed to `SuggestionElement.enableSuggestionMode(config?)`.
119
+ * Both callbacks are optional. If `onTargetEditCommit` is omitted, customers
120
+ * can still drive auto-commit by subscribing to the `targetEditCommit` event
121
+ * and calling the pre-bound `commitSuggestion` builder on the payload.
122
+ */
123
+ export interface EnableSuggestionModeConfig {
124
+ /**
125
+ * Invoked on focus of a tagged element, after the SDK captures the
126
+ * snapshot. v1: informational — return value is reserved for future
127
+ * use (e.g. `{ oldValue }` to override the SDK's auto-snapshot).
128
+ */
129
+ onTargetEditStart?: TargetEditStartHandler;
130
+ /**
131
+ * Invoked once per detected commit (on `change` for atomic inputs, on
132
+ * `focusout` for text-like inputs). Returning a `TargetEditCommitResult`
133
+ * auto-commits with the supplied summary/metadata; returning null defers
134
+ * to event subscribers.
135
+ */
136
+ onTargetEditCommit?: TargetEditCommitHandler;
137
+ }
138
+ /**
139
+ * SDK-managed suggestion data persisted on a CommentAnnotation.
140
+ * Present iff annotation.type === 'suggestion'.
141
+ *
142
+ * Customer code must not write to this directly — use the SuggestionElement API.
143
+ */
144
+ export interface SuggestionData {
145
+ /** Lifecycle state machine. */
146
+ status: SuggestionStatus;
147
+ /** Stable, customer-owned target identifier. */
148
+ targetId: string;
149
+ /** v1: always 'custom'. Wrappers widen later. */
150
+ targetType: SuggestionTargetType;
151
+ /** Snapshot taken at startSuggestion / focus time. Frozen via structuredClone. */
152
+ oldValue: any;
153
+ /** Value submitted via commitSuggestion. */
154
+ newValue: any;
155
+ /** Optional human-readable description for logs / notifications. */
156
+ summary: string | null;
157
+ /**
158
+ * True if the live value at approve time differed from oldValue.
159
+ * v1 records flag only; v1.1 will surface a confirmation prompt.
160
+ */
161
+ driftDetected: boolean;
162
+ /** Populated only when status === 'rejected'. */
163
+ rejectReason: string | null;
164
+ /**
165
+ * Full User snapshot of the resolver, populated when status moves to
166
+ * approved | rejected | stale | apply_failed. Snapshot rather than userId
167
+ * so customer code can render name/email/photoUrl without an extra lookup,
168
+ * and so historical suggestions retain their resolver record even if the
169
+ * user later updates their profile.
170
+ */
171
+ resolvedBy: User | null;
172
+ resolvedAt: number | null;
173
+ }
174
+ /**
175
+ * Fields shared across every Suggestion regardless of status.
176
+ * Internal — used to build the per-status discriminated types below.
177
+ */
178
+ interface SuggestionBase<T = unknown> {
179
+ /** Annotation document id (same as the underlying CommentAnnotation.annotationId). */
180
+ annotationId: string;
181
+ /** Stable, customer-owned target identifier. */
182
+ targetId: string;
183
+ /** v1: always 'custom'. */
184
+ targetType: SuggestionTargetType;
185
+ /** Snapshot taken at startSuggestion / focus time. */
186
+ oldValue: T;
187
+ /** Value submitted via commitSuggestion. */
188
+ newValue: T;
189
+ /** Optional human-readable description. */
190
+ summary: string | null;
191
+ /** Customer-defined metadata supplied via CommitSuggestionConfig.metadata. */
192
+ metadata: Record<string, any>;
193
+ /** True iff the live value at approve time differed from oldValue. */
194
+ driftDetected: boolean;
195
+ /**
196
+ * User of the suggestion's creator (sourced from annotation.from).
197
+ */
198
+ createdBy?: User;
199
+ createdAt: number;
200
+ }
201
+ /** A suggestion in the 'pending' state — newly created, no owner action yet. */
202
+ export interface PendingSuggestion<T = unknown> extends SuggestionBase<T> {
203
+ status: 'pending';
204
+ rejectReason: null;
205
+ resolvedBy: null;
206
+ resolvedAt: null;
207
+ }
208
+ /** A suggestion that has been approved (apply handler success or pending invocation). */
209
+ export interface ApprovedSuggestion<T = unknown> extends SuggestionBase<T> {
210
+ status: 'accepted' | 'apply_failed';
211
+ rejectReason: null;
212
+ resolvedBy: User;
213
+ resolvedAt: number;
214
+ }
215
+ /**
216
+ * A suggestion that has been rejected. `rejectReason` may be null when the
217
+ * rejecter dismissed without supplying a reason — matches the persisted
218
+ * `SuggestionData.rejectReason: string | null` shape.
219
+ */
220
+ export interface RejectedSuggestion<T = unknown> extends SuggestionBase<T> {
221
+ status: 'rejected';
222
+ rejectReason: string | null;
223
+ resolvedBy: User;
224
+ resolvedAt: number;
225
+ }
226
+ /** A suggestion whose target was unresolvable at approve time. */
227
+ export interface StaleSuggestion<T = unknown> extends SuggestionBase<T> {
228
+ status: 'stale';
229
+ rejectReason: null;
230
+ resolvedBy: User | null;
231
+ resolvedAt: number | null;
232
+ }
233
+ /**
234
+ * Public Suggestion — discriminated union keyed by `status`. TypeScript narrows
235
+ * field types per status (e.g. `resolvedBy: User` is non-null on approved/rejected,
236
+ * `rejectReason: string | null` on rejected since one-click reject without a reason
237
+ * is supported).
238
+ */
239
+ export type Suggestion<T = unknown> = PendingSuggestion<T> | ApprovedSuggestion<T> | RejectedSuggestion<T> | StaleSuggestion<T>;
240
+ export interface CommitSuggestionConfig<T = unknown> {
241
+ /**
242
+ * Must be registered (via data-velt-target attribute or registerTarget call)
243
+ * before commit, otherwise the suggestion is rejected with a dev-mode warning.
244
+ */
245
+ targetId: string;
246
+ /** Any JSON-serializable value. Customer's apply handler interprets it. */
247
+ newValue: T;
248
+ /** Optional human-readable string for logs and notifications. */
249
+ summary?: string;
250
+ /** Optional customer-defined metadata. Stored on Suggestion.metadata. */
251
+ metadata?: Record<string, unknown>;
252
+ }
253
+ /**
254
+ * Pre-bound builder attached to `targetEditCommit` payloads. Calling it
255
+ * commits the suggestion with the SDK's default summary/metadata, optionally
256
+ * overridden by `result`. If the customer's `onTargetEditCommit` handler
257
+ * already returned a non-null result for this edit, this builder is a no-op
258
+ * (resolves immediately) so subscribers can't double-commit.
259
+ */
260
+ export type TargetEditCommitBuilder = (result?: TargetEditCommitResult) => Promise<{
261
+ id: string;
262
+ } | null>;
263
+ export interface SuggestionGetSuggestionsFilter {
264
+ targetId?: string;
265
+ status?: SuggestionStatus | SuggestionStatus[];
266
+ }
267
+ export {};
@@ -1,10 +1,24 @@
1
- import { ResolverConfig } from "./resolver.data.model";
1
+ import { ResolverConfig, ResolverResponse, RetryConfig } from "./resolver.data.model";
2
2
  import { User } from "./user.data.model";
3
3
  export interface UserDataProvider {
4
4
  get(userIds: string[]): Promise<Record<string, User>>;
5
5
  config?: ResolverConfig;
6
6
  resolveTimeout?: number;
7
7
  }
8
+ export interface AnonymousUserDataProvider {
9
+ resolveUserIdsByEmail(request: ResolveUserIdsByEmailRequest): Promise<ResolverResponse<Record<string, string>>>;
10
+ config?: AnonymousUserDataProviderConfig;
11
+ }
12
+ export interface AnonymousUserDataProviderConfig {
13
+ resolveTimeout?: number;
14
+ getRetryConfig?: RetryConfig;
15
+ }
16
+ export interface ResolveUserIdsByEmailRequest {
17
+ organizationId: string;
18
+ documentId?: string;
19
+ folderId?: string;
20
+ emails: string[];
21
+ }
8
22
  export interface GetUserResolverRequest {
9
23
  organizationId: string;
10
24
  userIds: string[];
@@ -19,6 +33,7 @@ export interface GetUserPermissionsResponse {
19
33
  folders?: {
20
34
  [folderId: string]: {
21
35
  accessRole?: UserPermissionAccessRole;
36
+ accessType?: string;
22
37
  expiresAt?: number;
23
38
  error?: string;
24
39
  errorCode?: UserPermissionAccessRoleResult;
@@ -35,6 +50,7 @@ export interface GetUserPermissionsResponse {
35
50
  documents?: {
36
51
  [documentId: string]: {
37
52
  accessRole?: UserPermissionAccessRole;
53
+ accessType?: string;
38
54
  expiresAt?: number;
39
55
  error?: string;
40
56
  errorCode?: UserPermissionAccessRoleResult;
@@ -12,6 +12,8 @@ export declare class User {
12
12
  * Default: Random avatar name.
13
13
  */
14
14
  name?: string;
15
+ email_lowercase?: string;
16
+ name_lowercase?: string;
15
17
  clientUserName?: string;
16
18
  /**
17
19
  * Your user's display picture URL.
@@ -158,6 +160,7 @@ export interface PermissionQuery {
158
160
  source: PermissionSource;
159
161
  organizationId: string;
160
162
  context?: Context | SetDocumentsContext;
163
+ parentFolderId?: string;
161
164
  };
162
165
  }
163
166
  export interface PermissionResult {
@@ -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
@@ -0,0 +1,17 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Configuration for the opt-in cross-organization "For You" notifications feature.
5
+ */
6
+ export interface CrossOrganizationConfig {
7
+ /** Whether cross-organization notifications are active. Defaults to `true` on enable. */
8
+ enabled?: boolean;
9
+ /** Allowlist of organization IDs to include. When omitted, all indexed orgs are eligible. */
10
+ organizationIds?: string[];
11
+ /** Organization IDs to exclude. The current organization is always excluded. */
12
+ excludeOrganizationIds?: string[];
13
+ /** Upper bound on the number of organizations fetched. Defaults to 20. */
14
+ maxOrganizations?: number;
15
+ /** Feeds the merge applies to. Only `'forYou'` is supported; `'all'` is ignored with a warning. */
16
+ feeds?: ('forYou' | 'all')[];
17
+ }
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
 
3
3
  import { GetNotificationsDataQuery, Notification, NotificationInitialSettingsConfig, NotificationSettingsConfig, NotificationTabConfig } from "../data/notification.model";
4
+ import { CrossOrganizationConfig } from "./cross-organization-config.model";
4
5
 
5
6
  export declare class NotificationElement {
6
7
  /**
@@ -128,6 +129,16 @@ export declare class NotificationElement {
128
129
  */
129
130
  disableCurrentDocumentOnly: () => void;
130
131
 
132
+ /**
133
+ * Opt in to cross-organization "For You" notifications.
134
+ */
135
+ enableCrossOrganization: (config?: CrossOrganizationConfig | null) => void;
136
+
137
+ /**
138
+ * Opt out of cross-organization "For You" notifications.
139
+ */
140
+ disableCrossOrganization: () => void;
141
+
131
142
  constructor();
132
143
 
133
144
  /**
@@ -254,4 +265,8 @@ export declare class NotificationElement {
254
265
  * To disable current document only
255
266
  */
256
267
  private _disableCurrentDocumentOnly;
268
+
269
+ private _enableCrossOrganization;
270
+
271
+ private _disableCrossOrganization;
257
272
  }
@@ -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
  }