@svar-ui/gantt-data-provider 2.7.2 → 2.8.0
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.
- package/dist/index.js +504 -102
- package/dist/index.js.map +1 -1
- package/dist/types/EventStream.d.ts +31 -0
- package/dist/types/RemoteEvents.d.ts +45 -0
- package/dist/types/RestDataProvider.d.ts +4 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/uuid.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type MessageCallback = (message: string) => void;
|
|
2
|
+
export type ResyncCallback = () => void;
|
|
3
|
+
export type ConnectionCallback = (online: boolean) => void;
|
|
4
|
+
export type EventStreamConfig = {
|
|
5
|
+
url: string;
|
|
6
|
+
onMessage?: MessageCallback;
|
|
7
|
+
onResync?: ResyncCallback;
|
|
8
|
+
onConnectionChange?: ConnectionCallback;
|
|
9
|
+
params?: Record<string, string> | (() => Record<string, string>);
|
|
10
|
+
withCredentials?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export default class EventStream {
|
|
13
|
+
private config;
|
|
14
|
+
private eventSource;
|
|
15
|
+
private connectedSignal;
|
|
16
|
+
private wasOpen;
|
|
17
|
+
private hasMissedEvents;
|
|
18
|
+
private isOnline;
|
|
19
|
+
private rejectConnect;
|
|
20
|
+
private retryTimer;
|
|
21
|
+
private retryDelayMs;
|
|
22
|
+
private isStopped;
|
|
23
|
+
constructor(config: EventStreamConfig);
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
disconnect(): void;
|
|
26
|
+
private scheduleRetry;
|
|
27
|
+
private clearRetry;
|
|
28
|
+
private close;
|
|
29
|
+
private notify;
|
|
30
|
+
private getURL;
|
|
31
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IApi, ITask, TID } from "@svar-ui/gantt-store";
|
|
2
|
+
import { EventStreamConfig } from "./EventStream";
|
|
3
|
+
export type TRemoteEventType = "task" | "link" | "assignment";
|
|
4
|
+
export type TRemoteEventAction = "add" | "update" | "delete";
|
|
5
|
+
export type TRemoteEvent = {
|
|
6
|
+
type: TRemoteEventType;
|
|
7
|
+
action: TRemoteEventAction;
|
|
8
|
+
id: TID;
|
|
9
|
+
data?: unknown;
|
|
10
|
+
from?: string;
|
|
11
|
+
};
|
|
12
|
+
export interface IRemoteEventsProvider {
|
|
13
|
+
parseDates?: (tasks: ITask[]) => ITask[];
|
|
14
|
+
resolveId(id: TID, kind: number): TID;
|
|
15
|
+
}
|
|
16
|
+
export default class RemoteEvents {
|
|
17
|
+
readonly clientId: string;
|
|
18
|
+
private provider;
|
|
19
|
+
private api?;
|
|
20
|
+
private eventStream;
|
|
21
|
+
constructor(provider: IRemoteEventsProvider, config: EventStreamConfig);
|
|
22
|
+
connect(api: IApi): Promise<void>;
|
|
23
|
+
disconnect(): void;
|
|
24
|
+
processMessage(message: string): void;
|
|
25
|
+
private applyEvent;
|
|
26
|
+
private applyEventTask;
|
|
27
|
+
private applyEventTaskAdd;
|
|
28
|
+
private applyEventTaskUpdate;
|
|
29
|
+
private applyEventTaskDelete;
|
|
30
|
+
private applyEventLink;
|
|
31
|
+
private applyEventLinkAdd;
|
|
32
|
+
private applyEventLinkUpdate;
|
|
33
|
+
private applyEventLinkDelete;
|
|
34
|
+
private applyEventAssignment;
|
|
35
|
+
private applyEventAssignmentAdd;
|
|
36
|
+
private applyEventAssignmentUpdate;
|
|
37
|
+
private applyEventAssignmentDelete;
|
|
38
|
+
private resolveRemoteId;
|
|
39
|
+
private doesItemExist;
|
|
40
|
+
private isTaskLoaded;
|
|
41
|
+
private canAcceptChild;
|
|
42
|
+
private isLinkLoaded;
|
|
43
|
+
private isAssignmentLoaded;
|
|
44
|
+
private parseMessage;
|
|
45
|
+
}
|
|
@@ -14,7 +14,9 @@ export default class RestDataProvider extends Rest<TMethodsConfig> {
|
|
|
14
14
|
private changeQueue;
|
|
15
15
|
protected _batchUrl: string;
|
|
16
16
|
private flushTimeout;
|
|
17
|
+
private headers;
|
|
17
18
|
constructor(url: string, config?: Partial<TProviderConfig>);
|
|
19
|
+
setHeaders(headers: Record<string, string>): void;
|
|
18
20
|
getHandlers(): ActionMap<TMethodsConfig>;
|
|
19
21
|
getData(id?: TID, options?: {
|
|
20
22
|
resources?: boolean;
|
|
@@ -23,10 +25,11 @@ export default class RestDataProvider extends Rest<TMethodsConfig> {
|
|
|
23
25
|
parseDates(data: ITask[]): ITask[];
|
|
24
26
|
formatDate(date: any): string;
|
|
25
27
|
sendBatch<T>(url: string, method: string, data?: any, customHeaders?: any): Promise<T>;
|
|
28
|
+
resolveId(id: TID, kind: number): TID;
|
|
26
29
|
private sendBatchRequest;
|
|
30
|
+
private flushBatch;
|
|
27
31
|
send<T>(url: string, method: string, data?: any, customHeaders?: any): Promise<T>;
|
|
28
32
|
private getPayload;
|
|
29
33
|
private transformDates;
|
|
30
|
-
private correctID;
|
|
31
34
|
}
|
|
32
35
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { default as RestDataProvider } from "./RestDataProvider";
|
|
2
|
+
export { default as RemoteEvents, type IRemoteEventsProvider, } from "./RemoteEvents";
|
|
3
|
+
export { default as EventStream, type EventStreamConfig } from "./EventStream";
|
|
4
|
+
export { TaskID, LinkID, AssignmentID } from "./constants";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateUUID(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svar-ui/gantt-data-provider",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Backend integration helper for SVAR Gantt component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"license.txt"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@svar-ui/lib-data-provider": "1.7.
|
|
22
|
+
"@svar-ui/lib-data-provider": "1.7.4"
|
|
23
23
|
}
|
|
24
24
|
}
|