@veltdev/sdk 4.5.5 → 4.5.6-beta.10

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.
@@ -3,7 +3,7 @@ import { Observable } from "rxjs";
3
3
  import { Config, DisableLogsConfig } from "../models/data/config.data.model";
4
4
  import { DocumentUser } from "../models/data/document-user.data.model";
5
5
  import { Location } from "../models/data/location.model";
6
- import { User, UserOptions, VeltAuthProvider } from "../models/data/user.data.model";
6
+ import { User, UserOptions, VeltAuthProvider, VeltPermissionProvider } from "../models/data/user.data.model";
7
7
  import { CustomCss } from "../models/data/custom-css.data.model";
8
8
  import { AreaElement } from "../models/element/area-element.model";
9
9
  import { ArrowElement } from "../models/element/arrow-element.model";
@@ -100,6 +100,9 @@ export declare class Snippyly {
100
100
  * To set the data provider.
101
101
  */
102
102
  setDataProviders: (dataProvider: VeltDataProvider) => void;
103
+
104
+ setPermissionProvider: (permissionProvider: VeltPermissionProvider) => void;
105
+
103
106
  /**
104
107
  * To set the encryption provider.
105
108
  */
@@ -41,6 +41,14 @@ export declare class DocumentPaths {
41
41
  * Huddle path.
42
42
  */
43
43
  audioHuddle?: string;
44
+ /**
45
+ * Heartbeat path.
46
+ */
47
+ heartbeat?: string;
48
+ /**
49
+ * Heartbeat by document path.
50
+ */
51
+ heartbeatByDocument?: string;
44
52
  /**
45
53
  * Document Id provided by the user.
46
54
  */
@@ -0,0 +1,10 @@
1
+ import { BaseMetadata } from "./base-metadata.data.model";
2
+ export interface Heartbeat {
3
+ id: string;
4
+ createdTimestamp: number;
5
+ userId: string;
6
+ veltUserId: string;
7
+ tabId: string;
8
+ metadata: BaseMetadata;
9
+ lastUpdatedTimestamp: number;
10
+ }
@@ -11,11 +11,12 @@ export declare class LiveStateDataMap {
11
11
  */
12
12
  default?: {
13
13
  singleEditor?: SingleEditorLiveStateData;
14
- autoSyncState?: {
15
- current?: LiveStateData;
16
- history?: {
17
- [liveStateDataId: string]: LiveStateData;
18
- };
19
- };
14
+ autoSyncState?: LiveStateAutoSyncState;
15
+ };
16
+ }
17
+ export declare class LiveStateAutoSyncState {
18
+ current?: LiveStateData;
19
+ history?: {
20
+ [liveStateDataId: string]: LiveStateData;
20
21
  };
21
22
  }
@@ -90,3 +90,9 @@ export interface LiveStateSingleEditorExternalUserPresence {
90
90
  */
91
91
  userIds?: string[];
92
92
  }
93
+ export interface FetchLiveStateDataRequest {
94
+ /**
95
+ * Unique identifier to identify the state data you are syncing.
96
+ */
97
+ liveStateDataId?: string;
98
+ }
@@ -17,6 +17,7 @@ export interface ResolverResponse<T> {
17
17
  message?: string;
18
18
  timestamp?: number;
19
19
  statusCode: number;
20
+ signature?: string;
20
21
  }
21
22
  export interface RetryConfig {
22
23
  retryCount?: number;
@@ -1,4 +1,6 @@
1
+ import { ResolverResponse } from "./resolver.data.model";
1
2
  import { UserContact } from "./user-contact.data.model";
3
+ import { UserPermissionAccessRole } from "./user-resolver.data.model";
2
4
  export declare class User {
3
5
  /**
4
6
  * Unique user identifier that you use to identify your user.
@@ -109,3 +111,23 @@ export interface VeltAuthProvider {
109
111
  retryConfig?: AuthRetryConfig;
110
112
  generateToken?: () => Promise<string>;
111
113
  }
114
+ export interface VeltPermissionProvider {
115
+ onResourceAccessRequired: (requests: Array<PermissionQuery>) => Promise<ResolverResponse<PermissionResult[]>>;
116
+ retryConfig?: AuthRetryConfig;
117
+ forceRefresh?: boolean;
118
+ }
119
+ export interface PermissionQuery {
120
+ userId: string;
121
+ resource: {
122
+ id: string;
123
+ type: 'folder' | 'document' | 'organization';
124
+ };
125
+ }
126
+ export interface PermissionResult {
127
+ userId: string;
128
+ resourceId: string;
129
+ type: 'folder' | 'document' | 'organization';
130
+ accessRole?: UserPermissionAccessRole;
131
+ expiresAt?: number;
132
+ hasAccess: boolean;
133
+ }
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { ServerConnectionState } from '../../utils/enums';
3
- import { EditorAccessTimer, LiveStateDataConfig, LiveStateSingleEditorExternalUserPresence, SetLiveStateDataConfig, SetUserAsEditorResponse, SingleEditorConfig, UserEditorAccess } from '../data/live-state-data.data.model';
3
+ import { EditorAccessTimer, FetchLiveStateDataRequest, LiveStateDataConfig, LiveStateSingleEditorExternalUserPresence, SetLiveStateDataConfig, SetUserAsEditorResponse, SingleEditorConfig, UserEditorAccess } from '../data/live-state-data.data.model';
4
4
  import { LiveStateEventTypesMap } from '../data/live-state-events.data.model';
5
5
  import { User } from '../data/user.data.model';
6
6
 
@@ -20,6 +20,11 @@ export declare class LiveStateSyncElement {
20
20
  */
21
21
  getLiveStateData$: <T = unknown>(liveStateDataId?: string, liveStateDataConfig?: LiveStateDataConfig) => Observable<T>;
22
22
 
23
+ /**
24
+ * Fetches live state data.
25
+ */
26
+ fetchLiveStateData: <T = unknown>(request?: FetchLiveStateDataRequest) => Promise<T>;
27
+
23
28
  /**
24
29
  * Sets live state data for the provided ID and data.
25
30
  */
@@ -147,6 +152,16 @@ export declare class LiveStateSyncElement {
147
152
  */
148
153
  updateUserPresence: (userPresence: LiveStateSingleEditorExternalUserPresence) => void;
149
154
 
155
+ /**
156
+ * To enable heartbeat
157
+ */
158
+ enableHeartbeat: () => void;
159
+
160
+ /**
161
+ * To disable heartbeat
162
+ */
163
+ disableHeartbeat: () => void;
164
+
150
165
  /**
151
166
  * Subscribe to live state events
152
167
  */
@@ -168,6 +183,11 @@ export declare class LiveStateSyncElement {
168
183
  */
169
184
  private _getLiveStateData$;
170
185
 
186
+ /**
187
+ * Private method for fetching live state data.
188
+ */
189
+ private _fetchLiveStateData;
190
+
171
191
  /**
172
192
  * Private method for setting live state data.
173
193
  */
@@ -295,6 +315,16 @@ export declare class LiveStateSyncElement {
295
315
  */
296
316
  private _updateUserPresence;
297
317
 
318
+ /**
319
+ * To enable heartbeat
320
+ */
321
+ private _enableHeartbeat;
322
+
323
+ /**
324
+ * To disable heartbeat
325
+ */
326
+ private _disableHeartbeat;
327
+
298
328
  /**
299
329
  * Subscribe to live state events
300
330
  */
@@ -54,6 +54,8 @@ export declare class Constants {
54
54
  static FIREBASE_PARTIAL_PATH_NOTIFICATIONS: string;
55
55
  static FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS: string;
56
56
  static FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP: string;
57
+ static FIREBASE_PARTIAL_PATH_HEARTBEAT: string;
58
+ static FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT: string;
57
59
  static FIREBASE_PARTIAL_PATH_USERS: string;
58
60
  static FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS: string;
59
61
  static FIREBASE_PARTIAL_PATH_USER_REQUESTS: string;
package/models.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from './app/models/data/document-iam.data.model';
25
25
  export * from './app/models/data/document-metadata.model';
26
26
  export * from './app/models/data/document-paths.data.model';
27
27
  export * from './app/models/data/document-user.data.model';
28
+ export * from './app/models/data/heartbeat.data.model';
28
29
  export * from './app/models/data/huddle.model';
29
30
  export * from './app/models/data/live-state-data-map.data.model';
30
31
  export * from './app/models/data/live-state-data.data.model';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "4.5.5",
3
+ "version": "4.5.6-beta.10",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [