core-3nweb-client-lib 0.48.3 → 0.48.5

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.
@@ -58,7 +58,7 @@ function exposeASMailCAP(cap, expServices) {
58
58
  removeMsg: removeMsg.wrapService(box.removeMsg),
59
59
  subscribe: inboxSubscribe.wrapService(box.subscribe, expServices)
60
60
  },
61
- config: exposeCofigCAP(cap.config)
61
+ config: exposeConfigCAP(cap.config)
62
62
  };
63
63
  }
64
64
  }
@@ -597,7 +597,7 @@ var observeDelivery;
597
597
  observeDelivery.makeCaller = makeCaller;
598
598
  })(observeDelivery || (observeDelivery = {}));
599
599
  Object.freeze(observeDelivery);
600
- function exposeCofigCAP(cap) {
600
+ function exposeConfigCAP(cap) {
601
601
  return {
602
602
  getOnServer: (0, service_side_wrap_1.wrapReqReplySrvMethod)(cap, 'getOnServer'),
603
603
  setOnServer: (0, service_side_wrap_1.wrapReqReplySrvMethod)(cap, 'setOnServer')
@@ -1,4 +1,4 @@
1
- import type { BufferEncodingOption, Mode, ObjectEncodingOptions, RmDirOptions, Stats } from 'fs';
1
+ import type { Mode, ObjectEncodingOptions, Stats } from 'fs';
2
2
  export type { Stats } from 'fs';
3
3
  export type { FileException } from '../lib-common/exceptions/file';
4
4
  /**
@@ -47,14 +47,14 @@ declare function mkdir(path: string, options?: {
47
47
  recursive?: boolean;
48
48
  }): Promise<unknown>;
49
49
  declare function open(path: string, flags?: string, mode?: Mode): Promise<FileHandle>;
50
- declare function symlink(target: string, path: string, type?: string | null): Promise<void>;
51
- declare function readlink(path: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
52
- declare function readlink(path: string, options: BufferEncodingOption): Promise<Buffer>;
53
- declare function readlink(path: string, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
50
+ declare function symlink(target: string, path: string): Promise<void>;
51
+ declare function readlink(path: string): Promise<string>;
54
52
  declare function lstat(path: string): Promise<Stats>;
55
53
  declare function stat(path: string): Promise<Stats>;
56
54
  declare function readdir(path: string): Promise<string[]>;
57
- declare function rmdir(path: string, options?: RmDirOptions): Promise<void>;
55
+ declare function rmdir(path: string, options?: {
56
+ recursive?: boolean;
57
+ }): Promise<void>;
58
58
  declare function unlink(path: string): Promise<void>;
59
59
  declare function rename(oldPath: string, newPath: string): Promise<void>;
60
60
  declare function truncate(path: string, len?: number): Promise<void>;
@@ -95,12 +95,9 @@ class ReadonlyPayloadV2 {
95
95
  if (start === end) {
96
96
  return undefined;
97
97
  }
98
- const startSecInd = this.contentSections
99
- .findIndex(s => (s.ofs <= start));
100
- const endSecInd = this.contentSections
101
- .findIndex(s => ((s.ofs + s.len) >= end));
102
- (0, assert_1.assert)((startSecInd >= 0) && (endSecInd >= 0) &&
103
- (startSecInd <= endSecInd));
98
+ const startSecInd = this.contentSections.findIndex(s => (s.ofs <= start));
99
+ const endSecInd = this.contentSections.findIndex(s => ((s.ofs + s.len) >= end));
100
+ (0, assert_1.assert)((startSecInd >= 0) && (endSecInd >= 0) && (startSecInd <= endSecInd));
104
101
  return await this.syncProc.startOrChain((startSecInd === endSecInd) ?
105
102
  async () => {
106
103
  const s = this.contentSections[startSecInd];
@@ -790,8 +787,21 @@ function payloadLayoutException(msg, cause) {
790
787
  }
791
788
  async function sureReadOfBytesFrom(src, ofs, len) {
792
789
  const bytes = await src.readAt(ofs, len);
793
- (0, assert_1.assert)(!!bytes && (bytes.length === len));
794
- return bytes;
790
+ (0, assert_1.assert)(!!bytes);
791
+ if (bytes.length === len) {
792
+ return bytes;
793
+ }
794
+ // somehow, on Android src.readAt(ofs, len) may produce a thing that is shorter than len, hence, loop below
795
+ len -= bytes.length;
796
+ ofs += bytes.length;
797
+ const chunks = [bytes];
798
+ while (len > 0) {
799
+ const chunk = await src.readAt(ofs, len);
800
+ (0, assert_1.assert)(!!chunk);
801
+ len -= chunk.length;
802
+ ofs += chunk.length;
803
+ }
804
+ return (0, buffer_utils_1.joinByteArrs)(chunks);
795
805
  }
796
806
  function noop() { }
797
807
  // XXX we may add smaller bytes for packing section info: there is enough values
@@ -17,11 +17,9 @@ export declare const appendFile: (path: string, data: string | Uint8Array, optio
17
17
  encoding: BufferEncoding;
18
18
  } | BufferEncoding): Promise<string>;
19
19
  (path: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
20
- }, readdir: (path: string) => Promise<string[]>, readlink: {
21
- (path: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
22
- (path: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
23
- (path: string, options?: import("fs").ObjectEncodingOptions | string | null): Promise<string | Buffer>;
24
- }, rename: (oldPath: string, newPath: string) => Promise<void>, rmdir: (path: string, options?: import("fs").RmDirOptions) => Promise<void>, stat: (path: string) => Promise<import("fs").Stats>, symlink: (target: string, path: string, type?: string | null) => Promise<void>, truncate: (path: string, len?: number) => Promise<void>, unlink: (path: string) => Promise<void>, writeFile: (file: string, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & {
20
+ }, readdir: (path: string) => Promise<string[]>, readlink: (path: string) => Promise<string>, rename: (oldPath: string, newPath: string) => Promise<void>, rmdir: (path: string, options?: {
21
+ recursive?: boolean;
22
+ }) => Promise<void>, stat: (path: string) => Promise<import("fs").Stats>, symlink: (target: string, path: string) => Promise<void>, truncate: (path: string, len?: number) => Promise<void>, unlink: (path: string) => Promise<void>, writeFile: (file: string, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & {
25
23
  mode?: import("fs").Mode;
26
24
  flag?: string;
27
25
  flush?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.48.3",
3
+ "version": "0.48.5",
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",
@@ -36,7 +36,7 @@
36
36
  "license": "GPL-3.0-or-later",
37
37
  "dependencies": {
38
38
  "ecma-nacl-cryptors": "^1.0.1",
39
- "protobufjs": "^7.0.1",
39
+ "protobufjs": "^7.5.5",
40
40
  "punycode": "^2.1.1",
41
41
  "rxjs": "^7.5.7",
42
42
  "ws": "^8.18.3",