core-3nweb-client-lib 0.44.2 → 0.44.3

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.
@@ -86,6 +86,7 @@ function wrapWritableFileSyncAPI(sImpl) {
86
86
  return;
87
87
  }
88
88
  const w = {
89
+ whenConnected: sImpl.whenConnected.bind(sImpl),
89
90
  status: sImpl.status.bind(sImpl),
90
91
  startDownload: sImpl.startDownload.bind(sImpl),
91
92
  isRemoteVersionOnDisk: sImpl.isRemoteVersionOnDisk.bind(sImpl),
@@ -140,6 +141,7 @@ function wrapReadonlyFileSyncAPI(sImpl) {
140
141
  return;
141
142
  }
142
143
  const w = {
144
+ whenConnected: sImpl.whenConnected.bind(sImpl),
143
145
  status: sImpl.status.bind(sImpl),
144
146
  startDownload: sImpl.startDownload.bind(sImpl),
145
147
  isRemoteVersionOnDisk: sImpl.isRemoteVersionOnDisk.bind(sImpl),
@@ -235,6 +237,7 @@ function wrapWritableFSSyncAPI(sImpl) {
235
237
  return;
236
238
  }
237
239
  const w = {
240
+ whenConnected: sImpl.whenConnected.bind(sImpl),
238
241
  status: sImpl.status.bind(sImpl),
239
242
  startDownload: sImpl.startDownload.bind(sImpl),
240
243
  isRemoteVersionOnDisk: sImpl.isRemoteVersionOnDisk.bind(sImpl),
@@ -303,6 +306,7 @@ function wrapReadonlyFSSyncAPI(sImpl) {
303
306
  return;
304
307
  }
305
308
  const w = {
309
+ whenConnected: sImpl.whenConnected.bind(sImpl),
306
310
  status: sImpl.status.bind(sImpl),
307
311
  startDownload: sImpl.startDownload.bind(sImpl),
308
312
  isRemoteVersionOnDisk: sImpl.isRemoteVersionOnDisk.bind(sImpl),
@@ -121,6 +121,7 @@ export interface SyncedStorage extends Storage {
121
121
  suspendNetworkActivity(): void;
122
122
  resumeNetworkActivity(): void;
123
123
  connectionEvent$: Observable<StorageConnectionStatus>;
124
+ whenConnected(): Promise<void>;
124
125
  }
125
126
  export interface SyncedObjStatus extends LocalObjStatus {
126
127
  syncStatus(): SyncStatus;
@@ -127,6 +127,7 @@ function wrapSyncStorageImplementation(impl) {
127
127
  wrap.resumeNetworkActivity = impl.resumeNetworkActivity.bind(impl);
128
128
  wrap.getNumOfBytesNeedingDownload = impl.getNumOfBytesNeedingDownload.bind(impl);
129
129
  wrap.connectionEvent$ = impl.connectionEvent$;
130
+ wrap.whenConnected = impl.whenConnected.bind(impl);
130
131
  return Object.freeze(wrap);
131
132
  }
132
133
  function isSyncedStorage(storage) {
@@ -44,6 +44,7 @@ export declare class FileNode extends NodeInFS<FilePersistance> {
44
44
  private static initWithAttrs;
45
45
  protected setCurrentStateFrom(src: ObjSource): Promise<void>;
46
46
  private setUpdatedState;
47
+ getStorage(): Storage;
47
48
  getStats(flags?: VersionedReadFlags): Promise<Stats>;
48
49
  readSrc(flags: VersionedReadFlags | undefined): Promise<{
49
50
  src: FileByteSource;
@@ -126,6 +126,9 @@ class FileNode extends node_in_fs_1.NodeInFS {
126
126
  this.fileSize = fileAttrs.size;
127
127
  super.setUpdatedParams(version, fileAttrs.attrs, fileAttrs.xattrs);
128
128
  }
129
+ getStorage() {
130
+ return this.storage;
131
+ }
129
132
  async getStats(flags) {
130
133
  const { stats, attrs } = await this.getStatsAndSize(flags);
131
134
  stats.size = (attrs ? attrs.size : this.fileSize);
@@ -100,6 +100,7 @@ declare class V implements WritableFileVersionedAPI, N {
100
100
  declare class S implements WritableFileSyncAPI {
101
101
  private readonly n;
102
102
  constructor(n: N);
103
+ whenConnected(): Promise<void>;
103
104
  startUpload(opts?: OptionsToUploadLocal): Promise<{
104
105
  uploadVersion: number;
105
106
  uploadTaskId: number;
@@ -224,6 +224,9 @@ class S {
224
224
  this.n = n;
225
225
  Object.freeze(this);
226
226
  }
227
+ async whenConnected() {
228
+ return (await this.n.getNode()).getStorage().whenConnected();
229
+ }
227
230
  async startUpload(opts) {
228
231
  this.n.ensureIsWritable();
229
232
  const node = await this.n.getNode();
@@ -166,6 +166,7 @@ declare class V implements WritableFSVersionedAPI, N {
166
166
  declare class S implements WritableFSSyncAPI {
167
167
  private readonly n;
168
168
  constructor(n: N);
169
+ whenConnected(): Promise<void>;
169
170
  startUpload(path: string, opts?: OptionsToUploadLocal): Promise<{
170
171
  uploadVersion: number;
171
172
  uploadTaskId: number;
@@ -708,6 +708,9 @@ class S {
708
708
  this.n = n;
709
709
  Object.freeze(this);
710
710
  }
711
+ whenConnected() {
712
+ return this.n.getRootIfNotClosed('').getStorage().whenConnected();
713
+ }
711
714
  async startUpload(path, opts) {
712
715
  this.n.ensureIsWritable();
713
716
  const node = await this.n.get(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.44.2",
3
+ "version": "0.44.3",
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",
package/protos/file.proto CHANGED
@@ -268,6 +268,10 @@ message ArchiveCurrentRequestBody {
268
268
 
269
269
  // ==== ReadonlyFileSyncAPI referable object ====
270
270
 
271
+ // --- ReadonlyFileSyncAPI.whenConnected ---
272
+ // Request body is empty
273
+ // Reply body is empty
274
+
271
275
  // --- ReadonlyFileSyncAPI.status ---
272
276
  // Request body is common.BooleanValue
273
277
  // Reply body is SyncStatusMsg
package/protos/fs.proto CHANGED
@@ -216,6 +216,10 @@ message CollectionEvent {
216
216
 
217
217
  // ==== ReadonlyFSVersionedAPI referable object ====
218
218
 
219
+ // --- ReadonlyFSVersionedAPI.whenConnected ---
220
+ // Request body is empty
221
+ // Reply body is empty
222
+
219
223
  // --- ReadonlyFSVersionedAPI.stat ---
220
224
  // Request body is PathAndFlagsRequestBody
221
225
  // Reply body is file.StatsMsg