core-3nweb-client-lib 0.44.5 → 0.44.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.
@@ -73,6 +73,7 @@ export interface ObjDownloader {
73
73
  getSegs: (objId: ObjId, version: number, start: number, end: number) => Promise<Uint8Array>;
74
74
  splitSegsDownloads: (start: number, end: number) => Section[];
75
75
  schedule: (download: Download) => void;
76
+ whenConnected: () => Promise<void>;
76
77
  }
77
78
  export interface InitDownloadParts {
78
79
  layout: Layout;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2018 - 2020, 2022, 2025 3NSoft Inc.
3
+ Copyright (C) 2018 - 2020, 2022, 2025 - 2026 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
@@ -423,7 +423,12 @@ class Download {
423
423
  this.inBkgrnd.runData.currentDownload.deferred.resolve(bytes);
424
424
  }
425
425
  catch (exc) {
426
- this.inBkgrnd.runData.currentDownload.deferred.reject(exc);
426
+ if (exc.type === 'connect') {
427
+ await this.downloader.whenConnected();
428
+ }
429
+ else {
430
+ this.inBkgrnd.runData.currentDownload.deferred.reject(exc);
431
+ }
427
432
  }
428
433
  finally {
429
434
  this.inBkgrnd.runData.currentDownload = undefined;
@@ -33,6 +33,8 @@ function makeStorageException(fields) {
33
33
  for (const [key, value] of Object.entries(fields)) {
34
34
  exc[key] = value;
35
35
  }
36
+ const err = new Error(`runtime exception stack`);
37
+ exc['stack'] = err.stack;
36
38
  return exc;
37
39
  }
38
40
  function makeObjNotFoundExc(objId, remoteStorage) {
@@ -818,6 +818,19 @@ class S {
818
818
  throw (0, common_1.setPathInExc)(exc, path);
819
819
  }
820
820
  }
821
+ // XXX WIP
822
+ // async compareLocalAndRemoteFileItems(
823
+ // path: string, itemName: string, remoteVersion?: number
824
+ // ): Promise<FileDiff> {
825
+ // const folderNode = await this.getFolderNode(path);
826
+ // const localChild = (await folderNode.getFile(itemName))!;
827
+ // const remoteChild = await folderNode.getRemoteItemNode(itemName, remoteVersion);
828
+ // if (remoteChild.type === 'file') {
829
+ // return await localChild.compareWithRemote(remoteChild);
830
+ // } else {
831
+ // throw makeFileException('notFile', `${path}/${itemName}`);
832
+ // }
833
+ // }
821
834
  async adoptRemoteFolderItem(path, itemName, opts) {
822
835
  const node = await this.getFolderNode(path);
823
836
  try {
@@ -13,7 +13,8 @@
13
13
  See the GNU General Public License for more details.
14
14
 
15
15
  You should have received a copy of the GNU General Public License along with
16
- this program. If not, see <http://www.gnu.org/licenses/>. */
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
17
18
  Object.defineProperty(exports, "__esModule", { value: true });
18
19
  exports.asyncIteration = asyncIteration;
19
20
  exports.asyncFind = asyncFind;
@@ -0,0 +1,7 @@
1
+ export declare class AwaitableState {
2
+ private deferredStateSetPoint;
3
+ constructor();
4
+ setState(): void;
5
+ clearState(): void;
6
+ whenStateIsSet(): Promise<void>;
7
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2017 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.AwaitableState = void 0;
20
+ const deferred_1 = require("./processes/deferred");
21
+ class AwaitableState {
22
+ constructor() {
23
+ this.deferredStateSetPoint = (0, deferred_1.defer)();
24
+ Object.seal(this);
25
+ }
26
+ setState() {
27
+ if (this.deferredStateSetPoint) {
28
+ this.deferredStateSetPoint.resolve();
29
+ this.deferredStateSetPoint = undefined;
30
+ }
31
+ }
32
+ clearState() {
33
+ if (!this.deferredStateSetPoint) {
34
+ this.deferredStateSetPoint = (0, deferred_1.defer)();
35
+ }
36
+ }
37
+ async whenStateIsSet() {
38
+ var _a;
39
+ return (_a = this.deferredStateSetPoint) === null || _a === void 0 ? void 0 : _a.promise;
40
+ }
41
+ }
42
+ exports.AwaitableState = AwaitableState;
43
+ Object.freeze(exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.44.5",
3
+ "version": "0.44.7",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",