core-3nweb-client-lib 0.53.13 → 0.53.14

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.
@@ -122,10 +122,9 @@ class WIP {
122
122
  return;
123
123
  }
124
124
  this.state.stage = undefined;
125
- if (!this.sender.sessionId) {
126
- return;
125
+ if (this.sender.sessionId) {
126
+ await this.sender.cancelDelivery();
127
127
  }
128
- await this.sender.cancelDelivery();
129
128
  });
130
129
  }
131
130
  async startSession() {
@@ -437,7 +437,6 @@ class PerAppStorage {
437
437
  constructor(appFSsFactory, appDomain, policy) {
438
438
  this.appFSsFactory = appFSsFactory;
439
439
  this.policy = policy;
440
- this.appFSs = new Map();
441
440
  this.revAppDomain = reverseDomain(appDomain);
442
441
  Object.seal(this);
443
442
  }
@@ -453,29 +452,21 @@ class PerAppStorage {
453
452
  cap.getSysFS = this.getSysFS.bind(this);
454
453
  }
455
454
  Object.freeze(cap);
456
- return { cap, close: () => this.close() };
455
+ return { cap, close: () => { } };
457
456
  }
458
457
  async getAppSyncedFS(appName) {
459
458
  if (!appName) {
460
459
  appName = this.revAppDomain;
461
460
  }
462
461
  this.ensureAppFSAllowed(appName, 'synced');
463
- let appFS = this.appFSs.get(appName);
464
- if (!appFS) {
465
- appFS = await this.appFSsFactory.makeSyncedFSForApp(appName);
466
- }
467
- return appFS;
462
+ return await this.appFSsFactory.makeSyncedFSForApp(appName);
468
463
  }
469
464
  async getAppLocalFS(appName) {
470
465
  if (!appName) {
471
466
  appName = this.revAppDomain;
472
467
  }
473
468
  this.ensureAppFSAllowed(appName, 'local');
474
- let appFS = this.appFSs.get(appName);
475
- if (!appFS) {
476
- appFS = await this.appFSsFactory.makeLocalFSForApp(appName);
477
- }
478
- return appFS;
469
+ return await this.appFSsFactory.makeLocalFSForApp(appName);
479
470
  }
480
471
  /**
481
472
  * This throws up, if given file system is not allowed to be opened.
@@ -515,12 +506,6 @@ class PerAppStorage {
515
506
  const sysFS = await this.appFSsFactory.getSysFSs(type);
516
507
  return applyPolicyToFSItem(sysFS, policy, path);
517
508
  }
518
- close() {
519
- for (const fs of this.appFSs.values()) {
520
- this.appFSsFactory.addPreCloseWait(fs.close());
521
- }
522
- this.appFSs.clear();
523
- }
524
509
  }
525
510
  Object.freeze(PerAppStorage.prototype);
526
511
  Object.freeze(PerAppStorage);
@@ -518,6 +518,7 @@ class ObjStatus {
518
518
  const { local, remote } = this.status;
519
519
  if (this.stateIndicator !== 'behind') {
520
520
  if (this.stateIndicator === 'synced') {
521
+ // sync has already been done, nothing to do
521
522
  return;
522
523
  }
523
524
  else if ((this.stateIndicator === 'conflicting') && !version) {
@@ -1,3 +1,3 @@
1
1
  import * as https from 'https';
2
2
  import { RequestFn } from '../lib-client/request-utils';
3
- export declare function makeRequestFromNode(getAgent?: () => https.Agent | undefined): RequestFn<unknown>;
3
+ export declare function makeRequestFromNode(getAgent?: () => https.Agent | undefined, timeout?: number): RequestFn<unknown>;
@@ -23,9 +23,19 @@ const request_utils_1 = require("../lib-client/request-utils");
23
23
  // XXX
24
24
  // we need a request that uses http2, connected to some host:port, relying on downstream
25
25
  // making NetClient requester for every host:port.
26
- function makeRequestFromNode(getAgent) {
27
- const nodeHttpsRequest = (opts) => https.request(opts);
28
- const nodeHttpRequest = (opts) => http.request(opts);
26
+ function makeRequestFromNode(getAgent, timeout = 10000) {
27
+ const nodeHttpsRequest = (opts) => {
28
+ if (!opts.timeout) {
29
+ opts.timeout = timeout;
30
+ }
31
+ return https.request(opts);
32
+ };
33
+ const nodeHttpRequest = (opts) => {
34
+ if (!opts.timeout) {
35
+ opts.timeout = timeout;
36
+ }
37
+ return http.request(opts);
38
+ };
29
39
  return (opts, reqContentType, reqBody) => {
30
40
  const reqOpts = (0, request_utils_1.formHttpsReqOpts)(opts, reqContentType, reqBody);
31
41
  const agent = getAgent === null || getAgent === void 0 ? void 0 : getAgent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.53.13",
3
+ "version": "0.53.14",
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",