core-3nweb-client-lib 0.25.6 → 0.27.0

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 (215) hide show
  1. package/README.md +2 -2
  2. package/build/api-defs/asmail.d.ts +1 -1
  3. package/build/api-defs/files.d.ts +282 -70
  4. package/build/core/app-files.js +7 -7
  5. package/build/core/asmail/config/common.js +4 -4
  6. package/build/core/asmail/config/index.js +2 -2
  7. package/build/core/asmail/config/published-intro-key.js +1 -1
  8. package/build/core/asmail/delivery/common.js +7 -7
  9. package/build/core/asmail/delivery/index.js +7 -6
  10. package/build/core/asmail/delivery/msg.js +8 -7
  11. package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
  12. package/build/core/asmail/inbox/attachments/fs.js +11 -1
  13. package/build/core/asmail/inbox/cached-msgs.js +3 -3
  14. package/build/core/asmail/inbox/inbox-events.js +5 -4
  15. package/build/core/asmail/inbox/index.js +12 -12
  16. package/build/core/asmail/inbox/msg-downloader.js +3 -3
  17. package/build/core/asmail/inbox/msg-indexing.js +4 -4
  18. package/build/core/asmail/inbox/msg-on-disk.js +7 -7
  19. package/build/core/asmail/index.d.ts +3 -3
  20. package/build/core/asmail/index.js +13 -8
  21. package/build/core/asmail/key-verification.js +5 -5
  22. package/build/core/asmail/keyring/common.js +7 -6
  23. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  24. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  25. package/build/core/asmail/keyring/index.d.ts +7 -8
  26. package/build/core/asmail/keyring/index.js +15 -14
  27. package/build/core/asmail/keyring/keyring-storage.js +4 -3
  28. package/build/core/asmail/msg/opener.js +3 -3
  29. package/build/core/asmail/msg/packer.js +13 -13
  30. package/build/core/asmail/sending-params/own-params.js +4 -4
  31. package/build/core/asmail/sending-params/params-from-others.js +3 -3
  32. package/build/core/id-manager.js +8 -5
  33. package/build/core/index.d.ts +2 -1
  34. package/build/core/index.js +14 -14
  35. package/build/core/sign-in.d.ts +5 -4
  36. package/build/core/sign-in.js +12 -14
  37. package/build/core/sign-up.d.ts +1 -0
  38. package/build/core/sign-up.js +15 -11
  39. package/build/core/storage/common/json-saving.d.ts +21 -0
  40. package/build/core/storage/common/json-saving.js +82 -0
  41. package/build/core/storage/common/obj-info-file.d.ts +51 -0
  42. package/build/core/storage/common/obj-info-file.js +153 -5
  43. package/build/core/storage/common/utils.d.ts +2 -0
  44. package/build/core/storage/common/utils.js +32 -0
  45. package/build/core/storage/index.d.ts +3 -17
  46. package/build/core/storage/index.js +57 -77
  47. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  48. package/build/core/storage/local/obj-files-gc.js +53 -39
  49. package/build/core/storage/local/obj-files.d.ts +6 -9
  50. package/build/core/storage/local/obj-files.js +16 -19
  51. package/build/core/storage/local/obj-status.d.ts +20 -30
  52. package/build/core/storage/local/obj-status.js +46 -113
  53. package/build/core/storage/local/storage.d.ts +15 -5
  54. package/build/core/storage/local/storage.js +37 -18
  55. package/build/core/storage/synced/downloader.js +7 -6
  56. package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
  57. package/build/core/storage/synced/obj-files-gc.js +106 -13
  58. package/build/core/storage/synced/obj-files.d.ts +46 -47
  59. package/build/core/storage/synced/obj-files.js +207 -154
  60. package/build/core/storage/synced/obj-status.d.ts +103 -42
  61. package/build/core/storage/synced/obj-status.js +525 -137
  62. package/build/core/storage/synced/remote-events.d.ts +11 -12
  63. package/build/core/storage/synced/remote-events.js +80 -57
  64. package/build/core/storage/synced/storage.d.ts +24 -5
  65. package/build/core/storage/synced/storage.js +123 -38
  66. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  67. package/build/core/storage/synced/upload-header-file.js +64 -0
  68. package/build/core/storage/synced/upsyncer.d.ts +15 -9
  69. package/build/core/storage/synced/upsyncer.js +219 -246
  70. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  71. package/build/core/storage/system-folders/apps-data.js +110 -0
  72. package/build/core/storage/system-folders/index.d.ts +18 -0
  73. package/build/core/storage/system-folders/index.js +77 -0
  74. package/build/core-ipc/common-caps.js +3 -3
  75. package/build/core-ipc/generic.js +8 -8
  76. package/build/core-ipc/startup-caps.js +2 -2
  77. package/build/cryptors.js +6 -2
  78. package/build/ipc-via-protobuf/asmail-cap.js +67 -83
  79. package/build/ipc-via-protobuf/bytes.js +16 -17
  80. package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
  81. package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
  82. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  83. package/build/ipc-via-protobuf/connector.js +4 -4
  84. package/build/ipc-via-protobuf/file.d.ts +48 -12
  85. package/build/ipc-via-protobuf/file.js +476 -120
  86. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  87. package/build/ipc-via-protobuf/fs.js +592 -159
  88. package/build/ipc-via-protobuf/log-cap.js +2 -2
  89. package/build/ipc-via-protobuf/mailerid.js +3 -3
  90. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  91. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  92. package/build/ipc-via-protobuf/startup-cap.js +23 -23
  93. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  94. package/build/ipc.js +7 -2
  95. package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
  96. package/build/lib-client/3nstorage/exceptions.js +31 -10
  97. package/build/lib-client/3nstorage/service.d.ts +16 -2
  98. package/build/lib-client/3nstorage/service.js +109 -39
  99. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  100. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  101. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  102. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
  103. package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
  104. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  105. package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
  106. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  107. package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
  108. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  109. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  110. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
  111. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
  112. package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
  113. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  114. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  115. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
  116. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
  117. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  118. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
  119. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
  120. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
  121. package/build/lib-client/3nweb-signup.js +4 -4
  122. package/build/lib-client/asmail/recipient.js +15 -15
  123. package/build/lib-client/asmail/sender.js +22 -22
  124. package/build/lib-client/asmail/service-config.js +3 -3
  125. package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
  126. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  127. package/build/lib-client/cryptor/cryptor.js +4 -2
  128. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  129. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  130. package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
  131. package/build/lib-client/cryptor/worker-js.js +2 -2
  132. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  133. package/build/lib-client/files-select.js +1 -1
  134. package/build/lib-client/files.d.ts +1 -1
  135. package/build/lib-client/files.js +71 -4
  136. package/build/lib-client/fs-collection.js +3 -2
  137. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  138. package/build/lib-client/fs-sync-utils.js +61 -0
  139. package/build/lib-client/fs-view.d.ts +14 -0
  140. package/build/lib-client/fs-view.js +33 -0
  141. package/build/lib-client/key-derivation.js +1 -1
  142. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  143. package/build/lib-client/local-files/dev-file-src.js +2 -2
  144. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  145. package/build/lib-client/local-files/device-fs.js +56 -54
  146. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  147. package/build/lib-client/logging/log-to-file.js +11 -11
  148. package/build/lib-client/mailer-id/login.js +7 -7
  149. package/build/lib-client/mailer-id/provisioner.js +12 -12
  150. package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
  151. package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
  152. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  153. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  154. package/build/lib-client/request-utils.d.ts +1 -0
  155. package/build/lib-client/request-utils.js +14 -14
  156. package/build/lib-client/server-events.d.ts +3 -3
  157. package/build/lib-client/server-events.js +12 -10
  158. package/build/lib-client/service-locator.js +10 -10
  159. package/build/lib-client/user-with-mid-session.js +7 -7
  160. package/build/lib-client/user-with-pkl-session.js +25 -25
  161. package/build/lib-client/ws-utils.js +3 -3
  162. package/build/lib-common/async-cryptor-wrap.js +4 -4
  163. package/build/lib-common/async-fs-node.d.ts +5 -3
  164. package/build/lib-common/async-fs-node.js +19 -18
  165. package/build/lib-common/byte-streaming/pipe.js +1 -1
  166. package/build/lib-common/byte-streaming/wrapping.js +17 -17
  167. package/build/lib-common/canonical-address.js +1 -1
  168. package/build/lib-common/exceptions/error.d.ts +1 -0
  169. package/build/lib-common/exceptions/error.js +7 -6
  170. package/build/lib-common/exceptions/file.js +10 -1
  171. package/build/lib-common/ipc/generic-ipc.js +2 -2
  172. package/build/lib-common/ipc/ws-ipc.js +2 -2
  173. package/build/lib-common/json-utils.js +2 -1
  174. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  175. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  176. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  177. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  178. package/build/lib-common/objs-on-disk/obj-file.js +99 -37
  179. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  180. package/build/lib-common/objs-on-disk/utils.js +4 -4
  181. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  182. package/build/lib-common/processes/deferred.d.ts +6 -0
  183. package/build/lib-common/processes/deferred.js +30 -0
  184. package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
  185. package/build/lib-common/processes/labelled-exec-pools.js +141 -0
  186. package/build/lib-common/processes/pressure.d.ts +7 -0
  187. package/build/lib-common/processes/pressure.js +56 -0
  188. package/build/lib-common/processes/sleep.d.ts +1 -0
  189. package/build/lib-common/processes/sleep.js +26 -0
  190. package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
  191. package/build/lib-common/{processes.js → processes/synced.js} +187 -204
  192. package/build/lib-common/processes/timeout.d.ts +1 -0
  193. package/build/lib-common/processes/timeout.js +51 -0
  194. package/build/lib-common/random-node.js +7 -7
  195. package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
  196. package/build/lib-common/service-api/3nstorage/owner.js +85 -42
  197. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  198. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  199. package/build/lib-common/timed-cache.d.ts +1 -0
  200. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  201. package/build/lib-common/timed-non-weak-cache.js +11 -0
  202. package/build/lib-common/utils-for-observables.d.ts +15 -1
  203. package/build/lib-common/utils-for-observables.js +70 -19
  204. package/build/lib-common/weak-cache.d.ts +1 -0
  205. package/build/lib-common/weak-cache.js +12 -1
  206. package/build/lib-index.d.ts +2 -1
  207. package/build/lib-index.js +10 -7
  208. package/build/protos/asmail.proto.js +12912 -7127
  209. package/build/protos/file.proto.js +4848 -2399
  210. package/build/protos/fs.proto.js +9230 -3445
  211. package/package.json +8 -7
  212. package/protos/file.proto +91 -11
  213. package/protos/fs.proto +107 -8
  214. package/build/core/storage/synced/upsync-status.d.ts +0 -41
  215. package/build/core/storage/synced/upsync-status.js +0 -158
@@ -16,7 +16,7 @@
16
16
  this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.fsItem = exports.fsMsgType = exports.exposeFSService = exports.makeFSCaller = void 0;
19
+ exports.optionsToAdoptRemoteItemFromMsg = exports.optionsToAdoptRemoteItemToMsg = exports.fsItem = exports.fsMsgType = exports.exposeFSService = exports.makeFSCaller = void 0;
20
20
  const protobuf_msg_1 = require("./protobuf-msg");
21
21
  const protobuf_type_1 = require("../lib-client/protobuf-type");
22
22
  const fs_proto_1 = require("../protos/fs.proto");
@@ -26,10 +26,11 @@ const file = require("./file");
26
26
  const assert_1 = require("../lib-common/assert");
27
27
  const bytes_1 = require("./bytes");
28
28
  const rxjs_1 = require("rxjs");
29
- const processes_1 = require("../lib-common/processes");
29
+ const deferred_1 = require("../lib-common/processes/deferred");
30
30
  const operators_1 = require("rxjs/operators");
31
+ const utils_for_observables_1 = require("../lib-common/utils-for-observables");
31
32
  function makeFSCaller(caller, fsMsg) {
32
- connector_1.checkRefObjTypeIs('FSImpl', fsMsg.impl);
33
+ (0, connector_1.checkRefObjTypeIs)('FSImpl', fsMsg.impl);
33
34
  const objPath = fsMsg.impl.path;
34
35
  const fs = {
35
36
  name: fsMsg.name,
@@ -53,7 +54,7 @@ function makeFSCaller(caller, fsMsg) {
53
54
  stat: stat.makeCaller(caller, objPath),
54
55
  watchFolder: watch.makeFolderCaller(caller, objPath),
55
56
  watchFile: watch.makeFileCaller(caller, objPath),
56
- watchTree: watch.makeTreeCaller(caller, objPath),
57
+ watchTree: watchTree.makeCaller(caller, objPath),
57
58
  };
58
59
  if (fsMsg.writable) {
59
60
  fs.copyFile = copyFile.makeCaller(caller, objPath);
@@ -84,13 +85,31 @@ function makeFSCaller(caller, fsMsg) {
84
85
  readBytes: vReadBytes.makeCaller(caller, vPath),
85
86
  readJSONFile: vReadJSONFile.makeCaller(caller, vPath),
86
87
  readTxtFile: vReadTxtFile.makeCaller(caller, vPath),
88
+ listVersions: vListVersions.makeCaller(caller, vPath)
87
89
  };
88
- if (fsMsg.writable) {
90
+ if (fs.writable) {
89
91
  fs.v.getByteSink = vGetByteSink.makeCaller(caller, vPath);
90
92
  fs.v.writeBytes = vWriteBytes.makeCaller(caller, vPath);
91
93
  fs.v.writeJSONFile = vWriteJSONFile.makeCaller(caller, vPath);
92
94
  fs.v.writeTxtFile = vWriteTxtFile.makeCaller(caller, vPath);
93
95
  fs.v.updateXAttrs = vUpdateXAttrs.makeCaller(caller, vPath);
96
+ fs.v.archiveCurrent = vArchiveCurrent.makeCaller(caller, vPath);
97
+ }
98
+ if (fsMsg.isSynced) {
99
+ const vsPath = objPath.concat('v', 'sync');
100
+ fs.v.sync = {
101
+ status: vsStatus.makeCaller(caller, vsPath),
102
+ updateStatusInfo: vsUpdateStatusInfo.makeCaller(caller, vsPath),
103
+ isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.makeCaller(caller, vsPath),
104
+ download: vsDownload.makeCaller(caller, vsPath),
105
+ adoptRemote: vsAdoptRemote.makeCaller(caller, vsPath),
106
+ diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.makeCaller(caller, vsPath)
107
+ };
108
+ if (fs.writable) {
109
+ fs.v.sync.upload = vsUpload.makeCaller(caller, vsPath);
110
+ fs.v.sync.adoptRemoteFolderItem =
111
+ vsAdoptRemoteFolderItem.makeCaller(caller, vsPath);
112
+ }
94
113
  }
95
114
  }
96
115
  caller.registerClientDrop(fs, fsMsg.impl);
@@ -117,7 +136,7 @@ function exposeFSService(fs, expServices) {
117
136
  stat: stat.wrapService(fs.stat),
118
137
  watchFolder: watch.wrapService(fs.watchFolder, packFSEvent),
119
138
  watchFile: watch.wrapService(fs.watchFile, file_1.packFileEvent),
120
- watchTree: watch.wrapService(fs.watchTree, packFSEvent),
139
+ watchTree: watchTree.wrapService(fs.watchTree),
121
140
  };
122
141
  if (fs.writable) {
123
142
  implExp.copyFile = copyFile.wrapService(fs.copyFile);
@@ -147,6 +166,7 @@ function exposeFSService(fs, expServices) {
147
166
  readBytes: vReadBytes.wrapService(fs.v.readBytes),
148
167
  readJSONFile: vReadJSONFile.wrapService(fs.v.readJSONFile),
149
168
  readTxtFile: vReadTxtFile.wrapService(fs.v.readTxtFile),
169
+ listVersions: vListVersions.wrapService(fs.v.listVersions)
150
170
  };
151
171
  if (fs.writable) {
152
172
  implExp.v.getByteSink = vGetByteSink.wrapService(fs.v.getByteSink, expServices);
@@ -154,12 +174,29 @@ function exposeFSService(fs, expServices) {
154
174
  implExp.v.writeJSONFile = vWriteJSONFile.wrapService(fs.v.writeJSONFile);
155
175
  implExp.v.writeTxtFile = vWriteTxtFile.wrapService(fs.v.writeTxtFile);
156
176
  implExp.v.updateXAttrs = vUpdateXAttrs.wrapService(fs.v.updateXAttrs);
177
+ implExp.v.archiveCurrent = vArchiveCurrent.wrapService(fs.v.archiveCurrent);
178
+ }
179
+ if (fs.v.sync) {
180
+ implExp.v.sync = {
181
+ status: vsStatus.wrapService(fs.v.sync.status),
182
+ updateStatusInfo: vsUpdateStatusInfo.wrapService(fs.v.sync.updateStatusInfo),
183
+ isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.wrapService(fs.v.sync.isRemoteVersionOnDisk),
184
+ download: vsDownload.wrapService(fs.v.sync.download),
185
+ adoptRemote: vsAdoptRemote.wrapService(fs.v.sync.adoptRemote),
186
+ diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.wrapService(fs.v.sync.diffCurrentAndRemoteFolderVersions)
187
+ };
188
+ if (fs.writable) {
189
+ implExp.v.sync.upload = vsUpload.wrapService(fs.v.sync.upload);
190
+ implExp.v.sync.adoptRemoteFolderItem =
191
+ vsAdoptRemoteFolderItem.wrapService(fs.v.sync.adoptRemoteFolderItem);
192
+ }
157
193
  }
158
194
  }
159
195
  const impl = expServices.exposeDroppableService('FSImpl', implExp, fs);
160
196
  const fsMsg = {
161
197
  impl,
162
198
  isVersioned: !!fs.v,
199
+ isSynced: !!(fs.v && fs.v.sync),
163
200
  name: fs.name,
164
201
  type: fs.type,
165
202
  writable: fs.writable
@@ -174,7 +211,7 @@ var checkPresence;
174
211
  function wrapService(fn) {
175
212
  return buf => {
176
213
  const { path, throwIfMissing } = requestType.unpack(buf);
177
- const promise = fn(path, protobuf_msg_1.valOfOpt(throwIfMissing))
214
+ const promise = fn(path, (0, protobuf_msg_1.valOfOpt)(throwIfMissing))
178
215
  .then(found => protobuf_msg_1.boolValType.pack({ value: found }));
179
216
  return { promise };
180
217
  };
@@ -183,7 +220,7 @@ var checkPresence;
183
220
  function makeCaller(caller, objPath) {
184
221
  return (path, throwIfMissing) => caller
185
222
  .startPromiseCall(objPath, requestType.pack({
186
- path, throwIfMissing: protobuf_msg_1.toOptVal(throwIfMissing)
223
+ path, throwIfMissing: (0, protobuf_msg_1.toOptVal)(throwIfMissing)
187
224
  }))
188
225
  .then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
189
226
  }
@@ -258,7 +295,7 @@ var listXAttrs;
258
295
  const ipcPath = objPath.concat('listXAttrs');
259
296
  return path => caller
260
297
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
261
- .then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
298
+ .then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
262
299
  }
263
300
  listXAttrs.makeCaller = makeCaller;
264
301
  })(listXAttrs || (listXAttrs = {}));
@@ -270,7 +307,7 @@ function exposeSymLink(link, expServices) {
270
307
  if (link.isFile) {
271
308
  const promise = link.target()
272
309
  .then(f => {
273
- const file = file_1.exposeFileService(f, expServices);
310
+ const file = (0, file_1.exposeFileService)(f, expServices);
274
311
  return symLinkTargetType.pack({ file });
275
312
  });
276
313
  return { promise };
@@ -284,20 +321,20 @@ function exposeSymLink(link, expServices) {
284
321
  return { promise };
285
322
  }
286
323
  else {
287
- assert_1.assert(false);
324
+ (0, assert_1.assert)(false);
288
325
  }
289
326
  };
290
327
  const ref = expServices.exposeDroppableService('SymLinkImpl', exp, link);
291
328
  const msg = {
292
329
  readonly: link.readonly,
293
- isFile: protobuf_msg_1.toOptVal(link.isFile),
294
- isFolder: protobuf_msg_1.toOptVal(link.isFolder),
330
+ isFile: (0, protobuf_msg_1.toOptVal)(link.isFile),
331
+ isFolder: (0, protobuf_msg_1.toOptVal)(link.isFolder),
295
332
  impl: ref
296
333
  };
297
334
  return msg;
298
335
  }
299
336
  function makeSymLinkCaller(caller, linkMsg) {
300
- connector_1.checkRefObjTypeIs('SymLinkImpl', linkMsg.impl);
337
+ (0, connector_1.checkRefObjTypeIs)('SymLinkImpl', linkMsg.impl);
301
338
  const link = {
302
339
  readonly: linkMsg.readonly,
303
340
  target: () => caller
@@ -305,7 +342,7 @@ function makeSymLinkCaller(caller, linkMsg) {
305
342
  .then(buf => {
306
343
  const { file, fs } = symLinkTargetType.unpack(buf);
307
344
  if (file) {
308
- return file_1.makeFileCaller(caller, file);
345
+ return (0, file_1.makeFileCaller)(caller, file);
309
346
  }
310
347
  else if (fs) {
311
348
  return makeFSCaller(caller, fs);
@@ -314,8 +351,8 @@ function makeSymLinkCaller(caller, linkMsg) {
314
351
  throw new Error('Missing target info');
315
352
  }
316
353
  }),
317
- isFile: protobuf_msg_1.valOfOpt(linkMsg.isFile),
318
- isFolder: protobuf_msg_1.valOfOpt(linkMsg.isFolder)
354
+ isFile: (0, protobuf_msg_1.valOfOpt)(linkMsg.isFile),
355
+ isFolder: (0, protobuf_msg_1.valOfOpt)(linkMsg.isFolder)
319
356
  };
320
357
  return link;
321
358
  }
@@ -347,54 +384,149 @@ var readLink;
347
384
  Object.freeze(readLink);
348
385
  const fsEventMsgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSEventMsg);
349
386
  function packFSEvent(e) {
350
- const m = {
351
- type: e.type,
352
- path: e.path,
353
- isRemote: protobuf_msg_1.toOptVal(e.isRemote),
354
- newVersion: protobuf_msg_1.toOptVal(e.newVersion),
355
- name: protobuf_msg_1.toOptVal(e.name),
356
- oldName: protobuf_msg_1.toOptVal(e.oldName),
357
- newName: protobuf_msg_1.toOptVal(e.newName),
358
- entry: (e.entry ?
359
- protobuf_msg_1.toVal(lsEntryToMsg(e.entry)) : undefined),
360
- current: protobuf_msg_1.toOptVal(e.current),
361
- lastSynced: protobuf_msg_1.toOptVal(e.lastSynced),
362
- remoteVersion: protobuf_msg_1.toOptVal(e.remoteVersion)
363
- };
364
- return fsEventMsgType.pack(m);
387
+ const { type, path } = e;
388
+ switch (type) {
389
+ case 'removed':
390
+ return fsEventMsgType.pack({
391
+ type, path,
392
+ src: (0, protobuf_msg_1.toVal)(e.src)
393
+ });
394
+ case 'remote-removal':
395
+ return fsEventMsgType.pack({
396
+ type, path
397
+ });
398
+ case 'file-change':
399
+ return fsEventMsgType.pack({
400
+ type, path,
401
+ src: (0, protobuf_msg_1.toVal)(e.src),
402
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion)
403
+ });
404
+ case 'remote-change':
405
+ return fsEventMsgType.pack({
406
+ type, path,
407
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion)
408
+ });
409
+ case 'entry-addition':
410
+ return fsEventMsgType.pack({
411
+ type, path,
412
+ src: (0, protobuf_msg_1.toVal)(e.src),
413
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion),
414
+ entry: lsEntryToMsg(e.entry),
415
+ moveLabel: (0, protobuf_msg_1.toOptVal)(e.moveLabel)
416
+ });
417
+ case 'entry-removal':
418
+ return fsEventMsgType.pack({
419
+ type, path,
420
+ src: (0, protobuf_msg_1.toVal)(e.src),
421
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion),
422
+ name: (0, protobuf_msg_1.toVal)(e.name),
423
+ moveLabel: (0, protobuf_msg_1.toOptVal)(e.moveLabel)
424
+ });
425
+ case 'entry-renaming':
426
+ return fsEventMsgType.pack({
427
+ type, path,
428
+ src: (0, protobuf_msg_1.toVal)(e.src),
429
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion),
430
+ oldName: (0, protobuf_msg_1.toVal)(e.oldName),
431
+ newName: (0, protobuf_msg_1.toVal)(e.newName)
432
+ });
433
+ case 'remote-arch-ver-removal':
434
+ return fsEventMsgType.pack({
435
+ type, path,
436
+ removedArchVer: (0, protobuf_msg_1.toVal)(e.removedArchVer)
437
+ });
438
+ case 'remote-version-archival':
439
+ return fsEventMsgType.pack({
440
+ type, path,
441
+ archivedVersion: (0, protobuf_msg_1.toVal)(e.archivedVersion)
442
+ });
443
+ default:
444
+ throw new Error(`Unknown event type ${type}`);
445
+ }
365
446
  }
366
447
  function unpackFSEvent(buf) {
367
448
  const m = fsEventMsgType.unpack(buf);
368
- const event = {
369
- type: m.type,
370
- path: m.path,
371
- isRemote: protobuf_msg_1.valOfOpt(m.isRemote),
372
- newVersion: protobuf_msg_1.valOfOptInt(m.newVersion),
373
- name: protobuf_msg_1.valOfOpt(m.name),
374
- oldName: protobuf_msg_1.valOfOpt(m.oldName),
375
- newName: protobuf_msg_1.valOfOpt(m.newName),
376
- entry: (m.entry ? lsEntryFromMsg(m.entry.value) : undefined),
377
- current: protobuf_msg_1.valOfOptInt(m.current),
378
- lastSynced: protobuf_msg_1.valOfOptInt(m.lastSynced),
379
- remoteVersion: protobuf_msg_1.valOfOptInt(m.remoteVersion)
380
- };
381
- return event;
449
+ const { type, path } = m;
450
+ switch (type) {
451
+ case 'entry-addition':
452
+ return {
453
+ type, path,
454
+ src: (0, protobuf_msg_1.valOf)(m.src),
455
+ newVersion: (0, protobuf_msg_1.valOfOptInt)(m.newVersion),
456
+ entry: lsEntryFromMsg(m.entry),
457
+ moveLabel: (0, protobuf_msg_1.valOfOptInt)(m.moveLabel)
458
+ };
459
+ case 'entry-removal':
460
+ return {
461
+ type, path,
462
+ src: (0, protobuf_msg_1.valOf)(m.src),
463
+ newVersion: (0, protobuf_msg_1.valOfOptInt)(m.newVersion),
464
+ name: (0, protobuf_msg_1.valOf)(m.name),
465
+ moveLabel: (0, protobuf_msg_1.valOfOptInt)(m.moveLabel)
466
+ };
467
+ case 'entry-renaming':
468
+ return {
469
+ type, path,
470
+ src: (0, protobuf_msg_1.valOf)(m.src),
471
+ newVersion: (0, protobuf_msg_1.valOfOptInt)(m.newVersion),
472
+ oldName: (0, protobuf_msg_1.valOf)(m.oldName),
473
+ newName: (0, protobuf_msg_1.valOf)(m.newName)
474
+ };
475
+ case 'file-change':
476
+ return {
477
+ type, path,
478
+ src: (0, protobuf_msg_1.valOf)(m.src),
479
+ newVersion: (0, protobuf_msg_1.valOfOptInt)(m.newVersion)
480
+ };
481
+ case 'removed':
482
+ return {
483
+ type, path,
484
+ src: (0, protobuf_msg_1.valOf)(m.src)
485
+ };
486
+ case 'remote-removal':
487
+ return {
488
+ type, path
489
+ };
490
+ case 'remote-change':
491
+ return {
492
+ type, path, newVersion: (0, protobuf_msg_1.intValOf)(m.newVersion)
493
+ };
494
+ case 'remote-arch-ver-removal':
495
+ return {
496
+ type, path, removedArchVer: (0, protobuf_msg_1.intValOf)(m.removedArchVer)
497
+ };
498
+ case 'remote-version-archival':
499
+ return {
500
+ type, path, archivedVersion: (0, protobuf_msg_1.intValOf)(m.archivedVersion)
501
+ };
502
+ default:
503
+ throw new Error(`Unknown event type ${type}`);
504
+ }
382
505
  }
383
506
  function lsEntryToMsg(e) {
384
507
  return {
385
508
  name: e.name,
386
- isFile: protobuf_msg_1.toOptVal(e.isFile),
387
- isFolder: protobuf_msg_1.toOptVal(e.isFolder),
388
- isLink: protobuf_msg_1.toOptVal(e.isLink)
509
+ isFile: (0, protobuf_msg_1.toOptVal)(e.isFile),
510
+ isFolder: (0, protobuf_msg_1.toOptVal)(e.isFolder),
511
+ isLink: (0, protobuf_msg_1.toOptVal)(e.isLink)
389
512
  };
390
513
  }
391
514
  function lsEntryFromMsg(m) {
392
- return {
393
- name: m.name,
394
- isFile: protobuf_msg_1.valOfOpt(m.isFile),
395
- isFolder: protobuf_msg_1.valOfOpt(m.isFolder),
396
- isLink: protobuf_msg_1.valOfOpt(m.isLink)
397
- };
515
+ const name = m.name;
516
+ if ((0, protobuf_msg_1.valOfOpt)(m.isFile)) {
517
+ return { name, isFile: true };
518
+ }
519
+ else if ((0, protobuf_msg_1.valOfOpt)(m.isFolder)) {
520
+ return { name, isFolder: true };
521
+ }
522
+ else if ((0, protobuf_msg_1.valOfOpt)(m.isLink)) {
523
+ return { name, isLink: true };
524
+ }
525
+ else {
526
+ throw (0, connector_1.makeIPCException)({
527
+ badReply: true, message: `Missing fs entry type flag`
528
+ });
529
+ }
398
530
  }
399
531
  var watch;
400
532
  (function (watch) {
@@ -402,7 +534,7 @@ var watch;
402
534
  return buf => {
403
535
  const { path } = reqWithPathType.unpack(buf);
404
536
  const s = new rxjs_1.Subject();
405
- const obs = s.asObservable().pipe(operators_1.map(packEvent));
537
+ const obs = s.asObservable().pipe((0, operators_1.map)(packEvent));
406
538
  const onCancel = fn(path, s);
407
539
  return { obs, onCancel };
408
540
  };
@@ -412,15 +544,9 @@ var watch;
412
544
  return (path, obs) => {
413
545
  const s = new rxjs_1.Subject();
414
546
  const unsub = caller.startObservableCall(ipcPath, reqWithPathType.pack({ path }), s);
415
- s.subscribe({
416
- next: buf => {
417
- if (obs.next) {
418
- obs.next(unpackEvent(buf));
419
- }
420
- },
421
- complete: obs.complete,
422
- error: obs.error
423
- });
547
+ s.asObservable()
548
+ .pipe((0, operators_1.map)(unpackEvent))
549
+ .subscribe((0, utils_for_observables_1.toRxObserver)(obs));
424
550
  return unsub;
425
551
  };
426
552
  }
@@ -429,11 +555,6 @@ var watch;
429
555
  return makeCaller(caller, ipcPath, unpackFSEvent);
430
556
  }
431
557
  watch.makeFolderCaller = makeFolderCaller;
432
- function makeTreeCaller(caller, objPath) {
433
- const ipcPath = objPath.concat('watchTree');
434
- return makeCaller(caller, ipcPath, unpackFSEvent);
435
- }
436
- watch.makeTreeCaller = makeTreeCaller;
437
558
  function makeFileCaller(caller, objPath) {
438
559
  const ipcPath = objPath.concat('watchFile');
439
560
  return makeCaller(caller, ipcPath, file_1.unpackFileEvent);
@@ -441,6 +562,33 @@ var watch;
441
562
  watch.makeFileCaller = makeFileCaller;
442
563
  })(watch || (watch = {}));
443
564
  Object.freeze(watch);
565
+ var watchTree;
566
+ (function (watchTree) {
567
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.WatchTreeRequestBody);
568
+ function wrapService(fn) {
569
+ return buf => {
570
+ const { path, depth } = requestType.unpack(buf);
571
+ const s = new rxjs_1.Subject();
572
+ const obs = s.asObservable().pipe((0, operators_1.map)(packFSEvent));
573
+ const onCancel = fn(path, (0, protobuf_msg_1.valOfOpt)(depth), s);
574
+ return { obs, onCancel };
575
+ };
576
+ }
577
+ watchTree.wrapService = wrapService;
578
+ function makeCaller(caller, objPath) {
579
+ const ipcPath = objPath.concat('watchTree');
580
+ return (path, depth, obs) => {
581
+ const s = new rxjs_1.Subject();
582
+ const unsub = caller.startObservableCall(ipcPath, requestType.pack({ path, depth: (0, protobuf_msg_1.toOptVal)(depth) }), s);
583
+ s.asObservable()
584
+ .pipe((0, operators_1.map)(unpackFSEvent))
585
+ .subscribe((0, utils_for_observables_1.toRxObserver)(obs));
586
+ return unsub;
587
+ };
588
+ }
589
+ watchTree.makeCaller = makeCaller;
590
+ })(watchTree || (watchTree = {}));
591
+ Object.freeze(watchTree);
444
592
  var close;
445
593
  (function (close) {
446
594
  function wrapService(fn) {
@@ -500,7 +648,7 @@ var listFolder;
500
648
  const ipcPath = objPath.concat('listFolder');
501
649
  return path => caller
502
650
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
503
- .then(buf => protobuf_msg_1.fixArray(requestType.unpack(buf).entries).map(lsEntryFromMsg));
651
+ .then(buf => (0, protobuf_msg_1.fixArray)(requestType.unpack(buf).entries).map(lsEntryFromMsg));
504
652
  }
505
653
  listFolder.makeCaller = makeCaller;
506
654
  })(listFolder || (listFolder = {}));
@@ -531,7 +679,7 @@ var readTxtFile;
531
679
  return buf => {
532
680
  const { path } = reqWithPathType.unpack(buf);
533
681
  const promise = fn(path)
534
- .then(txt => protobuf_msg_1.encodeToUtf8(txt));
682
+ .then(txt => (0, protobuf_msg_1.encodeToUtf8)(txt));
535
683
  return { promise };
536
684
  };
537
685
  }
@@ -540,7 +688,7 @@ var readTxtFile;
540
688
  const ipcPath = objPath.concat('readTxtFile');
541
689
  return path => caller
542
690
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
543
- .then(buf => (buf ? protobuf_msg_1.decodeFromUtf8(buf) : ''));
691
+ .then(buf => (buf ? (0, protobuf_msg_1.decodeFromUtf8)(buf) : ''));
544
692
  }
545
693
  readTxtFile.makeCaller = makeCaller;
546
694
  })(readTxtFile || (readTxtFile = {}));
@@ -551,7 +699,7 @@ var readBytes;
551
699
  function wrapService(fn) {
552
700
  return buf => {
553
701
  const { path, start, end } = readBytes.requestType.unpack(buf);
554
- const promise = fn(path, protobuf_msg_1.valOfOptInt(start), protobuf_msg_1.valOfOptInt(end))
702
+ const promise = fn(path, (0, protobuf_msg_1.valOfOptInt)(start), (0, protobuf_msg_1.valOfOptInt)(end))
555
703
  .then(file.readBytes.packReply);
556
704
  return { promise };
557
705
  };
@@ -561,7 +709,7 @@ var readBytes;
561
709
  const ipcPath = objPath.concat('readBytes');
562
710
  return (path, start, end) => caller
563
711
  .startPromiseCall(ipcPath, readBytes.requestType.pack({
564
- path, start: protobuf_msg_1.toOptVal(start), end: protobuf_msg_1.toOptVal(end)
712
+ path, start: (0, protobuf_msg_1.toOptVal)(start), end: (0, protobuf_msg_1.toOptVal)(end)
565
713
  }))
566
714
  .then(file.readBytes.unpackReply);
567
715
  }
@@ -575,7 +723,7 @@ var getByteSource;
575
723
  const { path } = reqWithPathType.unpack(buf);
576
724
  const promise = fn(path)
577
725
  .then(src => {
578
- const ref = bytes_1.exposeSrcService(src, expServices);
726
+ const ref = (0, bytes_1.exposeSrcService)(src, expServices);
579
727
  return protobuf_msg_1.objRefType.pack(ref);
580
728
  });
581
729
  return { promise };
@@ -588,7 +736,7 @@ var getByteSource;
588
736
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
589
737
  .then(buf => {
590
738
  const ref = protobuf_msg_1.objRefType.unpack(buf);
591
- return bytes_1.makeSrcCaller(caller, ref);
739
+ return (0, bytes_1.makeSrcCaller)(caller, ref);
592
740
  });
593
741
  }
594
742
  getByteSource.makeCaller = makeCaller;
@@ -601,7 +749,7 @@ var readonlyFile;
601
749
  const { path } = reqWithPathType.unpack(buf);
602
750
  const promise = fn(path)
603
751
  .then(file => {
604
- const fileMsg = file_1.exposeFileService(file, expServices);
752
+ const fileMsg = (0, file_1.exposeFileService)(file, expServices);
605
753
  return file_1.fileMsgType.pack(fileMsg);
606
754
  });
607
755
  return { promise };
@@ -614,7 +762,7 @@ var readonlyFile;
614
762
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
615
763
  .then(buf => {
616
764
  const fileMsg = file_1.fileMsgType.unpack(buf);
617
- return file_1.makeFileCaller(caller, fileMsg);
765
+ return (0, file_1.makeFileCaller)(caller, fileMsg);
618
766
  });
619
767
  }
620
768
  readonlyFile.makeCaller = makeCaller;
@@ -628,41 +776,41 @@ var select;
628
776
  action: sc.action,
629
777
  type: (Array.isArray(sc.type) ?
630
778
  sc.type : ((typeof sc.type === 'string') ? [sc.type] : [])),
631
- depth: protobuf_msg_1.toOptVal(sc.depth),
779
+ depth: (0, protobuf_msg_1.toOptVal)(sc.depth),
632
780
  };
633
781
  if (typeof sc.name === 'string') {
634
- c.pattern = protobuf_msg_1.toVal(sc.name);
782
+ c.pattern = (0, protobuf_msg_1.toVal)(sc.name);
635
783
  }
636
784
  else if (sc.name.type === 'pattern') {
637
- c.pattern = protobuf_msg_1.toVal(sc.name.p);
785
+ c.pattern = (0, protobuf_msg_1.toVal)(sc.name.p);
638
786
  }
639
787
  else if (sc.name.type === 'exact') {
640
- c.exactName = protobuf_msg_1.toVal(sc.name.p);
788
+ c.exactName = (0, protobuf_msg_1.toVal)(sc.name.p);
641
789
  }
642
790
  else if (sc.name.type === 'regexp') {
643
- c.regexp = protobuf_msg_1.toVal(sc.name.p);
791
+ c.regexp = (0, protobuf_msg_1.toVal)(sc.name.p);
644
792
  }
645
793
  return c;
646
794
  }
647
795
  function criteriaFromMsg(c) {
648
796
  let name;
649
797
  if (c.exactName) {
650
- name = { type: 'exact', p: protobuf_msg_1.valOf(c.exactName) };
798
+ name = { type: 'exact', p: (0, protobuf_msg_1.valOf)(c.exactName) };
651
799
  }
652
800
  else if (c.pattern) {
653
- name = { type: 'pattern', p: protobuf_msg_1.valOf(c.pattern) };
801
+ name = { type: 'pattern', p: (0, protobuf_msg_1.valOf)(c.pattern) };
654
802
  }
655
803
  else if (c.regexp) {
656
- name = { type: 'regexp', p: protobuf_msg_1.valOf(c.regexp) };
804
+ name = { type: 'regexp', p: (0, protobuf_msg_1.valOf)(c.regexp) };
657
805
  }
658
806
  else {
659
- throw connector_1.makeIPCException({ message: `Invalid name parameter in select criteria` });
807
+ throw (0, connector_1.makeIPCException)({ message: `Invalid name parameter in select criteria` });
660
808
  }
661
- const typeArr = protobuf_msg_1.fixArray(c.type);
809
+ const typeArr = (0, protobuf_msg_1.fixArray)(c.type);
662
810
  const sc = {
663
811
  action: c.action,
664
812
  name,
665
- depth: protobuf_msg_1.valOfOptInt(c.depth),
813
+ depth: (0, protobuf_msg_1.valOfOptInt)(c.depth),
666
814
  type: ((typeArr.length > 0) ? typeArr : undefined)
667
815
  };
668
816
  return sc;
@@ -687,21 +835,21 @@ var select;
687
835
  const req = { path, criteria: criteriaToMsg(criteria) };
688
836
  const s = new rxjs_1.Subject();
689
837
  caller.startObservableCall(ipcPath, requestType.pack(req), s);
690
- const reply = processes_1.defer();
838
+ const reply = (0, deferred_1.defer)();
691
839
  let completion = undefined;
692
840
  s.subscribe({
693
841
  next: buf => {
694
842
  const ref = protobuf_msg_1.objRefType.unpack(buf);
695
843
  const collection = fsCollection.makeCollectionCaller(ref, caller);
696
844
  reply.resolve(collection);
697
- completion = processes_1.defer();
845
+ completion = (0, deferred_1.defer)();
698
846
  },
699
847
  complete: () => {
700
848
  if (completion) {
701
849
  completion.resolve();
702
850
  }
703
851
  else {
704
- reply.reject(connector_1.makeIPCException({
852
+ reply.reject((0, connector_1.makeIPCException)({
705
853
  message: `Early completion sent by core side`
706
854
  }));
707
855
  }
@@ -736,7 +884,7 @@ var fsCollection;
736
884
  }
737
885
  fsCollection.exposeCollectionService = exposeCollectionService;
738
886
  function makeCollectionCaller(ref, caller) {
739
- connector_1.checkRefObjTypeIs('FSCollection', ref);
887
+ (0, connector_1.checkRefObjTypeIs)('FSCollection', ref);
740
888
  const objPath = ref.path;
741
889
  const collection = {
742
890
  get: get.makeCaller(caller, objPath),
@@ -801,7 +949,7 @@ var fsCollection;
801
949
  return () => caller
802
950
  .startPromiseCall(ipcPath, undefined)
803
951
  .then(buf => {
804
- const items = protobuf_msg_1.fixArray(replyType.unpack(buf).items);
952
+ const items = (0, protobuf_msg_1.fixArray)(replyType.unpack(buf).items);
805
953
  const pairs = [];
806
954
  for (const { name, item } of items) {
807
955
  pairs.push([name, fsItem.fsItemFromMsg(caller, item)]);
@@ -822,7 +970,7 @@ var fsCollection;
822
970
  return ref;
823
971
  }
824
972
  function makeIterCaller(ref, caller) {
825
- connector_1.checkRefObjTypeIs('FSItemsIter', ref);
973
+ (0, connector_1.checkRefObjTypeIs)('FSItemsIter', ref);
826
974
  const objPath = ref.path;
827
975
  const iter = {
828
976
  next: makeIterNextCaller(caller, objPath)
@@ -834,7 +982,7 @@ var fsCollection;
834
982
  function packIterRes(res, expServices) {
835
983
  let msg;
836
984
  if (res.done) {
837
- msg = { done: protobuf_msg_1.toVal(true) };
985
+ msg = { done: (0, protobuf_msg_1.toVal)(true) };
838
986
  }
839
987
  else {
840
988
  const itemRef = fsItem.exposeFSItem(expServices, res.value[1]);
@@ -895,7 +1043,7 @@ var fsCollection;
895
1043
  function wrapService(fn, expServices) {
896
1044
  return () => {
897
1045
  const s = new rxjs_1.Subject();
898
- const obs = s.asObservable().pipe(operators_1.map(event => packEvent(event, expServices)));
1046
+ const obs = s.asObservable().pipe((0, operators_1.map)(event => packEvent(event, expServices)));
899
1047
  const onCancel = fn(s);
900
1048
  return { obs, onCancel };
901
1049
  };
@@ -904,7 +1052,7 @@ var fsCollection;
904
1052
  function packEvent(event, expServices) {
905
1053
  const msg = {
906
1054
  type: event.type,
907
- path: protobuf_msg_1.toOptVal(event.path)
1055
+ path: (0, protobuf_msg_1.toOptVal)(event.path)
908
1056
  };
909
1057
  if (event.item) {
910
1058
  msg.item = fsItem.exposeFSItem(expServices, event.item);
@@ -915,7 +1063,7 @@ var fsCollection;
915
1063
  const msg = eventType.unpack(buf);
916
1064
  const event = {
917
1065
  type: msg.type,
918
- path: protobuf_msg_1.valOfOpt(msg.path)
1066
+ path: (0, protobuf_msg_1.valOfOpt)(msg.path)
919
1067
  };
920
1068
  if (msg.item) {
921
1069
  event.item = fsItem.fsItemFromMsg(caller, msg.item);
@@ -927,15 +1075,9 @@ var fsCollection;
927
1075
  return obs => {
928
1076
  const s = new rxjs_1.Subject();
929
1077
  const unsub = caller.startObservableCall(path, undefined, s);
930
- s.subscribe({
931
- next: buf => {
932
- if (obs.next) {
933
- obs.next(unpackEvent(buf, caller));
934
- }
935
- },
936
- complete: obs.complete,
937
- error: obs.error
938
- });
1078
+ s.asObservable()
1079
+ .pipe((0, operators_1.map)(buf => unpackEvent(buf, caller)))
1080
+ .subscribe((0, utils_for_observables_1.toRxObserver)(obs));
939
1081
  return unsub;
940
1082
  };
941
1083
  }
@@ -949,18 +1091,18 @@ var fsItem;
949
1091
  fsItem.msgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSItem);
950
1092
  function exposeFSItem(expServices, item) {
951
1093
  const msg = {
952
- isLink: protobuf_msg_1.toOptVal(item.isLink)
1094
+ isLink: (0, protobuf_msg_1.toOptVal)(item.isLink)
953
1095
  };
954
1096
  if (item.isFile) {
955
- msg.isFile = protobuf_msg_1.toVal(true);
1097
+ msg.isFile = (0, protobuf_msg_1.toVal)(true);
956
1098
  if (item.item) {
957
1099
  msg.item = {
958
- file: file_1.exposeFileService(item.item, expServices)
1100
+ file: (0, file_1.exposeFileService)(item.item, expServices)
959
1101
  };
960
1102
  }
961
1103
  }
962
1104
  else if (item.isFolder) {
963
- msg.isFolder = protobuf_msg_1.toVal(true);
1105
+ msg.isFolder = (0, protobuf_msg_1.toVal)(true);
964
1106
  if (item.item) {
965
1107
  msg.item = {
966
1108
  fs: exposeFSService(item.item, expServices)
@@ -968,7 +1110,7 @@ var fsItem;
968
1110
  }
969
1111
  }
970
1112
  else if (item.isCollection) {
971
- msg.isCollection = protobuf_msg_1.toVal(true);
1113
+ msg.isCollection = (0, protobuf_msg_1.toVal)(true);
972
1114
  if (item.item) {
973
1115
  msg.item = {
974
1116
  collection: fsCollection.exposeCollectionService(item.item, expServices)
@@ -991,21 +1133,21 @@ var fsItem;
991
1133
  fsItem.exposeFSItem = exposeFSItem;
992
1134
  function fsItemFromMsg(caller, msg) {
993
1135
  const item = {
994
- isLink: protobuf_msg_1.valOfOpt(msg.isLink)
1136
+ isLink: (0, protobuf_msg_1.valOfOpt)(msg.isLink)
995
1137
  };
996
- if (protobuf_msg_1.valOfOpt(msg.isFile)) {
1138
+ if ((0, protobuf_msg_1.valOfOpt)(msg.isFile)) {
997
1139
  item.isFile = true;
998
1140
  if (msg.item) {
999
- item.item = file_1.makeFileCaller(caller, msg.item.file);
1141
+ item.item = (0, file_1.makeFileCaller)(caller, msg.item.file);
1000
1142
  }
1001
1143
  }
1002
- else if (protobuf_msg_1.valOfOpt(msg.isFolder)) {
1144
+ else if ((0, protobuf_msg_1.valOfOpt)(msg.isFolder)) {
1003
1145
  item.isFolder = true;
1004
1146
  if (msg.item) {
1005
1147
  item.item = makeFSCaller(caller, msg.item.fs);
1006
1148
  }
1007
1149
  }
1008
- else if (protobuf_msg_1.valOfOpt(msg.isCollection)) {
1150
+ else if ((0, protobuf_msg_1.valOfOpt)(msg.isCollection)) {
1009
1151
  item.isCollection = true;
1010
1152
  if (msg.item) {
1011
1153
  item.item = fsCollection.makeCollectionCaller(msg.item.collection, caller);
@@ -1064,7 +1206,7 @@ var vListXAttrs;
1064
1206
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1065
1207
  .then(buf => {
1066
1208
  const { version: v, xaNames } = file.vListXAttrs.replyType.unpack(buf);
1067
- return { version: protobuf_msg_1.fixInt(v), lst: (xaNames ? xaNames : []) };
1209
+ return { version: (0, protobuf_msg_1.fixInt)(v), lst: (xaNames ? xaNames : []) };
1068
1210
  });
1069
1211
  }
1070
1212
  vListXAttrs.makeCaller = makeCaller;
@@ -1091,7 +1233,7 @@ var vListFolder;
1091
1233
  .then(buf => {
1092
1234
  const { version: v, entries } = replyType.unpack(buf);
1093
1235
  return {
1094
- version: protobuf_msg_1.fixInt(v), lst: protobuf_msg_1.fixArray(entries.map(lsEntryFromMsg))
1236
+ version: (0, protobuf_msg_1.fixInt)(v), lst: (0, protobuf_msg_1.fixArray)(entries.map(lsEntryFromMsg))
1095
1237
  };
1096
1238
  });
1097
1239
  }
@@ -1117,7 +1259,7 @@ var vReadJSONFile;
1117
1259
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1118
1260
  .then(buf => {
1119
1261
  const { version: v, json } = file.vReadJSON.replyType.unpack(buf);
1120
- return { version: protobuf_msg_1.fixInt(v), json: JSON.parse(json) };
1262
+ return { version: (0, protobuf_msg_1.fixInt)(v), json: JSON.parse(json) };
1121
1263
  });
1122
1264
  }
1123
1265
  vReadJSONFile.makeCaller = makeCaller;
@@ -1140,7 +1282,7 @@ var vReadTxtFile;
1140
1282
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1141
1283
  .then(buf => {
1142
1284
  const { version: v, txt } = file.vReadTxt.replyType.unpack(buf);
1143
- return { version: protobuf_msg_1.fixInt(v), txt };
1285
+ return { version: (0, protobuf_msg_1.fixInt)(v), txt };
1144
1286
  });
1145
1287
  }
1146
1288
  vReadTxtFile.makeCaller = makeCaller;
@@ -1151,7 +1293,7 @@ var vReadBytes;
1151
1293
  function wrapService(fn) {
1152
1294
  return buf => {
1153
1295
  const { path, start, end } = readBytes.requestType.unpack(buf);
1154
- const promise = fn(path, protobuf_msg_1.valOfOptInt(start), protobuf_msg_1.valOfOptInt(end))
1296
+ const promise = fn(path, (0, protobuf_msg_1.valOfOptInt)(start), (0, protobuf_msg_1.valOfOptInt)(end))
1155
1297
  .then(file.vReadBytes.packReply);
1156
1298
  return { promise };
1157
1299
  };
@@ -1162,7 +1304,7 @@ var vReadBytes;
1162
1304
  return (path, start, end) => {
1163
1305
  return caller
1164
1306
  .startPromiseCall(ipcPath, readBytes.requestType.pack({
1165
- path, start: protobuf_msg_1.toOptVal(start), end: protobuf_msg_1.toOptVal(end)
1307
+ path, start: (0, protobuf_msg_1.toOptVal)(start), end: (0, protobuf_msg_1.toOptVal)(end)
1166
1308
  }))
1167
1309
  .then(file.vReadBytes.unpackReply);
1168
1310
  };
@@ -1177,7 +1319,7 @@ var vGetByteSource;
1177
1319
  const { path } = reqWithPathType.unpack(buf);
1178
1320
  const promise = fn(path)
1179
1321
  .then(({ version, src }) => {
1180
- const ref = bytes_1.exposeSrcService(src, expServices);
1322
+ const ref = (0, bytes_1.exposeSrcService)(src, expServices);
1181
1323
  return file.vGetByteSource.replyType.pack({ version, src: ref });
1182
1324
  });
1183
1325
  return { promise };
@@ -1190,7 +1332,7 @@ var vGetByteSource;
1190
1332
  .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1191
1333
  .then(buf => {
1192
1334
  const { version: v, src } = file.vGetByteSource.replyType.unpack(buf);
1193
- return { version: protobuf_msg_1.fixInt(v), src: bytes_1.makeSrcCaller(caller, src) };
1335
+ return { version: (0, protobuf_msg_1.fixInt)(v), src: (0, bytes_1.makeSrcCaller)(caller, src) };
1194
1336
  });
1195
1337
  }
1196
1338
  vGetByteSource.makeCaller = makeCaller;
@@ -1230,7 +1372,7 @@ var makeFolder;
1230
1372
  function wrapService(fn) {
1231
1373
  return buf => {
1232
1374
  const { path, exclusive } = requestType.unpack(buf);
1233
- const promise = fn(path, protobuf_msg_1.valOfOpt(exclusive));
1375
+ const promise = fn(path, (0, protobuf_msg_1.valOfOpt)(exclusive));
1234
1376
  return { promise };
1235
1377
  };
1236
1378
  }
@@ -1239,7 +1381,7 @@ var makeFolder;
1239
1381
  const ipcPath = objPath.concat('makeFolder');
1240
1382
  return (path, exclusive) => caller
1241
1383
  .startPromiseCall(ipcPath, requestType.pack({
1242
- path, exclusive: protobuf_msg_1.toOptVal(exclusive)
1384
+ path, exclusive: (0, protobuf_msg_1.toOptVal)(exclusive)
1243
1385
  }));
1244
1386
  }
1245
1387
  makeFolder.makeCaller = makeCaller;
@@ -1251,7 +1393,7 @@ var deleteFolder;
1251
1393
  function wrapService(fn) {
1252
1394
  return buf => {
1253
1395
  const { path, removeContent } = requestType.unpack(buf);
1254
- const promise = fn(path, protobuf_msg_1.valOfOpt(removeContent));
1396
+ const promise = fn(path, (0, protobuf_msg_1.valOfOpt)(removeContent));
1255
1397
  return { promise };
1256
1398
  };
1257
1399
  }
@@ -1260,7 +1402,7 @@ var deleteFolder;
1260
1402
  const ipcPath = objPath.concat('deleteFolder');
1261
1403
  return (path, removeContent) => caller
1262
1404
  .startPromiseCall(ipcPath, requestType.pack({
1263
- path, removeContent: protobuf_msg_1.toOptVal(removeContent)
1405
+ path, removeContent: (0, protobuf_msg_1.toOptVal)(removeContent)
1264
1406
  }));
1265
1407
  }
1266
1408
  deleteFolder.makeCaller = makeCaller;
@@ -1327,7 +1469,7 @@ var copyFile;
1327
1469
  function wrapService(fn) {
1328
1470
  return buf => {
1329
1471
  const { src, dst, overwrite } = requestType.unpack(buf);
1330
- const promise = fn(src, dst, protobuf_msg_1.valOfOpt(overwrite));
1472
+ const promise = fn(src, dst, (0, protobuf_msg_1.valOfOpt)(overwrite));
1331
1473
  return { promise };
1332
1474
  };
1333
1475
  }
@@ -1336,7 +1478,7 @@ var copyFile;
1336
1478
  const ipcPath = objPath.concat('copyFile');
1337
1479
  return (src, dst, overwrite) => caller
1338
1480
  .startPromiseCall(ipcPath, requestType.pack({
1339
- src, dst, overwrite: protobuf_msg_1.toOptVal(overwrite)
1481
+ src, dst, overwrite: (0, protobuf_msg_1.toOptVal)(overwrite)
1340
1482
  }));
1341
1483
  }
1342
1484
  copyFile.makeCaller = makeCaller;
@@ -1348,7 +1490,7 @@ var copyFolder;
1348
1490
  function wrapService(fn) {
1349
1491
  return buf => {
1350
1492
  const { src, dst, mergeAndOverwrite } = requestType.unpack(buf);
1351
- const promise = fn(src, dst, protobuf_msg_1.valOfOpt(mergeAndOverwrite));
1493
+ const promise = fn(src, dst, (0, protobuf_msg_1.valOfOpt)(mergeAndOverwrite));
1352
1494
  return { promise };
1353
1495
  };
1354
1496
  }
@@ -1357,7 +1499,7 @@ var copyFolder;
1357
1499
  const ipcPath = objPath.concat('copyFolder');
1358
1500
  return (src, dst, mergeAndOverwrite) => caller
1359
1501
  .startPromiseCall(ipcPath, requestType.pack({
1360
- src, dst, mergeAndOverwrite: protobuf_msg_1.toOptVal(mergeAndOverwrite)
1502
+ src, dst, mergeAndOverwrite: (0, protobuf_msg_1.toOptVal)(mergeAndOverwrite)
1361
1503
  }));
1362
1504
  }
1363
1505
  copyFolder.makeCaller = makeCaller;
@@ -1370,7 +1512,7 @@ var saveFile;
1370
1512
  return buf => {
1371
1513
  const { dst, file, overwrite } = requestType.unpack(buf);
1372
1514
  const f = expServices.getOriginalObj(file);
1373
- const promise = fn(f, dst, protobuf_msg_1.valOfOpt(overwrite));
1515
+ const promise = fn(f, dst, (0, protobuf_msg_1.valOfOpt)(overwrite));
1374
1516
  return { promise };
1375
1517
  };
1376
1518
  }
@@ -1379,7 +1521,7 @@ var saveFile;
1379
1521
  const ipcPath = objPath.concat('saveFile');
1380
1522
  return (f, dst, overwrite) => caller
1381
1523
  .startPromiseCall(ipcPath, requestType.pack({
1382
- file: caller.srvRefOf(f), dst, overwrite: protobuf_msg_1.toOptVal(overwrite)
1524
+ file: caller.srvRefOf(f), dst, overwrite: (0, protobuf_msg_1.toOptVal)(overwrite)
1383
1525
  }));
1384
1526
  }
1385
1527
  saveFile.makeCaller = makeCaller;
@@ -1392,7 +1534,7 @@ var saveFolder;
1392
1534
  return buf => {
1393
1535
  const { dst, folder: file, overwrite } = requestType.unpack(buf);
1394
1536
  const f = expServices.getOriginalObj(file);
1395
- const promise = fn(f, dst, protobuf_msg_1.valOfOpt(overwrite));
1537
+ const promise = fn(f, dst, (0, protobuf_msg_1.valOfOpt)(overwrite));
1396
1538
  return { promise };
1397
1539
  };
1398
1540
  }
@@ -1401,7 +1543,7 @@ var saveFolder;
1401
1543
  const ipcPath = objPath.concat('saveFolder');
1402
1544
  return (f, dst, overwrite) => caller
1403
1545
  .startPromiseCall(ipcPath, requestType.pack({
1404
- folder: caller.srvRefOf(f), dst, overwrite: protobuf_msg_1.toOptVal(overwrite)
1546
+ folder: caller.srvRefOf(f), dst, overwrite: (0, protobuf_msg_1.toOptVal)(overwrite)
1405
1547
  }));
1406
1548
  }
1407
1549
  saveFolder.makeCaller = makeCaller;
@@ -1437,16 +1579,16 @@ function unpackPathAndFlags(buf) {
1437
1579
  }
1438
1580
  function optFlagsToMsg(flags) {
1439
1581
  return (flags ? {
1440
- create: protobuf_msg_1.toOptVal(flags.create),
1441
- exclusive: protobuf_msg_1.toOptVal(flags.exclusive),
1442
- truncate: protobuf_msg_1.toOptVal(flags.truncate)
1582
+ create: (0, protobuf_msg_1.toOptVal)(flags.create),
1583
+ exclusive: (0, protobuf_msg_1.toOptVal)(flags.exclusive),
1584
+ truncate: (0, protobuf_msg_1.toOptVal)(flags.truncate)
1443
1585
  } : undefined);
1444
1586
  }
1445
1587
  function optFlagsFromMsg(m) {
1446
1588
  return (m ? {
1447
- create: protobuf_msg_1.valOfOpt(m.create),
1448
- exclusive: protobuf_msg_1.valOfOpt(m.exclusive),
1449
- truncate: protobuf_msg_1.valOfOpt(m.truncate)
1589
+ create: (0, protobuf_msg_1.valOfOpt)(m.create),
1590
+ exclusive: (0, protobuf_msg_1.valOfOpt)(m.exclusive),
1591
+ truncate: (0, protobuf_msg_1.valOfOpt)(m.truncate)
1450
1592
  } : undefined);
1451
1593
  }
1452
1594
  var writableSubRoot;
@@ -1482,7 +1624,7 @@ var writableFile;
1482
1624
  const { path, flags } = unpackPathAndFlags(buf);
1483
1625
  const promise = fn(path, flags)
1484
1626
  .then(file => {
1485
- const fileMsg = file_1.exposeFileService(file, expServices);
1627
+ const fileMsg = (0, file_1.exposeFileService)(file, expServices);
1486
1628
  return file_1.fileMsgType.pack(fileMsg);
1487
1629
  });
1488
1630
  return { promise };
@@ -1495,7 +1637,7 @@ var writableFile;
1495
1637
  .startPromiseCall(ipcPath, packPathAndFlags(path, flags))
1496
1638
  .then(buf => {
1497
1639
  const fileMsg = file_1.fileMsgType.unpack(buf);
1498
- return file_1.makeFileCaller(caller, fileMsg);
1640
+ return (0, file_1.makeFileCaller)(caller, fileMsg);
1499
1641
  });
1500
1642
  }
1501
1643
  writableFile.makeCaller = makeCaller;
@@ -1558,9 +1700,7 @@ var writeBytes;
1558
1700
  const ipcPath = objPath.concat('writeBytes');
1559
1701
  return (path, bytes, flags) => caller
1560
1702
  .startPromiseCall(ipcPath, requestType.pack({
1561
- path,
1562
- bytes: bytes,
1563
- flags: optFlagsToMsg(flags)
1703
+ path, bytes: bytes, flags: optFlagsToMsg(flags)
1564
1704
  }));
1565
1705
  }
1566
1706
  writeBytes.makeCaller = makeCaller;
@@ -1573,7 +1713,7 @@ var getByteSink;
1573
1713
  const { path, flags } = unpackPathAndFlags(buf);
1574
1714
  const promise = fn(path, flags)
1575
1715
  .then(sink => {
1576
- const ref = bytes_1.exposeSinkService(sink, expServices);
1716
+ const ref = (0, bytes_1.exposeSinkService)(sink, expServices);
1577
1717
  return protobuf_msg_1.objRefType.pack(ref);
1578
1718
  });
1579
1719
  return { promise };
@@ -1586,7 +1726,7 @@ var getByteSink;
1586
1726
  .startPromiseCall(ipcPath, packPathAndFlags(path, flags))
1587
1727
  .then(buf => {
1588
1728
  const ref = protobuf_msg_1.objRefType.unpack(buf);
1589
- return bytes_1.makeSinkCaller(caller, ref);
1729
+ return (0, bytes_1.makeSinkCaller)(caller, ref);
1590
1730
  });
1591
1731
  }
1592
1732
  getByteSink.makeCaller = makeCaller;
@@ -1617,7 +1757,7 @@ function optVerFlagsToMsg(f) {
1617
1757
  return;
1618
1758
  }
1619
1759
  const m = optFlagsToMsg(f);
1620
- m.currentVersion = protobuf_msg_1.toOptVal(f.currentVersion);
1760
+ m.currentVersion = (0, protobuf_msg_1.toOptVal)(f.currentVersion);
1621
1761
  return m;
1622
1762
  }
1623
1763
  function optVerFlagsFromMsg(m) {
@@ -1625,7 +1765,7 @@ function optVerFlagsFromMsg(m) {
1625
1765
  return;
1626
1766
  }
1627
1767
  const f = optFlagsFromMsg(m);
1628
- f.currentVersion = protobuf_msg_1.valOfOpt(m.currentVersion);
1768
+ f.currentVersion = (0, protobuf_msg_1.valOfOpt)(m.currentVersion);
1629
1769
  return f;
1630
1770
  }
1631
1771
  var vWriteJSONFile;
@@ -1690,9 +1830,7 @@ var vWriteBytes;
1690
1830
  const ipcPath = objPath.concat('writeBytes');
1691
1831
  return (path, bytes, flags) => caller
1692
1832
  .startPromiseCall(ipcPath, requestType.pack({
1693
- path,
1694
- bytes: bytes,
1695
- flags: optVerFlagsToMsg(flags)
1833
+ path, bytes: bytes, flags: optVerFlagsToMsg(flags)
1696
1834
  }))
1697
1835
  .then(protobuf_msg_1.unpackInt);
1698
1836
  }
@@ -1707,7 +1845,7 @@ var vGetByteSink;
1707
1845
  const { path, flags } = requestType.unpack(buf);
1708
1846
  const promise = fn(path, optVerFlagsFromMsg(flags))
1709
1847
  .then(({ version, sink }) => {
1710
- const ref = bytes_1.exposeSinkService(sink, expServices);
1848
+ const ref = (0, bytes_1.exposeSinkService)(sink, expServices);
1711
1849
  return file.vGetByteSink.replyType.pack({ version, sink: ref });
1712
1850
  });
1713
1851
  return { promise };
@@ -1722,10 +1860,305 @@ var vGetByteSink;
1722
1860
  }))
1723
1861
  .then(buf => {
1724
1862
  const { sink, version: v } = file.vGetByteSink.replyType.unpack(buf);
1725
- return { version: protobuf_msg_1.fixInt(v), sink: bytes_1.makeSinkCaller(caller, sink) };
1863
+ return { version: (0, protobuf_msg_1.fixInt)(v), sink: (0, bytes_1.makeSinkCaller)(caller, sink) };
1726
1864
  });
1727
1865
  }
1728
1866
  vGetByteSink.makeCaller = makeCaller;
1729
1867
  })(vGetByteSink || (vGetByteSink = {}));
1730
1868
  Object.freeze(vGetByteSink);
1869
+ var vsStatus;
1870
+ (function (vsStatus) {
1871
+ function wrapService(fn) {
1872
+ return buf => {
1873
+ const { path } = reqWithPathType.unpack(buf);
1874
+ const promise = fn(path)
1875
+ .then(file.packSyncStatus);
1876
+ return { promise };
1877
+ };
1878
+ }
1879
+ vsStatus.wrapService = wrapService;
1880
+ function makeCaller(caller, objPath) {
1881
+ const ipcPath = objPath.concat('status');
1882
+ return (path) => caller
1883
+ .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1884
+ .then(file.unpackSyncStatus);
1885
+ }
1886
+ vsStatus.makeCaller = makeCaller;
1887
+ })(vsStatus || (vsStatus = {}));
1888
+ Object.freeze(vsStatus);
1889
+ var vsUpdateStatusInfo;
1890
+ (function (vsUpdateStatusInfo) {
1891
+ function wrapService(fn) {
1892
+ return buf => {
1893
+ const { path } = reqWithPathType.unpack(buf);
1894
+ const promise = fn(path)
1895
+ .then(file.packSyncStatus);
1896
+ return { promise };
1897
+ };
1898
+ }
1899
+ vsUpdateStatusInfo.wrapService = wrapService;
1900
+ function makeCaller(caller, objPath) {
1901
+ const ipcPath = objPath.concat('updateStatusInfo');
1902
+ return (path) => caller
1903
+ .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
1904
+ .then(file.unpackSyncStatus);
1905
+ }
1906
+ vsUpdateStatusInfo.makeCaller = makeCaller;
1907
+ })(vsUpdateStatusInfo || (vsUpdateStatusInfo = {}));
1908
+ Object.freeze(vsUpdateStatusInfo);
1909
+ var vsIsRemoteVersionOnDisk;
1910
+ (function (vsIsRemoteVersionOnDisk) {
1911
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSSyncIsOnDiskRequestBody);
1912
+ const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSSyncIsOnDiskReplyBody);
1913
+ function wrapService(fn) {
1914
+ return buf => {
1915
+ const { path, version } = requestType.unpack(buf);
1916
+ const promise = fn(path, (0, protobuf_msg_1.fixInt)(version))
1917
+ .then(status => replyType.pack({ status }));
1918
+ return { promise };
1919
+ };
1920
+ }
1921
+ vsIsRemoteVersionOnDisk.wrapService = wrapService;
1922
+ function makeCaller(caller, objPath) {
1923
+ const ipcPath = objPath.concat('isRemoteVersionOnDisk');
1924
+ return (path, version) => caller
1925
+ .startPromiseCall(ipcPath, requestType.pack({ path, version }))
1926
+ .then(buf => replyType.unpack(buf).status);
1927
+ }
1928
+ vsIsRemoteVersionOnDisk.makeCaller = makeCaller;
1929
+ })(vsIsRemoteVersionOnDisk || (vsIsRemoteVersionOnDisk = {}));
1930
+ Object.freeze(vsIsRemoteVersionOnDisk);
1931
+ var vsDownload;
1932
+ (function (vsDownload) {
1933
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSSyncDownloadRequestBody);
1934
+ function wrapService(fn) {
1935
+ return buf => {
1936
+ const { path, version } = requestType.unpack(buf);
1937
+ const promise = fn(path, (0, protobuf_msg_1.fixInt)(version));
1938
+ return { promise };
1939
+ };
1940
+ }
1941
+ vsDownload.wrapService = wrapService;
1942
+ function makeCaller(caller, objPath) {
1943
+ const ipcPath = objPath.concat('download');
1944
+ return (path, version) => caller
1945
+ .startPromiseCall(ipcPath, requestType.pack({
1946
+ path, version
1947
+ }));
1948
+ }
1949
+ vsDownload.makeCaller = makeCaller;
1950
+ })(vsDownload || (vsDownload = {}));
1951
+ Object.freeze(vsDownload);
1952
+ var vsUpload;
1953
+ (function (vsUpload) {
1954
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSSyncUploadRequestBody);
1955
+ function wrapService(fn) {
1956
+ return buf => {
1957
+ const { path, opts } = requestType.unpack(buf);
1958
+ const promise = fn(path, file.optionsToUploadLocalFromMsg(opts));
1959
+ return { promise };
1960
+ };
1961
+ }
1962
+ vsUpload.wrapService = wrapService;
1963
+ function makeCaller(caller, objPath) {
1964
+ const ipcPath = objPath.concat('upload');
1965
+ return (path, opts) => caller
1966
+ .startPromiseCall(ipcPath, requestType.pack({
1967
+ path, opts: file.optionsToUploadLocalToMsg(opts)
1968
+ }));
1969
+ }
1970
+ vsUpload.makeCaller = makeCaller;
1971
+ })(vsUpload || (vsUpload = {}));
1972
+ Object.freeze(vsUpload);
1973
+ function optionsToAdoptRemoteItemToMsg(opts) {
1974
+ if (!opts) {
1975
+ return;
1976
+ }
1977
+ return {
1978
+ localVersion: (0, protobuf_msg_1.toOptVal)(opts.localVersion),
1979
+ remoteVersion: (0, protobuf_msg_1.toOptVal)(opts.remoteVersion)
1980
+ };
1981
+ }
1982
+ exports.optionsToAdoptRemoteItemToMsg = optionsToAdoptRemoteItemToMsg;
1983
+ function optionsToAdoptRemoteItemFromMsg(msg) {
1984
+ if (!msg) {
1985
+ return;
1986
+ }
1987
+ return {
1988
+ localVersion: (0, protobuf_msg_1.valOfOptInt)(msg.localVersion),
1989
+ remoteVersion: (0, protobuf_msg_1.valOfOptInt)(msg.remoteVersion)
1990
+ };
1991
+ }
1992
+ exports.optionsToAdoptRemoteItemFromMsg = optionsToAdoptRemoteItemFromMsg;
1993
+ var vsAdoptRemoteFolderItem;
1994
+ (function (vsAdoptRemoteFolderItem) {
1995
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.AdoptRemoteFolderItemRequestBody);
1996
+ function wrapService(fn) {
1997
+ return buf => {
1998
+ const { path, itemName, opts } = requestType.unpack(buf);
1999
+ const promise = fn(path, itemName, optionsToAdoptRemoteItemFromMsg(opts))
2000
+ .then(protobuf_msg_1.packInt);
2001
+ return { promise };
2002
+ };
2003
+ }
2004
+ vsAdoptRemoteFolderItem.wrapService = wrapService;
2005
+ function makeCaller(caller, objPath) {
2006
+ const ipcPath = objPath.concat('adoptRemoteFolderItem');
2007
+ return (path, itemName, opts) => caller
2008
+ .startPromiseCall(ipcPath, requestType.pack({
2009
+ path, itemName, opts: optionsToAdoptRemoteItemToMsg(opts)
2010
+ }))
2011
+ .then(protobuf_msg_1.unpackInt);
2012
+ }
2013
+ vsAdoptRemoteFolderItem.makeCaller = makeCaller;
2014
+ })(vsAdoptRemoteFolderItem || (vsAdoptRemoteFolderItem = {}));
2015
+ Object.freeze(vsAdoptRemoteFolderItem);
2016
+ var vsAdoptRemote;
2017
+ (function (vsAdoptRemote) {
2018
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.AdoptRemoteRequestBody);
2019
+ function wrapService(fn) {
2020
+ return buf => {
2021
+ const { path, opts } = requestType.unpack(buf);
2022
+ const promise = fn(path, file.remoteAdoptionOptsFromMsg(opts));
2023
+ return { promise };
2024
+ };
2025
+ }
2026
+ vsAdoptRemote.wrapService = wrapService;
2027
+ function makeCaller(caller, objPath) {
2028
+ const ipcPath = objPath.concat('adoptRemote');
2029
+ return (path, opts) => caller
2030
+ .startPromiseCall(ipcPath, requestType.pack({
2031
+ path, opts: file.remoteAdoptionOptsToMsg(opts)
2032
+ }));
2033
+ }
2034
+ vsAdoptRemote.makeCaller = makeCaller;
2035
+ })(vsAdoptRemote || (vsAdoptRemote = {}));
2036
+ Object.freeze(vsAdoptRemote);
2037
+ var vListVersions;
2038
+ (function (vListVersions) {
2039
+ function wrapService(fn) {
2040
+ return buf => {
2041
+ const { path } = reqWithPathType.unpack(buf);
2042
+ const promise = fn(path)
2043
+ .then(file.vListVersions.packReply);
2044
+ return { promise };
2045
+ };
2046
+ }
2047
+ vListVersions.wrapService = wrapService;
2048
+ function makeCaller(caller, objPath) {
2049
+ const ipcPath = objPath.concat('listVersions');
2050
+ return path => caller
2051
+ .startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
2052
+ .then(file.vListVersions.unpackReply);
2053
+ }
2054
+ vListVersions.makeCaller = makeCaller;
2055
+ })(vListVersions || (vListVersions = {}));
2056
+ Object.freeze(vListVersions);
2057
+ var vArchiveCurrent;
2058
+ (function (vArchiveCurrent) {
2059
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.ArchiveCurrentRequestBody);
2060
+ function wrapService(fn) {
2061
+ return buf => {
2062
+ const { path, version } = requestType.unpack(buf);
2063
+ const promise = fn(path, (0, protobuf_msg_1.valOfOptInt)(version))
2064
+ .then(protobuf_msg_1.packInt);
2065
+ return { promise };
2066
+ };
2067
+ }
2068
+ vArchiveCurrent.wrapService = wrapService;
2069
+ function makeCaller(caller, objPath) {
2070
+ const ipcPath = objPath.concat('archiveCurrent');
2071
+ return (path, version) => caller
2072
+ .startPromiseCall(ipcPath, requestType.pack({ path, version: (0, protobuf_msg_1.toOptVal)(version) }))
2073
+ .then(protobuf_msg_1.unpackInt);
2074
+ }
2075
+ vArchiveCurrent.makeCaller = makeCaller;
2076
+ })(vArchiveCurrent || (vArchiveCurrent = {}));
2077
+ Object.freeze(vArchiveCurrent);
2078
+ function folderDiffToMsg(diff) {
2079
+ var _a, _b, _c, _d;
2080
+ if (!diff) {
2081
+ return;
2082
+ }
2083
+ return {
2084
+ remoteVersion: (0, protobuf_msg_1.toOptVal)(diff.remoteVersion),
2085
+ currentVersion: diff.currentVersion,
2086
+ isCurrentLocal: diff.isCurrentLocal,
2087
+ isRemoteArchived: diff.isRemoteArchived,
2088
+ inCurrent: (_a = diff.inCurrent) === null || _a === void 0 ? void 0 : _a.map(lsEntryToMsg),
2089
+ inRemote: (_b = diff.inRemote) === null || _b === void 0 ? void 0 : _b.map(lsEntryToMsg),
2090
+ nameOverlaps: diff.nameOverlaps,
2091
+ ctime: diffTStoMsg(diff.ctime),
2092
+ mtime: diffTStoMsg(diff.mtime),
2093
+ xattrs: (diff.xattrs ? {
2094
+ inCurrent: (_c = diff.xattrs.inCurrent) === null || _c === void 0 ? void 0 : _c.map(({ name, value }) => file.xattrToMsg(name, value)),
2095
+ inRemote: (_d = diff.xattrs.inRemote) === null || _d === void 0 ? void 0 : _d.map(({ name, value }) => file.xattrToMsg(name, value)),
2096
+ nameOverlaps: diff.xattrs.nameOverlaps
2097
+ } : undefined)
2098
+ };
2099
+ }
2100
+ function diffTStoMsg(diffTS) {
2101
+ var _a;
2102
+ return {
2103
+ current: diffTS.current.valueOf(),
2104
+ remote: (0, protobuf_msg_1.toOptVal)((_a = diffTS.remote) === null || _a === void 0 ? void 0 : _a.valueOf())
2105
+ };
2106
+ }
2107
+ function folderDiffFromMsg(msg) {
2108
+ if (!msg) {
2109
+ return;
2110
+ }
2111
+ return {
2112
+ remoteVersion: (0, protobuf_msg_1.valOfOptInt)(msg.remoteVersion),
2113
+ currentVersion: (0, protobuf_msg_1.fixInt)(msg.currentVersion),
2114
+ isCurrentLocal: msg.isCurrentLocal,
2115
+ isRemoteArchived: msg.isRemoteArchived,
2116
+ inCurrent: ((msg.inCurrent.length > 0) ?
2117
+ msg.inCurrent.map(lsEntryFromMsg) : undefined),
2118
+ inRemote: ((msg.inRemote.length > 0) ?
2119
+ msg.inRemote.map(lsEntryFromMsg) : undefined),
2120
+ nameOverlaps: ((msg.nameOverlaps.length > 0) ?
2121
+ msg.nameOverlaps : undefined),
2122
+ ctime: diffTSfromMsg(msg.ctime),
2123
+ mtime: diffTSfromMsg(msg.mtime),
2124
+ xattrs: (msg.xattrs ? {
2125
+ inCurrent: ((msg.xattrs.inCurrent.length > 0) ?
2126
+ msg.xattrs.inCurrent.map(file.xattrFromMsg) : undefined),
2127
+ inRemote: ((msg.xattrs.inRemote.length > 0) ?
2128
+ msg.xattrs.inRemote.map(file.xattrFromMsg) : undefined),
2129
+ nameOverlaps: ((msg.xattrs.nameOverlaps.length > 0) ?
2130
+ msg.xattrs.nameOverlaps : undefined)
2131
+ } : undefined)
2132
+ };
2133
+ }
2134
+ function diffTSfromMsg(m) {
2135
+ return {
2136
+ current: new Date((0, protobuf_msg_1.fixInt)(m.current)),
2137
+ remote: (m.remote ? new Date((0, protobuf_msg_1.intValOf)(m.remote)) : undefined)
2138
+ };
2139
+ }
2140
+ var vsDiffCurrentAndRemoteFolderVersions;
2141
+ (function (vsDiffCurrentAndRemoteFolderVersions) {
2142
+ const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.DiffCurrentAndRemoteRequestBody);
2143
+ const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.DiffCurrentAndRemoteReplyBody);
2144
+ function wrapService(fn) {
2145
+ return buf => {
2146
+ const { path, remoteVersion } = requestType.unpack(buf);
2147
+ const promise = fn(path, (0, protobuf_msg_1.valOfOptInt)(remoteVersion))
2148
+ .then(diff => replyType.pack({ diff: folderDiffToMsg(diff) }));
2149
+ return { promise };
2150
+ };
2151
+ }
2152
+ vsDiffCurrentAndRemoteFolderVersions.wrapService = wrapService;
2153
+ function makeCaller(caller, objPath) {
2154
+ const ipcPath = objPath.concat('diffCurrentAndRemoteFolderVersions');
2155
+ return (path, remoteVersion) => caller
2156
+ .startPromiseCall(ipcPath, requestType.pack({
2157
+ path, remoteVersion: (0, protobuf_msg_1.toOptVal)(remoteVersion)
2158
+ }))
2159
+ .then(buf => folderDiffFromMsg(replyType.unpack(buf).diff));
2160
+ }
2161
+ vsDiffCurrentAndRemoteFolderVersions.makeCaller = makeCaller;
2162
+ })(vsDiffCurrentAndRemoteFolderVersions || (vsDiffCurrentAndRemoteFolderVersions = {}));
2163
+ Object.freeze(vsDiffCurrentAndRemoteFolderVersions);
1731
2164
  Object.freeze(exports);