core-3nweb-client-lib 0.27.0 → 0.27.4

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.
Files changed (81) hide show
  1. package/build/api-defs/files.d.ts +56 -26
  2. package/build/core/asmail/config/index.d.ts +2 -2
  3. package/build/core/asmail/config/index.js +2 -2
  4. package/build/core/asmail/config/invitations-anon.d.ts +10 -24
  5. package/build/core/asmail/config/invitations-anon.js +43 -31
  6. package/build/core/asmail/config/published-intro-key.d.ts +11 -22
  7. package/build/core/asmail/config/published-intro-key.js +47 -38
  8. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
  9. package/build/core/asmail/inbox/attachments/fs.js +4 -3
  10. package/build/core/asmail/inbox/index.js +2 -2
  11. package/build/core/asmail/index.d.ts +1 -1
  12. package/build/core/asmail/index.js +2 -2
  13. package/build/core/asmail/keyring/correspondent-keys.d.ts +2 -2
  14. package/build/core/asmail/keyring/correspondent-keys.js +1 -1
  15. package/build/core/asmail/keyring/index.d.ts +9 -29
  16. package/build/core/asmail/keyring/index.js +82 -69
  17. package/build/core/id-manager/index.d.ts +43 -0
  18. package/build/core/{id-manager.js → id-manager/index.js} +33 -114
  19. package/build/core/id-manager/key-storage.d.ts +21 -0
  20. package/build/core/id-manager/key-storage.js +96 -0
  21. package/build/core/index.js +22 -25
  22. package/build/core/sign-in.d.ts +1 -2
  23. package/build/core/sign-in.js +5 -14
  24. package/build/core/sign-up.d.ts +2 -0
  25. package/build/core/sign-up.js +2 -1
  26. package/build/core/storage/index.d.ts +4 -2
  27. package/build/core/storage/index.js +36 -57
  28. package/build/core/storage/local/storage.d.ts +1 -1
  29. package/build/core/storage/synced/obj-files-gc.d.ts +1 -4
  30. package/build/core/storage/synced/obj-files-gc.js +1 -18
  31. package/build/core/storage/synced/obj-files.d.ts +11 -1
  32. package/build/core/storage/synced/obj-files.js +59 -34
  33. package/build/core/storage/synced/obj-status.d.ts +19 -7
  34. package/build/core/storage/synced/obj-status.js +158 -83
  35. package/build/core/storage/synced/storage.d.ts +7 -2
  36. package/build/core/storage/synced/storage.js +38 -15
  37. package/build/core/storage/synced/upsyncer.d.ts +4 -4
  38. package/build/core/storage/synced/upsyncer.js +14 -9
  39. package/build/ipc-via-protobuf/file.d.ts +7 -0
  40. package/build/ipc-via-protobuf/file.js +60 -27
  41. package/build/ipc-via-protobuf/fs.js +55 -38
  42. package/build/lib-client/3nstorage/exceptions.d.ts +13 -1
  43. package/build/lib-client/3nstorage/exceptions.js +9 -3
  44. package/build/lib-client/3nstorage/service.d.ts +6 -2
  45. package/build/lib-client/3nstorage/service.js +33 -17
  46. package/build/lib-client/3nstorage/util/file-based-json.js +2 -1
  47. package/build/lib-client/3nstorage/util/for-arrays.d.ts +1 -0
  48. package/build/lib-client/3nstorage/util/for-arrays.js +32 -0
  49. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +5 -4
  50. package/build/lib-client/3nstorage/xsp-fs/common.js +1 -0
  51. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +5 -10
  52. package/build/lib-client/3nstorage/xsp-fs/file-node.js +43 -45
  53. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +7 -6
  54. package/build/lib-client/3nstorage/xsp-fs/file.js +14 -20
  55. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +16 -5
  56. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +238 -68
  57. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +18 -17
  58. package/build/lib-client/3nstorage/xsp-fs/fs.js +32 -37
  59. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +15 -11
  60. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +72 -22
  61. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +1 -1
  62. package/build/lib-client/local-files/device-fs.js +11 -11
  63. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +5 -2
  64. package/build/lib-client/objs-on-disk/obj-on-disk.js +16 -1
  65. package/build/lib-client/user-with-mid-session.d.ts +2 -1
  66. package/build/lib-client/user-with-mid-session.js +7 -1
  67. package/build/lib-common/async-fs-node.js +8 -8
  68. package/build/lib-common/exceptions/file.d.ts +4 -2
  69. package/build/lib-common/exceptions/file.js +24 -58
  70. package/build/lib-common/ipc/generic-ipc.js +5 -4
  71. package/build/lib-common/objs-on-disk/file-layout.js +1 -1
  72. package/build/lib-common/objs-on-disk/utils.js +1 -1
  73. package/build/lib-common/service-api/3nstorage/owner.d.ts +8 -9
  74. package/build/lib-common/service-api/3nstorage/owner.js +2 -1
  75. package/build/protos/asmail.proto.js +5943 -4348
  76. package/build/protos/file.proto.js +874 -0
  77. package/build/protos/fs.proto.js +7014 -5419
  78. package/package.json +3 -2
  79. package/protos/file.proto +23 -7
  80. package/protos/fs.proto +27 -13
  81. package/build/core/id-manager.d.ts +0 -46
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.27.0",
3
+ "version": "0.27.4",
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",
@@ -31,6 +31,7 @@
31
31
  "protobufjs": "^6.11.3",
32
32
  "punycode": "^2.1.1",
33
33
  "rxjs": "^6.5.2",
34
+ "tsuml2": "^0.6.1",
34
35
  "ws": "^7.4.6",
35
36
  "xsp-files": "^4.0.0"
36
37
  },
@@ -39,7 +40,7 @@
39
40
  "@types/node": "^16.11.7",
40
41
  "@types/ws": "^7.4.7",
41
42
  "jasmine": "^3.9.0",
42
- "spec-3nweb-server": "^1.6.1",
43
+ "spec-3nweb-server": "^1.6.3",
43
44
  "typescript": "^4.7.4"
44
45
  }
45
46
  }
package/protos/file.proto CHANGED
@@ -102,8 +102,20 @@ message FileEventMsg {
102
102
 
103
103
  // ==== ReadonlyFileVersionedAPI referable object ====
104
104
 
105
+ message VersionedReadFlags {
106
+ common.UInt64Value archived_version = 1;
107
+ common.UInt64Value remote_version = 2;
108
+ }
109
+
110
+ message RequestWithVersionedReadFlags {
111
+ VersionedReadFlags flags = 1;
112
+ }
113
+
105
114
  // --- ReadonlyFileVersionedAPI.getXAttr ---
106
- // Request body is GetXAttrRequestBody
115
+ message VersionedGetXAttrRequestBody {
116
+ string xa_name = 1;
117
+ VersionedReadFlags flags = 2;
118
+ }
107
119
  message VersionedGetXAttrReplyBody {
108
120
  uint64 version = 1;
109
121
  common.StringValue str = 2;
@@ -112,35 +124,39 @@ message VersionedGetXAttrReplyBody {
112
124
  }
113
125
 
114
126
  // --- ReadonlyFileVersionedAPI.listXAttrs ---
115
- // Request body is empty
127
+ // Request body is RequestWithVersionedReadFlags
116
128
  message VersionedListXAttrsReplyBody {
117
129
  uint64 version = 1;
118
130
  repeated string xa_names = 2;
119
131
  }
120
132
 
121
133
  // --- ReadonlyFileVersionedAPI.readBytes ---
122
- // Request body is ReadBytesRequestBody
134
+ message VersionedReadBytesRequestBody {
135
+ common.UInt64Value start = 1;
136
+ common.UInt64Value end = 2;
137
+ VersionedReadFlags flags = 10;
138
+ }
123
139
  message VersionedReadBytesReplyBody {
124
140
  uint64 version = 1;
125
141
  common.BytesValue bytes = 2;
126
142
  }
127
143
 
128
144
  // --- ReadonlyFileVersionedAPI.readTxt ---
129
- // Request body is empty
145
+ // Request body is RequestWithVersionedReadFlags
130
146
  message VersionedReadTxtReplyBody {
131
147
  uint64 version = 1;
132
148
  string txt = 2;
133
149
  }
134
150
 
135
151
  // --- ReadonlyFileVersionedAPI.readJSON ---
136
- // Request body is empty
152
+ // Request body is RequestWithVersionedReadFlags
137
153
  message VersionedReadJsonReplyBody {
138
154
  uint64 version = 1;
139
155
  string json = 2;
140
156
  }
141
157
 
142
158
  // --- ReadonlyFileVersionedAPI.getByteSource ---
143
- // Request body is empty
159
+ // Request body is RequestWithVersionedReadFlags
144
160
  message VersionedGetByteSourceReplyBody {
145
161
  uint64 version = 1;
146
162
  // src is a reference to FileByteSource
@@ -148,7 +164,7 @@ message VersionedGetByteSourceReplyBody {
148
164
  }
149
165
 
150
166
  // --- ReadonlyFileVersionedAPI.listVersions ---
151
- // Request body is empty
167
+ // Request body is RequestWithVersionedReadFlags
152
168
  message ListVersionsReplyBody {
153
169
  common.UInt64Value current = 1;
154
170
  repeated uint64 archived = 2;
package/protos/fs.proto CHANGED
@@ -231,38 +231,52 @@ message CollectionEvent {
231
231
  // ==== ReadonlyFSVersionedAPI referable object ====
232
232
 
233
233
  // --- ReadonlyFSVersionedAPI.getXAttr ---
234
- // Request body is GetXAttrRequestBody
234
+ message VersionedGetXAttrRequestBody {
235
+ string path = 1;
236
+ string xa_name = 2;
237
+ file.VersionedReadFlags flags = 10;
238
+ }
235
239
  // Reply body is file.VersionedGetXAttrReplyBody
236
240
 
241
+ message PathAndFlagsRequestBody {
242
+ string path = 1;
243
+ file.VersionedReadFlags flags = 2;
244
+ }
245
+
237
246
  // --- ReadonlyFSVersionedAPI.listXAttrs ---
238
- // Request body is PathOnlyRequestBody
247
+ // Request body is PathAndFlagsRequestBody
239
248
  // Reply body is file.VersionedListXAttrsReplyBody
240
249
 
241
250
  // --- ReadonlyFSVersionedAPI.listFolder ---
242
- // Request body is PathOnlyRequestBody
251
+ // Request body is PathAndFlagsRequestBody
243
252
  message VersionedListFolderReplyBody {
244
253
  uint64 version = 1;
245
254
  repeated ListingEntryMsg entries = 2;
246
255
  }
247
256
 
248
257
  // --- ReadonlyFSVersionedAPI.readJSONFile ---
249
- // Request body is PathOnlyRequestBody
258
+ // Request body is PathAndFlagsRequestBody
250
259
  // Reply body is file.VersionedReadJsonReplyBody
251
260
 
252
261
  // --- ReadonlyFSVersionedAPI.readTxtFile ---
253
- // Request body is PathOnlyRequestBody
262
+ // Request body is PathAndFlagsRequestBody
254
263
  // Reply body is file.VersionedReadTxtReplyBody
255
264
 
256
265
  // --- ReadonlyFSVersionedAPI.readBytes ---
257
- // Request body is ReadBytesRequestBody
266
+ message VersionedReadBytesRequestBody {
267
+ string path = 1;
268
+ common.UInt64Value start = 2;
269
+ common.UInt64Value end = 3;
270
+ file.VersionedReadFlags flags = 10;
271
+ }
258
272
  // Reply body is file.VersionedReadBytesReplyBody
259
273
 
260
274
  // --- ReadonlyFSVersionedAPI.getByteSource ---
261
- // Request body is PathOnlyRequestBody
275
+ // Request body is PathAndFlagsRequestBody
262
276
  // Reply body is file.VersionedGetByteSourceReplyBody
263
277
 
264
278
  // --- ReadonlyFSVersionedAPI.getByteSource ---
265
- // Request body is PathOnlyRequestBody
279
+ // Request body is PathAndFlagsRequestBody
266
280
  // Reply body is file.ListVersionsReplyBody
267
281
 
268
282
 
@@ -406,10 +420,10 @@ message WriteBytesRequestBody {
406
420
  message VersionedWriteJsonFileRequestBody {
407
421
  string path = 1;
408
422
  string json = 2;
409
- VersionedFileFlags flags = 3;
423
+ VersionedFileWriteFlags flags = 3;
410
424
  }
411
425
 
412
- message VersionedFileFlags {
426
+ message VersionedFileWriteFlags {
413
427
  common.BooleanValue truncate = 1;
414
428
  common.BooleanValue create = 2;
415
429
  common.BooleanValue exclusive = 3;
@@ -421,7 +435,7 @@ message VersionedFileFlags {
421
435
  message VersionedWriteTxtFileRequestBody {
422
436
  string path = 1;
423
437
  string txt = 2;
424
- VersionedFileFlags flags = 3;
438
+ VersionedFileWriteFlags flags = 3;
425
439
  }
426
440
 
427
441
  // --- WritableFSVersionedAPI.writeBytes ---
@@ -429,14 +443,14 @@ message VersionedWriteTxtFileRequestBody {
429
443
  message VersionedWriteBytesRequestBody {
430
444
  string path = 1;
431
445
  bytes bytes = 2;
432
- VersionedFileFlags flags = 3;
446
+ VersionedFileWriteFlags flags = 3;
433
447
  }
434
448
 
435
449
  // --- WritableFSVersionedAPI.getByteSink ---
436
450
  // Reply body is file.VersionedGetByteSinkReplyBody
437
451
  message VersionedGetByteSinkRequestBody {
438
452
  string path = 1;
439
- VersionedFileFlags flags = 2;
453
+ VersionedFileWriteFlags flags = 2;
440
454
  }
441
455
 
442
456
  // --- WritableFSVersionedAPI.archiveCurrent ---
@@ -1,46 +0,0 @@
1
- import { user as mid } from '../lib-common/mid-sigs-NaCl-Ed';
2
- import { JsonKey } from '../lib-common/jwkeys';
3
- import { GenerateKey } from './sign-in';
4
- import { LogError, LogWarning } from '../lib-client/logging/log-to-file';
5
- import { NetClient } from '../lib-client/request-utils';
6
- import { ServiceLocator } from '../lib-client/service-locator';
7
- declare type WritableFS = web3n.files.WritableFS;
8
- /**
9
- * This function completes provisioning process, returning a promise, resolvable
10
- * to either true, when all is done, or to false, when challenge reply is not
11
- * accepted by the server.
12
- */
13
- export interface CompleteProvisioning {
14
- keyParams: any;
15
- complete(defaultSKey: Uint8Array): Promise<boolean>;
16
- }
17
- /**
18
- * This returns a promise, resolvable to mailerId signer.
19
- */
20
- export declare type GetSigner = () => Promise<mid.MailerIdSigner>;
21
- export declare class IdManager {
22
- private makeNet;
23
- private midServiceFor;
24
- private readonly logError;
25
- private readonly logWarning;
26
- private address;
27
- private signer;
28
- private localFS;
29
- private syncedFS;
30
- private provisioningProc;
31
- private constructor();
32
- static initInOneStepWithoutStore(address: string, midLoginKey: GenerateKey | Uint8Array, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<IdManager | undefined>;
33
- static initWithoutStore(address: string, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<((midLoginKey: GenerateKey | Uint8Array) => Promise<IdManager | undefined>) | undefined>;
34
- static initFromLocalStore(address: string, localFS: WritableFS, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<IdManager | undefined>;
35
- private ensureLocalCacheOfKeys;
36
- private getSavedKey;
37
- setStorages(localFS: WritableFS | undefined, syncedFS: WritableFS, keysToSave?: JsonKey[]): Promise<void>;
38
- private provisionWithGivenKey;
39
- private provisionUsingSavedKey;
40
- getId(): string;
41
- getSigner: GetSigner;
42
- isProvisionedAndValid(): boolean;
43
- makeMailerIdCAP(): Service;
44
- }
45
- declare type Service = web3n.mailerid.Service;
46
- export {};