core-3nweb-client-lib 0.43.5 → 0.43.7
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/build/api-defs/files.d.ts +19 -0
- package/build/core/asmail/inbox/inbox-events.d.ts +2 -7
- package/build/core/asmail/inbox/inbox-events.js +28 -75
- package/build/core/storage/synced/obj-status.d.ts +21 -0
- package/build/core/storage/synced/obj-status.js +45 -2
- package/build/core/storage/synced/remote-events.d.ts +3 -2
- package/build/core/storage/synced/remote-events.js +19 -24
- package/build/core/storage/synced/storage.js +2 -2
- package/build/core/storage/synced/upsyncer.js +1 -2
- package/build/core-ipc/file.js +26 -2
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-common/ipc/ws-ipc.d.ts +12 -0
- package/build/lib-common/ipc/ws-ipc.js +66 -1
- package/build/protos/asmail.proto.js +318 -0
- package/build/protos/file.proto.js +318 -0
- package/build/protos/fs.proto.js +318 -0
- package/package.json +1 -1
- package/protos/file.proto +7 -0
|
@@ -169,6 +169,7 @@ declare namespace web3n.files {
|
|
|
169
169
|
local?: LocalVersion;
|
|
170
170
|
remote?: SyncVersionsBranch;
|
|
171
171
|
existsInSyncedParent?: boolean;
|
|
172
|
+
uploading?: UploadingState;
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
interface LocalVersion {
|
|
@@ -184,6 +185,24 @@ declare namespace web3n.files {
|
|
|
184
185
|
|
|
185
186
|
type SyncState = 'synced' | 'behind' | 'unsynced' | 'conflicting';
|
|
186
187
|
|
|
188
|
+
interface UploadingState {
|
|
189
|
+
/**
|
|
190
|
+
* Local version that is uploaded to server.
|
|
191
|
+
* If it is an upload of object removal, version is -1.
|
|
192
|
+
*/
|
|
193
|
+
localVersion: number;
|
|
194
|
+
/**
|
|
195
|
+
* New remote version that is uploaded to server.
|
|
196
|
+
* If it is an upload of object removal, version is -1.
|
|
197
|
+
*/
|
|
198
|
+
remoteVersion: number;
|
|
199
|
+
/**
|
|
200
|
+
* Bytes left to upload.
|
|
201
|
+
*/
|
|
202
|
+
bytesLeftToUpload: number;
|
|
203
|
+
uploadStarted: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
187
206
|
interface FileByteSource {
|
|
188
207
|
|
|
189
208
|
/**
|
|
@@ -29,18 +29,13 @@ export declare class InboxEvents {
|
|
|
29
29
|
private readonly newMsg$;
|
|
30
30
|
private readonly connectionEvents;
|
|
31
31
|
readonly connectionEvent$: Observable<InboxConnectionStatus>;
|
|
32
|
-
private
|
|
33
|
-
private networkActive;
|
|
32
|
+
private readonly wsProc;
|
|
34
33
|
private disconnectedAt;
|
|
35
34
|
constructor(msgReceiver: MailRecipient, getMsg: (msgId: string) => Promise<IncomingMessage>, listNewMsgs: (fromTS: number) => Promise<MsgInfo[]>, rmMsg: (msgId: string) => Promise<void>, logError: LogError);
|
|
36
|
-
private
|
|
37
|
-
private sleepAndRestart;
|
|
35
|
+
private makeProc;
|
|
38
36
|
private getMessage;
|
|
39
37
|
subscribe<T>(event: InboxEventType, observer: Observer<T>): () => void;
|
|
40
38
|
close(): void;
|
|
41
|
-
get isListening(): boolean;
|
|
42
|
-
private shouldRestartAfterErr;
|
|
43
|
-
private stopListening;
|
|
44
39
|
suspendNetworkActivity(): void;
|
|
45
40
|
resumeNetworkActivity(): void;
|
|
46
41
|
private listMsgsFromDisconnectedPeriod;
|
|
@@ -22,7 +22,6 @@ const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
|
|
|
22
22
|
const operators_1 = require("rxjs/operators");
|
|
23
23
|
const utils_for_observables_1 = require("../../../lib-common/utils-for-observables");
|
|
24
24
|
const ws_ipc_1 = require("../../../lib-common/ipc/ws-ipc");
|
|
25
|
-
const sleep_1 = require("../../../lib-common/processes/sleep");
|
|
26
25
|
function toInboxConnectionStatus(status, params) {
|
|
27
26
|
return (0, ws_ipc_1.addToStatus)(status, {
|
|
28
27
|
service: 'inbox',
|
|
@@ -52,54 +51,30 @@ class InboxEvents {
|
|
|
52
51
|
this.newMsg$ = this.newMsgs.asObservable().pipe((0, operators_1.share)());
|
|
53
52
|
this.connectionEvents = new rxjs_1.Subject();
|
|
54
53
|
this.connectionEvent$ = this.connectionEvents.asObservable().pipe((0, operators_1.share)());
|
|
55
|
-
this.listeningProc = undefined;
|
|
56
|
-
this.networkActive = true;
|
|
57
54
|
this.disconnectedAt = undefined;
|
|
58
|
-
this.
|
|
55
|
+
this.wsProc = new ws_ipc_1.WebSocketListening(SERVER_EVENTS_RESTART_WAIT_SECS, this.makeProc.bind(this));
|
|
56
|
+
this.wsProc.startListening();
|
|
59
57
|
Object.seal(this);
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const clearListeningProc = () => {
|
|
66
|
-
if (this.listeningProc === sub) {
|
|
67
|
-
this.listeningProc = undefined;
|
|
68
|
-
}
|
|
69
|
-
if (!this.disconnectedAt) {
|
|
70
|
-
this.disconnectedAt = Date.now();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const sub = (0, rxjs_1.from)(this.msgReceiver.openEventSource().then(({ client, heartbeat }) => {
|
|
59
|
+
makeProc() {
|
|
60
|
+
const proc$ = (0, rxjs_1.from)(this.msgReceiver.openEventSource().then(({ client, heartbeat }) => {
|
|
74
61
|
const channel = retrieval_1.msgRecievedCompletely.EVENT_NAME;
|
|
75
62
|
heartbeat.subscribe({
|
|
76
63
|
next: ev => this.connectionEvents.next(toInboxConnectionStatus(ev))
|
|
77
64
|
});
|
|
78
65
|
return new rxjs_1.Observable(obs => client.subscribe(channel, obs));
|
|
79
66
|
}))
|
|
80
|
-
.pipe((0, operators_1.mergeMap)(events => events), (0, operators_1.mergeMap)(async (ev) => this.getMessage(ev.msgId), 5))
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
this.
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
complete: () => {
|
|
88
|
-
clearListeningProc();
|
|
89
|
-
},
|
|
90
|
-
error: async (exc) => {
|
|
91
|
-
clearListeningProc();
|
|
92
|
-
if (this.shouldRestartAfterErr(exc)) {
|
|
93
|
-
this.sleepAndRestart();
|
|
67
|
+
.pipe((0, operators_1.mergeMap)(events => events), (0, operators_1.mergeMap)(async (ev) => this.getMessage(ev.msgId), 5), (0, operators_1.filter)(msg => !!msg), (0, operators_1.tap)({
|
|
68
|
+
next: msg => this.newMsgs.next(msg),
|
|
69
|
+
error: () => {
|
|
70
|
+
if (!this.disconnectedAt) {
|
|
71
|
+
this.disconnectedAt = Date.now();
|
|
94
72
|
}
|
|
95
73
|
}
|
|
96
|
-
});
|
|
97
|
-
|
|
74
|
+
}));
|
|
75
|
+
// list messages as a side effect of starting, or at point of starting.
|
|
98
76
|
this.listMsgsFromDisconnectedPeriod();
|
|
99
|
-
|
|
100
|
-
async sleepAndRestart() {
|
|
101
|
-
await (0, sleep_1.sleep)(SERVER_EVENTS_RESTART_WAIT_SECS);
|
|
102
|
-
this.startListening();
|
|
77
|
+
return proc$;
|
|
103
78
|
}
|
|
104
79
|
async getMessage(msgId) {
|
|
105
80
|
try {
|
|
@@ -123,45 +98,26 @@ class InboxEvents {
|
|
|
123
98
|
}
|
|
124
99
|
close() {
|
|
125
100
|
this.newMsgs.complete();
|
|
101
|
+
this.wsProc.close();
|
|
126
102
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
if (exc.type === 'connect') {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
else if (exc.type === 'http-request') {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
else if (exc.type === 'websocket') {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
stopListening() {
|
|
148
|
-
var _a;
|
|
149
|
-
(_a = this.listeningProc) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
150
|
-
this.listeningProc = undefined;
|
|
151
|
-
}
|
|
103
|
+
// XXX we should go along:
|
|
104
|
+
// - last working connection and ping
|
|
105
|
+
// - may be have an expect suspending of network, with less aggressive attempts to reconnect
|
|
106
|
+
// - instead of talking about presence of network, expose methods to nudge restarting behaviour, as outside
|
|
107
|
+
// may have better clues and able to command behaviour switch
|
|
152
108
|
suspendNetworkActivity() {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
109
|
+
// XXX code below shutdown for good, but restart sometimes has been failing.
|
|
110
|
+
//
|
|
111
|
+
// if (this.isListening) {
|
|
112
|
+
// if (!this.disconnectedAt) {
|
|
113
|
+
// this.disconnectedAt = Date.now();
|
|
114
|
+
// }
|
|
115
|
+
// this.stopListening();
|
|
116
|
+
// }
|
|
160
117
|
}
|
|
161
118
|
resumeNetworkActivity() {
|
|
162
|
-
this.
|
|
163
|
-
|
|
164
|
-
this.startListening();
|
|
119
|
+
if (!this.wsProc.isListening) {
|
|
120
|
+
this.wsProc.startListening();
|
|
165
121
|
}
|
|
166
122
|
}
|
|
167
123
|
async listMsgsFromDisconnectedPeriod() {
|
|
@@ -178,9 +134,6 @@ class InboxEvents {
|
|
|
178
134
|
this.newMsgs.next(msg);
|
|
179
135
|
this.disconnectedAt = msg.deliveryTS;
|
|
180
136
|
}
|
|
181
|
-
else if (!this.networkActive) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
137
|
}
|
|
185
138
|
this.disconnectedAt = undefined;
|
|
186
139
|
}
|
|
@@ -48,16 +48,37 @@ export interface RemovalUpload {
|
|
|
48
48
|
export interface WholeVerOrderedUpload {
|
|
49
49
|
type: 'ordered-whole';
|
|
50
50
|
createObj?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Header bytes that need to be uploaded. Undefined when header has been uploaded.
|
|
53
|
+
*/
|
|
51
54
|
header?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Segments bytes left to upload.
|
|
57
|
+
*/
|
|
52
58
|
segsLeft: number;
|
|
59
|
+
/**
|
|
60
|
+
* Offset in segments, to which point bytes where uploaded.
|
|
61
|
+
*/
|
|
53
62
|
segsOfs: number;
|
|
63
|
+
/**
|
|
64
|
+
* Upload transaction id.
|
|
65
|
+
*/
|
|
54
66
|
transactionId?: string;
|
|
55
67
|
}
|
|
56
68
|
export interface DiffVerOrderedUpload {
|
|
57
69
|
type: 'ordered-diff';
|
|
58
70
|
diff: DiffInfo;
|
|
71
|
+
/**
|
|
72
|
+
* Header bytes that need to be uploaded. Undefined when header has been uploaded.
|
|
73
|
+
*/
|
|
59
74
|
header?: number;
|
|
75
|
+
/**
|
|
76
|
+
* New chunks of segments that should be uploaded.
|
|
77
|
+
*/
|
|
60
78
|
newSegsLeft: FiniteChunk[];
|
|
79
|
+
/**
|
|
80
|
+
* Upload transaction id.
|
|
81
|
+
*/
|
|
61
82
|
transactionId?: string;
|
|
62
83
|
}
|
|
63
84
|
export interface BytesSection {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2016 - 2020, 2022 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2016 - 2020, 2022, 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -494,7 +494,8 @@ class ObjStatus {
|
|
|
494
494
|
state: this.stateIndicator,
|
|
495
495
|
local: localVersionFromStatus(this.status.local),
|
|
496
496
|
remote,
|
|
497
|
-
synced
|
|
497
|
+
synced,
|
|
498
|
+
uploading: uploadInStatus(this.status.upload)
|
|
498
499
|
};
|
|
499
500
|
}
|
|
500
501
|
neverUploaded() {
|
|
@@ -674,4 +675,46 @@ function skipNotFoundExc(exc) {
|
|
|
674
675
|
throw exc;
|
|
675
676
|
}
|
|
676
677
|
}
|
|
678
|
+
function uploadInStatus(upload) {
|
|
679
|
+
if (!upload) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (upload.type === 'new-version') {
|
|
683
|
+
const { needUpload } = upload;
|
|
684
|
+
if (!needUpload) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
let bytesLeftToUpload = 0;
|
|
688
|
+
if (needUpload.type === 'ordered-whole') {
|
|
689
|
+
const { header, segsLeft } = needUpload;
|
|
690
|
+
if (header) {
|
|
691
|
+
bytesLeftToUpload += header;
|
|
692
|
+
}
|
|
693
|
+
bytesLeftToUpload += segsLeft;
|
|
694
|
+
}
|
|
695
|
+
else if (needUpload.type === 'ordered-diff') {
|
|
696
|
+
const { header, newSegsLeft } = needUpload;
|
|
697
|
+
if (header) {
|
|
698
|
+
bytesLeftToUpload += header;
|
|
699
|
+
}
|
|
700
|
+
for (const { len: chunkLen } of newSegsLeft) {
|
|
701
|
+
bytesLeftToUpload += chunkLen;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return {
|
|
705
|
+
localVersion: upload.localVersion,
|
|
706
|
+
remoteVersion: upload.uploadVersion,
|
|
707
|
+
bytesLeftToUpload,
|
|
708
|
+
uploadStarted: !!needUpload.transactionId
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
return {
|
|
713
|
+
localVersion: -1,
|
|
714
|
+
remoteVersion: -1,
|
|
715
|
+
bytesLeftToUpload: 0,
|
|
716
|
+
uploadStarted: false
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
}
|
|
677
720
|
Object.freeze(exports);
|
|
@@ -18,9 +18,10 @@ export declare class RemoteEvents {
|
|
|
18
18
|
private readonly logError;
|
|
19
19
|
private readonly connectionEvents;
|
|
20
20
|
readonly connectionEvent$: Observable<StorageConnectionStatus>;
|
|
21
|
+
private readonly wsProc;
|
|
21
22
|
constructor(remoteStorage: StorageOwner, files: ObjFiles, broadcastNodeEvent: Storage['broadcastNodeEvent'], logError: LogError);
|
|
22
|
-
private
|
|
23
|
-
|
|
23
|
+
private makeProc;
|
|
24
|
+
startListening(): void;
|
|
24
25
|
close(): Promise<void>;
|
|
25
26
|
private absorbObjChange;
|
|
26
27
|
private absorbObjRemoval;
|
|
@@ -33,6 +33,7 @@ const SERVER_EVENTS_RESTART_WAIT_SECS = 5;
|
|
|
33
33
|
* events. Someone down the stream can react to these changes from remote.
|
|
34
34
|
*/
|
|
35
35
|
class RemoteEvents {
|
|
36
|
+
// private listeningProc: Subscription|undefined = undefined;
|
|
36
37
|
constructor(remoteStorage, files, broadcastNodeEvent, logError) {
|
|
37
38
|
this.remoteStorage = remoteStorage;
|
|
38
39
|
this.files = files;
|
|
@@ -40,11 +41,11 @@ class RemoteEvents {
|
|
|
40
41
|
this.logError = logError;
|
|
41
42
|
this.connectionEvents = new rxjs_1.Subject();
|
|
42
43
|
this.connectionEvent$ = this.connectionEvents.asObservable().pipe((0, operators_1.share)());
|
|
43
|
-
this.
|
|
44
|
+
this.wsProc = new ws_ipc_1.WebSocketListening(SERVER_EVENTS_RESTART_WAIT_SECS, this.makeProc.bind(this));
|
|
44
45
|
Object.seal(this);
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
makeProc() {
|
|
48
|
+
return (0, rxjs_1.from)(this.remoteStorage.openEventSource().then(({ client, heartbeat }) => {
|
|
48
49
|
heartbeat.subscribe({
|
|
49
50
|
next: ev => this.connectionEvents.next(toStorageConnectionStatus(ev))
|
|
50
51
|
});
|
|
@@ -56,23 +57,14 @@ class RemoteEvents {
|
|
|
56
57
|
// this.absorbArchVersionRemoval(client)
|
|
57
58
|
];
|
|
58
59
|
}))
|
|
59
|
-
.pipe((0, operators_1.mergeMap)(event$ => event$), (0, operators_1.mergeMap)(event$ => event$))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await this.logError(err);
|
|
64
|
-
this.absorbingRemoteEventsProc = undefined;
|
|
65
|
-
},
|
|
66
|
-
complete: () => {
|
|
67
|
-
this.absorbingRemoteEventsProc = undefined;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
60
|
+
.pipe((0, operators_1.mergeMap)(event$ => event$), (0, operators_1.mergeMap)(event$ => event$));
|
|
61
|
+
}
|
|
62
|
+
startListening() {
|
|
63
|
+
this.wsProc.startListening();
|
|
70
64
|
}
|
|
71
65
|
async close() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.absorbingRemoteEventsProc = undefined;
|
|
75
|
-
}
|
|
66
|
+
this.connectionEvents.complete();
|
|
67
|
+
this.wsProc.close();
|
|
76
68
|
}
|
|
77
69
|
absorbObjChange(client) {
|
|
78
70
|
return (new rxjs_1.Observable(obs => client.subscribe(owner_1.events.objChanged.EVENT_NAME, obs)))
|
|
@@ -136,19 +128,22 @@ class RemoteEvents {
|
|
|
136
128
|
});
|
|
137
129
|
}, 1));
|
|
138
130
|
}
|
|
131
|
+
// XXX we should go along:
|
|
132
|
+
// - last working connection and ping
|
|
133
|
+
// - may be have an expect suspending of network, with less aggressive attempts to reconnect
|
|
134
|
+
// - instead of talking about presence of network, expose methods to nudge restarting behaviour, as outside
|
|
135
|
+
// may have better clues and able to command behaviour switch
|
|
139
136
|
suspendNetworkActivity() {
|
|
140
137
|
// XXX
|
|
141
|
-
// -
|
|
142
|
-
// - press breaks on events from server
|
|
138
|
+
// - ...
|
|
143
139
|
}
|
|
144
140
|
resumeNetworkActivity() {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
if (!this.wsProc.isListening) {
|
|
142
|
+
this.wsProc.startListening();
|
|
143
|
+
}
|
|
148
144
|
}
|
|
149
145
|
}
|
|
150
146
|
exports.RemoteEvents = RemoteEvents;
|
|
151
147
|
Object.freeze(RemoteEvents.prototype);
|
|
152
148
|
Object.freeze(RemoteEvents);
|
|
153
|
-
function noop() { }
|
|
154
149
|
Object.freeze(exports);
|
|
@@ -51,7 +51,7 @@ class SyncedStore {
|
|
|
51
51
|
return {
|
|
52
52
|
syncedStore: (0, common_1.wrapSyncStorageImplementation)(s),
|
|
53
53
|
startObjProcs: () => {
|
|
54
|
-
s.remoteEvents.
|
|
54
|
+
s.remoteEvents.startListening();
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -64,7 +64,7 @@ class SyncedStore {
|
|
|
64
64
|
setupRemoteAndStartObjProcs: getSigner => {
|
|
65
65
|
setMid(getSigner);
|
|
66
66
|
s.uploader.start();
|
|
67
|
-
s.remoteEvents.
|
|
67
|
+
s.remoteEvents.startListening();
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -181,8 +181,7 @@ class UploadTask {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
async headerToUpload() {
|
|
184
|
-
return (this.uploadHeader ?
|
|
185
|
-
this.uploadHeader : await this.src.readHeader());
|
|
184
|
+
return (this.uploadHeader ? this.uploadHeader : await this.src.readHeader());
|
|
186
185
|
}
|
|
187
186
|
async startOrderedDiffUpload(upload) {
|
|
188
187
|
const diff = buffer_utils_1.utf8.pack(JSON.stringify(upload.diff));
|
package/build/core-ipc/file.js
CHANGED
|
@@ -205,7 +205,8 @@ function syncStatusToMsg(s) {
|
|
|
205
205
|
local: syncBranchToMsg(s.local),
|
|
206
206
|
synced: syncBranchToMsg(s.synced),
|
|
207
207
|
remote: syncBranchToMsg(s.remote),
|
|
208
|
-
existsInSyncedParent: (0, protobuf_msg_1.toOptVal)(s.existsInSyncedParent)
|
|
208
|
+
existsInSyncedParent: (0, protobuf_msg_1.toOptVal)(s.existsInSyncedParent),
|
|
209
|
+
uploading: uploadingToMsg(s.uploading)
|
|
209
210
|
};
|
|
210
211
|
}
|
|
211
212
|
function msgToSyncStatus(m) {
|
|
@@ -217,7 +218,8 @@ function msgToSyncStatus(m) {
|
|
|
217
218
|
local: msgToSyncBranch(m.local),
|
|
218
219
|
synced: msgToSyncBranch(m.synced),
|
|
219
220
|
remote: msgToSyncBranch(m.remote),
|
|
220
|
-
existsInSyncedParent: (0, protobuf_msg_1.valOfOpt)(m.existsInSyncedParent)
|
|
221
|
+
existsInSyncedParent: (0, protobuf_msg_1.valOfOpt)(m.existsInSyncedParent),
|
|
222
|
+
uploading: msgToUploading(m.uploading)
|
|
221
223
|
};
|
|
222
224
|
}
|
|
223
225
|
function syncBranchToMsg(b) {
|
|
@@ -241,6 +243,28 @@ function msgToSyncBranch(m) {
|
|
|
241
243
|
isArchived: (0, protobuf_msg_1.valOfOpt)(m.isArchived)
|
|
242
244
|
};
|
|
243
245
|
}
|
|
246
|
+
function uploadingToMsg(u) {
|
|
247
|
+
if (!u) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
localVersion: (0, protobuf_msg_1.toVal)(u.localVersion),
|
|
252
|
+
remoteVersion: (0, protobuf_msg_1.toVal)(u.remoteVersion),
|
|
253
|
+
bytesLeftToUpload: (0, protobuf_msg_1.toVal)(u.bytesLeftToUpload),
|
|
254
|
+
uploadStarted: u.uploadStarted
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function msgToUploading(u) {
|
|
258
|
+
if (!u) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
localVersion: (0, protobuf_msg_1.intValOf)(u.localVersion),
|
|
263
|
+
remoteVersion: (0, protobuf_msg_1.intValOf)(u.remoteVersion),
|
|
264
|
+
bytesLeftToUpload: (0, protobuf_msg_1.intValOf)(u.bytesLeftToUpload),
|
|
265
|
+
uploadStarted: u.uploadStarted
|
|
266
|
+
};
|
|
267
|
+
}
|
|
244
268
|
const syncStatusMsgType = protobuf_type_1.ProtoType.for(file_proto_1.file.SyncStatusMsg);
|
|
245
269
|
function packSyncStatus(s) {
|
|
246
270
|
return syncStatusMsgType.pack(syncStatusToMsg(s));
|