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
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { SubscribingClient } from './generic-ipc';
|
|
3
3
|
import * as WebSocket from 'ws';
|
|
4
|
+
import type { ConnectException, HTTPException } from '../exceptions/http';
|
|
4
5
|
export { RequestEnvelope, RequestHandler, EventfulServer, makeEventfulServer, SubscribingClient } from './generic-ipc';
|
|
5
6
|
export interface WSException extends web3n.RuntimeException {
|
|
6
7
|
type: 'websocket';
|
|
@@ -26,3 +27,14 @@ export declare function makeSubscriber(ws: WebSocket, ipcChannel: string | undef
|
|
|
26
27
|
heartbeat: Observable<ConnectionStatus>;
|
|
27
28
|
};
|
|
28
29
|
export declare function addToStatus<T extends ConnectionStatus>(status: ConnectionStatus, params: Partial<T>): T;
|
|
30
|
+
export declare function shouldRestartWSAfterErr(exc: WSException | ConnectException | HTTPException): boolean;
|
|
31
|
+
export declare class WebSocketListening {
|
|
32
|
+
readonly restartWaitSecs: number;
|
|
33
|
+
private readonly startWSProc;
|
|
34
|
+
private listeningProc;
|
|
35
|
+
constructor(restartWaitSecs: number, startWSProc: () => Observable<unknown>);
|
|
36
|
+
startListening(): void;
|
|
37
|
+
private sleepAndRestart;
|
|
38
|
+
close(): void;
|
|
39
|
+
get isListening(): boolean;
|
|
40
|
+
}
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.makeEventfulServer = void 0;
|
|
18
|
+
exports.WebSocketListening = exports.makeEventfulServer = void 0;
|
|
19
19
|
exports.makeWSException = makeWSException;
|
|
20
20
|
exports.makeSubscriber = makeSubscriber;
|
|
21
21
|
exports.addToStatus = addToStatus;
|
|
22
|
+
exports.shouldRestartWSAfterErr = shouldRestartWSAfterErr;
|
|
22
23
|
const rxjs_1 = require("rxjs");
|
|
23
24
|
const runtime_1 = require("../exceptions/runtime");
|
|
24
25
|
const generic_ipc_1 = require("./generic-ipc");
|
|
26
|
+
const sleep_1 = require("../processes/sleep");
|
|
25
27
|
var generic_ipc_2 = require("./generic-ipc");
|
|
26
28
|
Object.defineProperty(exports, "makeEventfulServer", { enumerable: true, get: function () { return generic_ipc_2.makeEventfulServer; } });
|
|
27
29
|
function makeWSException(params, flags) {
|
|
@@ -127,4 +129,67 @@ function addToStatus(status, params) {
|
|
|
127
129
|
}
|
|
128
130
|
return status;
|
|
129
131
|
}
|
|
132
|
+
function shouldRestartWSAfterErr(exc) {
|
|
133
|
+
if (!exc.runtimeException) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (exc.type === 'connect') {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
else if (exc.type === 'http-request') {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
else if (exc.type === 'websocket') {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class WebSocketListening {
|
|
150
|
+
constructor(restartWaitSecs, startWSProc) {
|
|
151
|
+
this.restartWaitSecs = restartWaitSecs;
|
|
152
|
+
this.startWSProc = startWSProc;
|
|
153
|
+
this.listeningProc = undefined;
|
|
154
|
+
Object.seal(this);
|
|
155
|
+
}
|
|
156
|
+
startListening() {
|
|
157
|
+
if (this.listeningProc) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const clearListeningProc = () => {
|
|
161
|
+
if (this.listeningProc === sub) {
|
|
162
|
+
this.listeningProc = undefined;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const sub = this.startWSProc()
|
|
166
|
+
.subscribe({
|
|
167
|
+
complete: () => {
|
|
168
|
+
clearListeningProc();
|
|
169
|
+
},
|
|
170
|
+
error: async (exc) => {
|
|
171
|
+
clearListeningProc();
|
|
172
|
+
if (shouldRestartWSAfterErr(exc)) {
|
|
173
|
+
this.sleepAndRestart();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
this.listeningProc = sub;
|
|
178
|
+
}
|
|
179
|
+
async sleepAndRestart() {
|
|
180
|
+
await (0, sleep_1.sleep)(this.restartWaitSecs * 1000);
|
|
181
|
+
this.startListening();
|
|
182
|
+
}
|
|
183
|
+
close() {
|
|
184
|
+
var _a;
|
|
185
|
+
(_a = this.listeningProc) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
186
|
+
this.listeningProc = undefined;
|
|
187
|
+
}
|
|
188
|
+
get isListening() {
|
|
189
|
+
return !!this.listeningProc;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.WebSocketListening = WebSocketListening;
|
|
193
|
+
Object.freeze(WebSocketListening.prototype);
|
|
194
|
+
Object.freeze(WebSocketListening);
|
|
130
195
|
Object.freeze(exports);
|
|
@@ -8204,6 +8204,7 @@ $root.file = (function() {
|
|
|
8204
8204
|
* @property {file.ISyncVersionsBranchMsg|null} [synced] SyncStatusMsg synced
|
|
8205
8205
|
* @property {file.ISyncVersionsBranchMsg|null} [remote] SyncStatusMsg remote
|
|
8206
8206
|
* @property {common.IBooleanValue|null} [existsInSyncedParent] SyncStatusMsg existsInSyncedParent
|
|
8207
|
+
* @property {file.IUploadingStateMsg|null} [uploading] SyncStatusMsg uploading
|
|
8207
8208
|
*/
|
|
8208
8209
|
|
|
8209
8210
|
/**
|
|
@@ -8261,6 +8262,14 @@ $root.file = (function() {
|
|
|
8261
8262
|
*/
|
|
8262
8263
|
SyncStatusMsg.prototype.existsInSyncedParent = null;
|
|
8263
8264
|
|
|
8265
|
+
/**
|
|
8266
|
+
* SyncStatusMsg uploading.
|
|
8267
|
+
* @member {file.IUploadingStateMsg|null|undefined} uploading
|
|
8268
|
+
* @memberof file.SyncStatusMsg
|
|
8269
|
+
* @instance
|
|
8270
|
+
*/
|
|
8271
|
+
SyncStatusMsg.prototype.uploading = null;
|
|
8272
|
+
|
|
8264
8273
|
/**
|
|
8265
8274
|
* Creates a new SyncStatusMsg instance using the specified properties.
|
|
8266
8275
|
* @function create
|
|
@@ -8295,6 +8304,8 @@ $root.file = (function() {
|
|
|
8295
8304
|
$root.file.SyncVersionsBranchMsg.encode(message.remote, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
|
8296
8305
|
if (message.existsInSyncedParent != null && Object.hasOwnProperty.call(message, "existsInSyncedParent"))
|
|
8297
8306
|
$root.common.BooleanValue.encode(message.existsInSyncedParent, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
|
|
8307
|
+
if (message.uploading != null && Object.hasOwnProperty.call(message, "uploading"))
|
|
8308
|
+
$root.file.UploadingStateMsg.encode(message.uploading, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
|
|
8298
8309
|
return writer;
|
|
8299
8310
|
};
|
|
8300
8311
|
|
|
@@ -8351,6 +8362,10 @@ $root.file = (function() {
|
|
|
8351
8362
|
message.existsInSyncedParent = $root.common.BooleanValue.decode(reader, reader.uint32());
|
|
8352
8363
|
break;
|
|
8353
8364
|
}
|
|
8365
|
+
case 6: {
|
|
8366
|
+
message.uploading = $root.file.UploadingStateMsg.decode(reader, reader.uint32());
|
|
8367
|
+
break;
|
|
8368
|
+
}
|
|
8354
8369
|
default:
|
|
8355
8370
|
reader.skipType(tag & 7);
|
|
8356
8371
|
break;
|
|
@@ -8409,6 +8424,11 @@ $root.file = (function() {
|
|
|
8409
8424
|
if (error)
|
|
8410
8425
|
return "existsInSyncedParent." + error;
|
|
8411
8426
|
}
|
|
8427
|
+
if (message.uploading != null && message.hasOwnProperty("uploading")) {
|
|
8428
|
+
var error = $root.file.UploadingStateMsg.verify(message.uploading);
|
|
8429
|
+
if (error)
|
|
8430
|
+
return "uploading." + error;
|
|
8431
|
+
}
|
|
8412
8432
|
return null;
|
|
8413
8433
|
};
|
|
8414
8434
|
|
|
@@ -8446,6 +8466,11 @@ $root.file = (function() {
|
|
|
8446
8466
|
throw TypeError(".file.SyncStatusMsg.existsInSyncedParent: object expected");
|
|
8447
8467
|
message.existsInSyncedParent = $root.common.BooleanValue.fromObject(object.existsInSyncedParent);
|
|
8448
8468
|
}
|
|
8469
|
+
if (object.uploading != null) {
|
|
8470
|
+
if (typeof object.uploading !== "object")
|
|
8471
|
+
throw TypeError(".file.SyncStatusMsg.uploading: object expected");
|
|
8472
|
+
message.uploading = $root.file.UploadingStateMsg.fromObject(object.uploading);
|
|
8473
|
+
}
|
|
8449
8474
|
return message;
|
|
8450
8475
|
};
|
|
8451
8476
|
|
|
@@ -8468,6 +8493,7 @@ $root.file = (function() {
|
|
|
8468
8493
|
object.synced = null;
|
|
8469
8494
|
object.remote = null;
|
|
8470
8495
|
object.existsInSyncedParent = null;
|
|
8496
|
+
object.uploading = null;
|
|
8471
8497
|
}
|
|
8472
8498
|
if (message.state != null && message.hasOwnProperty("state"))
|
|
8473
8499
|
object.state = message.state;
|
|
@@ -8479,6 +8505,8 @@ $root.file = (function() {
|
|
|
8479
8505
|
object.remote = $root.file.SyncVersionsBranchMsg.toObject(message.remote, options);
|
|
8480
8506
|
if (message.existsInSyncedParent != null && message.hasOwnProperty("existsInSyncedParent"))
|
|
8481
8507
|
object.existsInSyncedParent = $root.common.BooleanValue.toObject(message.existsInSyncedParent, options);
|
|
8508
|
+
if (message.uploading != null && message.hasOwnProperty("uploading"))
|
|
8509
|
+
object.uploading = $root.file.UploadingStateMsg.toObject(message.uploading, options);
|
|
8482
8510
|
return object;
|
|
8483
8511
|
};
|
|
8484
8512
|
|
|
@@ -8808,6 +8836,296 @@ $root.file = (function() {
|
|
|
8808
8836
|
return SyncVersionsBranchMsg;
|
|
8809
8837
|
})();
|
|
8810
8838
|
|
|
8839
|
+
file.UploadingStateMsg = (function() {
|
|
8840
|
+
|
|
8841
|
+
/**
|
|
8842
|
+
* Properties of an UploadingStateMsg.
|
|
8843
|
+
* @memberof file
|
|
8844
|
+
* @interface IUploadingStateMsg
|
|
8845
|
+
* @property {common.IUInt64Value|null} [localVersion] UploadingStateMsg localVersion
|
|
8846
|
+
* @property {common.IUInt64Value|null} [remoteVersion] UploadingStateMsg remoteVersion
|
|
8847
|
+
* @property {common.IUInt64Value|null} [bytesLeftToUpload] UploadingStateMsg bytesLeftToUpload
|
|
8848
|
+
* @property {boolean|null} [uploadStarted] UploadingStateMsg uploadStarted
|
|
8849
|
+
*/
|
|
8850
|
+
|
|
8851
|
+
/**
|
|
8852
|
+
* Constructs a new UploadingStateMsg.
|
|
8853
|
+
* @memberof file
|
|
8854
|
+
* @classdesc Represents an UploadingStateMsg.
|
|
8855
|
+
* @implements IUploadingStateMsg
|
|
8856
|
+
* @constructor
|
|
8857
|
+
* @param {file.IUploadingStateMsg=} [properties] Properties to set
|
|
8858
|
+
*/
|
|
8859
|
+
function UploadingStateMsg(properties) {
|
|
8860
|
+
if (properties)
|
|
8861
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
8862
|
+
if (properties[keys[i]] != null)
|
|
8863
|
+
this[keys[i]] = properties[keys[i]];
|
|
8864
|
+
}
|
|
8865
|
+
|
|
8866
|
+
/**
|
|
8867
|
+
* UploadingStateMsg localVersion.
|
|
8868
|
+
* @member {common.IUInt64Value|null|undefined} localVersion
|
|
8869
|
+
* @memberof file.UploadingStateMsg
|
|
8870
|
+
* @instance
|
|
8871
|
+
*/
|
|
8872
|
+
UploadingStateMsg.prototype.localVersion = null;
|
|
8873
|
+
|
|
8874
|
+
/**
|
|
8875
|
+
* UploadingStateMsg remoteVersion.
|
|
8876
|
+
* @member {common.IUInt64Value|null|undefined} remoteVersion
|
|
8877
|
+
* @memberof file.UploadingStateMsg
|
|
8878
|
+
* @instance
|
|
8879
|
+
*/
|
|
8880
|
+
UploadingStateMsg.prototype.remoteVersion = null;
|
|
8881
|
+
|
|
8882
|
+
/**
|
|
8883
|
+
* UploadingStateMsg bytesLeftToUpload.
|
|
8884
|
+
* @member {common.IUInt64Value|null|undefined} bytesLeftToUpload
|
|
8885
|
+
* @memberof file.UploadingStateMsg
|
|
8886
|
+
* @instance
|
|
8887
|
+
*/
|
|
8888
|
+
UploadingStateMsg.prototype.bytesLeftToUpload = null;
|
|
8889
|
+
|
|
8890
|
+
/**
|
|
8891
|
+
* UploadingStateMsg uploadStarted.
|
|
8892
|
+
* @member {boolean} uploadStarted
|
|
8893
|
+
* @memberof file.UploadingStateMsg
|
|
8894
|
+
* @instance
|
|
8895
|
+
*/
|
|
8896
|
+
UploadingStateMsg.prototype.uploadStarted = false;
|
|
8897
|
+
|
|
8898
|
+
/**
|
|
8899
|
+
* Creates a new UploadingStateMsg instance using the specified properties.
|
|
8900
|
+
* @function create
|
|
8901
|
+
* @memberof file.UploadingStateMsg
|
|
8902
|
+
* @static
|
|
8903
|
+
* @param {file.IUploadingStateMsg=} [properties] Properties to set
|
|
8904
|
+
* @returns {file.UploadingStateMsg} UploadingStateMsg instance
|
|
8905
|
+
*/
|
|
8906
|
+
UploadingStateMsg.create = function create(properties) {
|
|
8907
|
+
return new UploadingStateMsg(properties);
|
|
8908
|
+
};
|
|
8909
|
+
|
|
8910
|
+
/**
|
|
8911
|
+
* Encodes the specified UploadingStateMsg message. Does not implicitly {@link file.UploadingStateMsg.verify|verify} messages.
|
|
8912
|
+
* @function encode
|
|
8913
|
+
* @memberof file.UploadingStateMsg
|
|
8914
|
+
* @static
|
|
8915
|
+
* @param {file.IUploadingStateMsg} message UploadingStateMsg message or plain object to encode
|
|
8916
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
8917
|
+
* @returns {$protobuf.Writer} Writer
|
|
8918
|
+
*/
|
|
8919
|
+
UploadingStateMsg.encode = function encode(message, writer) {
|
|
8920
|
+
if (!writer)
|
|
8921
|
+
writer = $Writer.create();
|
|
8922
|
+
if (message.localVersion != null && Object.hasOwnProperty.call(message, "localVersion"))
|
|
8923
|
+
$root.common.UInt64Value.encode(message.localVersion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
8924
|
+
if (message.remoteVersion != null && Object.hasOwnProperty.call(message, "remoteVersion"))
|
|
8925
|
+
$root.common.UInt64Value.encode(message.remoteVersion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
|
|
8926
|
+
if (message.bytesLeftToUpload != null && Object.hasOwnProperty.call(message, "bytesLeftToUpload"))
|
|
8927
|
+
$root.common.UInt64Value.encode(message.bytesLeftToUpload, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
8928
|
+
if (message.uploadStarted != null && Object.hasOwnProperty.call(message, "uploadStarted"))
|
|
8929
|
+
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.uploadStarted);
|
|
8930
|
+
return writer;
|
|
8931
|
+
};
|
|
8932
|
+
|
|
8933
|
+
/**
|
|
8934
|
+
* Encodes the specified UploadingStateMsg message, length delimited. Does not implicitly {@link file.UploadingStateMsg.verify|verify} messages.
|
|
8935
|
+
* @function encodeDelimited
|
|
8936
|
+
* @memberof file.UploadingStateMsg
|
|
8937
|
+
* @static
|
|
8938
|
+
* @param {file.IUploadingStateMsg} message UploadingStateMsg message or plain object to encode
|
|
8939
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
8940
|
+
* @returns {$protobuf.Writer} Writer
|
|
8941
|
+
*/
|
|
8942
|
+
UploadingStateMsg.encodeDelimited = function encodeDelimited(message, writer) {
|
|
8943
|
+
return this.encode(message, writer).ldelim();
|
|
8944
|
+
};
|
|
8945
|
+
|
|
8946
|
+
/**
|
|
8947
|
+
* Decodes an UploadingStateMsg message from the specified reader or buffer.
|
|
8948
|
+
* @function decode
|
|
8949
|
+
* @memberof file.UploadingStateMsg
|
|
8950
|
+
* @static
|
|
8951
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
8952
|
+
* @param {number} [length] Message length if known beforehand
|
|
8953
|
+
* @returns {file.UploadingStateMsg} UploadingStateMsg
|
|
8954
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
8955
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
8956
|
+
*/
|
|
8957
|
+
UploadingStateMsg.decode = function decode(reader, length, error) {
|
|
8958
|
+
if (!(reader instanceof $Reader))
|
|
8959
|
+
reader = $Reader.create(reader);
|
|
8960
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.file.UploadingStateMsg();
|
|
8961
|
+
while (reader.pos < end) {
|
|
8962
|
+
var tag = reader.uint32();
|
|
8963
|
+
if (tag === error)
|
|
8964
|
+
break;
|
|
8965
|
+
switch (tag >>> 3) {
|
|
8966
|
+
case 1: {
|
|
8967
|
+
message.localVersion = $root.common.UInt64Value.decode(reader, reader.uint32());
|
|
8968
|
+
break;
|
|
8969
|
+
}
|
|
8970
|
+
case 2: {
|
|
8971
|
+
message.remoteVersion = $root.common.UInt64Value.decode(reader, reader.uint32());
|
|
8972
|
+
break;
|
|
8973
|
+
}
|
|
8974
|
+
case 3: {
|
|
8975
|
+
message.bytesLeftToUpload = $root.common.UInt64Value.decode(reader, reader.uint32());
|
|
8976
|
+
break;
|
|
8977
|
+
}
|
|
8978
|
+
case 4: {
|
|
8979
|
+
message.uploadStarted = reader.bool();
|
|
8980
|
+
break;
|
|
8981
|
+
}
|
|
8982
|
+
default:
|
|
8983
|
+
reader.skipType(tag & 7);
|
|
8984
|
+
break;
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
return message;
|
|
8988
|
+
};
|
|
8989
|
+
|
|
8990
|
+
/**
|
|
8991
|
+
* Decodes an UploadingStateMsg message from the specified reader or buffer, length delimited.
|
|
8992
|
+
* @function decodeDelimited
|
|
8993
|
+
* @memberof file.UploadingStateMsg
|
|
8994
|
+
* @static
|
|
8995
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
8996
|
+
* @returns {file.UploadingStateMsg} UploadingStateMsg
|
|
8997
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
8998
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
8999
|
+
*/
|
|
9000
|
+
UploadingStateMsg.decodeDelimited = function decodeDelimited(reader) {
|
|
9001
|
+
if (!(reader instanceof $Reader))
|
|
9002
|
+
reader = new $Reader(reader);
|
|
9003
|
+
return this.decode(reader, reader.uint32());
|
|
9004
|
+
};
|
|
9005
|
+
|
|
9006
|
+
/**
|
|
9007
|
+
* Verifies an UploadingStateMsg message.
|
|
9008
|
+
* @function verify
|
|
9009
|
+
* @memberof file.UploadingStateMsg
|
|
9010
|
+
* @static
|
|
9011
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
9012
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
9013
|
+
*/
|
|
9014
|
+
UploadingStateMsg.verify = function verify(message) {
|
|
9015
|
+
if (typeof message !== "object" || message === null)
|
|
9016
|
+
return "object expected";
|
|
9017
|
+
if (message.localVersion != null && message.hasOwnProperty("localVersion")) {
|
|
9018
|
+
var error = $root.common.UInt64Value.verify(message.localVersion);
|
|
9019
|
+
if (error)
|
|
9020
|
+
return "localVersion." + error;
|
|
9021
|
+
}
|
|
9022
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion")) {
|
|
9023
|
+
var error = $root.common.UInt64Value.verify(message.remoteVersion);
|
|
9024
|
+
if (error)
|
|
9025
|
+
return "remoteVersion." + error;
|
|
9026
|
+
}
|
|
9027
|
+
if (message.bytesLeftToUpload != null && message.hasOwnProperty("bytesLeftToUpload")) {
|
|
9028
|
+
var error = $root.common.UInt64Value.verify(message.bytesLeftToUpload);
|
|
9029
|
+
if (error)
|
|
9030
|
+
return "bytesLeftToUpload." + error;
|
|
9031
|
+
}
|
|
9032
|
+
if (message.uploadStarted != null && message.hasOwnProperty("uploadStarted"))
|
|
9033
|
+
if (typeof message.uploadStarted !== "boolean")
|
|
9034
|
+
return "uploadStarted: boolean expected";
|
|
9035
|
+
return null;
|
|
9036
|
+
};
|
|
9037
|
+
|
|
9038
|
+
/**
|
|
9039
|
+
* Creates an UploadingStateMsg message from a plain object. Also converts values to their respective internal types.
|
|
9040
|
+
* @function fromObject
|
|
9041
|
+
* @memberof file.UploadingStateMsg
|
|
9042
|
+
* @static
|
|
9043
|
+
* @param {Object.<string,*>} object Plain object
|
|
9044
|
+
* @returns {file.UploadingStateMsg} UploadingStateMsg
|
|
9045
|
+
*/
|
|
9046
|
+
UploadingStateMsg.fromObject = function fromObject(object) {
|
|
9047
|
+
if (object instanceof $root.file.UploadingStateMsg)
|
|
9048
|
+
return object;
|
|
9049
|
+
var message = new $root.file.UploadingStateMsg();
|
|
9050
|
+
if (object.localVersion != null) {
|
|
9051
|
+
if (typeof object.localVersion !== "object")
|
|
9052
|
+
throw TypeError(".file.UploadingStateMsg.localVersion: object expected");
|
|
9053
|
+
message.localVersion = $root.common.UInt64Value.fromObject(object.localVersion);
|
|
9054
|
+
}
|
|
9055
|
+
if (object.remoteVersion != null) {
|
|
9056
|
+
if (typeof object.remoteVersion !== "object")
|
|
9057
|
+
throw TypeError(".file.UploadingStateMsg.remoteVersion: object expected");
|
|
9058
|
+
message.remoteVersion = $root.common.UInt64Value.fromObject(object.remoteVersion);
|
|
9059
|
+
}
|
|
9060
|
+
if (object.bytesLeftToUpload != null) {
|
|
9061
|
+
if (typeof object.bytesLeftToUpload !== "object")
|
|
9062
|
+
throw TypeError(".file.UploadingStateMsg.bytesLeftToUpload: object expected");
|
|
9063
|
+
message.bytesLeftToUpload = $root.common.UInt64Value.fromObject(object.bytesLeftToUpload);
|
|
9064
|
+
}
|
|
9065
|
+
if (object.uploadStarted != null)
|
|
9066
|
+
message.uploadStarted = Boolean(object.uploadStarted);
|
|
9067
|
+
return message;
|
|
9068
|
+
};
|
|
9069
|
+
|
|
9070
|
+
/**
|
|
9071
|
+
* Creates a plain object from an UploadingStateMsg message. Also converts values to other types if specified.
|
|
9072
|
+
* @function toObject
|
|
9073
|
+
* @memberof file.UploadingStateMsg
|
|
9074
|
+
* @static
|
|
9075
|
+
* @param {file.UploadingStateMsg} message UploadingStateMsg
|
|
9076
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
9077
|
+
* @returns {Object.<string,*>} Plain object
|
|
9078
|
+
*/
|
|
9079
|
+
UploadingStateMsg.toObject = function toObject(message, options) {
|
|
9080
|
+
if (!options)
|
|
9081
|
+
options = {};
|
|
9082
|
+
var object = {};
|
|
9083
|
+
if (options.defaults) {
|
|
9084
|
+
object.localVersion = null;
|
|
9085
|
+
object.remoteVersion = null;
|
|
9086
|
+
object.bytesLeftToUpload = null;
|
|
9087
|
+
object.uploadStarted = false;
|
|
9088
|
+
}
|
|
9089
|
+
if (message.localVersion != null && message.hasOwnProperty("localVersion"))
|
|
9090
|
+
object.localVersion = $root.common.UInt64Value.toObject(message.localVersion, options);
|
|
9091
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion"))
|
|
9092
|
+
object.remoteVersion = $root.common.UInt64Value.toObject(message.remoteVersion, options);
|
|
9093
|
+
if (message.bytesLeftToUpload != null && message.hasOwnProperty("bytesLeftToUpload"))
|
|
9094
|
+
object.bytesLeftToUpload = $root.common.UInt64Value.toObject(message.bytesLeftToUpload, options);
|
|
9095
|
+
if (message.uploadStarted != null && message.hasOwnProperty("uploadStarted"))
|
|
9096
|
+
object.uploadStarted = message.uploadStarted;
|
|
9097
|
+
return object;
|
|
9098
|
+
};
|
|
9099
|
+
|
|
9100
|
+
/**
|
|
9101
|
+
* Converts this UploadingStateMsg to JSON.
|
|
9102
|
+
* @function toJSON
|
|
9103
|
+
* @memberof file.UploadingStateMsg
|
|
9104
|
+
* @instance
|
|
9105
|
+
* @returns {Object.<string,*>} JSON object
|
|
9106
|
+
*/
|
|
9107
|
+
UploadingStateMsg.prototype.toJSON = function toJSON() {
|
|
9108
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
9109
|
+
};
|
|
9110
|
+
|
|
9111
|
+
/**
|
|
9112
|
+
* Gets the default type url for UploadingStateMsg
|
|
9113
|
+
* @function getTypeUrl
|
|
9114
|
+
* @memberof file.UploadingStateMsg
|
|
9115
|
+
* @static
|
|
9116
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
9117
|
+
* @returns {string} The default type url
|
|
9118
|
+
*/
|
|
9119
|
+
UploadingStateMsg.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
9120
|
+
if (typeUrlPrefix === undefined) {
|
|
9121
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
9122
|
+
}
|
|
9123
|
+
return typeUrlPrefix + "/file.UploadingStateMsg";
|
|
9124
|
+
};
|
|
9125
|
+
|
|
9126
|
+
return UploadingStateMsg;
|
|
9127
|
+
})();
|
|
9128
|
+
|
|
8811
9129
|
file.StatsMsg = (function() {
|
|
8812
9130
|
|
|
8813
9131
|
/**
|