core-3nweb-client-lib 0.26.1 → 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 (199) hide show
  1. package/build/api-defs/asmail.d.ts +1 -1
  2. package/build/api-defs/files.d.ts +278 -69
  3. package/build/core/app-files.js +7 -7
  4. package/build/core/asmail/config/common.js +2 -2
  5. package/build/core/asmail/config/index.js +2 -2
  6. package/build/core/asmail/config/published-intro-key.js +1 -1
  7. package/build/core/asmail/delivery/common.js +7 -7
  8. package/build/core/asmail/delivery/index.js +5 -5
  9. package/build/core/asmail/delivery/msg.js +4 -4
  10. package/build/core/asmail/delivery/per-recipient-wip.js +1 -1
  11. package/build/core/asmail/inbox/attachments/fs.js +5 -1
  12. package/build/core/asmail/inbox/cached-msgs.js +1 -1
  13. package/build/core/asmail/inbox/inbox-events.js +4 -4
  14. package/build/core/asmail/inbox/index.js +10 -10
  15. package/build/core/asmail/inbox/msg-downloader.js +1 -1
  16. package/build/core/asmail/inbox/msg-indexing.js +1 -1
  17. package/build/core/asmail/inbox/msg-on-disk.js +5 -5
  18. package/build/core/asmail/index.d.ts +3 -3
  19. package/build/core/asmail/index.js +13 -8
  20. package/build/core/asmail/key-verification.js +5 -5
  21. package/build/core/asmail/keyring/common.js +7 -6
  22. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  23. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  24. package/build/core/asmail/keyring/index.d.ts +7 -8
  25. package/build/core/asmail/keyring/index.js +15 -14
  26. package/build/core/asmail/keyring/keyring-storage.js +2 -1
  27. package/build/core/asmail/msg/opener.js +3 -3
  28. package/build/core/asmail/msg/packer.js +13 -13
  29. package/build/core/asmail/sending-params/own-params.js +2 -2
  30. package/build/core/asmail/sending-params/params-from-others.js +1 -1
  31. package/build/core/id-manager.js +6 -3
  32. package/build/core/index.d.ts +2 -1
  33. package/build/core/index.js +14 -14
  34. package/build/core/sign-in.js +5 -5
  35. package/build/core/sign-up.js +9 -9
  36. package/build/core/storage/common/json-saving.js +2 -2
  37. package/build/core/storage/common/obj-info-file.d.ts +12 -4
  38. package/build/core/storage/common/obj-info-file.js +66 -34
  39. package/build/core/storage/common/utils.d.ts +2 -0
  40. package/build/core/storage/common/utils.js +32 -0
  41. package/build/core/storage/index.d.ts +3 -17
  42. package/build/core/storage/index.js +56 -76
  43. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  44. package/build/core/storage/local/obj-files-gc.js +49 -37
  45. package/build/core/storage/local/obj-files.d.ts +4 -7
  46. package/build/core/storage/local/obj-files.js +7 -10
  47. package/build/core/storage/local/obj-status.d.ts +12 -6
  48. package/build/core/storage/local/obj-status.js +24 -9
  49. package/build/core/storage/local/storage.d.ts +9 -6
  50. package/build/core/storage/local/storage.js +29 -18
  51. package/build/core/storage/synced/downloader.js +1 -1
  52. package/build/core/storage/synced/obj-files-gc.d.ts +5 -1
  53. package/build/core/storage/synced/obj-files-gc.js +91 -37
  54. package/build/core/storage/synced/obj-files.d.ts +42 -36
  55. package/build/core/storage/synced/obj-files.js +178 -147
  56. package/build/core/storage/synced/obj-status.d.ts +87 -85
  57. package/build/core/storage/synced/obj-status.js +463 -259
  58. package/build/core/storage/synced/remote-events.d.ts +11 -12
  59. package/build/core/storage/synced/remote-events.js +73 -56
  60. package/build/core/storage/synced/storage.d.ts +18 -9
  61. package/build/core/storage/synced/storage.js +108 -48
  62. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  63. package/build/core/storage/synced/upload-header-file.js +64 -0
  64. package/build/core/storage/synced/upsyncer.d.ts +12 -7
  65. package/build/core/storage/synced/upsyncer.js +205 -280
  66. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  67. package/build/core/storage/system-folders/apps-data.js +110 -0
  68. package/build/core/storage/system-folders/index.d.ts +18 -0
  69. package/build/core/storage/system-folders/index.js +77 -0
  70. package/build/core-ipc/common-caps.js +3 -3
  71. package/build/core-ipc/generic.js +8 -8
  72. package/build/core-ipc/startup-caps.js +2 -2
  73. package/build/cryptors.js +6 -2
  74. package/build/ipc-via-protobuf/asmail-cap.js +58 -57
  75. package/build/ipc-via-protobuf/bytes.js +16 -17
  76. package/build/ipc-via-protobuf/connector-clients-side.d.ts +1 -0
  77. package/build/ipc-via-protobuf/connector-clients-side.js +14 -15
  78. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  79. package/build/ipc-via-protobuf/connector.js +4 -4
  80. package/build/ipc-via-protobuf/file.d.ts +48 -12
  81. package/build/ipc-via-protobuf/file.js +474 -126
  82. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  83. package/build/ipc-via-protobuf/fs.js +577 -142
  84. package/build/ipc-via-protobuf/log-cap.js +2 -2
  85. package/build/ipc-via-protobuf/mailerid.js +3 -3
  86. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  87. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  88. package/build/ipc-via-protobuf/startup-cap.js +21 -21
  89. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  90. package/build/ipc.js +7 -2
  91. package/build/lib-client/3nstorage/exceptions.d.ts +3 -0
  92. package/build/lib-client/3nstorage/exceptions.js +13 -1
  93. package/build/lib-client/3nstorage/service.d.ts +16 -2
  94. package/build/lib-client/3nstorage/service.js +104 -38
  95. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  96. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  97. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  98. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +42 -18
  99. package/build/lib-client/3nstorage/xsp-fs/common.js +29 -19
  100. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  101. package/build/lib-client/3nstorage/xsp-fs/file-node.js +17 -13
  102. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  103. package/build/lib-client/3nstorage/xsp-fs/file.js +73 -25
  104. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  105. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  106. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +575 -179
  107. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
  108. package/build/lib-client/3nstorage/xsp-fs/fs.js +231 -110
  109. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  110. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  111. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -24
  112. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +229 -123
  113. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  114. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +17 -18
  115. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -3
  116. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +53 -53
  117. package/build/lib-client/3nweb-signup.js +4 -4
  118. package/build/lib-client/asmail/recipient.js +15 -15
  119. package/build/lib-client/asmail/sender.js +22 -22
  120. package/build/lib-client/asmail/service-config.js +3 -3
  121. package/build/lib-client/cryptor/cryptor-in-worker.js +18 -16
  122. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  123. package/build/lib-client/cryptor/cryptor.js +4 -2
  124. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  125. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  126. package/build/lib-client/cryptor/in-proc-wasm.js +6 -6
  127. package/build/lib-client/cryptor/worker-js.js +2 -2
  128. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  129. package/build/lib-client/files-select.js +1 -1
  130. package/build/lib-client/files.d.ts +1 -1
  131. package/build/lib-client/files.js +71 -6
  132. package/build/lib-client/fs-collection.js +1 -1
  133. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  134. package/build/lib-client/fs-sync-utils.js +61 -0
  135. package/build/lib-client/fs-view.d.ts +14 -0
  136. package/build/lib-client/fs-view.js +33 -0
  137. package/build/lib-client/key-derivation.js +1 -1
  138. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  139. package/build/lib-client/local-files/dev-file-src.js +2 -2
  140. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  141. package/build/lib-client/local-files/device-fs.js +56 -54
  142. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  143. package/build/lib-client/logging/log-to-file.js +7 -7
  144. package/build/lib-client/mailer-id/login.js +7 -7
  145. package/build/lib-client/mailer-id/provisioner.js +12 -12
  146. package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -3
  147. package/build/lib-client/objs-on-disk/obj-folders.js +31 -31
  148. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  149. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  150. package/build/lib-client/request-utils.d.ts +1 -0
  151. package/build/lib-client/request-utils.js +13 -13
  152. package/build/lib-client/server-events.d.ts +3 -3
  153. package/build/lib-client/server-events.js +9 -8
  154. package/build/lib-client/service-locator.js +10 -10
  155. package/build/lib-client/user-with-mid-session.js +7 -7
  156. package/build/lib-client/user-with-pkl-session.js +25 -25
  157. package/build/lib-client/ws-utils.js +2 -2
  158. package/build/lib-common/async-cryptor-wrap.js +4 -4
  159. package/build/lib-common/async-fs-node.d.ts +5 -3
  160. package/build/lib-common/async-fs-node.js +16 -16
  161. package/build/lib-common/byte-streaming/pipe.js +1 -1
  162. package/build/lib-common/byte-streaming/wrapping.js +13 -13
  163. package/build/lib-common/canonical-address.js +1 -1
  164. package/build/lib-common/exceptions/error.d.ts +1 -0
  165. package/build/lib-common/exceptions/error.js +7 -6
  166. package/build/lib-common/exceptions/file.js +4 -0
  167. package/build/lib-common/ipc/ws-ipc.js +2 -2
  168. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  169. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  170. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  171. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  172. package/build/lib-common/objs-on-disk/obj-file.js +96 -35
  173. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  174. package/build/lib-common/objs-on-disk/utils.js +3 -3
  175. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  176. package/build/lib-common/processes/labelled-exec-pools.d.ts +1 -1
  177. package/build/lib-common/processes/labelled-exec-pools.js +1 -1
  178. package/build/lib-common/processes/pressure.js +2 -2
  179. package/build/lib-common/processes/synced.js +1 -1
  180. package/build/lib-common/processes/timeout.js +2 -2
  181. package/build/lib-common/random-node.js +7 -7
  182. package/build/lib-common/service-api/3nstorage/owner.d.ts +95 -35
  183. package/build/lib-common/service-api/3nstorage/owner.js +82 -40
  184. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  185. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  186. package/build/lib-common/timed-cache.d.ts +1 -0
  187. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  188. package/build/lib-common/timed-non-weak-cache.js +11 -0
  189. package/build/lib-common/utils-for-observables.js +4 -4
  190. package/build/lib-common/weak-cache.d.ts +1 -0
  191. package/build/lib-common/weak-cache.js +12 -1
  192. package/build/lib-index.d.ts +2 -1
  193. package/build/lib-index.js +10 -7
  194. package/build/protos/asmail.proto.js +12955 -7496
  195. package/build/protos/file.proto.js +4867 -2744
  196. package/build/protos/fs.proto.js +9227 -3768
  197. package/package.json +6 -5
  198. package/protos/file.proto +91 -19
  199. package/protos/fs.proto +107 -8
@@ -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.vGetByteSink = exports.updateXAttrs = exports.vGetByteSource = exports.vReadJSON = exports.vReadTxt = exports.vReadBytes = exports.vListXAttrs = exports.vGetXAttr = exports.unpackFileEvent = exports.packFileEvent = exports.unpackJSON = exports.packJSON = exports.readBytes = exports.unpackXAttrValue = exports.packXAttrValue = exports.unpackStats = exports.packStats = exports.fileMsgType = exports.exposeFileService = exports.makeFileCaller = void 0;
19
+ exports.vListVersions = exports.remoteAdoptionOptsFromMsg = exports.remoteAdoptionOptsToMsg = exports.optionsToUploadLocalFromMsg = exports.optionsToUploadLocalToMsg = exports.vGetByteSink = exports.updateXAttrs = exports.xattrFromMsg = exports.xattrToMsg = exports.vGetByteSource = exports.vReadJSON = exports.vReadTxt = exports.vReadBytes = exports.vListXAttrs = exports.vGetXAttr = exports.unpackFileEvent = exports.packFileEvent = exports.unpackJSON = exports.packJSON = exports.readBytes = exports.unpackXAttrValue = exports.packXAttrValue = exports.unpackSyncStatus = exports.packSyncStatus = exports.unpackStats = exports.packStats = exports.fileMsgType = exports.exposeFileService = exports.makeFileCaller = 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 file_proto_1 = require("../protos/file.proto");
@@ -26,8 +26,9 @@ const bytes_1 = require("./bytes");
26
26
  const rxjs_1 = require("rxjs");
27
27
  const operators_1 = require("rxjs/operators");
28
28
  const utils_for_observables_1 = require("../lib-common/utils-for-observables");
29
+ const buffer_utils_1 = require("../lib-common/buffer-utils");
29
30
  function makeFileCaller(caller, fileMsg) {
30
- connector_1.checkRefObjTypeIs('FileImpl', fileMsg.impl);
31
+ (0, connector_1.checkRefObjTypeIs)('FileImpl', fileMsg.impl);
31
32
  const objPath = fileMsg.impl.path;
32
33
  const file = {
33
34
  writable: fileMsg.writable,
@@ -59,6 +60,7 @@ function makeFileCaller(caller, fileMsg) {
59
60
  readBytes: vReadBytes.makeCaller(caller, vPath),
60
61
  readJSON: vReadJSON.makeCaller(caller, vPath),
61
62
  readTxt: vReadTxt.makeCaller(caller, vPath),
63
+ listVersions: vListVersions.makeCaller(caller, vPath)
62
64
  };
63
65
  if (file.writable) {
64
66
  file.v.copy = vCopy.makeCaller(caller, vPath);
@@ -67,6 +69,21 @@ function makeFileCaller(caller, fileMsg) {
67
69
  file.v.writeBytes = vWriteBytes.makeCaller(caller, vPath);
68
70
  file.v.writeJSON = vWriteJSON.makeCaller(caller, vPath);
69
71
  file.v.writeTxt = vWriteTxt.makeCaller(caller, vPath);
72
+ file.v.archiveCurrent = vArchiveCurrent.makeCaller(caller, vPath);
73
+ }
74
+ if (fileMsg.isSynced) {
75
+ const vsPath = objPath.concat('v', 'sync');
76
+ const vsConnectPath = objPath.concat('v', 'sync', 'connect');
77
+ file.v.sync = {
78
+ status: vsStatus.makeCaller(caller, vsPath),
79
+ updateStatusInfo: vsUpdateStatusInfo.makeCaller(caller, vsPath),
80
+ isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.makeCaller(caller, vsPath),
81
+ download: vsDownload.makeCaller(caller, vsPath),
82
+ adoptRemote: vsAdoptRemote.makeCaller(caller, vsPath),
83
+ };
84
+ if (file.writable) {
85
+ file.v.sync.upload = vsUpload.makeCaller(caller, vsPath);
86
+ }
70
87
  }
71
88
  }
72
89
  caller.registerClientDrop(file, fileMsg.impl);
@@ -99,15 +116,29 @@ function exposeFileService(file, expServices) {
99
116
  listXAttrs: vListXAttrs.wrapService(file.v.listXAttrs),
100
117
  readBytes: vReadBytes.wrapService(file.v.readBytes),
101
118
  readJSON: vReadJSON.wrapService(file.v.readJSON),
102
- readTxt: vReadTxt.wrapService(file.v.readTxt)
119
+ readTxt: vReadTxt.wrapService(file.v.readTxt),
120
+ listVersions: vListVersions.wrapService(file.v.listVersions)
103
121
  };
104
122
  if (file.writable) {
105
- implExp.copy = vCopy.wrapService(file.v.copy, expServices);
106
- implExp.getByteSink = vGetByteSink.wrapService(file.v.getByteSink, expServices);
107
- implExp.updateXAttrs = vUpdateXAttrs.wrapService(file.v.updateXAttrs);
108
- implExp.writeBytes = vWriteBytes.wrapService(file.v.writeBytes);
109
- implExp.writeJSON = vWriteJSON.wrapService(file.v.writeJSON);
110
- implExp.writeTxt = vWriteTxt.wrapService(file.v.writeTxt);
123
+ implExp.v.copy = vCopy.wrapService(file.v.copy, expServices);
124
+ implExp.v.getByteSink = vGetByteSink.wrapService(file.v.getByteSink, expServices);
125
+ implExp.v.updateXAttrs = vUpdateXAttrs.wrapService(file.v.updateXAttrs);
126
+ implExp.v.writeBytes = vWriteBytes.wrapService(file.v.writeBytes);
127
+ implExp.v.writeJSON = vWriteJSON.wrapService(file.v.writeJSON);
128
+ implExp.v.writeTxt = vWriteTxt.wrapService(file.v.writeTxt);
129
+ implExp.v.archiveCurrent = vArchiveCurrent.wrapService(file.v.archiveCurrent);
130
+ }
131
+ if (file.v.sync) {
132
+ implExp.v.sync = {
133
+ status: vsStatus.wrapService(file.v.sync.status),
134
+ updateStatusInfo: vsUpdateStatusInfo.wrapService(file.v.sync.updateStatusInfo),
135
+ isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.wrapService(file.v.sync.isRemoteVersionOnDisk),
136
+ download: vsDownload.wrapService(file.v.sync.download),
137
+ adoptRemote: vsAdoptRemote.wrapService(file.v.sync.adoptRemote),
138
+ };
139
+ if (file.writable) {
140
+ implExp.v.sync.upload = vsUpload.wrapService(file.v.sync.upload);
141
+ }
111
142
  }
112
143
  }
113
144
  const impl = expServices.exposeDroppableService('FileImpl', implExp, file);
@@ -116,7 +147,8 @@ function exposeFileService(file, expServices) {
116
147
  isNew: file.isNew,
117
148
  name: file.name,
118
149
  writable: file.writable,
119
- isVersioned: !!file.v
150
+ isVersioned: !!file.v,
151
+ isSynced: !!(file.v && file.v.sync)
120
152
  };
121
153
  return fileMsg;
122
154
  }
@@ -126,20 +158,13 @@ const statsMsgType = protobuf_type_1.ProtoType.for(file_proto_1.file.StatsMsg);
126
158
  function packStats(s) {
127
159
  const msg = {
128
160
  writable: s.writable,
129
- isFile: protobuf_msg_1.toOptVal(s.isFile),
130
- isFolder: protobuf_msg_1.toOptVal(s.isFolder),
131
- isLink: protobuf_msg_1.toOptVal(s.isLink),
132
- ctime: (s.ctime ? protobuf_msg_1.toVal(s.ctime.valueOf()) : undefined),
133
- mtime: (s.mtime ? protobuf_msg_1.toVal(s.mtime.valueOf()) : undefined),
134
- size: protobuf_msg_1.toOptVal(s.size),
135
- version: protobuf_msg_1.toOptVal(s.version),
136
- sync: (s.sync ? {
137
- state: s.sync.state,
138
- conflictingRemote: s.sync.conflictingRemote,
139
- deletedOnRemote: protobuf_msg_1.toOptVal(s.sync.deletedOnRemote),
140
- latest: protobuf_msg_1.toOptVal(s.sync.latest),
141
- remote: protobuf_msg_1.toOptVal(s.sync.remote)
142
- } : undefined)
161
+ isFile: (0, protobuf_msg_1.toOptVal)(s.isFile),
162
+ isFolder: (0, protobuf_msg_1.toOptVal)(s.isFolder),
163
+ isLink: (0, protobuf_msg_1.toOptVal)(s.isLink),
164
+ ctime: (s.ctime ? (0, protobuf_msg_1.toVal)(s.ctime.valueOf()) : undefined),
165
+ mtime: (s.mtime ? (0, protobuf_msg_1.toVal)(s.mtime.valueOf()) : undefined),
166
+ size: (0, protobuf_msg_1.toOptVal)(s.size),
167
+ version: (0, protobuf_msg_1.toOptVal)(s.version),
143
168
  };
144
169
  return statsMsgType.pack(msg);
145
170
  }
@@ -148,25 +173,70 @@ function unpackStats(buf) {
148
173
  const m = statsMsgType.unpack(buf);
149
174
  return {
150
175
  writable: m.writable,
151
- isFile: protobuf_msg_1.valOfOpt(m.isFile),
152
- isFolder: protobuf_msg_1.valOfOpt(m.isFolder),
153
- isLink: protobuf_msg_1.valOfOpt(m.isLink),
154
- size: protobuf_msg_1.valOfOptInt(m.size),
155
- version: protobuf_msg_1.valOfOptInt(m.version),
156
- ctime: (m.ctime ? new Date(protobuf_msg_1.valOfOptInt(m.ctime)) : undefined),
157
- mtime: (m.mtime ? new Date(protobuf_msg_1.valOfOptInt(m.mtime)) : undefined),
158
- sync: (m.sync ? {
159
- state: m.sync.state,
160
- conflictingRemote: ((m.sync.conflictingRemote.length > 0) ?
161
- m.sync.conflictingRemote.map(protobuf_msg_1.fixInt) : undefined),
162
- deletedOnRemote: !!protobuf_msg_1.valOfOpt(m.sync.deletedOnRemote) || undefined,
163
- latest: protobuf_msg_1.valOfOptInt(m.sync.latest),
164
- remote: protobuf_msg_1.valOfOptInt(m.sync.remote)
165
- } : undefined),
176
+ isFile: (0, protobuf_msg_1.valOfOpt)(m.isFile),
177
+ isFolder: (0, protobuf_msg_1.valOfOpt)(m.isFolder),
178
+ isLink: (0, protobuf_msg_1.valOfOpt)(m.isLink),
179
+ size: (0, protobuf_msg_1.valOfOptInt)(m.size),
180
+ version: (0, protobuf_msg_1.valOfOptInt)(m.version),
181
+ ctime: (m.ctime ? new Date((0, protobuf_msg_1.valOfOptInt)(m.ctime)) : undefined),
182
+ mtime: (m.mtime ? new Date((0, protobuf_msg_1.valOfOptInt)(m.mtime)) : undefined),
166
183
  };
167
184
  }
168
185
  exports.unpackStats = unpackStats;
169
- const fileType = protobuf_type_1.ProtoType.for(file_proto_1.file.File);
186
+ function syncStatusToMsg(s) {
187
+ if (!s) {
188
+ return;
189
+ }
190
+ return {
191
+ state: s.state,
192
+ local: syncBranchToMsg(s.local),
193
+ synced: syncBranchToMsg(s.synced),
194
+ remote: syncBranchToMsg(s.remote),
195
+ existsInSyncedParent: (0, protobuf_msg_1.toOptVal)(s.existsInSyncedParent)
196
+ };
197
+ }
198
+ function msgToSyncStatus(m) {
199
+ if (!m) {
200
+ return;
201
+ }
202
+ return {
203
+ state: m.state,
204
+ local: msgToSyncBranch(m.local),
205
+ synced: msgToSyncBranch(m.synced),
206
+ remote: msgToSyncBranch(m.remote),
207
+ existsInSyncedParent: (0, protobuf_msg_1.valOfOpt)(m.existsInSyncedParent)
208
+ };
209
+ }
210
+ function syncBranchToMsg(b) {
211
+ if (!b) {
212
+ return;
213
+ }
214
+ return {
215
+ latest: (0, protobuf_msg_1.toOptVal)(b.latest),
216
+ archived: (b.archived ? b.archived : undefined),
217
+ isArchived: (0, protobuf_msg_1.toOptVal)(b.isArchived)
218
+ };
219
+ }
220
+ function msgToSyncBranch(m) {
221
+ if (!m) {
222
+ return;
223
+ }
224
+ return {
225
+ latest: (0, protobuf_msg_1.valOfOptInt)(m.latest),
226
+ archived: ((m.archived.length > 0) ?
227
+ m.archived.map(protobuf_msg_1.fixInt) : undefined),
228
+ isArchived: (0, protobuf_msg_1.valOfOpt)(m.isArchived)
229
+ };
230
+ }
231
+ const syncStatusMsgType = protobuf_type_1.ProtoType.for(file_proto_1.file.SyncStatusMsg);
232
+ function packSyncStatus(s) {
233
+ return syncStatusMsgType.pack(syncStatusToMsg(s));
234
+ }
235
+ exports.packSyncStatus = packSyncStatus;
236
+ function unpackSyncStatus(buf) {
237
+ return msgToSyncStatus(syncStatusMsgType.unpack(buf));
238
+ }
239
+ exports.unpackSyncStatus = unpackSyncStatus;
170
240
  var stat;
171
241
  (function (stat) {
172
242
  function wrapService(fn) {
@@ -189,29 +259,29 @@ Object.freeze(stat);
189
259
  const xattrValueType = protobuf_type_1.ProtoType.for(file_proto_1.file.XAttrValue);
190
260
  function packXAttrValue(val) {
191
261
  if (Buffer.isBuffer(val)) {
192
- return xattrValueType.pack({ bytes: protobuf_msg_1.toVal(val) });
262
+ return xattrValueType.pack({ bytes: (0, protobuf_msg_1.toVal)(val) });
193
263
  }
194
264
  else if (typeof val === 'string') {
195
- return xattrValueType.pack({ str: protobuf_msg_1.toVal(val) });
265
+ return xattrValueType.pack({ str: (0, protobuf_msg_1.toVal)(val) });
196
266
  }
197
267
  else if (val === undefined) {
198
268
  return xattrValueType.pack({});
199
269
  }
200
270
  else {
201
- return xattrValueType.pack({ json: protobuf_msg_1.toOptJson(val) });
271
+ return xattrValueType.pack({ json: (0, protobuf_msg_1.toOptJson)(val) });
202
272
  }
203
273
  }
204
274
  exports.packXAttrValue = packXAttrValue;
205
275
  function unpackXAttrValue(buf) {
206
276
  const { json, str, bytes } = xattrValueType.unpack(buf);
207
277
  if (bytes) {
208
- return protobuf_msg_1.valOf(bytes);
278
+ return (0, protobuf_msg_1.valOf)(bytes);
209
279
  }
210
280
  else if (str) {
211
- return protobuf_msg_1.valOf(str);
281
+ return (0, protobuf_msg_1.valOf)(str);
212
282
  }
213
283
  else {
214
- return protobuf_msg_1.valOfOptJson(json);
284
+ return (0, protobuf_msg_1.valOfOptJson)(json);
215
285
  }
216
286
  }
217
287
  exports.unpackXAttrValue = unpackXAttrValue;
@@ -250,7 +320,7 @@ var listXAttrs;
250
320
  const path = objPath.concat('listXAttrs');
251
321
  return () => caller
252
322
  .startPromiseCall(path, undefined)
253
- .then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
323
+ .then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
254
324
  }
255
325
  listXAttrs.makeCaller = makeCaller;
256
326
  })(listXAttrs || (listXAttrs = {}));
@@ -260,17 +330,17 @@ var readBytes;
260
330
  const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.ReadBytesRequestBody);
261
331
  const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.ReadBytesReplyBody);
262
332
  function packReply(bytes) {
263
- return replyType.pack({ bytes: protobuf_msg_1.toOptVal(bytes) });
333
+ return replyType.pack({ bytes: (0, protobuf_msg_1.toOptVal)(bytes) });
264
334
  }
265
335
  readBytes.packReply = packReply;
266
336
  function unpackReply(buf) {
267
- return protobuf_msg_1.valOfOpt(replyType.unpack(buf).bytes);
337
+ return (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).bytes);
268
338
  }
269
339
  readBytes.unpackReply = unpackReply;
270
340
  function wrapService(fn) {
271
341
  return buf => {
272
342
  const { start, end } = requestType.unpack(buf);
273
- const promise = fn(protobuf_msg_1.valOfOptInt(start), protobuf_msg_1.valOfOptInt(end))
343
+ const promise = fn((0, protobuf_msg_1.valOfOptInt)(start), (0, protobuf_msg_1.valOfOptInt)(end))
274
344
  .then(packReply);
275
345
  return { promise };
276
346
  };
@@ -280,7 +350,7 @@ var readBytes;
280
350
  const path = objPath.concat('readBytes');
281
351
  return (start, end) => caller
282
352
  .startPromiseCall(path, requestType.pack({
283
- start: protobuf_msg_1.toOptVal(start), end: protobuf_msg_1.toOptVal(end)
353
+ start: (0, protobuf_msg_1.toOptVal)(start), end: (0, protobuf_msg_1.toOptVal)(end)
284
354
  }))
285
355
  .then(unpackReply);
286
356
  }
@@ -292,7 +362,7 @@ var readTxt;
292
362
  function wrapService(fn) {
293
363
  return () => {
294
364
  const promise = fn()
295
- .then(txt => protobuf_msg_1.encodeToUtf8(txt));
365
+ .then(txt => (0, protobuf_msg_1.encodeToUtf8)(txt));
296
366
  return { promise };
297
367
  };
298
368
  }
@@ -301,24 +371,24 @@ var readTxt;
301
371
  const path = objPath.concat('readTxt');
302
372
  return () => caller
303
373
  .startPromiseCall(path, undefined)
304
- .then(buf => (buf ? protobuf_msg_1.decodeFromUtf8(buf) : ''));
374
+ .then(buf => (buf ? (0, protobuf_msg_1.decodeFromUtf8)(buf) : ''));
305
375
  }
306
376
  readTxt.makeCaller = makeCaller;
307
377
  })(readTxt || (readTxt = {}));
308
378
  Object.freeze(readTxt);
309
379
  function packJSON(json) {
310
- return protobuf_msg_1.encodeToUtf8(JSON.stringify(json));
380
+ return (0, protobuf_msg_1.encodeToUtf8)(JSON.stringify(json));
311
381
  }
312
382
  exports.packJSON = packJSON;
313
383
  function unpackJSON(buf) {
314
384
  if (!buf) {
315
- throw connector_1.makeIPCException({ missingBodyBytes: true });
385
+ throw (0, connector_1.makeIPCException)({ missingBodyBytes: true });
316
386
  }
317
387
  try {
318
- return JSON.parse(protobuf_msg_1.decodeFromUtf8(buf));
388
+ return JSON.parse((0, protobuf_msg_1.decodeFromUtf8)(buf));
319
389
  }
320
390
  catch (err) {
321
- throw error_1.errWithCause(err, `Can't parse ipc reply as json`);
391
+ throw (0, error_1.errWithCause)(err, `Can't parse ipc reply as json`);
322
392
  }
323
393
  }
324
394
  exports.unpackJSON = unpackJSON;
@@ -347,7 +417,7 @@ var getByteSource;
347
417
  return () => {
348
418
  const promise = fn()
349
419
  .then(src => {
350
- const ref = bytes_1.exposeSrcService(src, expServices);
420
+ const ref = (0, bytes_1.exposeSrcService)(src, expServices);
351
421
  return protobuf_msg_1.objRefType.pack(ref);
352
422
  });
353
423
  return { promise };
@@ -360,7 +430,7 @@ var getByteSource;
360
430
  .startPromiseCall(path, undefined)
361
431
  .then(buf => {
362
432
  const ref = protobuf_msg_1.objRefType.unpack(buf);
363
- return bytes_1.makeSrcCaller(caller, ref);
433
+ return (0, bytes_1.makeSrcCaller)(caller, ref);
364
434
  });
365
435
  }
366
436
  getByteSource.makeCaller = makeCaller;
@@ -368,27 +438,74 @@ var getByteSource;
368
438
  Object.freeze(getByteSource);
369
439
  const fileEventType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileEventMsg);
370
440
  function packFileEvent(e) {
371
- const msg = {
372
- type: e.type,
373
- path: e.path,
374
- isRemote: protobuf_msg_1.toOptVal(e.isRemote),
375
- newVersion: protobuf_msg_1.toOptVal(e.newVersion),
376
- current: protobuf_msg_1.toOptVal(e.current),
377
- uploaded: protobuf_msg_1.toOptVal(e.uploaded)
378
- };
379
- return fileEventType.pack(msg);
441
+ const { type, path } = e;
442
+ switch (type) {
443
+ case 'file-change':
444
+ return fileEventType.pack({
445
+ type, path,
446
+ src: (0, protobuf_msg_1.toVal)(e.src),
447
+ newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion)
448
+ });
449
+ case 'removed':
450
+ return fileEventType.pack({
451
+ type, path,
452
+ src: (0, protobuf_msg_1.toVal)(e.src)
453
+ });
454
+ case 'remote-change':
455
+ return fileEventType.pack({
456
+ type, path, newVersion: (0, protobuf_msg_1.toOptVal)(e.newVersion)
457
+ });
458
+ case 'remote-removal':
459
+ return fileEventType.pack({
460
+ type, path
461
+ });
462
+ case 'remote-arch-ver-removal':
463
+ return fileEventType.pack({
464
+ type, path, removedArchVer: (0, protobuf_msg_1.toOptVal)(e.removedArchVer)
465
+ });
466
+ case 'remote-version-archival':
467
+ return fileEventType.pack({
468
+ type, path, archivedVersion: (0, protobuf_msg_1.toOptVal)(e.archivedVersion)
469
+ });
470
+ default:
471
+ throw new Error(`Unknown event type ${type}`);
472
+ }
380
473
  }
381
474
  exports.packFileEvent = packFileEvent;
382
475
  function unpackFileEvent(buf) {
383
476
  const m = fileEventType.unpack(buf);
384
- return {
385
- type: m.type,
386
- path: m.path,
387
- isRemote: protobuf_msg_1.valOfOpt(m.isRemote),
388
- newVersion: protobuf_msg_1.valOfOptInt(m.newVersion),
389
- current: protobuf_msg_1.valOfOptInt(m.current),
390
- uploaded: protobuf_msg_1.valOfOptInt(m.uploaded),
391
- };
477
+ const { type, path } = m;
478
+ switch (type) {
479
+ case 'file-change':
480
+ return {
481
+ type, path,
482
+ src: (0, protobuf_msg_1.valOf)(m.src),
483
+ newVersion: (0, protobuf_msg_1.valOfOptInt)(m.newVersion)
484
+ };
485
+ case 'removed':
486
+ return {
487
+ type, path,
488
+ src: (0, protobuf_msg_1.valOf)(m.src)
489
+ };
490
+ case 'remote-removal':
491
+ return {
492
+ type, path
493
+ };
494
+ case 'remote-change':
495
+ return {
496
+ type, path, newVersion: (0, protobuf_msg_1.intValOf)(m.newVersion)
497
+ };
498
+ case 'remote-arch-ver-removal':
499
+ return {
500
+ type, path, removedArchVer: (0, protobuf_msg_1.intValOf)(m.removedArchVer)
501
+ };
502
+ case 'remote-version-archival':
503
+ return {
504
+ type, path, archivedVersion: (0, protobuf_msg_1.intValOf)(m.archivedVersion)
505
+ };
506
+ default:
507
+ throw new Error(`Unknown event type ${type}`);
508
+ }
392
509
  }
393
510
  exports.unpackFileEvent = unpackFileEvent;
394
511
  var watch;
@@ -396,7 +513,7 @@ var watch;
396
513
  function wrapService(fn) {
397
514
  return buf => {
398
515
  const s = new rxjs_1.Subject();
399
- const obs = s.asObservable().pipe(operators_1.map(packFileEvent));
516
+ const obs = s.asObservable().pipe((0, operators_1.map)(packFileEvent));
400
517
  const onCancel = fn(s);
401
518
  return { obs, onCancel };
402
519
  };
@@ -408,8 +525,8 @@ var watch;
408
525
  const s = new rxjs_1.Subject();
409
526
  const unsub = caller.startObservableCall(path, undefined, s);
410
527
  s.asObservable()
411
- .pipe(operators_1.map(unpackFileEvent))
412
- .subscribe(utils_for_observables_1.toRxObserver(obs));
528
+ .pipe((0, operators_1.map)(unpackFileEvent))
529
+ .subscribe((0, utils_for_observables_1.toRxObserver)(obs));
413
530
  return unsub;
414
531
  };
415
532
  }
@@ -422,15 +539,15 @@ var vGetXAttr;
422
539
  vGetXAttr.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedGetXAttrReplyBody);
423
540
  function unpackReply(buf) {
424
541
  const { json, str, bytes, version: v } = vGetXAttr.replyType.unpack(buf);
425
- const version = protobuf_msg_1.fixInt(v);
542
+ const version = (0, protobuf_msg_1.fixInt)(v);
426
543
  if (bytes) {
427
- return { version, attr: protobuf_msg_1.valOf(bytes) };
544
+ return { version, attr: (0, protobuf_msg_1.valOf)(bytes) };
428
545
  }
429
546
  else if (str) {
430
- return { version, attr: protobuf_msg_1.valOf(str) };
547
+ return { version, attr: (0, protobuf_msg_1.valOf)(str) };
431
548
  }
432
549
  else {
433
- return { version, attr: protobuf_msg_1.valOfOptJson(json) };
550
+ return { version, attr: (0, protobuf_msg_1.valOfOptJson)(json) };
434
551
  }
435
552
  }
436
553
  vGetXAttr.unpackReply = unpackReply;
@@ -440,13 +557,13 @@ var vGetXAttr;
440
557
  const promise = fn(xaName)
441
558
  .then(({ attr, version }) => {
442
559
  if (Buffer.isBuffer(attr)) {
443
- return vGetXAttr.replyType.pack({ version, bytes: protobuf_msg_1.toVal(attr) });
560
+ return vGetXAttr.replyType.pack({ version, bytes: (0, protobuf_msg_1.toVal)(attr) });
444
561
  }
445
562
  else if (typeof attr === 'string') {
446
- return vGetXAttr.replyType.pack({ version, str: protobuf_msg_1.toVal(attr) });
563
+ return vGetXAttr.replyType.pack({ version, str: (0, protobuf_msg_1.toVal)(attr) });
447
564
  }
448
565
  else {
449
- return vGetXAttr.replyType.pack({ version, json: protobuf_msg_1.toOptJson(attr) });
566
+ return vGetXAttr.replyType.pack({ version, json: (0, protobuf_msg_1.toOptJson)(attr) });
450
567
  }
451
568
  });
452
569
  return { promise };
@@ -479,7 +596,7 @@ var vListXAttrs;
479
596
  .startPromiseCall(path, undefined)
480
597
  .then(buf => {
481
598
  const { xaNames, version: v } = vListXAttrs.replyType.unpack(buf);
482
- return { version: protobuf_msg_1.fixInt(v), lst: (xaNames ? xaNames : []) };
599
+ return { version: (0, protobuf_msg_1.fixInt)(v), lst: (xaNames ? xaNames : []) };
483
600
  });
484
601
  }
485
602
  vListXAttrs.makeCaller = makeCaller;
@@ -491,19 +608,19 @@ var vReadBytes;
491
608
  const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedReadBytesReplyBody);
492
609
  function packReply(r) {
493
610
  return replyType.pack({
494
- version: r.version, bytes: protobuf_msg_1.toOptVal(r.bytes)
611
+ version: r.version, bytes: (0, protobuf_msg_1.toOptVal)(r.bytes)
495
612
  });
496
613
  }
497
614
  vReadBytes.packReply = packReply;
498
615
  function unpackReply(buf) {
499
616
  const { version: v, bytes: b } = replyType.unpack(buf);
500
- return { version: protobuf_msg_1.fixInt(v), bytes: protobuf_msg_1.valOfOpt(b) };
617
+ return { version: (0, protobuf_msg_1.fixInt)(v), bytes: (0, protobuf_msg_1.valOfOpt)(b) };
501
618
  }
502
619
  vReadBytes.unpackReply = unpackReply;
503
620
  function wrapService(fn) {
504
621
  return buf => {
505
622
  const { start, end } = requestType.unpack(buf);
506
- const promise = fn(protobuf_msg_1.valOfOptInt(start), protobuf_msg_1.valOfOptInt(end))
623
+ const promise = fn((0, protobuf_msg_1.valOfOptInt)(start), (0, protobuf_msg_1.valOfOptInt)(end))
507
624
  .then(packReply);
508
625
  return { promise };
509
626
  };
@@ -513,7 +630,7 @@ var vReadBytes;
513
630
  const path = objPath.concat('readBytes');
514
631
  return (start, end) => caller
515
632
  .startPromiseCall(path, requestType.pack({
516
- start: protobuf_msg_1.toOptVal(start), end: protobuf_msg_1.toOptVal(end)
633
+ start: (0, protobuf_msg_1.toOptVal)(start), end: (0, protobuf_msg_1.toOptVal)(end)
517
634
  }))
518
635
  .then(unpackReply);
519
636
  }
@@ -537,7 +654,7 @@ var vReadTxt;
537
654
  .startPromiseCall(path, undefined)
538
655
  .then(buf => {
539
656
  const { version: v, txt } = vReadTxt.replyType.unpack(buf);
540
- return { version: protobuf_msg_1.fixInt(v), txt };
657
+ return { version: (0, protobuf_msg_1.fixInt)(v), txt };
541
658
  });
542
659
  }
543
660
  vReadTxt.makeCaller = makeCaller;
@@ -563,10 +680,10 @@ var vReadJSON;
563
680
  .then(buf => {
564
681
  const { version: v, json } = vReadJSON.replyType.unpack(buf);
565
682
  try {
566
- return { version: protobuf_msg_1.fixInt(v), json: JSON.parse(json) };
683
+ return { version: (0, protobuf_msg_1.fixInt)(v), json: JSON.parse(json) };
567
684
  }
568
685
  catch (err) {
569
- throw error_1.errWithCause(err, `Can't parse ipc reply as json`);
686
+ throw (0, error_1.errWithCause)(err, `Can't parse ipc reply as json`);
570
687
  }
571
688
  });
572
689
  }
@@ -580,7 +697,7 @@ var vGetByteSource;
580
697
  return () => {
581
698
  const promise = fn()
582
699
  .then(({ version, src }) => {
583
- const ref = bytes_1.exposeSrcService(src, expServices);
700
+ const ref = (0, bytes_1.exposeSrcService)(src, expServices);
584
701
  return vGetByteSource.replyType.pack({ version, src: ref });
585
702
  });
586
703
  return { promise };
@@ -593,12 +710,42 @@ var vGetByteSource;
593
710
  .startPromiseCall(path, undefined)
594
711
  .then(buf => {
595
712
  const { version: v, src: ref } = vGetByteSource.replyType.unpack(buf);
596
- return { version: protobuf_msg_1.fixInt(v), src: bytes_1.makeSrcCaller(caller, ref) };
713
+ return { version: (0, protobuf_msg_1.fixInt)(v), src: (0, bytes_1.makeSrcCaller)(caller, ref) };
597
714
  });
598
715
  }
599
716
  vGetByteSource.makeCaller = makeCaller;
600
717
  })(vGetByteSource = exports.vGetByteSource || (exports.vGetByteSource = {}));
601
718
  Object.freeze(vGetByteSource);
719
+ function xattrToMsg(xaName, val) {
720
+ const msg = { xaName };
721
+ if (Buffer.isBuffer(val)) {
722
+ msg.bytes = (0, protobuf_msg_1.toVal)(val);
723
+ }
724
+ else if (ArrayBuffer.isView(val)) {
725
+ msg.bytes = (0, protobuf_msg_1.toVal)((0, buffer_utils_1.toBuffer)(val));
726
+ }
727
+ else if (typeof val === 'string') {
728
+ msg.str = (0, protobuf_msg_1.toVal)(val);
729
+ }
730
+ else {
731
+ msg.json = (0, protobuf_msg_1.toOptJson)(val);
732
+ }
733
+ return msg;
734
+ }
735
+ exports.xattrToMsg = xattrToMsg;
736
+ function xattrFromMsg(msg) {
737
+ const { xaName: name } = msg;
738
+ if (msg.bytes) {
739
+ return { name, value: (0, protobuf_msg_1.valOf)(msg.bytes) };
740
+ }
741
+ else if (msg.str) {
742
+ return { name, value: (0, protobuf_msg_1.valOf)(msg.str) };
743
+ }
744
+ else {
745
+ return { name, value: (0, protobuf_msg_1.valOfOptJson)(msg.json) };
746
+ }
747
+ }
748
+ exports.xattrFromMsg = xattrFromMsg;
602
749
  var updateXAttrs;
603
750
  (function (updateXAttrs) {
604
751
  const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.UpdateXAttrsRequestBody);
@@ -606,16 +753,9 @@ var updateXAttrs;
606
753
  const attrs = {};
607
754
  if (r.set) {
608
755
  attrs.set = {};
609
- for (const attr of r.set) {
610
- if (attr.bytes) {
611
- attrs.set[attr.xaName] = protobuf_msg_1.valOf(attr.bytes);
612
- }
613
- else if (attr.str) {
614
- attrs.set[attr.xaName] = protobuf_msg_1.valOf(attr.str);
615
- }
616
- else {
617
- attrs.set[attr.xaName] = protobuf_msg_1.valOfOptJson(attr.json);
618
- }
756
+ for (const xattr of r.set) {
757
+ const { name, value } = xattrFromMsg(xattr);
758
+ attrs.set[name] = value;
619
759
  }
620
760
  }
621
761
  if (r.remove) {
@@ -644,17 +784,7 @@ var updateXAttrs;
644
784
  };
645
785
  if (changes.set) {
646
786
  for (const [xaName, val] of Object.entries(changes.set)) {
647
- const attr = { xaName };
648
- if (Buffer.isBuffer(val)) {
649
- attr.bytes = protobuf_msg_1.toVal(val);
650
- }
651
- else if (typeof val === 'string') {
652
- attr.str = protobuf_msg_1.toVal(val);
653
- }
654
- else {
655
- attr.json = protobuf_msg_1.toOptJson(val);
656
- }
657
- r.set.push(attr);
787
+ r.set.push(xattrToMsg(xaName, val));
658
788
  }
659
789
  }
660
790
  return r;
@@ -740,9 +870,9 @@ var getByteSink;
740
870
  function wrapService(fn, expServices) {
741
871
  return buf => {
742
872
  const { truncateFile } = requestType.unpack(buf);
743
- const promise = fn(protobuf_msg_1.valOfOpt(truncateFile))
873
+ const promise = fn((0, protobuf_msg_1.valOfOpt)(truncateFile))
744
874
  .then(sink => {
745
- const ref = bytes_1.exposeSinkService(sink, expServices);
875
+ const ref = (0, bytes_1.exposeSinkService)(sink, expServices);
746
876
  return protobuf_msg_1.objRefType.pack(ref);
747
877
  });
748
878
  return { promise };
@@ -753,11 +883,11 @@ var getByteSink;
753
883
  const path = objPath.concat('getByteSink');
754
884
  return truncateFile => caller
755
885
  .startPromiseCall(path, requestType.pack({
756
- truncateFile: protobuf_msg_1.toOptVal(truncateFile)
886
+ truncateFile: (0, protobuf_msg_1.toOptVal)(truncateFile)
757
887
  }))
758
888
  .then(buf => {
759
889
  const ref = protobuf_msg_1.objRefType.unpack(buf);
760
- return bytes_1.makeSinkCaller(caller, ref);
890
+ return (0, bytes_1.makeSinkCaller)(caller, ref);
761
891
  });
762
892
  }
763
893
  getByteSink.makeCaller = makeCaller;
@@ -902,9 +1032,9 @@ var vGetByteSink;
902
1032
  function wrapService(fn, expServices) {
903
1033
  return buf => {
904
1034
  const { truncateFile, currentVersion } = requestType.unpack(buf);
905
- const promise = fn(protobuf_msg_1.valOfOpt(truncateFile), protobuf_msg_1.valOfOptInt(currentVersion))
1035
+ const promise = fn((0, protobuf_msg_1.valOfOpt)(truncateFile), (0, protobuf_msg_1.valOfOptInt)(currentVersion))
906
1036
  .then(({ sink, version }) => {
907
- const ref = bytes_1.exposeSinkService(sink, expServices);
1037
+ const ref = (0, bytes_1.exposeSinkService)(sink, expServices);
908
1038
  return vGetByteSink.replyType.pack({ version, sink: ref });
909
1039
  });
910
1040
  return { promise };
@@ -915,15 +1045,233 @@ var vGetByteSink;
915
1045
  const path = objPath.concat('getByteSink');
916
1046
  return (truncateFile, currentVersion) => caller
917
1047
  .startPromiseCall(path, requestType.pack({
918
- truncateFile: protobuf_msg_1.toOptVal(truncateFile),
919
- currentVersion: protobuf_msg_1.toOptVal(currentVersion)
1048
+ truncateFile: (0, protobuf_msg_1.toOptVal)(truncateFile),
1049
+ currentVersion: (0, protobuf_msg_1.toOptVal)(currentVersion)
920
1050
  }))
921
1051
  .then(buf => {
922
1052
  const { version: v, sink: ref } = vGetByteSink.replyType.unpack(buf);
923
- return { version: protobuf_msg_1.fixInt(v), sink: bytes_1.makeSinkCaller(caller, ref) };
1053
+ return { version: (0, protobuf_msg_1.fixInt)(v), sink: (0, bytes_1.makeSinkCaller)(caller, ref) };
924
1054
  });
925
1055
  }
926
1056
  vGetByteSink.makeCaller = makeCaller;
927
1057
  })(vGetByteSink = exports.vGetByteSink || (exports.vGetByteSink = {}));
928
1058
  Object.freeze(vGetByteSink);
1059
+ var vsStatus;
1060
+ (function (vsStatus) {
1061
+ function wrapService(fn) {
1062
+ return () => {
1063
+ const promise = fn()
1064
+ .then(packSyncStatus);
1065
+ return { promise };
1066
+ };
1067
+ }
1068
+ vsStatus.wrapService = wrapService;
1069
+ function makeCaller(caller, objPath) {
1070
+ const path = objPath.concat('status');
1071
+ return () => caller
1072
+ .startPromiseCall(path, undefined)
1073
+ .then(unpackSyncStatus);
1074
+ }
1075
+ vsStatus.makeCaller = makeCaller;
1076
+ })(vsStatus || (vsStatus = {}));
1077
+ Object.freeze(vsStatus);
1078
+ var vsUpdateStatusInfo;
1079
+ (function (vsUpdateStatusInfo) {
1080
+ function wrapService(fn) {
1081
+ return () => {
1082
+ const promise = fn()
1083
+ .then(packSyncStatus);
1084
+ return { promise };
1085
+ };
1086
+ }
1087
+ vsUpdateStatusInfo.wrapService = wrapService;
1088
+ function makeCaller(caller, objPath) {
1089
+ const path = objPath.concat('updateStatusInfo');
1090
+ return () => caller
1091
+ .startPromiseCall(path, undefined)
1092
+ .then(unpackSyncStatus);
1093
+ }
1094
+ vsUpdateStatusInfo.makeCaller = makeCaller;
1095
+ })(vsUpdateStatusInfo || (vsUpdateStatusInfo = {}));
1096
+ Object.freeze(vsUpdateStatusInfo);
1097
+ var vsIsRemoteVersionOnDisk;
1098
+ (function (vsIsRemoteVersionOnDisk) {
1099
+ const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileSyncIsOnDiskRequestBody);
1100
+ const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileSyncIsOnDiskReplyBody);
1101
+ function wrapService(fn) {
1102
+ return buf => {
1103
+ const { version } = requestType.unpack(buf);
1104
+ const promise = fn((0, protobuf_msg_1.fixInt)(version))
1105
+ .then(status => replyType.pack({ status }));
1106
+ return { promise };
1107
+ };
1108
+ }
1109
+ vsIsRemoteVersionOnDisk.wrapService = wrapService;
1110
+ function makeCaller(caller, objPath) {
1111
+ const path = objPath.concat('isRemoteVersionOnDisk');
1112
+ return version => caller
1113
+ .startPromiseCall(path, requestType.pack({ version }))
1114
+ .then(buf => replyType.unpack(buf).status);
1115
+ }
1116
+ vsIsRemoteVersionOnDisk.makeCaller = makeCaller;
1117
+ })(vsIsRemoteVersionOnDisk || (vsIsRemoteVersionOnDisk = {}));
1118
+ Object.freeze(vsIsRemoteVersionOnDisk);
1119
+ var vsDownload;
1120
+ (function (vsDownload) {
1121
+ const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileSyncDownloadRequestBody);
1122
+ function wrapService(fn) {
1123
+ return buf => {
1124
+ const { version } = requestType.unpack(buf);
1125
+ const promise = fn((0, protobuf_msg_1.fixInt)(version));
1126
+ return { promise };
1127
+ };
1128
+ }
1129
+ vsDownload.wrapService = wrapService;
1130
+ function makeCaller(caller, objPath) {
1131
+ const path = objPath.concat('download');
1132
+ return version => caller
1133
+ .startPromiseCall(path, requestType.pack({ version }));
1134
+ }
1135
+ vsDownload.makeCaller = makeCaller;
1136
+ })(vsDownload || (vsDownload = {}));
1137
+ Object.freeze(vsDownload);
1138
+ function optionsToUploadLocalToMsg(opts) {
1139
+ if (!opts) {
1140
+ return;
1141
+ }
1142
+ return {
1143
+ localVersion: (0, protobuf_msg_1.toOptVal)(opts.localVersion),
1144
+ uploadVersion: (0, protobuf_msg_1.toOptVal)(opts.uploadVersion)
1145
+ };
1146
+ }
1147
+ exports.optionsToUploadLocalToMsg = optionsToUploadLocalToMsg;
1148
+ function optionsToUploadLocalFromMsg(opts) {
1149
+ if (!opts) {
1150
+ return;
1151
+ }
1152
+ return {
1153
+ localVersion: (0, protobuf_msg_1.valOfOptInt)(opts.localVersion),
1154
+ uploadVersion: (0, protobuf_msg_1.valOfOptInt)(opts.uploadVersion)
1155
+ };
1156
+ }
1157
+ exports.optionsToUploadLocalFromMsg = optionsToUploadLocalFromMsg;
1158
+ var vsUpload;
1159
+ (function (vsUpload) {
1160
+ const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileSyncUploadRequestBody);
1161
+ function wrapService(fn) {
1162
+ return buf => {
1163
+ const { opts } = requestType.unpack(buf);
1164
+ const promise = fn(optionsToUploadLocalFromMsg(opts));
1165
+ return { promise };
1166
+ };
1167
+ }
1168
+ vsUpload.wrapService = wrapService;
1169
+ function makeCaller(caller, objPath) {
1170
+ const path = objPath.concat('upload');
1171
+ return opts => caller
1172
+ .startPromiseCall(path, requestType.pack({
1173
+ opts: optionsToUploadLocalToMsg(opts)
1174
+ }));
1175
+ }
1176
+ vsUpload.makeCaller = makeCaller;
1177
+ })(vsUpload || (vsUpload = {}));
1178
+ Object.freeze(vsUpload);
1179
+ function remoteAdoptionOptsToMsg(opts) {
1180
+ if (!opts) {
1181
+ return;
1182
+ }
1183
+ return {
1184
+ dropLocalVer: (0, protobuf_msg_1.toOptVal)(opts.dropLocalVer),
1185
+ remoteVersion: (0, protobuf_msg_1.toOptVal)(opts.remoteVersion)
1186
+ };
1187
+ }
1188
+ exports.remoteAdoptionOptsToMsg = remoteAdoptionOptsToMsg;
1189
+ function remoteAdoptionOptsFromMsg(msg) {
1190
+ if (!msg) {
1191
+ return;
1192
+ }
1193
+ return {
1194
+ dropLocalVer: (0, protobuf_msg_1.valOfOpt)(msg.dropLocalVer),
1195
+ remoteVersion: (0, protobuf_msg_1.valOfOptInt)(msg.remoteVersion)
1196
+ };
1197
+ }
1198
+ exports.remoteAdoptionOptsFromMsg = remoteAdoptionOptsFromMsg;
1199
+ var vsAdoptRemote;
1200
+ (function (vsAdoptRemote) {
1201
+ const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.AdoptRemoteRequestBody);
1202
+ function wrapService(fn) {
1203
+ return buf => {
1204
+ const { opts } = requestType.unpack(buf);
1205
+ const promise = fn(remoteAdoptionOptsFromMsg(opts));
1206
+ return { promise };
1207
+ };
1208
+ }
1209
+ vsAdoptRemote.wrapService = wrapService;
1210
+ function makeCaller(caller, objPath) {
1211
+ const path = objPath.concat('adoptRemote');
1212
+ return opts => caller
1213
+ .startPromiseCall(path, requestType.pack({
1214
+ opts: remoteAdoptionOptsToMsg(opts)
1215
+ }));
1216
+ }
1217
+ vsAdoptRemote.makeCaller = makeCaller;
1218
+ })(vsAdoptRemote || (vsAdoptRemote = {}));
1219
+ Object.freeze(vsAdoptRemote);
1220
+ var vListVersions;
1221
+ (function (vListVersions) {
1222
+ const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.ListVersionsReplyBody);
1223
+ function packReply(v) {
1224
+ return replyType.pack({
1225
+ current: (0, protobuf_msg_1.toOptVal)(v.current),
1226
+ archived: v.archived
1227
+ });
1228
+ }
1229
+ vListVersions.packReply = packReply;
1230
+ function unpackReply(b) {
1231
+ const r = replyType.unpack(b);
1232
+ return {
1233
+ current: (0, protobuf_msg_1.valOfOptInt)(r.current),
1234
+ archived: ((r.archived.length > 0) ?
1235
+ r.archived.map(protobuf_msg_1.fixInt) : undefined)
1236
+ };
1237
+ }
1238
+ vListVersions.unpackReply = unpackReply;
1239
+ function wrapService(fn) {
1240
+ return () => {
1241
+ const promise = fn()
1242
+ .then(packReply);
1243
+ return { promise };
1244
+ };
1245
+ }
1246
+ vListVersions.wrapService = wrapService;
1247
+ function makeCaller(caller, objPath) {
1248
+ const path = objPath.concat('listVersions');
1249
+ return () => caller
1250
+ .startPromiseCall(path)
1251
+ .then(unpackReply);
1252
+ }
1253
+ vListVersions.makeCaller = makeCaller;
1254
+ })(vListVersions = exports.vListVersions || (exports.vListVersions = {}));
1255
+ Object.freeze(vListVersions);
1256
+ var vArchiveCurrent;
1257
+ (function (vArchiveCurrent) {
1258
+ const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.ArchiveCurrentRequestBody);
1259
+ function wrapService(fn) {
1260
+ return buf => {
1261
+ const { version } = requestType.unpack(buf);
1262
+ const promise = fn((0, protobuf_msg_1.valOfOptInt)(version))
1263
+ .then(protobuf_msg_1.packInt);
1264
+ return { promise };
1265
+ };
1266
+ }
1267
+ vArchiveCurrent.wrapService = wrapService;
1268
+ function makeCaller(caller, objPath) {
1269
+ const path = objPath.concat('archiveCurrent');
1270
+ return version => caller
1271
+ .startPromiseCall(path, requestType.pack({ version: (0, protobuf_msg_1.toOptVal)(version) }))
1272
+ .then(protobuf_msg_1.unpackInt);
1273
+ }
1274
+ vArchiveCurrent.makeCaller = makeCaller;
1275
+ })(vArchiveCurrent || (vArchiveCurrent = {}));
1276
+ Object.freeze(vArchiveCurrent);
929
1277
  Object.freeze(exports);